• 🏆 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!

Unit selected event and multiplayer

Status
Not open for further replies.
Level 5
Joined
Jan 6, 2010
Messages
115
I tried to search for this, but didn't find anything directly related.

I have an "Unit is selected" event that works perfectly in single-player. In multi-player, however, the the event triggers only the _second time_ the unit is clicked. First click produces the selection circle, and a second click triggers the unit selected event...

Is there a workaround on this? Or even better, a logical explanation? I'd really like to see the event trigger at first click.
 
Level 5
Joined
Jan 6, 2010
Messages
115
  • SelectedWizard
    • Events
      • Unit - Wizard 0304 <gen> Is selected
    • Conditions
      • (Wizard 0304 <gen> is selected by SelectingPlayerHuman) Equal to True
    • Actions
  • ...
To spare you from the boredom of lengthy triggers, I narrowed the problem down to the condition above that requires that the selecting player is a variable called SelectingPlayerHuman. I naturally checked and confirmed that the variable SelectingPlayerHuman is indeed the player at time of selection.
And of course, if it weren't, it would work in singleplayer mode either.

This leads to a general question; is it an established truth that some triggers behaves differently in singleplayer and multiplayer mode? Note that it doesn't actually have to be other players in the game; as long as the map is started in Local Area Game mode, the condition keeps the action from triggering at the first click.
 
Not much info in that trigger. My guess would be that the SelectingPlayerHuman is set somewhere in the same trigger outside the posted condition.
That could explain why the major of the trigger is not run the first time, but will run the second time.

It could also be another trigger where you set the SelectingPlayerHuman. Maybe a loop is getting cut off or something.

You need to post the whole trigger, and possibly all triggers involving the SelectingPlayerHuman.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Keyboard events
Selection events
Wait actions

behave differently in multiplayer mode.
 
Level 5
Joined
Jan 6, 2010
Messages
115
Keyboard events
Selection events
Wait actions

behave differently in multiplayer mode.

Good to hear I'm not crazy.

Not much info in that trigger. My guess would be that the SelectingPlayerHuman is set somewhere in the same trigger outside the posted condition.
That could explain why the major of the trigger is not run the first time, but will run the second time.
Believe me, it's down to the bare essentials there. There's nothing else that's going on that an effect the outcome of that trigger. I bet that if I make a new map, with ONLY the trigger above (with a satisfied condition) you will need to click two times in multiplayer mode.

Now that this is settled, I just have to look for a workaround..
 
Level 5
Joined
Jan 6, 2010
Messages
115
Are you sure the variable SelectingPlayerHuman is set properly before the trigger runs first time?

I would recomment to post all related code.

Off course, as I said I tested this explicitly. It's a bit much code to post everything, but as I said, I've narrowed the problem down to that specific condition.
Today I'll make a new test map with only two triggers, and we'll see what's going on. I'll post results and the triggers if it's not working.

Thanks for your interest, btw.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Ok I tested this in a blank map with 2 triggers.

  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set SelectingPlayerHuman = Player 1 (Red)
  • Select Event
    • Events
      • Unit - Blood Mage 0000 <gen> Is selected
    • Conditions
      • (Blood Mage 0000 <gen> is selected by SelectingPlayerHuman) Equal to True
    • Actions
      • Game - Display to (All players) the text: Selected

Single player:Message displayed at first click
Multiplayer test:Message displayed at second click

I also didn't know that there is such an unit event "unit is selected".
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
If I use player selection event and use condition "selected unit equal to bloodmage" sure trigger will run at first click.


But this still not working at first click.
  • Select Event
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
      • (Blood Mage 0000 <gen> is selected by SelectingPlayerHuman) Equal to True
    • Actions
      • Game - Display to (All players) the text: Selected

Edit: Oh with this question, it is not event which causing problems.It is the condition
(Blood Mage 0000 <gen> is selected by SelectingPlayerHuman) Equal to True
Because trigger is running but this condition returns false.

You can also see this by doing a little test, when bloodmage is selected, if you select another unit game still thinks blood mage is selected by you and message is displayed.
 
Level 5
Joined
Jan 6, 2010
Messages
115
Thanks for doing the lab-work, Ceday. This has puzzled me for a long time. I think there's no logical conclusion other than how the game is programmed for multiplayer. Just like the 'wait-bug' that was once messing everything up in multiplayer. This one isn't as critical, but still represents a certain annoyance.

@Defskull; if it's a workaround you're proposing there I'll check it out when I get back to my computer.
 
Level 5
Joined
Jan 6, 2010
Messages
115
You know what? That does work if I start a new map. However, it seems my problems goes a bit deeper all of a sudden. It seems selection events and some boolean condition tests are now not working, also in singleplayer. This could probably be its own thread, but I'll follow up here...

This one is not triggering, even if it should.

  • SelectedElementalist
    • Events
      • Unit - Elementalist 0391 <gen> Is selected
    • Conditions
      • ((Triggering player) is in QueueHuman) Equal to True
    • Actions
      • ...

The following trigger is returning false and false (I'm player teal, btw).

  • SelectedElementalist returntest
    • Events
      • Unit - Elementalist 0391 <gen> Is selected
    • Conditions
    • Actions
      • If ((Triggering player) Equal to Player 3 (Teal)) then do (Game - Display to (All players) the text: teal) else do (Game - Display to (All players) for 3.00 seconds the text: false)
      • If (((Triggering player) is in QueueHuman) Equal to True) then do (Game - Display to (All players) the text: queuehuman) else do (Game - Display to (All players) for 3.00 seconds the text: false)
and just to be sure that the player really is on the player group Queue Human, I made this test trigger

  • SelectedElementalist returntest2
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • If ((Player 3 (Teal) is in QueueHuman) Equal to True) then do (Game - Display to (All players) the text: true) else do (Game - Display to (All players) for 3.00 seconds the text: false)
The periodic trigger indeed returns true every time.

I tested the same on a new map, and it's working as it should. I'm getting a bit worried here, cause I've worked on my map over a decade, and if the map itself is bugged, I don't know what to do.:goblin_cry:
 
Do the actions, which you dont display in trigger "SelectedElementalist" take inflluence on the QueueHuman?

And in you second trigger, can you display the name of triggering player properly?

As last hope you could minimize your map to this problem and attach it here, so we can test it ourself if its really a map or a trigger problem.
 
Level 5
Joined
Jan 6, 2010
Messages
115
Hey hey, the plot thickens:
Returning the name of triggering player is always the owner of the unit. This also applies to my freshly made test-map (see below).

This must have been changed in some patch at some point. Cause my old selection system (made in 2004 or so), based on clicking on the hero you want to play, still works. But as soon as I try to change anything, the selection event returns only the owner of the unit, not the selecting (triggering) player. I think I can go ahead and call this a bug?
 

Attachments

  • selectiontest.w3x
    12.6 KB · Views: 77
Last edited:
No, it works correctly. But you have messed up two things.

Your event: A unit gets selected --> Triggering Object == YourUnit ... --> TriggeringUnit == YourUnit ... --> TriggeringPlayer == OwnerOfTriggeringUnit.

This is the same case with a "Unit casts" as event. If you would print TriggeringPlayer in a Cast-Trigger, it would print the OwnerOfTriggeringUnit (== TriggeringPlayer here).

There is a simple solution for you:

Change the event to: Player - Selection Event.
Add a "Unit - Comparisson" as condition to check if TriggeringUnit == YourUnit.

Then all should work fine. TriggeringPlayer then is the player who selects the unit, and not the OwnerOfUnit anymore.
 
Level 5
Joined
Jan 6, 2010
Messages
115
Do the actions, which you dont display in trigger "SelectedElementalist" take inflluence on the QueueHuman?
As a general question, would this be a problem?

EDIT: hey, that's true. I've got this trigger. If I change the Intro boolean before having a wait-function first, the second trigger will immediately fire (even in singleplayer mode!)

Map initializiation: Intro is True

  • Skip
    • Events
      • Player - Player 3 (Teal) skips a cinematic sequence
    • Conditions
      • Intro Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Set Intro = False
      • Wait 1.00 seconds
      • Actions...

  • toMainMenuSelectingPlayer
    • Events
      • Player - Player 3 (Teal) skips a cinematic sequence
    • Conditions
      • Intro Equal to False
    • Actions
      • Actions...
So what is the lesson, here? I should always have a wait-function before changing dependencies of other variables' conditions?
 
Last edited:
You took it out of context. The last issue was fixed already. (?)

What do you want to achieve in this next trigger? Why you have 2 seperated trigger with exactly same event. Try to merge them.

Also try to avoid wait functions, they can easily make triggers non-mui if you don't pay attention.

Also when you have a new question you should let this thread be, and open a new topic.
 
Level 5
Joined
Jan 6, 2010
Messages
115
What do you want to achieve in this next trigger? Why you have 2 seperated trigger with exactly same event. Try to merge them.
It's the same event but different conditions. First time you press escape is just to skip the intro. Later on, the same key is used for something else. The boolean checks which it is.
You know what, I'll make a new thread on this one, its an interesting topic.
 
Status
Not open for further replies.
Top