• 🏆 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] Trigger is glitching and it spawns a unit for every player?

Status
Not open for further replies.
Level 5
Joined
Aug 18, 2013
Messages
85
  • Decrpy PROPER 2 Copy 8
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • ((Ability being cast) Equal to Decrypt ) and (Decrypt12 Equal to 0)
    • Actions
      • Set SpawnLoc = (Target point of ability being cast)
      • Unit - Create 1 Decrypter for Player 12 (Brown) at SpawnLoc facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_SpawnLoc)
      • Set DecryptRed12 = (Last created unit)
      • Set Decrypt12 = (Decrypt12 + 1)
      • Set SpawnLoc = (Position of DecryptRed12)
      • Visibility - Create an initially Enabled visibility modifier for Player 12 (Brown) emitting Visibility from SpawnLoc to a radius of 1024.00
      • Custom script: call RemoveLocation (udg_SpawnLoc)
      • Set Visibility12 = (Last created visibility modifier)
      • Countdown Timer - Start DecryptTimer12 as a One-shot timer that will expire in 300.00 seconds
      • Wait 2.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DecryptRed12 is alive) Equal to True
        • Then - Actions
          • Set Player = Player 12 (Brown)
          • Custom script: if GetLocalPlayer() == udg_Player then
          • Sound - Play RADAR_On <gen>
          • Custom script: endif
        • Else - Actions
I gave each player a similar trigger but it spawns a unit for every living player.

What did I do wrong?
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
This is the problem:
I gave each player a similar trigger
Just change all "Player 12" in your trigger to "Owning Player of Triggering Unit" and remove all other instances of this trigger. You just need one trigger for this.
Also, make "DecryptRed12" and "Decrypt12" array variables and index them by the player number:
Decrypt[Player ID: Owning Player of Triggering Unit]
 
Status
Not open for further replies.
Top