• 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.

a trigger for each player?

Status
Not open for further replies.
Level 1
Joined
Apr 26, 2016
Messages
5
i have a tower defense map setup with a creep spawn triggers that i found online that starts automatically

can someone help me getting the trigger to apply for each player that joins the game?

right now it uses a single spawn goes to the next level after all the creeps have been killed no matter how many 'players' are in the game.

its a fixed amount of creeps each level, and i want to be able to make the game scale for each player as multiple players would make the game too easy. ideally a spawn area for each player.

i uploaded the entire map to this link.


http://www.filedropper.com/zenobia
 
Level 1
Joined
Apr 26, 2016
Messages
5
hang on i was trying to copy from the trigger list..

sorry if this looks like a lot, i tried copying the creeps spawns/levels trigger
and just changed the player from 12 to 11, so there were 2 different instances of the same trigger

i also tried making multiple spawn points using multiple regions but i couldnt assign more than a single spawn point
to the spawn trigger

but what happened is after all the creeps from level 1 died the game just stopped.

also theres a small issue with the creeps bounty, the player is assigned to player 12 for the creeps, if i changed that to neutral hostile would that allow bounties to be collected, since you dont normally collect bounties, only experience, from killing enemy units?



  • inittialize game
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Sound - Play Music
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
      • -------- For the game initialization, it is a wise discission to initialize using time elapse --------
      • -------- because the timer window will not show up if you use map initialization event --------
      • -------- ==================================================== --------
      • -------- 1. Run the two essential triggers in creating the first spawns (Level 1) --------
      • Trigger - Run Set Creeps <gen> (checking conditions)
      • Trigger - Run firstSpawnTimer <gen> (checking conditions)

  • Set Creeps
    • Events
    • Conditions
    • Actions
      • -------- I would like to start counting from one --------
      • -------- You can start yours from zero --------
      • Set LevelCounter = 1
      • -------- This actions set the kind of creeps to spawn in every level, the number of creeps to spawn, the golds given --------
      • -------- at each end of wave, and the texts for warnings and the given gold --------
      • Set creepSpawnType[1] = Archer
      • -------- creepSpawnType is a unit type --------
      • Set goldLevelGiven[1] = 150
      • -------- goldGiven is integer --------
      • Set goldLevelText[1] = ((String(goldLevelGiven[1])) + is given.)
      • -------- goldLevelText is a String --------
      • Set creepNumLevel[1] = 1
      • -------- creepNumLevel is the creep count to spawn and is an integer --------
      • Set levelWarnings[1] = ((String(creepNumLevel[1])) + Level 1 creeps are coming.)
      • -------- levelWarnings warns the player about the coming creeps --------
      • -------- ==================NEXT LEVEL======================================== --------
      • Set creepSpawnType[2] = Footman
      • Set goldLevelGiven[2] = 350
      • Set goldLevelText[2] = ((String(goldLevelGiven[2])) + is given.)
      • Set creepNumLevel[2] = 10
      • Set levelWarnings[2] = ((String(creepNumLevel[2])) + Level 2 creeps are coming.)
      • -------- ==================NEXT LEVEL======================================== --------
      • Set creepSpawnType[3] = Hippogryph Rider
      • Set goldLevelGiven[3] = 250
      • Set goldLevelText[3] = ((String(goldLevelGiven[3])) + is given.)
      • Set creepNumLevel[3] = 5
      • Set levelWarnings[3] = ((String(creepNumLevel[3])) + Level 3 creeps are coming.)
      • -------- ==================NEXT LEVEL======================================== --------
      • Set creepSpawnType[4] = Nerubian Queen
      • Set goldLevelGiven[4] = 250
      • Set goldLevelText[4] = ((String(goldLevelGiven[4])) + is given.)
      • Set creepNumLevel[4] = 30
      • Set levelWarnings[4] = ((String(creepNumLevel[4])) + Level 4 creeps are coming.)
      • -------- ==================NEXT LEVEL======================================== --------
      • Set creepSpawnType[5] = Knight
      • Set goldLevelGiven[5] = 250
      • Set goldLevelText[5] = ((String(goldLevelGiven[5])) + is given.)
      • Set creepNumLevel[5] = 40
      • Set levelWarnings[5] = ((String(creepNumLevel[5])) + Level 5 creeps are coming.)
      • -------- ==================NEXT LEVEL======================================== --------
      • Set creepSpawnType[6] = Frost Wyrm
      • Set goldLevelGiven[6] = 250
      • Set goldLevelText[6] = ((String(goldLevelGiven[6])) + is given.)
      • Set creepNumLevel[6] = 20
      • Set levelWarnings[6] = ((String(creepNumLevel[6])) + Level 6 creeps are coming.)
  • firstSpawnTimer
    • Events
    • Conditions
    • Actions
      • -------- In our first spawn, we need to create a different timer and a timer window aside from the timer window to use in a regular level or spawns. --------
      • Countdown Timer - Start startTimer as a One-shot timer that will expire in 5.00 seconds
      • Countdown Timer - Create a timer window for startTimer with title Next Level in:
      • -------- We should store our timer window in a variable because we have two timer windows --------
      • Set startTimerWindow = (Last created timer window)
      • -------- Now, we will show our timer window to the player to give him time to prepare --------
      • Countdown Timer - Show startTimerWindow
  • firstSpawnEnd
    • Events
      • Time - startTimer expires
    • Conditions
    • Actions
      • -------- If our firstSpawnTimer expires we should do the following: --------
      • -------- 1. Hide or even destroy our first spawn--timer window. --------
      • Countdown Timer - Hide startTimerWindow
      • -------- 2. Tell the player that the first level is approaching --------
      • Game - Display to (All players) for 5.00 seconds the text: levelWarnings[LevelCounter]
      • -------- 3. Turn on the creation of creeps --------
      • Trigger - Turn on Spawn <gen>
  • Spawn
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • -------- This trigger is initially off. --------
      • -------- First thing to do is to store the locations where the spawn should occur and where our creeps will go --------
      • -------- 1. The spawn location --------
      • Set Spawner = (Random point in Region 000 <gen>)
      • -------- 2. The location where our creeps will go --------
      • Set tempPoint = (Random point in Region 001 <gen>)
      • -------- By using the if statement below, we set as to how many are allowed to spawn --------
      • -------- in each level --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of living creepSpawnType[LevelCounter] units owned by Player 12 (Brown)) Equal to creepNumLevel[LevelCounter]
        • Then - Actions
          • -------- We then turn off this trigger if the desired number of spawned creeps is meet --------
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • -------- If the number of creeps is still not enough, the creation will still continue --------
          • Unit - Create 1 creepSpawnType[LevelCounter] for Player 12 (Brown) at Spawner facing Default building facing degrees
          • -------- We order each creeps to attack and move towards the set dump area we call as tempPoint --------
          • Unit - Order (Last created unit) to Attack-Move To tempPoint
      • -------- If everything is done, we should remove memory leaks --------
      • Custom script: call RemoveLocation(udg_Spawner)
      • Custom script: call RemoveLocation(udg_tempPoint)
      • -------- This ends the creation of creeps --------
  • endLevel
    • Events
      • Player - Player 12 (Brown)'s Food used becomes Less than or equal to 0.00
    • Conditions
    • Actions
      • -------- The level will end if all creeps are dead --------
      • -------- Player - Player 12 (Brown)'s Food used becomes Less than or equal to 0.00 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LevelCounter Less than 6
        • Then - Actions
          • -------- We have to set the last level and here we have up to level 6 --------
          • -------- Then, we create coundown timer for the next wave of creeps. --------
          • Countdown Timer - Start levelTimer as a One-shot timer that will expire in 1.00 seconds
          • -------- Create the timer window --------
          • Countdown Timer - Create a timer window for levelTimer with title Next Level in:
          • -------- Save it in a variable --------
          • Set levelTimerWindow = (Last created timer window)
          • -------- Show the timer window to the player so he can be alerted --------
          • Countdown Timer - Show levelTimerWindow
        • Else - Actions
          • -------- We put here the action when the last level is reached. Here, the last level is 65 as stated in our if statement - --------
          • Game - Display to (All players) for 30.00 seconds the text: END GAME
  • nextLevel
    • Events
      • Time - levelTimer expires
    • Conditions
    • Actions
      • -------- In this trigger, you can see that we work on a different expiring timer than the --------
      • -------- expired timer of the first spawn. This is because, this will be used for the leveling purpose. --------
      • -------- If the level timer expires, we need to hide it --------
      • Countdown Timer - Hide levelTimerWindow
      • -------- We then add 1 to our level (the next spawns) --------
      • Set LevelCounter = (LevelCounter + 1)
      • -------- Then we display the alert text --------
      • -------- Take note that the text we used is actually a variable we get in the Set Creeps trigger --------
      • -------- Instead of using levelWarnings[0], levelWarnings[1], etc we just say levelWarnings[LevelCounter] --------
      • Game - Display to (All players) for 5.00 seconds the text: levelWarnings[LevelCounter]
      • -------- Now, we have to turn on The Spawn trigger to create units for the next level --------
      • Trigger - Turn on Spawn <gen>
 
Last edited:
Level 3
Joined
Feb 15, 2008
Messages
20
  • Player - Turn Gives bounty On for Player 12 (Brown)
You can use this for the bounty.

For multiple spawn points you have to take a look at your "Spawn" trigger. You need an additional variable for the second spawn point. And then create another unit at this point and order it to move. Your trigger has a problem if units die before all of them have spawned though and will create too many as a result. I suggest changing the condition to

  • (Number of units in (Units owned by Player 12 (Brown) of type creepSpawnType[LevelCounter])) Greater than or equal to creepNumLevel[LevelCounter]
 
Status
Not open for further replies.
Top