How to make this item moving while it's created

Tekst akapitu (2)
How to make items move when it creates

3 Likes

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)
}
3 Likes

Sausage2
Is it me or just seeing a sausage

2 Likes

It looks like an embryo or just a bun with a cut where a sausage is inserted

2 Likes

I can’t find the trigger when a unit attacks another unit

1 Like

image
Sry I mistook it

1 Like

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?

1 Like

The monster do have items, i just set it up already


But for some reason, this script does not want to run at all
RAT2

1 Like

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
 }
2 Likes

Ok, thanks, it seems to be working now

2 Likes

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!

1 Like

instead of dropping items held, you can just do ‘drop (item) at (pos)’ X times in the entity script of that unit.

1 Like