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

Periodic Event depended on real compression

Status
Not open for further replies.
Level 10
Joined
Mar 17, 2012
Messages
582
Hi everyone! Yesturday I faced one good task...
I'm wondering why we can't make
Periodic Event (Time - Every (100/"any hero attribute") seconds of a game time)

with any conditions

and any actions

P.S. I created an ability that drains hp of all nearby enemies matching conditions and restores hp of owner of an ability equal to hp drained.
Drain interval = (100/Agility of a hero) seconds and power of drain = 0.25\0.5\0.75\1*Intelligence.

I created a variable: Set Skillname_Real = (100/Agility of a hero)
and ordered my hero to damage enemies and heal himself... I also added the periodic event to another trigger using "every Skillname_Real seconds" there is no problems with that...

BUT

I noticed that Skillname_Real is set once and doesn't change (if at 1 level my hero damaged enemies ~every 3 seconds(35 agi) - he doesn't damage them faster even if I get +400 agility).

Is there any way to manage it?

PP.SS. I tried to add Periodic event - Every (2/(Level of ability)) seconds
do the same thing... but he was damaging every 2 seconds on every level...

:ogre_rage:
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You just have to adjust the calculation, but by using the same interval.

Okay, let's say you have an ability that deals 100 damage per second.
And let's say your interval is 0.03 second.

What you need to do is to adjust the calculation by multiplying your damage with the interval.

DamagePerSecond = 100
DamagePerInterval = 100 * 0.03 = 3

Therefore, each 0.03 second interval, the trigger will deal 3 damage to that unit, and by 1 second, it will become (3 * 33 = 99), 99 damage.

Remember, that value might not be accurate BUT the accuracy is too small to compare, therefore it is negligible.

Compare 100 and 99, just miss 1 value, no big deal :p

It is not efficient to create trigger per Hero/Unit that is why we have this method.

Your Case:
Let's say that ability is at Level 3, that means the damage is INT per second.
Let's say the calculation is 3 damage per 3 second, so what is the damage per second ?
Damage / Time = DPS
3 / 3 = 1 DPS
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Make a timer
set it to run on WhatEver variable while looping
make a trigger for your trigger that fires when this timer goes off
when u update the variable, pause the timer and restart it with the new variable
 
Level 10
Joined
Mar 17, 2012
Messages
582
Make a timer
set it to run on WhatEver variable while looping
make a trigger for your trigger that fires when this timer goes off
when u update the variable, pause the timer and restart it with the new variable

How can I remove Event from another trigger? I can add Event to another trigger but I don't see how to take it off and place a new one...
 
Level 10
Joined
Mar 17, 2012
Messages
582
You just have to adjust the calculation, but by using the same interval.

Okay, let's say you have an ability that deals 100 damage per second.
And let's say your interval is 0.03 second.

What you need to do is to adjust the calculation by multiplying your damage with the interval.

DamagePerSecond = 100
DamagePerInterval = 100 * 0.03 = 3

Therefore, each 0.03 second interval, the trigger will deal 3 damage to that unit, and by 1 second, it will become (3 * 33 = 99), 99 damage.

Remember, that value might not be accurate BUT the accuracy is too small to compare, therefore it is negligible.

Compare 100 and 99, just miss 1 value, no big deal :p

It is not efficient to create trigger per Hero/Unit that is why we have this method.

Your Case:
Let's say that ability is at Level 3, that means the damage is INT per second.
Let's say the calculation is 3 damage per 3 second, so what is the damage per second ?
Damage / Time = DPS
3 / 3 = 1 DPS

Understand me right, I need my damage trigger to work every (100/Agility of my hero) second... !!==and change it's periodicity if my Agility changes!==!!
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Ahhh I know, create an 'artificial wait' then :)
Gonna give you a rough idea;
1. Calculate the DPS second
2. After that, damage that unit and set the 'counter' variable to 0.00
3. Next, let's say your DPS calculated is 5 (meaning that it will damage that unit per 5 second), and your periodic interval is 0.03 second, each interval increase the counter by 0.03 -> Counter = Counter + 0.03
4. After you increase it, check if counter greater than or equal to DPS, if it is, well damage that unit and reset the counter back to 0.00, if not, do nothing.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Because the event object is created with the values you pass it at the time of creation.

Most events use pass by value so alterations to a variable will not have any effect on the event. Only a few events support pass by reference and those that do take a string for the variable name rather than an expression.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
How can I remove Event from another trigger? I can add Event to another trigger but I don't see how to take it off and place a new one...

you cant, u have to save all of the actions than rebuild it after you remove 5-10 entries
 
Level 10
Joined
Mar 17, 2012
Messages
582
Please, don't make things worse by dynamically creating triggers and destroy them (YES, YOU CAN DESTROY/REMOVE TRIGGERS -
call DestroyTrigger(GetTriggeringTrigger()))

Just do what I said, create an artificial wait between each damage interval.

Please, can you trigger that? I don't quite catch you :ogre_icwydt:

Cause it seems to me that wait instead of right periodic event is not very good solution))
 
Level 10
Joined
Mar 17, 2012
Messages
582
1. Calculate the DPS second
2. After that, damage that unit and set the 'counter' variable to 0.00
3. Next, let's say your DPS calculated is 5 (meaning that it will damage that unit per 5 second), and your periodic interval is 0.03 second, each interval increase the counter by 0.03 -> Counter = Counter + 0.03
4. After you increase it, check if counter greater than or equal to DPS, if it is, well damage that unit and reset the counter back to 0.00, if not, do nothing.

Help me to to work in practice you idea :)

W8 a minute... You wanna say that I have to create this?

Every 0.1 second of a game time

Ability_Owner has specific buff = MyBuff

Order my hero to do what he have to do
Set Agi_Real = real agility of my hero
Wait (100/Agi_Real) seconds

I'll check it, but I'm not sure...
 
Level 10
Joined
Mar 17, 2012
Messages
582

Are you washing your hands?)))

I'm not using another people's works because of 2 reasons:
- I want to learn something while triggering
- People Create bad names of variables) My brain explodes)))

Make a timer
set it to run on WhatEver variable while looping
make a trigger for your trigger that fires when this timer goes off
when u update the variable, pause the timer and restart it with the new variable

COuld You demonstrate it please?
 
Level 10
Joined
Mar 17, 2012
Messages
582
Oh, I thought you want a simple way, that is why systems are created, aimed for people that needs something to do it quick without creating more tension to the user.

There are few people like you, who actually wants to know what and how the system works, I like you ;p

Okay, I'll give you a demo map using Indexing as my approach.
In this test map, you have 3 Heroes, each has different level of ability.
Once you activate this spell, it will damage your unit per X second. This X is determined by your level of ability, the higher your level, the faster the interval.

Level 1 - 10 damage per 3 second
Level 2 - 10 damage per 2 second
Level 3 - 10 damage per 1 second
Spell lasts for 5 seconds.

The "DAMAGE" Floating Text is to acknowledge you how often does the DOT occurs (varied to each other).

You can take a look at that trigger and if you don't understand, ask me.

I like your example... I just hardly understand how DOT_Maxindex = DOT_Maxindex +1 works... Is it an endless timer right?

Why you use Unit array instead of just Unit in variables?
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Because I want to make a MUI trigger, simple.
Also, the MaxIndex and CurrentIndex is part of making the trigger MUI, not related to the real issue at all.
The real issue comes when you come across the variable;
  • DOT_Counter[DOT_CurrentIndex] Greater than or equal to DOT_DamageInterval[DOT_CurrentIndex]
As I told you before, the basic workarounds are;
1. Set DamageInterval (Let's say we set 1.50 second per damage interval)
2. Set Counter = 0
3. In the looping trigger, each time it occurs (which in that map, it occurs once every 0.03 second (configurable)), it will increase the Counter by your interval set, meaning that if you set your interval to occur at 0.03 second, it will increase Counter = Counter + 0.03
4. This looping will continue to loop until it reaches a value of 1.50 and above (to compare with DamageInterval value which was 1.50)
5. After it is greater than or equal to, damage the unit and reset the Counter back to 0, why ? Because it's Damage Over Time dude, we need another damage that is why we reset the Counter back to 0 for it to go up again and deal damage when it reaches a value of 1.50 and above, again.
6. Of course you want this trigger to end at a certain duration right ? You do not want it to run endlessly. Therefore, I created another duration which is to end the trigger if it is less than 0.00 Duration (meaning the duration has timed out). - which in the test map, I set to 5.00, meaning 5 seconds.
 
Level 10
Joined
Mar 17, 2012
Messages
582
6. Of course you want this trigger to end at a certain duration right ? You do not want it to run endlessly. Therefore, I created another duration which is to end the trigger if it is less than 0.00 Duration (meaning the duration has timed out). - which in the test map, I set to 5.00, meaning 5 seconds.

Actually no :ogre_hurrhurr: It's a passive aura :ogre_haosis:

Now I understand what you've done! Thanks! You realy helped me! I'll use it to my next hero!)

P.S. I cant give you +rep yet))) system doesn't allow) but I will when I can because you deserve it!!! :thumbs_up::grin:
 
Status
Not open for further replies.
Top