[vJASS] DestroyEffectTimed
|
|
Dynasti | Date: Wednesday, 2008-12-10, 6:12 PM | Message # 1 |
![Dynasti](/avatar/66/840050.jpg) Private
Group: Users
Messages: 11
Status: Offline
| I did this to make an efficient code for removing effects over a period of time. System Script:Code library EffectOverTime
globals private constant real Tick = 0.1
private timer Tim = CreateTimer()
private integer array Er private integer Total = 0 endglobals
private struct Effect effect StoredEffect real Counter = 0 real CounterMax = 0 static method ExecuteEffect takes nothing returns nothing local Effect dat local integer i = 0 loop exitwhen i >= Total set dat = Er[i]
if dat.Counter >= dat.CounterMax then
set Total = Total - 1 set Er[i] = Er[Total]
set i = i - 1
call dat.destroy() else set dat.Counter = dat.Counter + Tick endif set i = i + 1 endloop if Total == 0 then call PauseTimer(Tim) endif endmethod static method create takes effect StoringEffect, real Time returns Effect local Effect dat = Effect.allocate() set dat.StoredEffect = StoringEffect
set dat.CounterMax = Time - Tick if Total == 0 then call TimerStart(Tim, Tick, true, function Effect.ExecuteEffect) endif set Er[Total] = dat set Total = Total + 1 return dat endmethod method onDestroy takes nothing returns nothing call DestroyEffect(.StoredEffect) set .StoredEffect = null endmethod endstruct
function DestroyEffectTimed takes effect StoringEffect, real Time returns nothing call Effect.create(StoringEffect, Time) endfunction endlibrary Ok if you find any bugs with it or ways of improvement, please reply. Example map: DestroyEffectTimed.w3x
If you got it, then.. Yeah what do you get realy?
Message edited by Dynasti - Thursday, 2008-12-11, 4:57 PM |
|
| |
Darkt3mpl3r | Date: Wednesday, 2008-12-10, 6:45 PM | Message # 2 |
![Darkt3mpl3r](/avatar/32/570804.jpg) Sergeant
Group: Administrators
Messages: 35
Status: Offline
| Looks exactly like this one. http://www.hiveworkshop.com/forums/resource.php?t=109932
|
|
| |
Dynasti | Date: Wednesday, 2008-12-10, 7:00 PM | Message # 3 |
![Dynasti](/avatar/66/840050.jpg) Private
Group: Users
Messages: 11
Status: Offline
| Quote (Darkt3mpl3r) Looks exactly like this one. http://www.hiveworkshop.com/forums/resource.php?t=109932 Because i made it
If you got it, then.. Yeah what do you get realy?
|
|
| |
Darkt3mpl3r | Date: Wednesday, 2008-12-10, 8:52 PM | Message # 4 |
![Darkt3mpl3r](/avatar/32/570804.jpg) Sergeant
Group: Administrators
Messages: 35
Status: Offline
| So why having multiaccount and why changed the system then ?
|
|
| |
Dynasti | Date: Wednesday, 2008-12-10, 9:33 PM | Message # 5 |
![Dynasti](/avatar/66/840050.jpg) Private
Group: Users
Messages: 11
Status: Offline
| Quote (Darkt3mpl3r) So why having multiaccount and why changed the system then ? huh? I'm posting my systems and spells at both Hive and Ngo :P
If you got it, then.. Yeah what do you get realy?
|
|
| |
Darkt3mpl3r | Date: Wednesday, 2008-12-10, 10:01 PM | Message # 6 |
![Darkt3mpl3r](/avatar/32/570804.jpg) Sergeant
Group: Administrators
Messages: 35
Status: Offline
| The System on Hive is posted by Justify. You also wrote comments on his submission. And thus, I think that you're using a second account when you say, that that resources is yours. And this System != System by Justify ( Some names changed in the code and a bit different structure )
|
|
| |
Dynasti | Date: Thursday, 2008-12-11, 4:56 PM | Message # 7 |
![Dynasti](/avatar/66/840050.jpg) Private
Group: Users
Messages: 11
Status: Offline
| I asked him for permission to use his example, but the code i made is made from scratch :P
If you got it, then.. Yeah what do you get realy?
|
|
| |
Fireeye | Date: Friday, 2008-12-12, 10:39 PM | Message # 8 |
![Fireeye](/avatar/93/867657.jpg) Private
Group: Moderators
Messages: 16
Status: Offline
| I personally wouldn't call it a system, more like a code snippet. However there's 1 con you propably should mind, if you use a HIGH (i guess > .5 seconds) Tick value, the effect duration won't last exactly as long as you want it to.
|
|
| |
Dynasti | Date: Friday, 2008-12-12, 11:09 PM | Message # 9 |
![Dynasti](/avatar/66/840050.jpg) Private
Group: Users
Messages: 11
Status: Offline
| Quote (Fireeye) However there's 1 con you propably should mind, if you use a HIGH (i guess > .5 seconds) Tick value, know, that is why i recommend a tick rate from 0.1 - 0.05
If you got it, then.. Yeah what do you get realy?
|
|
| |