a time spell - help!

Kahem

New Member
Reaction score
2
Hello all
im trying to make a GUI spell like nerubian weavers "time lapse" from dota.
basicly what this spell does is records the location mana and hit points of the nerubian weaver each second, for up to 5 seconds.
so when the weaver casts time lapse it is instantly moved to the point where it was 5 seconds ago and its mana and life are set to what they were.

What i am trying to create is a GUI spell like this, but is hero targetable, friend enemy and self.
Hence it needs to be mpi (and gui)
so you are able to cast it on, say, a retreating enemy to move it back, or an friend who just got the crap nuked out of him to restore his hit points
im having trouble with it, especialy making it leak free.

if anyone can help me out i will be greatful
and if you can make me a full working demo map i would be even for greatful!
thanks for taking the time to help me out.
 

Kahem

New Member
Reaction score
2
oh, the spell is 4 levels

"Sends a target 2/3/4/5 seconds back in time moving it to where it was, with the same hit points and mana"
 

Rainther

I guess I should write something of value here...
Reaction score
61
Holy crap > _<.

My solution'd be to have 4 units (dummies) for each unit you can cast this on where you set their mana, health and location to the unit's position.
Basicly you have 4 units and each second you take the unit which have 5 seconds and put it infront of the line. Theese units should be hidden.
To simply it all, you should this ability should only work for 1 unit for each player.

There is no easy way to do this since historical data isn't saved from the game.
 

Joccaren

You can change this now in User CP.
Reaction score
54
Use a game cache to save the unit, since it is hero targetable, I gather its more like the Sea captains ability where after x amount of seconds, the target unit is moved back to the place where the ability was cast on it. Try this (does not include game cache, ask if you need help with that part) :

Event:
*An ability is cast
Condition:
*Ability being cast equal to Moveback
Actions:
*Save (Target unit of ability) as (SpellTarget) of (Moveback) in last created game cache
*set (Tempoint) to (Position of (Target Unit of ability)
*Wait 'x' seconds
*Remove (Target unit of ability) from game
*Restore (SpellTarget) of (Moveback) at (Tempoint) for (Owner of ability being cast)


This will screw up if you have more than one unit able to use this ability (This means multiples of the one unit able to cast the ability, another copy of this unit owned by another player that can use this ability or any other unit that can use this ability)
 

Kahem

New Member
Reaction score
2
HORAY! i did it!
thanks for the idea of making unit dummys!!!
originaly i used 5 point arays, and 10 real arays to record where each hero was on the map, its hp and mana, but they leaked! and to destroy a point ment i couldnt keep track of the location of each hero

BUT after you sujested to use a dummy unit i deleted all that and made 5 unit arays. heres the triggers for anyone else wanting to make this spell

Events
Time - Every 1.00 seconds of game time
Conditions
Actions
Set ForEachInt = 0
For each (Integer A) from 1 to 12, do (Actions)
Loop - Actions
Set ForEachInt = (ForEachInt + 1)
Set Remember5[ForEachInt] = Remember4[ForEachInt]
Set Remember4[ForEachInt] = Remember3[ForEachInt]
Set Remember3[ForEachInt] = Remember2[ForEachInt]
Set Remember2[ForEachInt] = Remember1[ForEachInt]
Unit Group - Pick every unit in (Units owned by (Player(ForEachInt)) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
Loop - Actions
Set TempPoint = (Position of (Picked unit))
Unit - Create 1 Dummy for (Player(ForEachInt)) at TempPoint facing (Facing of (Picked unit)) degrees
Set Remember1[ForEachInt] = (Last created unit)
Unit - Hide (Last created unit)
Unit - Set life of (Last created unit) to (Life of (Picked unit))
Unit - Set mana of (Last created unit) to (Mana of (Picked unit))
Unit - Add a 6.00 second Generic expiration timer to (Last created unit)


Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Time Portal
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Time Portal for (Triggering unit)) Equal to 4
Then - Actions
Set TempPoint = (Position of (Target unit of ability being cast))
Set PortalUnit = (Target unit of ability being cast)
Unit - Create 1 Time Portal for (Owner of (Triggering unit)) at TempPoint facing (Facing of PortalUnit) degrees
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_TempPoint)
Set TempPoint = (Position of Remember5[(Player number of (Owner of PortalUnit))])
Unit - Create 1 Time Portal for (Owner of (Triggering unit)) at TempPoint facing (Facing of PortalUnit) degrees
Unit - Set life of PortalUnit to (Life of Remember5[(Player number of (Owner of PortalUnit))])
Unit - Set mana of PortalUnit to (Mana of Remember5[(Player number of (Owner of PortalUnit))])
Unit - Move PortalUnit instantly to TempPoint, facing (Facing of Remember5[(Player number of (Owner of PortalUnit))]) degrees
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_TempPoint)
Set PortalUnit = No unit
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Time Portal for (Triggering unit)) Equal to 3
Then - Actions
Set PortalUnit = PortalUnit
Set TempPoint = (Position of PortalUnit)
Unit - Create 1 Time Portal for (Owner of (Triggering unit)) at TempPoint facing (Facing of PortalUnit) degrees
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_TempPoint)
Set TempPoint = (Position of Remember4[(Player number of (Owner of PortalUnit))])
Unit - Create 1 Time Portal for (Owner of (Triggering unit)) at TempPoint facing (Facing of PortalUnit) degrees
Unit - Set life of PortalUnit to (Life of Remember4[(Player number of (Owner of PortalUnit))])
Unit - Set mana of PortalUnit to (Mana of Remember4[(Player number of (Owner of PortalUnit))])
Unit - Move PortalUnit instantly to TempPoint, facing (Facing of Remember4[(Player number of (Owner of PortalUnit))]) degrees
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_TempPoint)
Set PortalUnit = No unit
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Time Portal for (Triggering unit)) Equal to 2
Then - Actions
Set PortalUnit = (Target unit of ability being cast)
Set TempPoint = (Position of PortalUnit)
Unit - Create 1 Time Portal for (Owner of (Triggering unit)) at TempPoint facing (Facing of PortalUnit) degrees
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_TempPoint)
Set TempPoint = (Position of Remember3[(Player number of (Owner of PortalUnit))])
Unit - Create 1 Time Portal for (Owner of (Triggering unit)) at TempPoint facing (Facing of PortalUnit) degrees
Unit - Set life of PortalUnit to (Life of Remember3[(Player number of (Owner of PortalUnit))])
Unit - Set mana of PortalUnit to (Mana of Remember3[(Player number of (Owner of PortalUnit))])
Unit - Move PortalUnit instantly to TempPoint, facing (Facing of Remember3[(Player number of (Owner of PortalUnit))]) degrees
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_TempPoint)
Set PortalUnit = No unit
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Time Portal for (Triggering unit)) Equal to 1
Then - Actions
Set PortalUnit = (Target unit of ability being cast)
Set TempPoint = (Position of PortalUnit)
Unit - Create 1 Time Portal for (Owner of (Triggering unit)) at TempPoint facing (Facing of PortalUnit) degrees
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_TempPoint)
Set TempPoint = (Position of Remember2[(Player number of (Owner of PortalUnit))])
Unit - Create 1 Time Portal for (Owner of (Triggering unit)) at TempPoint facing (Facing of PortalUnit) degrees
Unit - Set life of PortalUnit to (Life of Remember2[(Player number of (Owner of PortalUnit))])
Unit - Set mana of PortalUnit to (Mana of Remember2[(Player number of (Owner of PortalUnit))])
Unit - Move PortalUnit instantly to TempPoint, facing (Facing of Remember2[(Player number of (Owner of PortalUnit))]) degrees
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_TempPoint)
Set PortalUnit = No unit
Else - Actions
 

Rainther

I guess I should write something of value here...
Reaction score
61
You're welcome. I figured it'd be easier to use dummy units since they store both health, mana and position all in one.
 

MurderMode

Giving new meaning to co-op... slowly
Reaction score
154
instead of using dummy units I think you could use 5 hash tables (1 for each second) to store the mana, hp and position of the unit in seperate keys and it would work as mui without needing dummies for every unit
 

roXplosive

New Member
Reaction score
15
I have seen this thread and it looks just fine (the code right now) but I've been thinking about MUI . My solution would be : create a unit group that holds units with time lapse in it and an unit array for units with the ability . This calls for a few triggers :

1 On map init null the unit array
2 On ability learn if ability learned is time lapse add unit to unit group if not already there and do seek if in the units array from 5 to 5 positions you find a null spot occupy it with the learning unit
3 On unit creation / upgrade purchased check if the unit has the ability then add it to the array
4 On unit death if the dying unit has ability and is nonhero null every the postition it occupyes in the array and the other 4 positions for dummies but if it's a hero only null the dumies because heroes can be revived . Also remove nonhero units from the unit group
5 periodic refreshing timer that every 1 second for all the units in the array
and save the mana/life/position in the array for each unit recorded .
The units array is composed as follows : position 0 - first unit that has time lapse . Position 1 - position of unit 2 seconds ago and so forth .
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top