- Joined
- Jan 30, 2013
- Messages
- 12,757
Useful, though we have quite a number of these.
(1 ratings)
most of which have bug: perma stun bug, I already looked at 3 system from Hive and they have perma stun bug (systms based on hoof stomp, firebolt)Useful, though we have quite a number of these.
Using storm bolt, the buff doesn't get applied instantly.most of which have bug: perma stun bug, I already looked at 3 system from Hive and they have perma stun bug (systms based on hoof stomp, firebolt)
This one is save.
It is unfixable unless whole idea will be changedIt's not something unfixable tho.
library Stun uses TimerUtilsEx, Table, DummyRecycler
/*
Stun.create(unit, duration, additiveTime)
- Stun a unit for a certain duration preventing it from doing anything.
- Duration of zero means infinite.
- Buff indicator appears.
this.destroy()
- Destroy a Stun instance.
*/
globals
private constant integer STUN_SPELL = 'AStn'
private constant integer STUN_BUFF = 'BPSE'
endglobals
struct Stun extends array
implement Alloc
private unit u
private unit dummy
private timer t
private static Table tb
private static trigger trg
private static group g = CreateGroup()
private static integer counter = 0
method destroy takes nothing returns nothing
call UnitRemoveAbility(this.u, STUN_BUFF)
call GroupRemoveUnit(thistype.g, this.u)
call thistype.tb.remove(GetHandleId(this.u))
call UnitRemoveAbility(this.dummy, STUN_SPELL)
call RecycleDummy(this.dummy)
call ReleaseTimer(this.t)
set this.u = null
set this.dummy = null
set this.t = null
call this.deallocate()
endmethod
private static method expire takes nothing returns nothing
call thistype(GetTimerData(GetExpiredTimer())).destroy()
endmethod
private static method onDeath takes nothing returns boolean
local thistype this = thistype.tb[GetHandleId(GetTriggerUnit())]
if this != 0 then
call this.destroy()
endif
return false
endmethod
private static method add takes nothing returns nothing
call TriggerRegisterUnitEvent(thistype.trg, GetEnumUnit(), EVENT_UNIT_DEATH)
endmethod
static method create takes unit u, real duration, boolean stack returns thistype
local integer id = GetHandleId(u)
local thistype this = thistype.tb[id]
local real prevDuration
local unit dummy
if this != 0 then
set prevDuration = TimerGetRemaining(this.t)
else
set this = thistype.allocate()
set this.u = u
set this.t = NewTimerEx(this)
set thistype.tb[id] = this
set prevDuration = 0
endif
if stack then
set duration = prevDuration + duration
elseif duration < prevDuration then
return this
endif
if duration > 0 then
call TimerStart(this.t, duration, false, function thistype.expire)
endif
if prevDuration == 0 then
set this.dummy = GetRecycledDummyAnyAngle(GetUnitX(u), GetUnitY(u), 0)
call SetUnitOwner(this.dummy, GetOwningPlayer(u), false)
call PauseUnit(this.dummy, false)
call UnitAddAbility(this.dummy, STUN_SPELL)
call IssueTargetOrderById(this.dummy, ORDER_thunderbolt, u)
set thistype.counter = thistype.counter + 1
if thistype.counter > 10 then
set thistype.counter = 0
call DestroyTrigger(thistype.trg)
set thistype.trg = CreateTrigger()
call TriggerAddCondition(thistype.trg, Filter(function thistype.onDeath))
call ForGroup(thistype.g, function thistype.add)
endif
call TriggerRegisterUnitEvent(thistype.trg, u, EVENT_UNIT_DEATH)
call GroupAddUnit(thistype.g, u)
endif
return this
endmethod
private static method onInit takes nothing returns nothing
set thistype.tb = Table.create()
set thistype.trg = CreateTrigger()
call TriggerAddCondition(thistype.trg, Filter(function thistype.onDeath))
endmethod
endstruct
endlibrary
This one is based on your. Without 20 levels and any duration. This one also allows you to detect how much time left.If you have idea how, please share.
GetIssuedOrderId() == 851973
and then after 0sec timer (one for whole map) check for stunSystemBuff. If it has buff-it was stunned by System and can be added to group or something..It can be solvable but you have to use trigger spells. Which means you need dummy target spell (chain lightning with no effects), a dummy which shots from the caster position, damage detect system which detects the damage caused by the dummy and condition: if stored in hash value is greater than the current bullet's value, then do stun else do nothing. The system you tried to make acutally is much more complicated.interactions System<->OE spells are safer now but not perfect: like unit stunned for 7sec by System and MountainKing bash it for 0.50sec right after - unit lose 7sec stun and is stunned for 0.50sec but I have to think about that, not sure if it is solvable at all?
It's because you moves your dummy. My one just stay on one place and cast from there. Don't need to to create X,Y coordiantates of the victim. (but it doesn't rallly matter since your execution of trigger is works) however it doesn't count invisibility. Because you dummy is neutral passive and it probably doesn't share vision with the target - you can just move your dummy to engage the stun, but the dummy doesnt see the target because of invisibility.delay cap is the same for missle speed:0 and 10000, i see no diffrence, its still 0.004sec
I don't understand why a user would use another stun ability if he/she already has a stun system. The problem with this is the high-leveled ability which increases Loading Time (as mentioned by Fruit Forest) and it only allows you to stun at discrete intervals, you can't stun a unit for 3.1415 seconds.yeah, with separate timer for each unit you're save as long as you remember to not use any stun ability, only your library
but most systems even do not have warning "do not use stun abi except imported stun system"
and i bet users can forget (or just wants to use some stun abi except system)
Duuuude you can create triggered war stomp. just use group variable and pickk all in range then create the dummy and do stuff. If you try to implement stun system you have to decline all standard stun abilities.why WarStomp cannot be used: it doesnt work for duration set in OE to 0sec (like we can and should do with thunderbolt ability) so it is set by authors to 3600sec. Its very dangerous: if stunned unit (by system) is stuned again by any ability = perma stun.
Thanks for bringing the discussion up. I honestly did never code myself a stun system, so idk all critical points.I dont know if it is right place but I fast looked in all stun system on Hive:
CTL will probably result in same as the first one you mentioned with "perma stun bug".y Mckill2009: based on storm bolt, stun duration in OE must be fixed, it uses CTL library (I dont know how this lib works),so Im not sure if it's save like Flux' solution?
Hm, yes that's not really a stun system. I'm not sure it should be named as one.by Vladadamm: it uses PauseUnit (not related)
But it's not instant, or?by baassee: based on thunder bolt, not looking for buff in loop, should work fine
A workaround to a Stun system using periodic timer (or CTL) is to round off the stun duration to the nearest TIMEOUT interval. ExampleCTL will probably result in same as the first one you mentioned with "perma stun bug".
Because it is so easier. Tell gui user to ban all this abilites:I don't understand why a user would use another stun ability if he/she already has a stun system.