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

Spawning Separate Wave Units for 4 Players

Status
Not open for further replies.
Level 1
Joined
Oct 6, 2017
Messages
2
Hello, thank you for taking the time to look at my question.

I'm trying to create an arena map, similar to Custom Hero Survival—I want every player's enemies to spawn as they click "enter arena" instead of spawning simultaneously, however. I can't quite figure out how to spawn the same unit for different players at different times, while making it MUI.

The outline is this:
  • Wave 1: Spawn 1 Furbolg
  • Wave 2: Spawn 2 Furbolg
If (Triggering Unit) enters arena spawn units in Wave 1
My current trigger idea is to have a separate trigger with all wave information, which is triggered when a unit enters the arena. This creates MUI problems down the line, I fear. It is important to me that the individual waves can be configured easily (without having to scroll far down one way-too-long trigger).

The triggers I have at the moment (which function for a single player, but not multiple players):
  • GateNorthEnter
    • Events
      • Unit - A unit enters gateNorth <gen>
    • Conditions
      • waveStart Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in (Units owned by Player 1 (Red))) Equal to True
        • Then - Actions
          • Destructible - Open Gate (Horizontal) 0000 <gen>
          • Camera - Apply CameraArena <gen> for (Owner of (Triggering unit)) over 1.00 seconds
          • Camera - Set a spacebar-point for (Owner of (Triggering unit)) at (Center of CameraArenaRegion <gen>)
          • Unit - Order (Triggering unit) to Move To (Center of arenaNorth <gen>)
          • Set wave = (wave + 1.00)
        • Else - Actions
          • Game - Display to (All players controlled by a ((Owner of (Triggering unit)) controller) player) for 5.00 seconds the text: |cffcc00This is not...
  • Wave 1
    • Events
      • Game - wave becomes Equal to 1.00
    • Conditions
    • Actions
      • Set temppointArena = (Center of arenaNorthSpawn <gen>)
      • Set waveUnitCount = 1
      • Unit - Create waveUnitCount Furbolg for Player 12 (Brown) at temppointArena facing Default building facing degrees
      • Unit - Wake up (Last created unit)
      • Unit - Order (Last created unit) to Attack-Move To (Center of arenaNorth <gen>)
      • Unit Group - Add (Last created unit) to wavegroupPlayer1
      • Set unitsInGroup = waveUnitCount
      • Custom script: call RemoveLocation(udg_temppointArena)
I figure the solution is rather simple... But I've now spent 3 weeks trying to figure it out, so it's become time to ask you brighter fellows. Thank you for reading, and in advance for helping.
 
Level 1
Joined
Oct 6, 2017
Messages
2
Hey UreDe4D, thank you for your suggestion!

I have considered using an array to do it. I am concerned about what happens if two players enter their respective arenas at the exact same time.
Let me illustrate (GateNorthEnter; final Then action, Wave 1; first and second Actions):

  • GateNorthEnter
    • Events
      • Unit - A unit enters gateNorth <gen>
    • Conditions
      • waveStart Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in (Units owned by Player 1 (Red))) Equal to True
        • Then - Actions
          • Destructible - Open Gate (Horizontal) 0000 <gen>
          • Camera - Apply CameraArena <gen> for (Owner of (Triggering unit)) over 1.00 seconds
          • Camera - Set a spacebar-point for (Owner of (Triggering unit)) at (Center of CameraArenaRegion <gen>)
          • Unit - Order (Triggering unit) to Move To (Center of arenaNorth <gen>)
          • Set wave = (wave + 1.00)
          • Set wavePlayer = 0
        • Else - Actions
          • Game - Display to (All players controlled by a ((Owner of (Triggering unit)) controller) player) for 5.00 seconds the text: |cffcc00This is not...
  • Wave 1
    • Events
      • Game - wave becomes Equal to 1.00
    • Conditions
    • Actions
      • Set temppointArena[wavePlayer] = (Center of arenaNorthSpawn <gen>)
      • Set waveUnitCount[wavePlayer] = 1
      • Unit - Create waveUnitCount Furbolg for Player 12 (Brown) at temppointArena[wavePlayer] facing Default building facing degrees
      • Unit - Wake up (Last created unit)
      • Unit - Order (Last created unit) to Attack-Move To (Center of arenaNorth <gen>)
      • Unit Group - Add (Last created unit) to wavegroupPlayer1
      • Set unitsInGroup = waveUnitCount
      • Custom script: call RemoveLocation(udg_temppointArena[wavePlayer])
Barring that I am not sure of how to change the region (arenaNorthSpawn --> arenaEastSpawn, for example) with variables, if two players enter simultaneously, the actions between "Set temmpointArena" and "Set waveUnitCount" might change, given my understanding of how Arrays work and update.

I might also be in the wrong, but is this the implementation that you suggested?
 
Level 13
Joined
Nov 4, 2006
Messages
1,239
yes it's more or less what i meant. Are you using separate triggers for each wave?

i would suggest using separate triggers for each player, then you also get rid of the problem with two players running into their spawn at the same time (although as long as there are no waits in your triggers it shoudn't be a problem).

next you pack everything into variable arrays. the spawn zones, the triggers, the waveunittypes (unless it remains furbolg for the entire game), etc. and then you run the trigger which belongs to the respective player

i have uploaded a testmap with only one wavetrigger for you to look at. i hope it helps
 

Attachments

  • spawns.w3x
    22.7 KB · Views: 52
Status
Not open for further replies.
Top