• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] How to change teams (alliances)

Status
Not open for further replies.
Level 4
Joined
Aug 9, 2008
Messages
67
Ok now the solution for this is probably something very stupid that I forgot so I apologize in advance for that:grin:
But here is the problem:
I am making a tag map (similar-ish to tree tag) when the hunter kills a runner, that runner becomes the hunter. Of course I want to change the visibility (an that goes with alliance) settings to accommodate this change.
Here are the actions I take:
  • Events:
  • When a unit dies
  • Actions:
    • For each integer A 1 - 12:
      • Player - set ((Owner of the dying unit's) alliance to (Integer A) to Enemy
      • Player - set (Integer A) alliance to ((Owner of the dying unit's) to Enemy
      • Player - set ((Owner of the killing unit's) alliance to (Integer A) to Ally shared vision
      • Player - set (Integer A) alliance to ((Owner of the killing unit's) to Ally shared vision
    • Player - set ((Owner of the killing unit's) alliance to ((Owner of the dying unit's) to Enemy
Now that causes a problem because the killing unit there can still see the dying unit (this only happens the first time) and I have no idea why.
Please help:cry:
 
Level 20
Joined
Jan 6, 2008
Messages
2,627
have you tried
  • Events:
    • When a unit dies
  • Actions:
    • For each integer A 1 - 12:
    • Player - set ((Owner of the dying unit's) alliance to (Integer A) to Enemy
    • Player - set (Integer A) alliance to ((Owner of the dying unit's) to Enemy
    • Player - set ((Owner of the killing unit's) alliance to (Integer A) to Ally shared vision
    • Player - set (Integer A) alliance to ((Owner of the killing unit's) to Ally shared vision
    • Player - set ((Owner of the killing unit's) alliance to ((Owner of the dying unit's) to Enemy
    • Unit - Kill (dying unit)
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Maybe you have to set alliance first instead of enemy first?
That could be the problem?
Cause first you set (owner of(dying)) enemy with everyone, and vice versa (the same other way round) and THEN you set (owner of (killing)) alliance to EVERYONE (including the (owner of(dying))
If you change the order, you wont have the extra action either; (May work, but i DONT KNOW)
 
Level 3
Joined
Aug 19, 2007
Messages
24
  • Events:
  • When a unit dies
  • Actions:
    • For each integer A 1 - 12:
      • Player - set ((Owner of the dying unit's) alliance to (Integer A) to Enemy
      • Player - set (Integer A) alliance to ((Owner of the dying unit's) to Enemy
Okay, every player becomes the enemy of the dying unit and the dying unit becomes their enemy

  • Player - set ((Owner of the killing unit's) alliance to (Integer A) to Ally shared vision
  • Player - set (Integer A) alliance to ((Owner of the killing unit's) to Ally shared vision
Now every player becomes the ally of the killing unit and the killing unit becomes their ally

  • Player - set ((Owner of the killing unit's) alliance to ((Owner of the dying unit's) to Enemy
This resolves half the problem - now the killing unit considers the dying unit an enemy, but not the opposite.

I suggest that you simply do things in the opposite order...
  • Events:
  • When a unit dies
  • Actions:
    • For each integer A 1 - 12:
      • Player - set ((Owner of the killing unit's) alliance to (Integer A) to Ally shared vision
      • Player - set (Integer A) alliance to ((Owner of the killing unit's) to Ally shared vision
      • Player - set ((Owner of the dying unit's) alliance to (Integer A) to Enemy
      • Player - set (Integer A) alliance to ((Owner of the dying unit's) to Enemy
In this case, everyone first becomes allies with everyone (because they were only enemies with the killing unit previously) and then the dying unit becomes everyone's enemy.

See if that fixes your problem.
 
Level 4
Joined
Aug 9, 2008
Messages
67
Yes thank you! (Although I did tell him to enemy already...anyways) :D
Thanks to everybody who helped.
 
Status
Not open for further replies.
Top