Jump to content

[HELP] coding script character.lua


Recommended Posts

Try looking at wathgrith.lua code (wigfrid)

For example, my character is loosing sanity when killing animals, i did this :


	
    inst:ListenForEvent("killed", onkilled)

(In the master_postinit)



local function onkilled(inst, data)
if data.victim:HasTag("animal") then
 inst.components.sanity:DoDelta(-TUNING.SANITY_SMALL)
 end
end

So when my character is killing a creature with the animal tag, she will lose some sanity.

 

Just change "killed" for the attack event, and do something like

 inst.components.health:DoDelta(TUNING.HEALTH_SMALL)

(not tested)

Take a look at tuning.lua (in script), for example of value. Usually, something like :

 inst.components.health:DoDelta(20)

should work too.

Good luck.

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...