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

PROBLEM IN TD wave name unit trigger

Status
Not open for further replies.
Level 6
Joined
Dec 24, 2012
Messages
187
i have a problem in TD,
i want to add a name of the unit every wave..
just like,
ex:
Level 1- Fulborg(Ability: Fast)
Level 2- Gnoll(Abilty: Dodge)
Level 3- Wagon(Ability: Mechanical,Tough)
Level 4- Satyr (Ability: Invulnerability when hit)
Level 5- Arthas (Ability: Boss, Tough)

and so on..
what trigger should i make,

my trigger doesn't work.
only the Level 1- (Blank-No-Name) ex: Level 1-

Here's my Trigger:
http://www.hiveworkshop.com/forums/members/224689-albums6025-picture77990.png
224689-albums6025-picture77990.png
 
Level 6
Joined
Dec 24, 2012
Messages
187
@TO
You shouldn't use last created unit in anything unless you just created that unit.
If you remove last created unit before the trigger fires it returns null / blank.
If you create a new unit it will display the wrong units name.

hmm.. can you give me a trigger? and some examples?

this is my spawn trigger.


224689-albums6025-picture77942.png


Do you have the units initialized so that they are able to be shown in the string?

hmmm.. i think, yes ??
Not sure with the units, but i have trigger, Creep spawn.
 
Level 6
Joined
Dec 24, 2012
Messages
187
@TO
Use the link I posted above to learn how to post triggers. Then post the trigger the triggers the correct way.

like this ?
Thank you for this :)


here's my triggers:
(The Trigger that doesn't work)
  • Wave names
    • Events
      • Time - iTsCreepTime expires
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (|c00FCC430Level|r + ( - + ((String(LevelCount)) + ( |c00F27AD0 + (Name of (Last created unit))))))
The Trigger of Creep Spawn:

  • Spwans initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set GamePlayers = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User)))
      • Set CreepArray[1] = Fat Guy
      • Set CreepArray[2] = Zombie Doll
      • Set CreepArray[3] = Bat
      • Set CreepArray[4] = Dead Vampire
      • Set CreepArray[5] = Meme (Weakest Boss)
      • Set CreepArray[6] = Armored Soldier
      • Set CreepArray[7] = Pool Searcher
      • Set CreepArray[8] = SnakeBat
      • Set CreepArray[9] = Kitty
      • Set CreepArray[10] = Sexy Big Boobs (Weaker Boss)
      • Set CreepArray[11] = Monkey
      • Set CreepArray[12] = Gorilla
      • Set CreepArray[13] = Bat King
      • Set CreepArray[14] = Werewolf
      • Set CreepArray[15] = Witch Spider (Weak Boss)
      • Set CreepArray[16] = Possessed Motorbike
      • Set CreepArray[17] = Possessed Mechanic Chicken
      • Set CreepArray[18] = Possessed Air Drone
      • Set CreepArray[19] = Possessed Tank
      • Set CreepArray[20] = Think-Care (Average Boss)
      • Set creepCount_LastIndex = 100
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
      • Game - Display to (All players) for 20.00 seconds the text: |cff87ceebHello Pla...
      • Set colourGold = |cffffcc00
      • Set colourPlayers[1] = |c00ff0303
      • Set colourPlayers[2] = |c000042ff
      • Set colourPlayers[3] = |c001ce6b9
      • Set colourPlayers[4] = |c00540081
      • Set colourPlayers[5] = |c00fffc01
      • Set colourPlayers[6] = |c00feba0e
      • Set HostileCreeps = Player 11 (Dark Green)
      • Player - Turn Gives bounty On for HostileCreeps
      • Set LivesCount = 100
The Timer expires Trigger:

  • Spawning Region Men
    • Events
      • Time - iTsCreepTime expires
    • Conditions
    • Actions
      • Countdown Timer - Destroy TheCreepBrokenWindow
      • For each (Integer A) from 1 to CreepsSpawnCount[LevelCount], do (Actions)
        • Loop - Actions
          • Wait 0.50 seconds
          • Player Group - Pick every player in GamePlayers and do (Actions)
            • Loop - Actions
              • Set tmPoint = ((Picked player) start location)
              • Unit - Create 2 CreepArray[LevelCount] for HostileCreeps at tmPoint facing 2.00 degrees
              • Custom script: call RemoveLocation( udg_tmPoint )
done :)
 
Level 5
Joined
Feb 22, 2013
Messages
161
Well first of all, do what death said and merge the triggers that have the same event and also instead of using the name of the last created unit use the conversion from unit-type to string:

  • Game - Display to (All players) the text: (|c00FCC430Level|r + (- + ((String(LevelCount)) + ( |c00F27AD0 + (String(CreepArray[LevelCount]))))))
 
Level 6
Joined
Dec 24, 2012
Messages
187
Well first of all, do what death said and merge the triggers that have the same event and also instead of using the name of the last created unit use the conversion from unit-type to string:

  • Game - Display to (All players) the text: (|c00FCC430Level|r + (- + ((String(LevelCount)) + ( |c00F27AD0 + (String(CreepArray[LevelCount]))))))

Problem is most likely the wait. Don't use wait in a loop. Don't use integer A/B they are slower and less efficient.

Add the two triggers that fire from the same timer ending together.

i tried what u'd said guyz, but this is what happened

http://www.hiveworkshop.com/forums/members/224689-albums6025-picture78082.jpg
224689-albums6025-picture78082.jpg


this is the trigger:

  • Spawning Region Men
    • Events
      • Time - iTsCreepTime expires
    • Conditions
    • Actions
      • Countdown Timer - Destroy TheCreepBrokenWindow
      • For each (Integer A) from 1 to CreepsSpawnCount[LevelCount], do (Actions)
        • Loop - Actions
          • Wait 0.50 seconds
          • Player Group - Pick every player in GamePlayers and do (Actions)
            • Loop - Actions
              • Set tmPoint = ((Picked player) start location)
              • Unit - Create 2 CreepArray[LevelCount] for HostileCreeps at tmPoint facing 2.00 degrees
              • Custom script: call RemoveLocation( udg_tmPoint )
          • Game - Display to (All players) the text: (|c00FCC430Level|r + ( - + ((String(LevelCount)) + ( |c00F27AD0 + (String(CreepArray[LevelCount]))))))
 
Take this out of the loop.
  • Game - Display to (All players) the text: (|c00FCC430Level|r + ( - + ((String(LevelCount)) + ( |c00F27AD0 + (String(CreepArray[LevelCount]))))))
It is displaying multiple times because it is in the loop.
Don't use integer A/B. Use your own variable or it will bug in the future.
Don't use waits. They are inaccurate and can fail.
If you want to spawn units like this use a counter to count the units spawned. You need another trigger to do this with a second timer. Make that timer fire every .5 seconds. In the new timer end trigger increase the counter and spawn a unit. When the counter hits the number of units you want stop the new timer.
Then set the counter to 0 so it can be used next time.

This will make the spawning run better and prevent any future bugs.
 
Level 6
Joined
Dec 24, 2012
Messages
187
Take this out of the loop.
  • Game - Display to (All players) the text: (|c00FCC430Level|r + ( - + ((String(LevelCount)) + ( |c00F27AD0 + (String(CreepArray[LevelCount]))))))
It is displaying multiple times because it is in the loop.
Don't use integer A/B. Use your own variable or it will bug in the future.
Don't use waits. They are inaccurate and can fail.
If you want to spawn units like this use a counter to count the units spawned. You need another trigger to do this with a second timer. Make that timer fire every .5 seconds. In the new timer end trigger increase the counter and spawn a unit. When the counter hits the number of units you want stop the new timer.
Then set the counter to 0 so it can be used next time.

This will make the spawning run better and prevent any future bugs.

Can you make me the trigger?
or make it in my map?
dunno how to do it :( sorry, :ogre_frown:
 
Can you make me the trigger?
or make it in my map?
dunno how to do it :( sorry, :ogre_frown:

I can try to type it up as close as possible.

Variables
  • unitSpawnCounter = integer
  • spawnMax = integer
  • CreepArray = unit type array. (You already have this one)
  • SpawnTimer = timer. (When the next spawn wave will start.)
  • SpawnLocationPlayer = point array (This should be used to store the location that units will get spawned at.)
  • GamePlayers = player group. (You already have this.)
  • LevelCount = integer (You already have this one.)

  • Setup Trigger
    • Events
      • Time - Time Event 0.00
    • Conditions
    • Actions
      • Set spawnMax = 25
      • Set unitSpawnCounter = 0
      • Set CreepArray[1] = units
      • // Set all of the creeps you want to spawn into the array.
      • Set SpawnLocationPlayer[1] = player 1 reds unit spawn.
      • // Set the spawn location for all players like above.
      • Set GamePlayers = all players you want to spawn for.
  • Spawn Setup Trigger
    • Events
      • Spawn Timer Ends
    • Conditions
    • Actions
      • Display the game message that you have above to show the level that players are on.
      • Trigger - Turn on Spawning Units Trigger
  • Spawning Units Trigger
    • Events
      • Time - Every 0.50 seconds of game.
    • Conditions
    • Actions
      • Set unitSpawnCounter = unitSpawnCounter + 1
      • Set LevelCount = LevelCount + 1
      • If all conditions are met then do actions.
        • If Conditions
          • spawnMax greater than unitSpawnCounter
        • Then
          • Player Group - Pick every player in GamePlayers and do (Actions)
            • Loop - Actions
              • Unit - Create 1 CreepArray[LevelCount] for HostileCreeps at SpawnLocationPlayer[Player number of (picked player)] facing 2.00 degrees
        • Else
          • Trigger - turn off this trigger.
The above should work a lot better for you.
 
Level 6
Joined
Dec 24, 2012
Messages
187
I can try to type it up as close as possible.

Variables
  • unitSpawnCounter = integer
  • spawnMax = integer
  • CreepArray = unit type array. (You already have this one)
  • SpawnTimer = timer. (When the next spawn wave will start.)
  • SpawnLocationPlayer = point array (This should be used to store the location that units will get spawned at.)
  • GamePlayers = player group. (You already have this.)
  • LevelCount = integer (You already have this one.)

  • Setup Trigger
    • Events
      • Time - Time Event 0.00
    • Conditions
    • Actions
      • Set spawnMax = 25
      • Set unitSpawnCounter = 0
      • Set CreepArray[1] = units
      • // Set all of the creeps you want to spawn into the array.
      • Set SpawnLocationPlayer[1] = player 1 reds unit spawn.
      • // Set the spawn location for all players like above.
      • Set GamePlayers = all players you want to spawn for.
  • Spawn Setup Trigger
    • Events
      • Spawn Timer Ends
    • Conditions
    • Actions
      • Display the game message that you have above to show the level that players are on.
      • Trigger - Turn on Spawning Units Trigger
  • Spawning Units Trigger
    • Events
      • Time - Every 0.50 seconds of game.
    • Conditions
    • Actions
      • Set unitSpawnCounter = unitSpawnCounter + 1
      • Set LevelCount = LevelCount + 1
      • If all conditions are met then do actions.
        • If Conditions
          • spawnMax greater than unitSpawnCounter
        • Then
          • Player Group - Pick every player in GamePlayers and do (Actions)
            • Loop - Actions
              • Unit - Create 1 CreepArray[LevelCount] for HostileCreeps at SpawnLocationPlayer[Player number of (picked player)] facing 2.00 degrees
        • Else
          • Trigger - turn off this trigger.
The above should work a lot better for you.
hi friend, is it ok for you that i will give the map to you
and make the trigger?
co'z im just a begginer about this.. hehe(Sorry) :ogre_hurrhurr: sorry for the disturbance..
 
Status
Not open for further replies.
Top