# Spell request

Status
Not open for further replies.

#### teo_mania

Level 3
What i need is a passive spell that gets unit to his hp he had 10 seconds before.Chance 1% on hit

Level 15
you have to save his like very 0.x seconds for a variable, but before that int=int[i-1] so it'a like a snake game... if u can understand the method you can easily maki it

#### defskull

Level 33
Once he learned the spell, start an Event - Periodic Event that triggers once per 10 second (until the end of the game)
Each interval, save the variable of that unit's HP like this:

• Set CurrentHP = (Life of *YourUnit*)
This is to trigger upon hit:

• Unit - Set life of *YourUnit* to ((Life of *YourUnit) + CurrentHP)
*YourUnit* is a Unit-variable

Level 15
That won't work since if he gets damaged just after the trigger saves it'll turn his life into the one in 1 second ago... You have to use it with a chain of variables to track the HP change for up to 10 seconds and only take the last value but don't lose the-let's say- 5th second's value since in 5 seconds it may come handy
So use
for each integer (i) from 1 to 9 do
Set CurrentHP = CurrentHP[i+1]
then after the loop:
Set CurrentHP[10] = (Life of *YourUnit*)
and do it every second

sry for not making it properly but I'm tired so I'm gone sleep see you

#### defskull

Level 33
If you use logic, you'll understand my trigger, related to the thread's problem
It relates the HP with 10 seconds ago, meaning that it doesn't take into account of 9 seconds ago or 11 seconds after that, it is exact 10 second per interval

Situation:
You learned the spell at time (15:40)
You have 500/500 HP at a time of (23:44) (but the HP reset is saved at 23:40, because you learned it at xx:40, which means it increases 10 seconds per interval (per save variable))
You received damage of 200 at 23:41
The spell is triggered
Your HP will be reset to the last saved variable which is the 23:40

If you receive damage at 23:39, your HP will be reset to the time of 23:30, glad you understand concept of logic and time-inteval

You doesn't need to save it every once a second, WHY ?
- It is because this spell works for the last 10 seconds, not for the last 1 second.

Level 15
The but the last didN't mean in the LAST 10 SECONDS but 10 SECONDS AGO-means if you take damage at 13:44 your hp has to be reset to 13:34 but for that you have to track the hp every second. If the system tracked the hp and you could ask for "Unit - get hp 10 seconds ago" it would work good, but you need to track back ALWAYS the one 10 seconds ago, NOT the last 10 second interval (saved a 13:40 and hit at 13:44 means 4 seconds ago...)

I didn't take into account the one 11 seconds ago but you need 9 seconds ago at 13:43 because it will reset to that value after a second...

#### teo_mania

Level 3
I'll try the trigger to see if it works thanks

Status
Not open for further replies.

Replies
10
Views
667
Replies
2
Views
489
Replies
1
Views
380
Replies
2
Views
861
Replies
0
Views
279