- Joined
- Oct 11, 2008
- Messages
- 304
Let me test somethingI think the problem can be solved if the system just keeps the stun with the longest remaining duration?
Edit: How does disable system handle multiple instances of the stun?
Let me test somethingI think the problem can be solved if the system just keeps the stun with the longest remaining duration?
Edit: How does disable system handle multiple instances of the stun?
I am sorry that I am not much of a use, as I can only come up with questions and ideas for now since my coding skills are on a basic level : (Let me test something
There is a system on Wurst that seems to do this: [System] StatusHandler. However, I have 0 knowledge there, and I think it is a bad idea to jump all over the place.Let me test something
The BuffSyste itself handles the instance without any problem, it uses the same method of Status with counter = counter + 1 for each buff if stack is partial or full.I am sorry that I am not much of a use, as I can only come up with questions and ideas for now since my coding skills are on a basic level : (
Example:
//This will execute when:
// - A BUFF_STACK_NONE Buff is removed from a unit.
// - A BUFF_STACK_PARTIAL Buff from a certain source is removed from a unit.
// - A BUFF_STACK_FULL Buff instance is removed.
method onRemove takes nothing returns nothing
//Configure what happens when the Buff is removed.
endmethod
//This will execute when:
// - A BUFF_STACK_NONE/BUFF_STACK_PARTIAL Buff is applied to a unit
// not having the same Buff before it is applied.
// - A BUFF_STACK_PARTIAL Buff is applied to a unit already having
// the same buff but from a different source.
// - A BUFF_STACK_FULL Buff is applied to a unit.
method onApply takes nothing returns nothing
//Configure what happens when the Buff is applied.
endmethod
So, to conclude, I should use Disable System with your adjustments and Buff System with A BUFF_STACK_NONE to achieve my desired purpose? (which means having two buffs [stun with permanent and remove when the buff is finished]). And then I have to rebuild my cc reduction?The BuffSyste itself handles the instance without any problem, it uses the same method of Status with counter = counter + 1 for each buff if stack is partial or full.
So ya, there's no problem with that.
onApply1 -> add stun to the unit -> unit now is stunned (with 1)
onApply2 -> add stun to the unit -> unit still stunned (with 2 now)
onApply3 -> add stun to the unit -> unit still stunned (with 3 now)
onRemove2 -> stay stunned and with buff -> unit still stunned (with 2)
onRemove3 -> stay stunned and with buff -> unit still stunned (with 1)
onRemove1 -> remove stun of the unit -> unit is not stunned because counter = 0
Remember:
JASS:Example: //This will execute when: // - A BUFF_STACK_NONE Buff is removed from a unit. // - A BUFF_STACK_PARTIAL Buff from a certain source is removed from a unit. // - A BUFF_STACK_FULL Buff instance is removed. method onRemove takes nothing returns nothing //Configure what happens when the Buff is removed. endmethod //This will execute when: // - A BUFF_STACK_NONE/BUFF_STACK_PARTIAL Buff is applied to a unit // not having the same Buff before it is applied. // - A BUFF_STACK_PARTIAL Buff is applied to a unit already having // the same buff but from a different source. // - A BUFF_STACK_FULL Buff is applied to a unit. method onApply takes nothing returns nothing //Configure what happens when the Buff is applied. endmethod
I'm dumb, sorry about that xD it's all documented.
function onAbilityCast ...
local StunBuff sb = StunBuff.add(source, target) //will return the buff already applied, because it don't stack
local real newDuration = 5. //this spell apply 5 sec stun
if sb.duration < newDuration then //if not, will use the already left duration of the buff
set sb.duration = newDuration
endif
//... etc
endfunction
Okay, so how? I desperately need Spell Steal for my Altered Melee. I was trying to make one by trying to adding a spell's orderid and spell steal priority integer but as a vJass noob that I am I can't figure out how to do this properly.It is also easy to code a custom Spell Steal using this system.
he hasn't been around for months, not sure you will get an answer.Okay, so how? I desperately need Spell Steal for my Altered Melee. I was trying to make one by trying to adding a spell's orderid and spell steal priority integer but as a vJass noob that I am I can't figure out how to do this properly.
That's unfortunate.he hasn't been around for months, not sure you will get an answer.
Why? I only see this being relevant if the unit can revive in some way but you want to retain all buffs it had before it died... and I don't understand why you would want that. What should happen to the buffs' durations while the unit is dead (suspended, continue, last indefinitely)? What about effects due to the buffs? How long should it last when the unit dies? What if the unit is never revived?What if i want to keep buff afte unit death?
private static method onDeath takes nothing returns nothing
//call thistype.dispelAll(GetTriggerUnit())
endmethod
Let`s say i want to use it for Hero buff, that won`t dispell untill some actions done.There is kind of an easy way to stop buffs being removed... but it has a really bad downside. Comment out the only line in the onDeath function and buffs will never be purged on unit death:
if GetUnitAbilityLeve(GetSellAbilityUnit(),'A000') > 0 then
set b.DisspelOnDeath==false
endif
private static method onDeath takes nothing returns nothing
if this.OnDeath==true then
call thistype.dispelAll(GetTriggerUnit())
endif
endmethod
struct Buff
boolean isDispellable = true
//...
method remove takes nothing returns nothing
local boolean remove = false
local integer id
local thistype head
local integer count
// alteration in the line below this:
if this.exist and not this.isDispellable then
//...
debug else
debug call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "[Buff]: Attempted to remove non-existing Buff instance.")
endif
endmethod
//...
endstruct
Thank you very much for this.Ok, in principle that should work. It still does leak some data for units whose buffs are not dispelled on death and are never revived. I would just straight up make the buff undispellable as long as that boolean flag variable is set to true:
There is a code/programming tutorials section located here. There is a subforum specifically for JASS tutorials here. However, there are probably not many tutorials about 'general programming and learning JASS' so the best suggestion I have for you is this: experiment and write code on your own, and when you get stuck simply post a thread here asking your question so that someone like me can help point you in the right direction.Last question: There is any guides at Hive about this type of building code?
You're using cJASS not the normal JASSHelper compiler? Or was that a typo? Probably make a new thread for this issue.cjass
Using JNGP for compilingYou're using cJASS not the normal JASSHelper compiler? Or was that a typo? Probably make a new thread for this issue.