• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Only working in single player. Why?

Status
Not open for further replies.
Level 6
Joined
Apr 28, 2005
Messages
155
Hi peeps. Spare a moment?

  • ClickRemoval
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 7 (Green) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
    • Conditions
    • Actions
      • Set TempGroup = (Units owned by (Triggering player) matching (((Unit-type of (Matching unit)) Equal to Box) and (((Matching unit) is selected by (Triggering player)) Equal to True)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup) Greater than or equal to 1
        • Then - Actions
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • Unit - Kill (Picked unit)
          • Custom script: call DestroyGroup (udg_TempGroup)
          • Set TempGroup = (Units owned by (Triggering player) matching (((Unit-type of (Matching unit)) Equal to Maze Runner) and (((Matching unit) is alive) Equal to True)))
          • Selection - Select (Random unit from TempGroup) for (Triggering player)
          • Custom script: call DestroyGroup (udg_TempGroup)
        • Else - Actions
          • Do nothing
The intended purpose...
to kill the selected "box" and then select a (the only) "maze runner". One trigger for all players.

In single player...
this works just fine.

On battle.net or Lan...
it seems that I must first select the box, and then select something else (or the box again) in order to execute the trigger.

It just doesn't make any sense!

Thoughts?
 
Level 9
Joined
Jul 27, 2006
Messages
652
You've destoryed your group? Hence you cant use it again?
At least thats what i think happened?
Dunno why it would only work in single playe thought...
but hey i might be completely wrong but as far as im concrened "call DestroyGroup" does just that....
 
Level 6
Joined
Apr 28, 2005
Messages
155
You've destoryed your group? Hence you cant use it again?
At least thats what i think happened?
Dunno why it would only work in single playe thought...
but hey i might be completely wrong but as far as im concrened "call DestroyGroup" does just that....

I don't know much about memory leaks, but I've learned from tutorials that this is the way to kill them.
The groups are evidently reusable, or my my map would pretty much not run at all :p
 
Level 9
Joined
Jul 27, 2006
Messages
652
Well then i cant see a reason why this doesnt work? everything seems fine to be fine? Just so you know, there is no real reason to destory that group since its a global and is being reset again and again... Im not sure if it would still leak without the "DestroyGroup" function...
There is a script called "set WantDestroyGroupBJ=true" or something like that that...
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
YOUR ALL WRONG!
He destroyes the group and makes a new one then destroyes that.

Set TempGroup = (Units owned by (Triggering player) matching (((Unit-type of (Matching unit)) Equal to Box) and (((Matching unit) is selected by (Triggering player)) Equal to True)))

Is the issue, "((Matching unit) is selected by (Triggering player)) Equal to True" means the unit has to be selected for it to be chossen, which it is not.

In multiplayer (LAN AND BNET) it bugs and the event is delayed by more than a second and then that action also bugs, often returning false when it should be true. The only fix is not using it or using thoes selectiable things (I can not remember name but they are called selectables or something similar) in jass. Or you can experiment a bit and work out a way around that via timers and stuff.
 
Level 9
Joined
Jul 27, 2006
Messages
652
I knew i was right :smile:
And its GroupClear()

EDIT:
YOUR ALL WRONG!
He destroyes the group and makes a new one then destroyes that.

Set TempGroup = (Units owned by (Triggering player) matching (((Unit-type of (Matching unit)) Equal to Box) and (((Matching unit) is selected by (Triggering player)) Equal to True)))

Is the issue, "((Matching unit) is selected by (Triggering player)) Equal to True" means the unit has to be selected for it to be chossen, which it is not.

In multiplayer (LAN AND BNET) it bugs and the event is delayed by more than a second and then that action also bugs, often returning false when it should be true. The only fix is not using it or using thoes selectiable things (I can not remember name but they are called selectables or something similar) in jass. Or you can experiment a bit and work out a way around that via timers and stuff.

Damn you Dr :smile: you know too much about this game...
 
Last edited:
Level 2
Joined
Apr 27, 2004
Messages
28
It's still not efficient to create and destroy TempGroup though. Since tempgroup is used repeatedly, the proper method would be to "unit group, add unit group" I.E. add all units matching blah blah blah to temp, then clear when done with the group.

Temp
Events
Conditions
Actions
Unit Group - Add all units of (Units owned by (Triggering player) matching (((Unit-type of (Matching unit)) Equal to Footman) and (((Matching unit) is selected by (Triggering player)) Equal to True))) to TempGroup
Unit Group - Remove all units from TempGroup
 
Level 9
Joined
Jul 27, 2006
Messages
652
Hmmm it would be better to set the group each time, that way you dont have to remove the units each time making it that little bit faster.
 
Level 2
Joined
Apr 27, 2004
Messages
28
Is it?

I could be wrong, but creating the group twice and then destroying it twice seems less effective than simply clearing it twice.

I assume you are implying that destroying the group executes faster than clearing it.
 
Level 6
Joined
Apr 28, 2005
Messages
155
Oh man, now I'm even more confused about what method to use!
I'm just gonna stick with what I have now until more urgent stuff is solved.

YOUR ALL WRONG!
He destroyes the group and makes a new one then destroyes that.

Set TempGroup = (Units owned by (Triggering player) matching (((Unit-type of (Matching unit)) Equal to Box) and (((Matching unit) is selected by (Triggering player)) Equal to True)))

Is the issue, "((Matching unit) is selected by (Triggering player)) Equal to True" means the unit has to be selected for it to be chossen, which it is not.

In multiplayer (LAN AND BNET) it bugs and the event is delayed by more than a second and then that action also bugs, often returning false when it should be true. The only fix is not using it or using thoes selectiable things (I can not remember name but they are called selectables or something similar) in jass. Or you can experiment a bit and work out a way around that via timers and stuff.

I'm afraid the only jass I know is these call destroy things I snapped up from a Wc3C tutorial.
As far as the delay goes I kinda understand what you mean, but what exactly in the trigger causes this bug? Or does thing bug apply to all triggers?
I have no idea how to get around this problem. It could be done in Jass you say? Then perhaps I could make a request in the appropriate forum.
 
Level 11
Joined
Jul 12, 2005
Messages
764
It's still not efficient to create and destroy TempGroup though. Since tempgroup is used repeatedly, the proper method would be to "unit group, add unit group" I.E. add all units matching blah blah blah to temp, then clear when done with the group.

Temp
Events
Conditions
Actions
Unit Group - Add all units of (Units owned by (Triggering player) matching (((Unit-type of (Matching unit)) Equal to Footman) and (((Matching unit) is selected by (Triggering player)) Equal to True))) to TempGroup
Unit Group - Remove all units from TempGroup
Lol, this has no sence, cause it leaks like you didn't even use the TempGroup variable :D
Forget this one!
Just do what PurplePoot says ;)
 
Status
Not open for further replies.
Top