Jump to content

Avoiding damage on pick


Recommended Posts

Hello,

 

(First, my english isn't really good so sorry for the mistake)

 

I'm not good at mod but was able to make little mod for personnal use. Nothing elaborate, but i've got an idea i would like to see in game :

 

 

Making a mod allowing to pick the cactus and spiky bush without taking damage. (And maybe the other similar things, if there is).

 

I would like to see it possible by a "glove" item, (weapon slot) but a hat or armor will be enough if easiest.

 

 

Could someone help me knowing if the thing is possible and how ? Great thanks ! :-)

Link to comment
Share on other sites

@Lumina,

as for the effect of taking no dmg from them, this is the onpickedfunction from the spiky bush (marsh_bush.lua):

local function onpickedfn(inst, picker)    inst.AnimState:PlayAnimation("picking")    inst.AnimState:PushAnimation("picked", false)    if picker.components.combat then        picker.components.combat:GetAttacked(inst, TUNING.MARSHBUSH_DAMAGE)        picker:PushEvent("thorns")    endend
the onpicked-function of the cactus (cactus.lua) is a bit bigger, but it also uses picker.components.combat:GetAttacked(inst, TUNING.MARSHBUSH_DAMAGE) to do the dmg. now there's two ways to make your item prevent that. u can either add an AddPrefabPostInit to change the onpickedfunction of all spikybushes and cacti, so they do not do the dmg to players, that have your item equipped, or u can make your item change the players GetAttacked-function on equip to ignore dmg from cacti and spiky bushes, and change it back to the original function on unequip.

i think the first way would be the better one.

also, if u really only want it for your personal use, and would rather have it the easiest way possible, just comment out the line with picker.components.combat:GetAttacked in the gamefiles themselves.(u might have to redo that after future updates though)

Edited by Seiai
Link to comment
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
 Share

×
  • Create New...