Nooby Question - GUI / MPI

Status
Not open for further replies.
Level 11
Joined
Feb 23, 2009
Messages
577
Hi all, I was testing my item system in multiplayer with my brother yesterday and it instantly started acting weird. I can tell very easily what is going wrong, and know how to "fix" it, but I don't understand why it's doing what it's doing. If someone could please take the time to explain why this is happening it would be great.

Here is what happens, when one player presses "Escape" it seems like it's somehow interacting with other players as well. What's wrong with this trigger? Hope someone can help :)!

Thanks!

  • Camera Escape
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
      • Player - Player 2 (Blue) skips a cinematic sequence
      • Player - Player 3 (Teal) skips a cinematic sequence
      • Player - Player 4 (Purple) skips a cinematic sequence
      • Player - Player 5 (Yellow) skips a cinematic sequence
      • Player - Player 6 (Orange) skips a cinematic sequence
      • Player - Player 7 (Green) skips a cinematic sequence
      • Player - Player 8 (Pink) skips a cinematic sequence
      • Player - Player 9 (Gray) skips a cinematic sequence
      • Player - Player 10 (Light Blue) skips a cinematic sequence
      • Player - Player 11 (Dark Green) skips a cinematic sequence
      • Player - Player 12 (Brown) skips a cinematic sequence
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering player) is in Camera_InventoryViewOn) Equal to True
        • Then - Actions
          • Selection - Clear selection for (Triggering player)
          • Player Group - Remove (Triggering player) from Camera_InventoryViewOn
          • Visibility - Destroy Camera_VisibilityMod[(Player number of (Triggering player))]
          • Visibility - Create an initially Enabled visibility modifier for (Triggering player) emitting Black mask across Bag_Region[(Player number of (Triggering player))]
          • Visibility - Destroy (Last created visibility modifier)
          • Set Group_A = (Units owned by (Triggering player) matching ((Level of Inventory (Hero) for (Matching unit)) Equal to 1))
          • Set Point_A = (Position of (Random unit from Group_A))
          • Selection - Select (Random unit from Group_A) for (Triggering player)
          • Custom script: call DestroyGroup(udg_Group_A)
          • Camera - Reset camera for (Triggering player) to standard game-view over 0.00 seconds
          • Camera - Pan camera for (Triggering player) to Point_A over 0.00 seconds
          • Custom script: call RemoveLocation(udg_Point_A)
        • Else - Actions
          • Selection - Clear selection for (Triggering player)
          • Visibility - Create an initially Enabled visibility modifier for (Triggering player) emitting Visibility across Bag_Region[(Player number of (Triggering player))]
          • Set Camera_VisibilityMod[(Player number of (Triggering player))] = (Last created visibility modifier)
          • Visibility - Enable Camera_VisibilityMod[(Player number of (Triggering player))]
          • Camera - Lock camera target for (Triggering player) to Camera_LockDummy[(Player number of (Triggering player))], offset by (0.00, 0.00) using Default rotation
          • Player Group - Add (Triggering player) to Camera_InventoryViewOn
          • Countdown Timer - Start Camera_InventoryViewTimer as a One-shot timer that will expire in 0.00 seconds
 
Level 41
Joined
Feb 27, 2007
Messages
5,233
Only thing I see is this: Countdown Timer - Start Camera_InventoryViewTimer as a One-shot timer that will expire in 0.00 seconds. Can you post the trigger that runs when that timer expires? My only other guess is something about the escape keypress messes with the camera settings so it looks like it resets.

Your "select a random unit that has an inventory" bit is kinda weird. I presume each player only has 1 hero, right? It would be far smarter to just use a unit array to store each player's hero and get it back later in instances like this. Saves you a good number of function calls.
 
Level 11
Joined
Feb 23, 2009
Messages
577
Only thing I see is this: Countdown Timer - Start Camera_InventoryViewTimer as a One-shot timer that will expire in 0.00 seconds. Can you post the trigger that runs when that timer expires? My only other guess is something about the escape keypress messes with the camera settings so it looks like it resets.

Here it is:

  • Camera Timer
    • Events
      • Time - Camera_InventoryViewTimer expires
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of players in Camera_InventoryViewOn) Not equal to 0
        • Then - Actions
          • Player Group - Pick every player in Camera_InventoryViewOn and do (Actions)
            • Loop - Actions
              • Camera - Set (Picked player)'s camera Angle of attack to 270.00 over 0.00 seconds
              • Camera - Set (Picked player)'s camera Field of view to 77.50 over 0.00 seconds
          • Countdown Timer - Start Camera_InventoryViewTimer as a One-shot timer that will expire in 0.03 seconds
        • Else - Actions
Your "select a random unit that has an inventory" bit is kinda weird. I presume each player only has 1 hero, right? It would be far smarter to just use a unit array to store each player's hero and get it back later in instances like this. Saves you a good number of function calls.

Yes, I agree it's weird, and may seem dumb xD... but there is a reason to it lol. And the reason that I don't set it to a variable and keep calling it like that is so that the system would be ultra noob friendly once finished.
 
Level 41
Joined
Feb 27, 2007
Messages
5,233
I don't see anything that would cause the error you experience. Try it with a different keypress event other than escape? Try commenting out the Countdown Timer start in the second trigger you posted. Maybe re setting the camera every 0.03 is too quick and gets wonky.

Just random ideas.
 
it seems like it's somehow interacting with other players as well.
Is it possible to elaborate on this?

Do players somehow share vision or so? (in case vision modifiers can even be affected by vision sharing, too, because idk anymore for example)

Camera_LockDummy[] array is correclty initialisized?
 
Level 11
Joined
Feb 23, 2009
Messages
577
For starters, I suggest using variables for better readability, it also makes it easier to spot the error.

I always do, except for this very specific case, and I only do it with this one (though I do it in many places).


Is it possible to elaborate on this?

Do players somehow share vision or so? (in case vision modifiers can even be affected by vision sharing, too, because idk anymore for example)

Camera_LockDummy[] array is correclty initialisized?

That may be the case, I will test it again with my brother lol... But also, it seems like if we both click escape relatively at the same time that it will only work for 1 player.
 
Level 15
Joined
Aug 14, 2007
Messages
936
That's the problem with multiplayer, I get this kind of problems a lot when I was doing random Hero, when more than one player did Random Hero and if the trigger is setup as a bunch of events in one trigger, it usually will have that problem.

I have a solution that I hope you try first before giving your own comment, which I had tried in the past and it should work. Split this one trigger into 12 different trigger handles, that way each player has their own trigger which will handle each of their own things in different threads. Then test it out with your brother, this means that you need to copy paste the same trigger 12 times. Believe me it works :)
 
Status
Not open for further replies.
Top