Jump to content

Recommended Posts

Sorry if you don't understand what I'm saying is that I don't speak English but I would like your help.

this the code I was using:

inst: ListenForEvent ("killed",
     function (inst, data)
         local victim = data.victim
         if (victim ~ = nil and victim.prefab == "butterfly")
         then
             inst.components.sanity: DoDelta (-10)
         end
     end
)

I just don't know why it doesn't work with ocean fish, or lobsters and salamanders.

I would greatly appreciate your help sincerely.

Makaoshi. ♡♡♡

inst: ListenForEvent ("killed",
     function (inst, data)
         local victim = data.victim
         if (victim ~= nil and (victim.prefab == "wobster_sheller_land" or victim.prefab == "fruitdragon")) then
             inst.components.sanity: DoDelta (-10)
         end
     end
)

The code that you have is only working for butterflys, if you want it to work with other creatures you will need to add the prefab name like it did in this example. This will work for lobsters and saladmanders, the ocean fish will need to be added by yourself ;)

  • Like 1

Thank you very much for the help, for days I tried to do something like that and nothing worked. ♡♡♡♡♡

Makaoshi.

Edited by Makaoshi

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
×
  • Create New...