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

[Solved] Wave Timer Poblem!!

Status
Not open for further replies.
Level 6
Joined
May 9, 2011
Messages
228
Guys i have a problem about my wave timer
so i set the enemy player into neutral hostile
i set the timer to 5 seconds countdown after countdown is done the first wave will appear and im gonna kill all the enemies after killing all enemies the next wave timer will appear to wait 45 seconds countdown and it will continue until to the last wave...so the problem is this:

there are 2 timer windows appear and it has 45 seconds countdown and i didnt see the 5 seconds countdown timer window, after i kill all the enemies and i wait for the next wave but the 45 seconds timer countdown didnt appear if you didnt get my point heres my trigger

  • Level 1
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Unit - Create 10 Footman for Neutral Hostile at (Center of Top Spawn <gen>) facing Default building facing degrees
      • Unit - Create 10 Footman for Neutral Hostile at (Center of Left Spawn <gen>) facing Default building facing degrees
      • Unit - Create 10 Footman for Neutral Hostile at (Center of Right Spawn <gen>) facing Default building facing degrees
      • Unit - Create 10 Footman for Neutral Hostile at (Center of Bottom Spawn <gen>) facing Default building facing degrees
      • Game - Display to (All players) the text: Level 1 wave is sta...
      • Trigger - Turn on Level 2 <gen>
      • Trigger - Turn off (This trigger)
  • Level 2
    • Events
      • Time - CREEPTIMER expires
    • Conditions
      • (All units of (Units owned by Neutral Hostile) are dead) Equal to True
    • Actions
      • Unit - Create 10 Priest for Neutral Hostile at (Center of Top Spawn <gen>) facing Default building facing degrees
      • Unit - Create 10 Priest for Neutral Hostile at (Center of Left Spawn <gen>) facing Default building facing degrees
      • Unit - Create 10 Priest for Neutral Hostile at (Center of Right Spawn <gen>) facing Default building facing degrees
      • Unit - Create 10 Priest for Neutral Hostile at (Center of Bottom Spawn <gen>) facing Default building facing degrees
      • Game - Display to (All players) the text: Wave 2 is going to ...
      • Trigger - Turn off (This trigger)
      • Trigger - Turn on Level 3 <gen>
  • Move Copy
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Order (Units in Top Spawn <gen> owned by Neutral Hostile) to Attack-Move To (Center of Center of Map <gen>)
      • Unit Group - Order (Units in Left Spawn <gen> owned by Neutral Hostile) to Attack-Move To (Center of Center of Map <gen>)
      • Unit Group - Order (Units in Right Spawn <gen> owned by Neutral Hostile) to Attack-Move To (Center of Center of Map <gen>)
      • Unit Group - Order (Units in Bottom Spawn <gen> owned by Neutral Hostile) to Attack-Move To (Center of Center of Map <gen>)
  • Untitled Trigger 003
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Countdown Timer - Start CREEPTIMER as a One-shot timer that will expire in 5.00 seconds
      • Set CREEPTIMER = (Last started timer)
      • Countdown Timer - Create a timer window for CREEPTIMER with title Prepare for Battle!...
  • Untitled Trigger 004
    • Events
      • Time - CREEPTIMER expires
    • Conditions
    • Actions
      • Countdown Timer - Destroy (Last created timer window)
  • Creep Timer
    • Events
      • Unit - A unit owned by Neutral Hostile Dies
    • Conditions
      • (All units of (Units owned by Neutral Hostile) are dead) Equal to True
    • Actions
      • Countdown Timer - Create a timer window for CREEPTIMER with title Prepare for Battle!...
      • Set CREEPWAIT = 45
      • Countdown Timer - Start CREEPTIMER as a One-shot timer that will expire in 45.00 seconds
      • Set CREEPWINDOW = (Last created timer window)
      • Player Group - Pick every player in (All players) and do (Player - Add (200 + (50 x (Execution count of (This trigger)))) to (Picked player) Current gold)
  • Timer Destroy
    • Events
      • Time - CREEPTIMER expires
    • Conditions
    • Actions
      • Countdown Timer - Destroy CREEPWINDOW
anyone can help me!!
i give repz for those who can help me
 

Attachments

  • Hive Heroic Survival 1.1.w3x
    3.8 MB · Views: 92
Last edited:
Level 3
Joined
Jun 9, 2010
Messages
31
For your current triggers...

for trigger 003, set the timer window to a variable, and then in trigger 004 destroy the variable timer window, and not just the last created. I believe that only is supposed to be used (the "last created") when it's inside the same trigger. Use variables when going across multiple triggers, plus it's a good habit.

The best way to detect when there's no creeps left is to create a trigger who's event is set off by the player state of Neutral Hostile's Food used = 0. As long as all the creeps in your spawns have a food value, it will work. Be careful; summoned units have default food usage of 0.

Also, as a rule of thumb, each timer should have a unique variable for the timer itself, and the timer window as well. Both should be cleared, and each timer window destroyed and then recreated as needed.

I can see that the initial five second timer starts briefly, however the game thinks that a Hostile creep dies if there's no units on the map (or however you made it, idk if there's some initially on the map) and since you have two seperate timers using the same variables, it takes over the 5 second timer and makes it the 45 second timer.

So in English, here's what you gotta do to fix your problem:

1. Make each timer and timer window unique in its variables. You shouldn't be using the same variables for two different timers (that's lazy!)

2. Use the food method I described above, except disable it at the start of the game, and enable it after the first wave spawns (add an "action" in the first level trigger, and make it "trigger - run (FOOD DETECTION) ignoring conditions"

That should fix the detection, and should stop the game from swapping out your 5 second timer with your 45 second timer.

Does that make sense?


Going a bit off topic here, Here's my setup for wave spawns:

I'm not saying you need to do this, it's just my personal preference. It could/would fix it, however what I said above is much much quicker for your system. I actually use that food detection in my code below. Put your spawns in an array, and then use a loop to determine the wave you're on. It's soo much easier and more efficient. Here, look at what I do for my wave spawns.

  • CreepWaveTypeSetup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set creepArray[0] = Footman
      • Set creepArray[1] = Knight
      • Set creepArray[2] = Mortar Team
      • Set creepArray[3] = Priest
      • Set creepArray[4] = Dragon Hawk
      • Set creepArray[5] = Siege Engine
      • Set creepArray[6] = Paladin
      • Set creepArray[7] = Archmage (8)
      • Set creepArray[8] = Wisp
      • Set creepArray[9] = Archer
      • Set creepArray[10] = Huntress
      • Set creepArray[11] = Dryad
      • Set creepArray[12] = Glaive Thrower
      • Set creepArray[13] = Hippogryph
      • Set creepArray[14] = Mountain Giant
      • Set creepArray[15] = Avatar of Vengeance
      • Set creepArray[16] = Demon Hunter
      • Set creepArray[17] = Warden
      • Set creepArray[18] = Priestess of the Moon
      • Set creepArray[19] = Keeper of the Grove
      • Set creepArray[20] = Demon (Demon Form)
      • Set creepArray[21] = Peon
      • Set creepArray[22] = Grunt
      • Set creepArray[23] = Raider
      • Set creepArray[24] = Tauren
      • Set creepArray[25] = Troll Headhunter
      • Set creepArray[26] = Demolisher
      • Set creepArray[27] = Wind Rider
      • Set creepArray[28] = Troll Witch Doctor
      • Set creepArray[29] = Shaman
      • Set creepArray[30] = Spirit Walker
      • Set creepArray[31] = Blademaster
      • Set creepArray[32] = Far Seer
      • Set creepArray[33] = Tauren Chieftain
      • Set creepArray[34] = Rexxar
      • Set creepArray[35] = Shadow Wolf (Level 3) (Level 3)
      • Set creepArray[36] = Grom Hellscream (Possessed)
      • Set creepArray[37] = Ghoul
      • Set creepArray[38] = Shade
      • Set creepArray[39] = Abomination
      • Set creepArray[40] = Gargoyle
      • Set creepArray[41] = Meat Wagon
      • Set creepArray[42] = Crypt Fiend
      • Set creepArray[43] = Banshee
      • Set creepArray[44] = Necromancer
      • Set creepArray[45] = Frost Wyrm
      • Set creepArray[46] = Death Knight
      • Set creepArray[47] = Ordin Frostbane
      • Set creepArray[48] = Terrordar
      • Set creepArray[49] = Diablo
  • Spawn Initialization
    • Events
      • Dialog - A dialog button is clicked for LivesMenu
      • Player - Player 11 (Dark Green)'s Food used becomes Equal to 0.00
    • Conditions
    • Actions
      • Trigger - Turn on Reward <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WaveNumber Less than or equal to 49
        • Then - Actions
          • -------- Starts countdown until the next wave --------
          • Countdown Timer - Create a timer window for WaveCountdown with title (=== + (Wave + ((String((WaveNumber + 1))) + ===)))
          • Set WaveCountdownWindow = (Last created timer window)
          • Countdown Timer - Start WaveCountdown as a One-shot timer that will expire in 10.00 seconds
          • Countdown Timer - Show WaveCountdownWindow
        • Else - Actions
          • -------- Player wins the game if he gets past wave 50 --------
          • Game - Display to (All players) the text: The game will end i...
          • Wait 30.00 seconds
          • Player Group - Pick every player in (All allies of Player 1 (Red)) and do (Actions)
            • Loop - Actions
              • Game - Victory (Picked player) (Show dialogs, Show scores)
  • Spawn Creeps
    • Events
      • Time - WaveCountdown expires
    • Conditions
    • Actions
      • Leaderboard - Change the value for Player 12 (Brown) in LivesLeaderboard to (WaveNumber + 1)
      • -------- Gets rid of timer window, makes room for new one next round --------
      • Countdown Timer - Destroy WaveCountdownWindow
      • For each (Integer A) from 1 to CreepSpawnCount[WaveNumber], do (Actions)
        • Loop - Actions
          • -------- Creates a second delay between the spawn of the units --------
          • Wait 1.25 seconds
          • Set tmpPoint = (Center of Left Spawn <gen>)
          • Unit - Create 1 creepArray[WaveNumber] for Player 11 (Dark Green) at tmpPoint facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation(udg_tmpPoint)
          • Set tmpPoint = (Center of Bot left spawn <gen>)
          • Unit - Create 1 creepArray[WaveNumber] for Player 11 (Dark Green) at tmpPoint facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation(udg_tmpPoint)
          • Set tmpPoint = (Center of Bottom Right Spawn <gen>)
          • Unit - Create 1 creepArray[WaveNumber] for Player 11 (Dark Green) at tmpPoint facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation(udg_tmpPoint)
          • Set tmpPoint = (Center of Right Spawn <gen>)
          • Unit - Create 1 creepArray[WaveNumber] for Player 11 (Dark Green) at tmpPoint facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation(udg_tmpPoint)
      • Set WaveNumber = (WaveNumber + 1)
It spawns a unit every 1.25 seconds at each of the four spawn points, instead of spawning a cluster of them
all the temporary points (tmpPoint) are to fix memory leaks.

I've got another array that specifies the amount of creeps that spawn per lane per wave, but you don't have to worry about that.



EDIT: I'll be working on my map all tomorrow. If you're having trouble understanding what I'm suggesting, I'll edit your map and then post up the new triggers tomorrow afternoon. I'm going to bed though since it's 2:40 over here.
 
Last edited:
Level 6
Joined
May 9, 2011
Messages
228
yeah im very confuse about the trigger you gave me....
btw instead of player 11 how about neutral hostile coz they cast neutral spells
if your gonna edit my map its very find to me....
 
Level 6
Joined
May 9, 2011
Messages
228
i have a problem
i copy the trigger of yours and put it into my map
when the creeps starts to spawn it sleep
i donno what happen
please tell me
btw the trigger is awesome its simple but awesome
 
Level 6
Joined
May 9, 2011
Messages
228
yeah player 12 can attack buildings but the problem is they cant cast any neutral spells..thats why i use neutral hostile the problem is they cant attack buildings
 
  • Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Other Actions before --------
      • Set SpawnLocation[1] = (Center of Region 000 <gen>)
      • Set SpawnLocation[2] = (Center of Region 001 <gen>)
      • Set SpawnLocation[3] = (Center of Region 002 <gen>)
      • Set SpawnLocation[4] = (Center of Region 003 <gen>)
      • -------- Other Actions after --------
  • Spawn Creeps
    • Events
      • Time - WaveCountdown expires
    • Conditions
    • Actions
      • Leaderboard - Change the value for Player 12 (Brown) in LivesLeaderboard to (WaveNumber + 1)
      • -------- Gets rid of timer window, makes room for new one next round --------
      • Countdown Timer - Destroy WaveCountdownWindow
      • For each (Integer A) from 1 to CreepSpawnCount[WaveNumber], do (Actions)
        • Loop - Actions
          • -------- Creates a second delay between the spawn of the units --------
          • Wait 1.25 seconds
          • Unit - Create 1 creepArray[WaveNumber] for Player 11 (Dark Green) at SpawnLocation[1] facing Default building facing (270.0) degrees
          • Unit - Create 1 creepArray[WaveNumber] for Player 11 (Dark Green) at SpawnLocation[2] facing Default building facing (270.0) degrees
          • Unit - Create 1 creepArray[WaveNumber] for Player 11 (Dark Green) at SpawnLocation[3] facing Default building facing (270.0) degrees
          • Unit - Create 1 creepArray[WaveNumber] for Player 11 (Dark Green) at SpawnLocation[4]facing Default building facing (270.0) degrees
      • Set WaveNumber = (WaveNumber + 1)
 
Level 6
Joined
May 9, 2011
Messages
228
i dont get it guys
@Maker: yoh dude i use the trigger of yours then i copy and paste to my map and the values that you gave to me , the problem is they cant attack buildings they will ignore it btw the values you given to me is the range of the spawn zone or...bcoz my spawn zone far
@Kobas: can you give me a more configurable and understandable trigger
 
Give me some time to try something.

EDIT:

Nevermind, it will be better to code this in jass or vjass, using functions in GUI is possible but dunno will you understand them (sorry if this sounded offensive).
My idea was to add few functions into 1 trigger and then just call it from another one when some event happen.
 
Last edited:
Level 6
Joined
May 9, 2011
Messages
228
if i change the player from neutral hostile to player 12 i have no problem bcoz they can attack buildings, do you know how to make the player 12 cast spells more on like AI type player??
 
Level 12
Joined
Nov 20, 2007
Messages
660
Your spawn system is so ... bad ?
And in your map are tons of leaks.
That's how your spawn system should look (4-5 triggers instead of 1/level).
I like your heroes concept and models.
The gameplay is arch known and i suggest you to add something new (original).
And you should learn some tutorials (THERE are a lots of).
Keep working on your map improving it, i'm sure that in one day you will finish it and will look awsome.
 

Attachments

  • Spawn System.w3x
    18.9 KB · Views: 38
Level 6
Joined
May 9, 2011
Messages
228
thank you for the trigger you made its awesome but if i going to change the enemy player into NH they cant attack buildings bcoz it can cast spells while player cant cast spells
 
Level 8
Joined
Jan 8, 2010
Messages
493
is the reason why you want them to remain NH is so that they can act like an AI and make them cast spells? 'cause if you just want them to do something like:

a unit enters a corner of the spawn route, make that unit cast something

then you can use Pharaoh_'s example in triggers. but if you want something like:

a unit is in a route, suddenly they are surrounded by 4 units, make that unit cast something

you can use the AI Editor.
 
Level 6
Joined
May 9, 2011
Messages
228
what should i do first
can you give me an exact example
event: ??
condition: ??
action: Unit - Order unit to Human Mountain King - Thunder Clap
 
Level 8
Joined
Jan 8, 2010
Messages
493
what Pharaoh_ said is something in this situation:

1. a unit enters a particular region in a map
2. make the unit cast the spell
  • Events
    • Unit - A unit enters Region 1
  • Conditions
    • (Unit type of (Triggering Unit)) Equal to SomeCreature
  • Actions
    • Unit - Order (Triggering Unit) to Human - Mountain King - Thunderclap
that is of course, you have an event that will make the unit cast Thunderclap, the event which is when that unit enters Region 1.

but i'm sure you notice this, a Centaur with a Warstomp will not cast Warstomp unless it is surrounded by at least 3-4 units. you don't have an event to use like Unit - A unit is surrounded by 4 units. in that case, you have to use the AI Editor to make that unit cast Warstomp.

the reason why i asked if you need to have them remain Neutral Hostile is because of that example with Centaur. if you can handle the AI Editor well, you can change the Neutral Hostile to any Player, and use AI to make them intelligently cast spells.
 
Level 6
Joined
May 9, 2011
Messages
228
Ok guys i figure it out so i set to NH and i turn the building into not building so the NH can attack they can cast a spell
ok thank you guys for the hard work dont worry i will give +rep to all who help me
 
Status
Not open for further replies.
Top