System Damage

Sevion

The DIY Ninja
Just save it as .j

On the part where it says File Type: [DROP DOWN BOX]

Change it to All Types.

As for the syntax highlighting, you don't need the endfunctions' in there. Or the comments.

Just the [ljass]function NAME takes STUFF returns STUFF[/ljass] parts.
 

Sevion

The DIY Ninja
True, but mostly, I find that pop-up stuff really annoying as it blocks code underneath and I'm like stretching my neck around trying to see around it, then I decide to click away to get rid of the annoying box then have to reclick into the ('s to finish my code :p
 

GoGo-Boy

You can change this now in User CP
So I tested your system in my map now for some hours and I'm really impressed ^.^
That finally opens the door to 'on damage'-events with nice performance and nothing leaking.
And your damage functions are so much better, easier to use. And the boolean checks are great as well.

Therefore you get one :thup: and another one :thup:

Edit:
Is there a way to make a single unit takes damage event that still can use your IsAttack() stuff etc.?
Because I have some things in mind for that a single unit takes extra damage when it got attacked with a certain skill. Now it would be unnecessary if that trigger tries to 'run' for every unit, performance-wise.
 

Jesus4Lyf

Good Idea™
Personally, in my latest map I just check if the damaged unit has the ability. I only really care for efficiency in my low level or publicly released items of code.

However, actually everything will work fine if you define a "unit takes damage" event yourself, except damage blocking...

Edit:
>Now it would be unnecessary if that trigger tries to 'run' for every unit, performance-wise.
Think of how it is standard to run the trigger for 40 spells every time any spell is cast. (Although GTrigger resolves this.) Isn't really nasty though. I prefer nice code. :)
 

GoGo-Boy

You can change this now in User CP
Yah the performance loss is probably negligible ^^
After all I don't really know how that trigger events stuff is made in the Wc3 engine :O

However since you say everything still works expect the blocking part I may register it on a single unit since I don't have any intentions of blocking for that scenario, but I'll see.
Thanks for your fast answers ;P
 

Zwiebelchen

You can change this now in User CP.
You really need a better demo map. You didn't even gave examples on non-blocking damage. How do I get the event damage? There is no function for that, or am I missing something?
And how can I make for example an ability, that blocks damage only when the ability is active? All I saw now was a general condition that blocks all damage.
I'm confused and don't understand how it works.
 

Zwiebelchen

You can change this now in User CP.
The it doesn't work ... I don't know why. Maybe you can see what is wrong here:

JASS:

private function Damage_text_Conditions takes nothing returns boolean
    local real amount = GetEventDamage()
    if DSabsorb[GetTriggerUnit()] > 0 then
        if DSabsorb[GetTriggerUnit()] >= amount then
            call Damage_Block(amount)
        else
            call Damage_Block(DSabsorb[GetTriggerUnit()])
        endif
        set DSabsorb[GetTriggerUnit()] = DSabsorb[GetTriggerUnit()] - amount
        if DSabsorb[GetTriggerUnit()] < 0 then
            set DSabsorb[GetTriggerUnit()] = 0
        endif
    endif
    if amount >= 1.00 then
        return true
    endif
    return false
endfunction

function Damage_text_Actions takes nothing returns nothing
...
endfunction

private function StartDamageText takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerAddCondition(t, Condition(function Damage_text_Conditions))
    call Damage_RegisterEvent(t)
endfunction
endscope

The function Damage_text_Actions never fires, though it should.
DSabsorb is a PUI Struct that always exists. That's not the problem.
 

GoGo-Boy

You can change this now in User CP
Would be better if you DebugMSG the Condition function to tell us where directly it isn't working.
 

Jesus4Lyf

Good Idea™
JASS:
private function StartDamageText takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerAddCondition(t, Condition(function Damage_text_Conditions))
    call Damage_RegisterEvent(t)
endfunction

-->
JASS:
private function StartDamageText takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerAddCondition(t, Condition(function Damage_text_Conditions))
    call TriggerAddAction(t, function Damage_text_Actions)
    call Damage_RegisterEvent(t)
endfunction

Should use a local var for [LJASS]DSabsorb[GetTriggerUnit()][/LJASS], by the way. But I understand if that's just an experiment or whatever.
 

GoGo-Boy

You can change this now in User CP
Weehh this system removed quite a lot of code from my current triggers already and improved so much. The blocking is working great as well and sure a hell of useful.
Seriously the most useful stuff I had so far.
I probably try out some of your other things as well. Especially since PandaMine isn't modding anymore and the HSAS System may no more be up to date.
Edit: Though it seems like your struct attachment systems attach to timers only. Whatever, will do for most parts ;P
 

Jesus4Lyf

Good Idea™
:)

Worth seeing is T32 for timer attachment (only for a period of 0.03125 though, and it isn't the easiest to use, but it is the most efficient) and AIDS for unit attachment (my fave attachment sys <3 AIDS structs).

KT2 is also good for timers when you can't use T32, although sometimes TimerUtils is better (see what you like, either are fine).

That's my rundown on attachment systems. Attaching to triggers is a little harder. I'd probably say use hashtables.

>Seriously the most useful stuff I had so far.
Thanks. I'm glad you have found it useful. :thup:
 

Zwiebelchen

You can change this now in User CP.
JASS:
private function StartDamageText takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerAddCondition(t, Condition(function Damage_text_Conditions))
    call Damage_RegisterEvent(t)
endfunction

-->
JASS:
private function StartDamageText takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerAddCondition(t, Condition(function Damage_text_Conditions))
    call TriggerAddAction(t, function Damage_text_Actions)
    call Damage_RegisterEvent(t)
endfunction

Should use a local var for [LJASS]DSabsorb[GetTriggerUnit()][/LJASS], by the way. But I understand if that's just an experiment or whatever.
Wow, LOL, what a stupid mistake. My bad. I'm drowning in shame :/ ...
Thanks ...

Well, the PUI Struct is fine for that variable, I think.
 

Jesus4Lyf

Good Idea™
What I mean is:
JASS:
private function Damage_text_Conditions takes nothing returns boolean
    local real amount = GetEventDamage()
    if DSabsorb[GetTriggerUnit()] &gt; 0 then
        if DSabsorb[GetTriggerUnit()] &gt;= amount then

-->
JASS:
private function Damage_text_Conditions takes nothing returns boolean
    local real dsAbsorb = DSabsorb[GetTriggerUnit()]
    local real amount = GetEventDamage()
    if dsAbsorb &gt; 0 then
        if dsAbsorb &gt;= amount then

And so on.

Maybe since you're doing a set operation ([LJASS]set DSabsorb[GetTriggerUnit()][/LJASS]) it isn't worth fixing anyway because you'd need to work around that a little anyway. I'm not personally fussed.
 

Weep

Godspeed to the sound of the pounding
Out of curiosity, what's the difference between resuming an expired 0 timer, and starting one anew?
 

Troll-Brain

You can change this now in User CP.
Resuming it double fires it for some reason, and I assume it's more efficient. :p
Double is the word :

JASS:
library TestResumeTimer initializer init

globals
    private integer I = 0
endglobals

private function Handler takes nothing returns nothing
    set I = I+1
    call BJDebugMsg(I2S(I))
endfunction

private function init takes nothing returns nothing
local timer tim = CreateTimer()
local integer i = 0

call TimerStart(tim,0.,false,function Handler)


call TriggerSleepAction(1.)

    loop
    exitwhen i == 100
    
        call ResumeTimer(tim)
    
    set i = i+1
    endloop

endfunction

endlibrary


Yes it's an unrealistic scenario, but as you see the timer is fired only two times, and this case isn't so incredible (4 - 5, whatever).

So instead, you would go to the timer expire event add add conditions / clear conditions
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    ^_^
  • Varine Varine:
    Good luck to the hurricane path people. Is TH still in Houston?
  • Ghan Ghan:
    I think so
    +1
  • The Helper The Helper:
    Yeah we got nothing here did not even rain
  • Ghan Ghan:
    We could use some rain.
  • The Helper The Helper:
    I am not complaining though Hurricanes are not fun I have been through alot of them
  • Blackveiled Blackveiled:
    I evacuated for it just incase since I live in La Porte pretty much right on the water (in Houston area). Didn't see anything. It's a good thing for me anyways.
  • Ghan Ghan:
    It's too bad that Blizzard messed up so terribly with Reforged.
  • Ghan Ghan:
    Still has a 0.6 user metacritic score.
  • Ghan Ghan:
    (Out of 10)
  • Varine Varine:
    I haven't even tried it yet because everyone said it sucked. How do you get .6 out of ten?
  • The Helper The Helper:
    I am waiting for Dwarf Fortress to come out on Steam then I am on it.
  • Accname Accname:
    I play Dwarf Fortress from time to time.
  • Accname Accname:
    Its Okay.
  • Accname Accname:
    But the performance is sub-par. Does not seem to be well optimized.
  • Varine Varine:
    Is the Steam version coming with a graphical overlay or is it using the ASCII graphics still?
  • tom_mai78101 tom_mai78101:
    Steam version has the graphical overlay.
  • The Helper The Helper:
    Steam Version has graphics, a new interface and will be integrated in the steam mod stuff
  • Blackveiled Blackveiled:
    I didn't think WC3 Reforged was that bad. It pretty much did what it stated (to me at least), but then again I can care less about reforged campaigns and all that. I just care about gameplay.
  • Varine Varine:
    I think people were hoping for a resurgence in mod support. I have little interest in the actual game tbh
  • Varine Varine:
    Plus I know they added that Dota precedent clause where Blizzard can steal your shit which isn't cool.
  • Ghan Ghan:
    They sold Reforged to the community as primarily a huge graphical uplift with high res textures and redone cinematics.
  • Ghan Ghan:
    They even showed one of the redone cinematics at Blizzcon and that very cinematic wasn't even in the released game.
  • Ghan Ghan:
    So I think folks were angry about that.

    Members online

    Affiliates

    Hive Workshop
    Top