System DPS - Damage Per Second

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
>Try it?
Well... It doesn't o_O
JASS:

//condition which ability is cast...
function Actions takes nothing returns nothing
    local unit t = GetSpellTargetUnit()
    call TriggerSleeepAction(0.4)
    call StopDps(t)
    call TriggerSleepAction(1)
    set t = null
endfunction

//Init trigg and stuff...

And this does not set the PUI counter to 0 :/ The duration of the spell is 4 seconds and this is ran 0.4 seconds after the start
 

Cohadar

master of fugue
Reaction score
209
lol
JASS:
function StartDpsEx takes unit whichUnit, unit whichTarg, real whichDmg, real whichDur, attacktype whichAttackType, damagetype whichDamageType, string whichFx, string whichPoint returns nothing
    local Config store = Config.create(whichUnit, whichTarg, whichDmg, whichDur, whichAttackType, whichDamageType, whichFx, whichPoint)
    local integer pui = GetUnitIndex(store.targ)
    set PUI_TICKS[pui] = PUI_TICKS[pui] + R2I(whichDur)
    call TimerStart(store.time, TIMER_INTERVAL, true, function Dps)
endfunction



JASS:
function StartDpsEx takes unit whichUnit, unit whichTarg, real whichDmg, real whichDur, attacktype whichAttackType, damagetype whichDamageType, string whichFx, string whichPoint returns nothing
    local Config store = Config.create(whichUnit, whichTarg, whichDmg, whichDur, whichAttackType, whichDamageType, whichFx, whichPoint)
    local integer pui = GetUnitIndex(store.targ)
    set PUI_TICKS[pui] = PUI_TICKS[pui] + R2I(whichDur/TIMER_INTERVAL)  // <----<< noob
    call TimerStart(store.time, TIMER_INTERVAL, true, function Dps)
endfunction



EDIT:
also this:
JASS:
    method onDestroy takes nothing returns nothing
        call ClearTimerStructA(.time)
        call PauseTimer(.time)
        call DestroyTimer(.time)
        set PUI_TICKS[GetUnitIndex(.targ)] = 0
    endmethod
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
JASS:
set PUI_TICKS[GetUnitIndex(.targ)] = 0

But if the target has 2+ dps functions on him? Won't that break MUI ?

EDIT: lol..fixed... I love you... you get rep (if I can) and <3 New ver
Still wanna know if this is gonna break MUI :S
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
Okay, another version released. Added buff check again with normal and extended functions. Just to explain a bit how it works...

JASS:
function StartDps takes unit whichUnit, unit whichTarg, real whichDmg, real whichDur returns nothing
call StartDpsBuffEx(whichUnit, whichTarg, whichDmg, whichDur, DIS_BUFF_CHECK ...)

You might notice this DIS_BUFF_CHECK. Well, this is a global integer constant with a value of 0. In the main damage per second function I've added an if/then/else statement that checks if the integer is a buff raw code, or a zero ( 0 ). If it's a buff it will continue to damage if the target has the buff. If it's a zero it will still damage until it finishes.
I made IncreaseDur so that this can work if you want a Poison-like damage (because dps functions are stackable). For example you cast an ability that puts a slow-poison buff on a target. But if you cast again the duration starts all over again and the two casted poisons do not stack (in poison ability). So to make it like that you just simply increase the duration of the damaging. ^^

Umm, I'm not exactly sure my if/then/else statements are optimized... I think it can be done much easier .. Or not...
Comments? :)

EDIT: Oh, and now it uses the newest version of PUI - v4.2 ^^
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
> Im sorry but why is this system even useful?
Never felt tired of creating loops/timers over and over again for simple spells? Or for difficult ones? It just shortens your work and saves your fingers from breaking from ticking on the keyboard.
> caster system can do dps to
Never used caster system. Didn't know that a DPS system already exists..
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
Updated again. Uses ABCT now instead of ABC and PUI.
However, now there isn't an Increase Duration function.
If you want to stop the damaging you just remove the buff you
used with StartDps/StartDpsEx function. Yes, buff checks are used only.
Included a boolean argument to the functions so you can choose if you want
a special effect to be displayed each time the unit is damaged.

Umm, can't remember what else I did. Ask if you want to ask something.
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
Another update, lol
Returned normal Start and StartEx functions that do not require a buff to work. Also returned Stop and Increase Duration functions for them. The system uses PUI again.
Comments? ^^
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
Seems to be very nice and very useful system. I think I might use it, though my map doesn't really make use of damage over seconds stuff, but that might change :)
 

Cohadar

master of fugue
Reaction score
209
Another update, lol
Returned normal Start and StartEx functions that do not require a buff to work. Also returned Stop and Increase Duration functions for them. The system uses PUI again.
Comments? ^^

I already told you, buffs are good, always use buffs when you can.
I assume you returned to the non-buff version because your system failed with buff version a couple of times.

Here is why: When you use spells like Acid Bomb, the buff on the unit does not get activated immediately, the bomb must fly to the unit first (projectile) and when it hit's it, it applies the buff.

So for a buff system to work properly you must wait for a buff to come after spell is cast and then start the DPS.

Put waiting time to 3 seconds or something (3 ticks in this case) and if buff does not show in that time after you cast a spell you simply abort the dps.

As you can see this gets a little tricky here, but that is the point of systems,
doing the dirty work instead of you, those kind of systems are the only one worth using anyways.

All blizzard dps spells use buffs (so they work ok with dispel, spell shield ...)
dps systems that do not use buffs are simply lame.
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
Ow, haven't thought about Acid Bomb... Thanks for that I'll try to work out something.
Anyway I put non-buff function because someone might want that ..
 

Cohadar

master of fugue
Reaction score
209
Noone wants spells that don't behave good with other spells.
It is very important that dps can be dispelled or blocked.
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
Updated again, hope this is the last. Uses only ABCT again and works only with buff. Has 5 seconds wait after cast. If in these 5 seconds the target does not recieve the assigned buff then DPS is cancelled. Test map includes Frost Nova and Acid Bomb test.
 

Cohadar

master of fugue
Reaction score
209
JASS:

//  PROS:
//      - Easy to use
//
//  CONS:
//      - A bit difficult to use


loooooooooooooooooooooooooooooooooooooooooooool :D

Anyways you need a CHECK_DURATION = 5.0 constant
(hardcoding it in tics is not good, calculate ticks from the constant)

Btw using other systems is not a con, especially if I made them :p
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
> Anyways you need a CHECK_DURATION = 5.0 constant
Um, ok, I'll do it right away ^^

> Btw using other systems is not a con, especially if I made them
Oh... Okay xD

> lol thingy
May be easy for some people and difficult for others ..
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top