• 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] Triggers broken in multiplayer TD [map attached]

Status
Not open for further replies.
Level 2
Joined
Sep 21, 2007
Messages
26
Hello everyone,

I've been working on my TD map for a week or so now and i have all the base work done (paths, multiboard, lives etc) and i can play through all the waves (5 waves + boss round) perfectly on singleplayer.

Yet when i load it up with 3-4 players it behaves very strangely.

Instead of spawning all 20 creeps per player, player one gets 7, player 2 gets 7 and player 3 gets 8, then in round two and onwards, player 3 gets all 20 and player 1 and 2 get no spawns at all.

I've been looking over and over the triggers and i just can't figure out why it's behaving like this, so i've come to you guys for help.

The only thing i can think of is that maybe the (Last Created Unit) is getting mixed between the players as the events happen at the same time?

Would really appreciate another set of eyes on these triggers,
thanks!
 

Attachments

  • NanoTDv0.2.w3x
    70.5 KB · Views: 51
Level 2
Joined
Sep 21, 2007
Messages
26
Well coudn't find the problem did find that when the sumoning stops the game sais one of the computer's buildings is attacked yes the invurnereble ones....

It's not a last created unit problem. Can't be involved with killing, Still hapens when i don't.




I have to show you something though becouse making a trigger for every player X every wave is just NOT DONE!
  • Ingame initialisation
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • Player Group - Add (Player((Integer A))) to Players
            • Else - Actions
              • Do nothing
      • -------- spawn triggers --------
      • Set SpawnTriggers[1] = Spawn P1 creeps <gen>
      • Set SpawnTriggers[2] = Spawn P2 creeps <gen>
      • Set SpawnTriggers[3] = Spawn P3 creeps <gen>
      • Set SpawnTriggers[4] = Spawn P4 creeps <gen>
      • -------- Creating spawn positions --------
      • Set Spawnpoint[1] = (Center of P1Path0 <gen>)
      • Set Spawnpoint[2] = (Center of P2Path0 <gen>)
      • Set Spawnpoint[3] = (Center of P3Path0 <gen>)
      • Set Spawnpoint[4] = (Center of P4Path0 <gen>)
      • -------- Creating spawn array --------
      • Set WaveUnitType[1] = Couch
      • Set WaveUnitType[2] = Dude (Male)
      • -------- exc --------
      • -------- exc --------
      • -------- exc --------
  • Waves
    • Events
      • Time - Elapsed game time is 30.00 seconds
      • Player - Player 5 (Yellow)'s Food used becomes Equal to 0.00
    • Conditions
    • Actions
      • Set WaveNR = (WaveNR + 1)
      • Game - Display to (All players) the text: ((|c00FFFF00Wave + ((String(WaveNR)) + |r)) + will begin in |c00FF000010 seconds!|r)
      • Wait 10.00 seconds
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Trigger - Run SpawnTriggers[(Player number of (Picked player))] (ignoring conditions)
          • Multiboard - Set the text for NTDBoard item in column 0, row 2 to <Empty String>
          • Multiboard - Set the text for NTDBoard item in column 2, row ((Player number of (Picked player)) + 2) to ( + (String(WaveNR)))
          • Wait 0.05 seconds
          • -------- tiny wait against the (Last created unit) problem --------

And for all players a looping summon trigger, that is all!!!

  • Spawn P1 creeps
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 20, do (Actions)
        • Loop - Actions
          • Unit - Create 1 WaveUnitType[WaveNR] for Player 5 (Yellow) at Spawnpoint[1] facing Spawnpoint[1]
          • Unit - Set the custom value of (Last created unit) to (Player number of Player 1 (Red))
          • Wait 0.80 seconds
and put Special Effect - Destroy (Last created special effect) behind your special effects they will finish the animation so far i remember.
 
Level 2
Joined
Sep 21, 2007
Messages
26
I knew there would be a much easier way of doing it, doh!

Thanks a lot for taking the time to look at it for me. I'll implement that today when i get the time and see if it stops any of those weird things we were experiencing in multiplayer.

^_^
 
Level 2
Joined
Sep 21, 2007
Messages
26
Ok i've been working on it for a while and i've gotten Allcor's ideas implemented (and modified slightly) and it's working much better (and the triggers are coded MUCH better) but it's still giving some odd results.

It works PERFECTLY when i'm the only one playing. But when i run it with multiple players (computer players are fine to test this) each person only gets ~6 spawns each. Every round the same thing, each person ~6 spawns (instead of the 20 times per wave the spawn trigger is meant to loop).

The wave triggers are now set up like this:

  • Initial Wave
    • Events
      • Time - Elapsed game time is 30.00 seconds
    • Conditions
    • Actions
      • Set WaveNum = (WaveNum + 1)
      • Game - Display to (All players) for 10.00 seconds the text: ((|c00FFFF00Wave + (String(WaveNum))) + |r will begin in |c00FF000010 seconds!|r)
      • Wait 10.00 seconds
      • Player Group - Pick every player in Players and do (Actions)
        • Loop - Actions
          • Set Cur_Round[(Player number of (Picked player))] = WaveNumSpawns[WaveNum]
          • Multiboard - Set the text for NTDBoard item in column 2, row ((Player number of (Picked player)) + 2) to ( + (String(Cur_Round[(Player number of (Picked player))])))
          • Multiboard - Set the text for NTDBoard item in column 0, row 2 to <Empty String>
          • Trigger - Run SpawnTriggers[(Player number of (Picked player))] (ignoring conditions)
          • Wait 0.05 seconds
  • All Waves
    • Events
      • Player - Player 5 (Yellow)'s Food used becomes Equal to 0.00
    • Conditions
      • WaveNum Greater than or equal to 1
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • WaveNum Equal to 5
        • Then - Actions
          • -------- Boss Rounds --------
          • Game - Display to (All players) for 4.00 seconds the text: ((|c00FFFF00Wave + (String(WaveNum))) + |r |c0096FF96COMPLETE!|r)
          • Wait 2.00 seconds
          • Set WaveNum = (WaveNum + 1)
          • Game - Display to (All players) for 8.00 seconds the text: |c00FF0000WARNING!|...
        • Else - Actions
          • -------- Normal Rounds --------
          • Game - Display to (All players) for 4.00 seconds the text: ((|c00FFFF00Wave + (String(WaveNum))) + |r |c0096FF96COMPLETE!|r)
          • Wait 5.00 seconds
          • Set WaveNum = (WaveNum + 1)
          • Game - Display to (All players) for 5.00 seconds the text: ((|c00FFFF00Wave + (String(WaveNum))) + |r will begin in |c00FF00005 seconds!|r)
      • Wait 10.00 seconds
      • Player Group - Pick every player in Players and do (Actions)
        • Loop - Actions
          • Set Cur_Round[(Player number of (Picked player))] = WaveNumSpawns[WaveNum]
          • Multiboard - Set the text for NTDBoard item in column 2, row ((Player number of (Picked player)) + 2) to ( + (String(Cur_Round[(Player number of (Picked player))])))
          • Multiboard - Set the text for NTDBoard item in column 0, row 2 to <Empty String>
          • Trigger - Run SpawnTriggers[(Player number of (Picked player))] (ignoring conditions)
          • Wait 0.05 seconds
With each player's Spawn triggers being set up like so:

  • Spawn P1 Creeps
    • Events
    • Conditions
      • Player_dead[(Player number of Player 1 (Red))] Equal to False
    • Actions
      • For each (Integer A) from 1 to WaveNumSpawns[WaveNum], do (Actions)
        • Loop - Actions
          • Unit - Create 1 WaveUnitType[WaveNum] for Player 5 (Yellow) at (Center of P1Path0 <gen>) facing (Center of P1Path1 <gen>)
          • Unit - Set the custom value of (Last created unit) to (Player number of Player 1 (Red))
          • Wait 0.80 seconds

I've attached the updated map, please if anyone can see anything wrong with the triggers posted, or anything else in the map, let me know! This is really doing my head in.

Thanks ^_^
 

Attachments

  • NanoTDv0.3.w3x
    65.7 KB · Views: 47
Level 2
Joined
Sep 21, 2007
Messages
26
Thanks for all the help, it's no problems. It doesn't seem like there's anything declared incorrectly, i assume it's just some sort of timing thing somewhere giving odd results.

I noticed that when i changed

  • Wait 0.80 seconds
to

  • Wait 0.10 seconds
in the Spawning trigger i managed to have ~13 mobs spawn. So somehow it may be spawning for a certain amount of time and then just exiting the loop?

Does anyone know why this'd happen?
 
Level 2
Joined
Sep 21, 2007
Messages
26
Finally solved this one. The 'Integer A' in the loop was getting some crossover between the players and using an integer variable array i.e count[player_number] as the loop variable fixed the issue. Now they finally spawn the correct amounts in multiplayer!
 
Status
Not open for further replies.
Top