Sign in to follow this  

Recommended Posts

Codina    26

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    261

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    26
Posted (edited)
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

Edited by Codina

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this