How to make items move when it creates
So, does the behavior youâre expecting for the item(s) is to spread at the center of the deceased unit?
Then, you can just do the following command to the killed unit before it is destroyed, and youâll get there.
Trigger: when a unit attacks another unit
Action:
// decrease the victim's hp (probably entity attribute) by in-built scripts or manually
if (hp of last attacked unit < 0) {
drop all of (last attacked unit)'s items
// your action, such as destroy (last attacked unit)
}
Is it me or just seeing a sausage
It looks like an embryo or just a bun with a cut where a sausage is inserted
I canât find the trigger when a unit attacks another unit
Sry I mistook it
Ok then, i will try make this
I have a problem, when i try to kill a monster, it doesnât drop anything
Let me see the script. Maybe the monster does not have any items or you first destroyed it before dropping all items?
The monster do have items, i just set it up already
But for some reason, this script does not want to run at all
Uhm, if that does not work, do you have a âunit deathâ program in your game?
If there is not, make one and set the trigger to âwhen a unitâs attribute becomes 0 or lessâ.
And set the actions as follows:
Actions:
if (unit type of triggering attribute == health) {
if (unit type of triggering unit == "????") {
make (triggering unit) drop all of its items
}
// destroy it or something else
}
If you have one, add the script above to your unit death script, especially this part:
if (unit type of triggering unit == "????") {
make (triggering unit) drop all of its items
}
Ok, thanks, it seems to be working now
What about an enemy that dies and drops more same items
You were checking if health is less than 0 and I am guessing the minimum value for health is 0. So thatâs probably why it didnât work this way!
instead of dropping items held, you can just do âdrop (item) at (pos)â X times in the entity script of that unit.