When a unit kills another unit, how do I make another unit get the gold from killing it. For example, player A kills player B. How can I make it so player C get’s the kill?
Also, how can you make an a.i. switch to another slot?
1 Like
You could add an entity variable on the attacking unit that determines who to redirect the kill to. For example, you can do something like this when the unit gets created:
set (kill goes to) of (last created unit) as (triggering unit)
In this example the variable is called kill goes to
, and triggering unit
is just an arbitrary placeholder for whatever appropriately goes there in your script. Then, in the unit death
script, make it give the kill to the kill goes to
of the attacker rather than the attacker themself:
set Points of ((kill goes to) of (last attacking unit)) as (Points of ((kill goes to) of (last attacking unit)) + 1)
Something along the lines of that.
To make a unit switch to another slot, use the make unit select item at slot
action.
1 Like
There was a make unit select item at slot
script? Oof, I was looking all that time and I couldn’t find it. Anyways, thanks.