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

Kill Count System Problem

Status
Not open for further replies.
Level 8
Joined
Mar 26, 2009
Messages
301
  • Infected Death Counter
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Dying unit)) Equal to Player 4 (Purple)
    • Actions
      • Set Infected_Death_Count = (Infected_Death_Count + 1)
      • Set A_Infected_Death_Count_Real = (A_Infected_Death_Count_Real + 1.00)
  • Wave 2
    • Events
      • Game - A_Infected_Death_Count_Real becomes Equal to 10.00
    • Conditions
    • Actions
      • Set Wave_Number = 2
      • Wait 3.00 seconds
      • Quest - Display to (All players) the Hint message: |cff8080FFHint:|r Z...
      • Wait 7.00 seconds
      • Game - Display to (All players) the text: |cffFF0000Wave 2|r
      • Sound - Play Incoming_Wave <gen>
      • Wait 5.00 seconds
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Zombie for Player 4 (Purple) at (Center of SPAWN POINT SOUTH 1 <gen>) facing 90.00 degrees
          • Unit - Order (Last created unit) to Attack-Move To (Center of MAP CENTER <gen>)
          • Unit - Create 1 Zombie for Player 4 (Purple) at (Center of SPAWN POINT SOUTH 2 <gen>) facing 90.00 degrees
          • Unit - Order (Last created unit) to Attack-Move To (Center of MAP CENTER <gen>)
          • Unit - Create 1 Zombie for Player 4 (Purple) at (Center of SPAWN POINT SOUTH 3 <gen>) facing 90.00 degrees
          • Unit - Order (Last created unit) to Attack-Move To (Center of MAP CENTER <gen>)
          • Unit - Create 1 Zombie for Player 4 (Purple) at (Center of SPAWN POINT NORTH 3 <gen>) facing 90.00 degrees
          • Unit - Order (Last created unit) to Attack-Move To (Center of MAP CENTER <gen>)
          • Unit - Create 1 Zombie for Player 4 (Purple) at (Center of SPAWN POINT NORTH 1 <gen>) facing 90.00 degrees
          • Unit - Order (Last created unit) to Attack-Move To (Center of MAP CENTER <gen>)
          • Wait Global_Raid_Interval seconds
This is how creep spawn works in my map. Problem is, that real variable (or integer variable) does not show the proper unit death count. There is either a problem with Variable Trigger or Spawn Trigger. Has anybody experienced something like this before?
P.S: I've also explained this in Map Development section. You can check the original map and see what is wrong. (Check the link in my signature)
 
Level 13
Joined
Mar 24, 2010
Messages
950
theres a few probs i see off the bat

1 is u should try not to use waits in your trigger if you can but if it wont be conflicting with anything else and it wont be running (overlapping) it shouldnt be a huge issue. what is a prob tho is u have a wait in your loop at the bottom, try having the wait outside the loop and run the loop again, see if that works.

also it looks like your count trigger is ok, instead of dying unit try triggering unit
and i have had something weird happen before with that count issue too, it was only in 1 map tho. when i exported the trigger it worked fine. So maybe somethings messed up with your map?
But anyway an easy work around is make a temp_int var and do..
Set temp_int = (Infected_Death_Count + 1)
Set Infected_Death_Count = temp_int
Set A_Infected_Death_Count_Real = (convert int to real(temp_int)

that should solve ur probs :)
 
Level 8
Joined
Mar 26, 2009
Messages
301
Gonna check it out after trying one last thing =) Thank you.
theres a few probs i see off the bat

1 is u should try not to use waits in your trigger if you can but if it wont be conflicting with anything else and it wont be running (overlapping) it shouldnt be a huge issue. what is a prob tho is u have a wait in your loop at the bottom, try having the wait outside the loop and run the loop again, see if that works.

also it looks like your count trigger is ok, instead of dying unit try triggering unit
and i have had something weird happen before with that count issue too, it was only in 1 map tho. when i exported the trigger it worked fine. So maybe somethings messed up with your map?
But anyway an easy work around is make a temp_int var and do..
Set temp_int = (Infected_Death_Count + 1)
Set Infected_Death_Count = temp_int
Set A_Infected_Death_Count_Real = (convert int to real(temp_int)

that should solve ur probs :)
Changed dying unit to triggering unit. Gonna test it now. Btw; wait is in Creep Spawn trigger. It doesn't create a conflict with anything (i hope) =) So it shouldn't be a problem. Thank you for your answer =)
Moved to Triggers & Scripts.
Sorry for posting to wrong section.
WARNING: Questions regarding the creation of triggers or systems go here (not in Triggers & Scripts!), whilst problems with malfunctioning triggers must be posted in Triggers & Scripts
I didn't notice the second part of this message =)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Game - A_Infected_Death_Count_Real becomes Equal to 10.00
I wonder.... Could it be perhapse that it never becomes "equal" to 10.00?

The problem with reals in WC3 is they are floatingpoints, thus they have a limited accuracy and are incapable of representing integers precicly. The accuracy is enough that for most purposes even with compounded error no meaningful deviation from the expected results occurs but...
There is a difference between equals and equivelent to. Thus what could be happenind is that 1.00 added 10 times does not give the exact same floating point value that 10.00 as a constant compiles to and so they fail to ever become equal to each other. AKA a floating point precission bug.

Eithor make the trigger run when it comes equal to or greater than or switch to another system.
Another system could use arrays to test when a wave should start on the actual unit death. Make a pair of arrays, 1 for wave triggers (trigger array) and the other for the kill count (integer). Have a variable store which wave it is on. As waves are linear, you only ever need to test the kills needed for the next wave when a unit dies and thus it remains O(1) efficency no mater how many waves you have. When a wave does beginne, you need simply incriment the wave counter by 1 and then run the wave trigger.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Just design a system that works?

Eithor make the trigger run when it comes equal to or greater than or switch to another system.
Another system could use arrays to test when a wave should start on the actual unit death. Make a pair of arrays, 1 for wave triggers (trigger array) and the other for the kill count (integer). Have a variable store which wave it is on. As waves are linear, you only ever need to test the kills needed for the next wave when a unit dies and thus it remains O(1) efficency no mater how many waves you have. When a wave does beginne, you need simply incriment the wave counter by 1 and then run the wave trigger.

If you want something to happen, you must design it so it can happen. Adding checks for example within loops to see if the loop should exit when a certain condition occurs. You could even have a mode that gets set on and off if spawning is occuring and so the nextwave simply waits until spawning stops and issues a break as soon as possible from spawn loop command.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Yes, plan and design a new creep spawn system which will avoid problems and bugs. I advise using 1 trigger to do all spawning and then get the waves to just alter variables used by that 1 trigger. This prevents any chance of parallelisim which is what is causing you problems as far as I can tell.
 
Status
Not open for further replies.
Top