[Trigger] Switch Team Trigger

Status
Not open for further replies.
Level 10
Joined
Jul 31, 2008
Messages
477
Helloo guys!

So im making a map. It's called demon tag, its like tree tag or camper tag or stuff like that. But when you die you become a demon. But my swap team trigger fails...

Here it is:
  • Swap Team
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Unit-type of (Dying unit)) Equal to Goblin Runner
  • Actions
    • Unit - Create 1 Voidwalker for (owner of (dying unit)) at (Center of Starting point <gen>) facing default building facing degrees
    • Set PG = (All players matching ((Number of living Goblin Runner units owned by (Owner of (Dying unit))) Equal to 0))
    • Player Group - Make PG treat (All enemies of Player 2 (Blue)) as an Enemy
    • Player Group - Make PG treat (All allies of Player 2 (Blue)) as an Ally with shared vision
    • Player Group - Make (All allies of Player 2 (Blue)) treat PG as an Ally with shared vision
    • Custom script: call DestroyForce(udg_PG)
What is wrong?
 
I could help. I would need a copy of your map though, to make it easier. If you don't trust me, then I'll try to figure out your trigger w/o your map. Although, there is no reason not to trust me lol.

Try this for the time being:

  • Unit - Create 1 Voidwalker for (owner of (dying unit)) at (Center of Starting point <gen>) facing default building facing degrees
  • Player - Make (owner of dying unit) treat (All enemies of Player 2 (Blue)) as an Enemy
  • Player - Make (owner of dying unit) treat (All allies of Player 2 (Blue)) as an Ally with shared vision
  • Player Group - Make (All allies of Player 2 (Blue)) treat (owner of dying unit) as an Ally with shared vision
You dont need to set the player to a group. It is very unnecessary and redundant. If my method doesn't work, still keep my method but tweak it a little bit. This work for you.
 
Set PG = (All players matching ((Number of living Goblin Runner units owned by (Owner of (Dying unit))) Equal to 0))
100% certain the fault lies with that line. Due to illogical condition, PG becomes equal to all players as the condition returns true for all players that pass throu it which happen to be all players. Thus basically you set all players to treat all enemies of blue as an enemy. You then make all palyers treat all allies of blue as an ally with vision. Finally you make all allies of blue treat all players as an ally with vision.

Seems quite logical why it does not work.
 
You shouldn't even need a player group. I believe you can just get the player from the owner of the dying unit.
 
  • Player Group - Add (Owner of (Dying unit)) to tempPlayerGroup
  • -------- Do your player group things here --------
  • Player Group - Remove all players from tempPlayerGroup
That should be the leak-free way to handle it.

This is assuming you don't have the action for Player - Set Alliance.
 
Mine actually works lol. Heres mine revised for 100% leak free.

  • Set temp_loc = position of dying unit
  • Set temp_p = owner of dying unit
  • Unit - Create 1 Voidwalker for (owner of (dying unit)) at (temp_loc <gen>) facing default building facing degrees
  • Player - Make (temp_p) treat (All enemies of Player 2 (Blue)) as an Enemy
  • Player - Make (temp_p) treat (All allies of Player 2 (Blue)) as an Ally with shared vision
  • Player Group - Make (All allies of Player 2 (Blue)) treat (temp_p) as an Ally with shared vision
  • Custom script: call RemoveLocation(udg_temp_loc)
  • Custom script: call RemovePlayer(udg_temp_p)
 
  • Player Group - Add (Owner of (Dying unit)) to tempPlayerGroup
  • -------- Do your player group things here --------
  • Player Group - Remove all players from tempPlayerGroup
That should be the leak-free way to handle it.

This is assuming you don't have the action for Player - Set Alliance.

should it be like this?

  • Player Group - Add (Owner of (Dying unit)) to tempPlayerGroup
  • Player Group - Make TempPlayerGroup treat (All allies of Player 2 (Blue)) as an Ally with shared vision
  • Player Group - Remove all players from tempPlayerGroup
 
I think "All allies of Player 2" might leak. But yes, basically. And what about making enemies?
 
Yeah right,
It should be like this:

  • Player Group - Add (Owner of (Dying unit)) to tempPlayerGroup
  • Player Group - Make TempPlayerGroup treat (All allies of Player 2 (Blue)) as an Ally with shared vision
  • Player Group - Make TempPlayerGroup treat (All enemies of Player 2 (Blue)) as an Enemy
  • Player Group - Remove all players from tempPlayerGroup
 
Status
Not open for further replies.
Back
Top