Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

Recommended Posts

Codina    47

I want to make a mod that when you eat specific food it gives you a small buff. Example: when you eat spicy chili it gives you 10x damage modifier and plays the Wolfgang flexing animation. The damage modifier lasts for 4 minutes. 

I would have to type my own script for this right?

Share this post


Link to post
Share on other sites
Ultroman    530

Yes, you will have to make your own script for this, using AddPlayerPostInit where you extend the Eat function of the eater-component, and make it do something special if the eating is successful.

I am sorry, but I don't have time to help in-depth atm, but here's a link to my newcomer post. It should help you get started.

Something like this, though:

AddPlayerPostInit(function(inst)
	if inst.components.eater then
		local old_Eat = inst.components.Eat
		inst.components.Eat = function(food, feeder, ...)
			if old_Eat(food, feeder, ...)
				-- Do your stuff in here.
			end
		end
	end
end)

The stuff you need to do, would be something like adding an extra multiplier to externaldamagemultipliers in the combat component, and then do a DoTaskInTime() call with a function which removes the multiplier again.

Share this post


Link to post
Share on other sites
Codina    47
11 hours ago, Ultroman said:

Yes, you will have to make your own script for this, using AddPlayerPostInit where you extend the Eat function of the eater-component, and make it do something special if the eating is successful.

I am sorry, but I don't have time to help in-depth atm, but here's a link to my newcomer post. It should help you get started.

Something like this, though:


AddPlayerPostInit(function(inst)
	if inst.components.eater then
		local old_Eat = inst.components.Eat
		inst.components.Eat = function(food, feeder, ...)
			if old_Eat(food, feeder, ...)
				-- Do your stuff in here.
			end
		end
	end
end)

The stuff you need to do, would be something like adding an extra multiplier to externaldamagemultipliers in the combat component, and then do a DoTaskInTime() call with a function which removes the multiplier again.

I looked into Tykvesh's Battle Horn mod script as a reference because it uses the similar mechanics.   https://steamcommunity.com/sharedfiles/filedetails/?id=906612255&searchtext=horn

I've only able to learn the commands for adding variables and text at the moment

Share this post


Link to post
Share on other sites