I'm developing a map where if a hostile unit is killed, you gain that unit into your army (like an army-building game). Problem is I have difficulty with the simplest trigger. I have no clue why this does not work but I'm hoping someone can help me out.
The code goes like this:
Event: Any Unit Dies
Variables:
Conditions: Player 1 from (All Players) == Owner of (Killing Unit)
Owner of (Triggering Unit) == Player 15 from (All Players)
Actions: Create 1 (Unit Type of (Triggering Unit)) for Player 1 at Point 001 using default facing (No Options)
Now this does not work, but if I were to remove the conditions it does work. I've been at this for an hour now trying to rephrase the trigger to work in my favor. Strange thing about this trigger is if I were to change the "==" to a ">=" or even a "!=" to both conditions it would work just fine. That just does not make sense at all. Only detail that'd be wrong is if Player1 were to kill a unit from Player2, Player1 would steal Player2's unit (I don't want that).
I will of course use an array to combine the Players eventually, but right now I'm still having trouble with the basics. If anybody knows the underlying reason this does not work, please let me know! I looked into some of your helps and tutorials, but I didn't find the answer I was looking for. I'm not sure if I'm supposed to employ a Boolean or some type of variable to make this work, but right now I've just about given up. If you'd like to help, I'd appreciate it.
"Player x from Playergroup" returns a player in the x-th slot instead of the player number. The first slot should be Player 0 by default.
Player numbers are integers, so you can directly write the player number you want.
In addition to that, you clearly want an OR in your conditions. The OR adds another layer whose contained elements are all combined via OR.
So, you might want something like this:
Or
. . . Owner of (Killing Unit) == 15
. . . Owner of (Killing Unit) == 0
0 is the neutral player, 15 is the hostile player.
I'm developing a map where if a hostile unit is killed, you gain that unit into your army (like an army-building game). Problem is I have difficulty with the simplest trigger. I have no clue why this does not work but I'm hoping someone can help me out.
The code goes like this:
Event: Any Unit Dies
Variables:
Conditions: Player 1 from (All Players) == Owner of (Killing Unit)
Owner of (Triggering Unit) == Player 15 from (All Players)
Actions: Create 1 (Unit Type of (Triggering Unit)) for Player 1 at Point 001 using default facing (No Options)
Now this does not work, but if I were to remove the conditions it does work. I've been at this for an hour now trying to rephrase the trigger to work in my favor. Strange thing about this trigger is if I were to change the "==" to a ">=" or even a "!=" to both conditions it would work just fine. That just does not make sense at all. Only detail that'd be wrong is if Player1 were to kill a unit from Player2, Player1 would steal Player2's unit (I don't want that).
I will of course use an array to combine the Players eventually, but right now I'm still having trouble with the basics. If anybody knows the underlying reason this does not work, please let me know! I looked into some of your helps and tutorials, but I didn't find the answer I was looking for. I'm not sure if I'm supposed to employ a Boolean or some type of variable to make this work, but right now I've just about given up. If you'd like to help, I'd appreciate it.
"Player x from Playergroup" returns a player in the x-th slot instead of the player number. The first slot should be Player 0 by default.
Player numbers are integers, so you can directly write the player number you want.
In addition to that, you clearly want an OR in your conditions. The OR adds another layer whose contained elements are all combined via OR.
So, you might want something like this:
Or
. . . Owner of (Killing Unit) == 15
. . . Owner of (Killing Unit) == 0
0 is the neutral player, 15 is the hostile player.