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

Confused with arrays!!!

Status
Not open for further replies.
Level 13
Joined
Oct 16, 2010
Messages
737
Hi!

I'm trying to make a global spell which will rewind time. The idea is that you use the spell and all units in the map will be moved to their position they were in 15 or so seconds ago. Their health and mana will also be set back to whatever they had at that point. Those are just the basics though, I was thinking of adding things like hero experience and gold in the mine (let's not talk about getting it to work with destructibles!!)

Anyway I've been trying and trying to get it to work but I've completely confused myself and honestly have no idea how to get it to work anymore.

Here is the trigger I had put together that would record stats and positions of units across the battlefield. Any help would be awesome as this could be one really cool spell to add somewhere!!!

P.S. I did have a trigger for activating the spell but I got confused and now it's long gone.

  • Time Spell 2 Part 1
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
      • Time2Count Less than 30
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Time2Count Less than 30
        • Then - Actions
          • Set Time2Count = (Time2Count + 1)
        • Else - Actions
          • Set Time2Count = 1
      • Set TempInt = 0
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Set TempInt = (TempInt + 1)
          • Set Time2SavedUnit[Time2Count] = TempInt
          • Set Time2HP[Time2SavedUnit[Time2Count]] = (Life of (Picked unit))
          • Set Time2MP[Time2SavedUnit[Time2Count]] = (Mana of (Picked unit))
          • Set Time2Point[Time2SavedUnit[Time2Count]] = (Position of (Picked unit))
 
Is this your only trigger?

Remove very first trigger condition - useless, because you check it later anyway if Time2Count Less than 30

Why you reset TempInt each 0.5 seconds to 0?

Dont use your index like
  • Set Time2HP[Time2SavedUnit[Time2Count]]= (Life of (Picked unit))
Do like this
  • Set Time2HP[Time2Count]= (Life of (Picked unit))
because then the unit will have same index as the hp-value (just methode... , because index is wrong, too)
 
Level 13
Joined
Oct 16, 2010
Messages
737
Ahh that first condition was there purely for testing. And I was setting TempInt to 0 as I was attempting to use that as a number for the unit. So each time everything would reset so that each unit could be given a number again. That was my attempt of logic behind it, but honestly I've no idea. Never done any indexing before so this is my first attempt
 
Status
Not open for further replies.
Top