• Hey! Register here to create your account, engage with the community, and talk about what is new!

How do you make code run when a entity dies

BigDoofish

New member
Joined
May 3, 2023
Messages
14
Reaction score
1
i know about the player kill mob event but that excludes damage code block, and entity event mob dies also doesnt work (believe me i tried multiple times to make it work)

so now i am stuck, i have two options, take my time and dig deeper to find an awnser or give up and make itvery easy to softlock yourself.
support isn't online, so i turn to the forums yet again for awnsers.

(sorry if this sound strangel english isnt my first language)
 
Solution
the best solution is on Entity Take Damage Event, check if the Game Value: Health is Equals or Smaller (<=) than Game Value: Damage, this will always trigger and the if will check if the damage was equal or more than the health (so if it will die) and then you can put your code inside! Make sure to check if the mob is NOT holding a Totem of Undying if you are using one in your game

ARMcPro

Forum adept
Overlord
Joined
Oct 20, 2020
Messages
1,263
Reaction score
353
the best solution is on Entity Take Damage Event, check if the Game Value: Health is Equals or Smaller (<=) than Game Value: Damage, this will always trigger and the if will check if the damage was equal or more than the health (so if it will die) and then you can put your code inside! Make sure to check if the mob is NOT holding a Totem of Undying if you are using one in your game
 
Solution

BigDoofish

New member
Joined
May 3, 2023
Messages
14
Reaction score
1
the best solution is on Entity Take Damage Event, check if the Game Value: Health is Equals or Smaller (<=) than Game Value: Damage, this will always trigger and the if will check if the damage was equal or more than the health (so if it will die) and then you can put your code inside! Make sure to check if the mob is NOT holding a Totem of Undying if you are using one in your game
where can you find the <= in the code?
and would the game values be current health: victim and attack damage: default?

edit: i got it, but now the messages arent working
time to edit every items description woooooo

edit 2 i fixed it but now every player gets the message and a coin, but this game isnt really meant to be played with multiple people at a time
edit yet again: now the teleport isnt working for some reason

NEVERMIND, jeez it sucks having to edit this all the time
 
Last edited:

BigDoofish

New member
Joined
May 3, 2023
Messages
14
Reaction score
1
where can you find the <= in the code?
and would the game values be current health: victim and attack damage: default?

edit: i got it, but now the messages arent working
time to edit every items description woooooo
???? now it triggers every time i damage the mob what?
 
Top Bottom