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

[Solved] How to clear integer ?

Status
Not open for further replies.
Level 3
Joined
Dec 20, 2010
Messages
48
Hi, I am making a map with duel system.I want mine to become a duel system scored by poins(poins +1 every time your team kill enemy units).But I need to reset the Integer(the poins integer) so the next duel will back to normal, and I don't know how to clear it ! Can anyone help me ?



  • Duel System
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
      • (Guild War Arena <gen> contains (Dying unit)) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Dying unit) belongs to an ally of Player 1 (Red)) Equal to True
        • Then - Actions
          • Set Poins[2] = (Poins[2] + 1)
        • Else - Actions
          • Set Poins[1] = (Poins[1] + 1)
Poins[1] = Poins for Team 1
Poins[2] = Poins for Team 2

I just wanted to create a trigger which can reset the Poins variable, and 1 more thing.Please see the trigger and check for these :
a.Leaks
b.Variables (wrong/correct)

+repp to who've tried and helped me :ogre_haosis:
 
Replace (Dying unit) with (Triggering unit) to improve the speed of script. Additionaly, if you are using just 2 indexes from array variable you are wasting some memory (since when you declare array parameter, engine immidiately prepares 8192 indexes of such). So what I suggest is replacing array integers with normal non array ones (ofcourse if you are using just 2 inxedes, if 3 or more are used, it's okey to stay with the idea).

Fixed trigger:
  • Duel System
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Guild War Arena <gen> contains (Triggering unit)) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) belongs to an ally of Player 1 (Red)) Equal to True
        • Then - Actions
          • Set Poins2 = (Poins2 + 1)
        • Else - Actions
          • Set Poins1 = (Poins1 + 1)
 
Status
Not open for further replies.
Top