System Damage

Discussion in 'Systems and Snippets' started by Jesus4Lyf, Jul 6, 2009.

  1. hgkjfhfdsj

    hgkjfhfdsj Active Member

    Ratings:
    +55 / 0 / -0
    i got lost there :p
    for learning purposes could you/someone sketch what it would look like?
     
  2. aggro

    aggro New Member

    Ratings:
    +0 / 0 / -0
    hi there, im kinda new in jass. im trying this system and its really good. im making some basic examples to find out the system. however im getting "undeclared function Damage_IsAttack" error
    JASS:
    scope Example initializer Start
    
    private function Actions takes nothing returns boolean
         if Damage_IsAttack() then           
            call Damage_BlockAll()
        endif
        return false
    endfunction
    
    function Start takes nothing returns nothing
            local trigger t = CreateTrigger()
            call TriggerAddAction( t, function Actions )
            call Damage_RegisterEvent(t)
    endfunction
    
    endscope


    what's wrong in there?
     
  3. Laiev

    Laiev Hey Listen!!

    Ratings:
    +187 / 0 / -0
    copy the trigger from the post, not the demo map :p

    will work fine
     
  4. hgkjfhfdsj

    hgkjfhfdsj Active Member

    Ratings:
    +55 / 0 / -0
    - what version jasshelper/system?
    - i think you meant TriggerAddCondition?
     
  5. aggro

    aggro New Member

    Ratings:
    +0 / 0 / -0
    >>i think you meant TriggerAddCondition?

    yeah, thats the point. i couldnt add Damage_IsAttack condition. it gives the error what i told up here. i have the latest jasshelper newgen etc.
     
  6. Laiev

    Laiev Hey Listen!!

    Ratings:
    +187 / 0 / -0
    :p
     
  7. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    Out of date version in the demo map. Get from first post, instead. :p
     
  8. Bribe

    Bribe vJass errors are legion

    Ratings:
    +67 / 0 / -0
    JASS:
    //
        private struct Detector extends array // Uses AIDS.
            //! runtextmacro AIDS()
            
            private static conditionfunc ACTIONS_COND
            
            private trigger t
            
            private method AIDS_onCreate takes nothing returns nothing
                set this.t=CreateTrigger()
                call TriggerAddCondition(this.t,thistype.ACTIONS_COND)
                call TriggerRegisterUnitEvent(this.t,this.unit,EVENT_UNIT_DAMAGED)
            endmethod
            
            private method AIDS_onDestroy takes nothing returns nothing
                call DestroyTrigger(this.t)
            endmethod
            
            private static method AIDS_onInit takes nothing returns nothing
                set thistype.ACTIONS_COND=Condition(function OnDamageActions)
            endmethod
        endstruct


    Due to the JASSHelper compile-time wackiness, putting the AIDS textmacro at the top of the struct like this wastefully creates three conditions to execute onInit, onCreate, and onDestroy, needlessly increasing handle count and needlessly slowing down those processes. Putting the textmacro at the bottom of the struct prevents this problem. Then again, you're using the method operator unit from the AIDS struct, which stupidly compiles to a condition-evaluation instead of inlining if the textmacro is below the declaration. vJass totally fails.
     
  9. Lmfaocj

    Lmfaocj Active Member

    Ratings:
    +1 / 0 / -0
    I am new and I don't know jass can anyone help me.
    I know don't how to make every skill deal damage using "Damage" ex. "Shock Wave"
     
  10. Laiev

    Laiev Hey Listen!!

    Ratings:
    +187 / 0 / -0
    you need recreate that spell with trigger to use the function to deals damage by the system
     
  11. Lmfaocj

    Lmfaocj Active Member

    Ratings:
    +1 / 0 / -0
    How would I do that, with the shock wave spell because it's a aoe and has not buffs, how would I make the skill deal damage?

    and does normal attacking have something I can add so it does not detect normal damage.

    like if I was to use

    JASS:
    //function Conditions takes nothing return boolean
    //    if ( not (  ) )
    //        return false
    //    endif
    //    return true
    //endfunction
    
    function Actions takes nothing returns nothing
        local real Damage=GetEventDamage
        call Damage_Block
        call UnitDamageTargetEx( GetEventDamageSource(), GetTriggerUnit(), Damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
    endfunction
        
    //===========================================================================
    function HyperAttack takes nothing returns nothing
        local trigger t= CreateTrigger()
    //    call TriggerAddCondition( t, function Conditions)
        call TriggerAddAction( t, function Actions)
        call Damage_RegisterEvent
    endfunction
     
  12. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    If you don't know JASS, it's probably a bit unrealistic to try to trigger damage for something like Shockwave...

    There's a few ways, the simplest being make it deal 0 damage, then register Damage's Zero damage event, and deal the actual damage. If you use a dummy caster, you can also attach the caster to the dummy and the amount of damage... Would allow you to change the damage of spells over time, etc, as well. :)

    But if you don't know JASS in the first place, it's a bit of a pain. By a bit of a pain, I mean I don't find it likely that you can complete it.

    Edit: I wonder if someone can make a system which does the above in an effective way..?
     
  13. W!†A_cRaft

    W!†A_cRaft Ultra Cool Member

    Ratings:
    +28 / 0 / -0
    JASS:
    //          function Damage_RegisterEvent takes trigger whichTrigger returns nothing
    //              - This registers a special "any unit takes damage" event.
    //              - This event supports dynamic trigger use.
    //              - Only triggers registered on this event may block damage.
    //              - Only fires when the damage dealt is not 0.


    How do I control this thing, or to put it more precissly, what am i suppose to do with this function? Where am i suppose to call it?

    EDIT: can normal damage (regular attacks from unit within the map) be blocked? Or do I have to make another "healing trigger" for those attacks?
     
  14. Laiev

    Laiev Hey Listen!!

    Ratings:
    +187 / 0 / -0
    in the event part, instead of any other event, call it, that is the event

    ya, it can block regular damage from unit
     
  15. W!†A_cRaft

    W!†A_cRaft Ultra Cool Member

    Ratings:
    +28 / 0 / -0
    instead of any event?

    what if i want an periodic event or something?
    or possibly a player chat message event?

    EDIT: am i suppose to put this in the regular trigger event register, at the bottom of the trigger? or in the actions of the trigger simply calling an event register function?
     
  16. Laiev

    Laiev Hey Listen!!

    Ratings:
    +187 / 0 / -0
    • Like Like x 1
  17. W!†A_cRaft

    W!†A_cRaft Ultra Cool Member

    Ratings:
    +28 / 0 / -0
    but, what is this OnInit function, i mean from where to call it/use it?

    am i suppose to call it from the regular action function? or
    from the InitTrig_<triggername> or what?

    EDIT: what confuses me is that they say "must register every trigger to it, or else they cant block"
     
  18. kingkingyyk3

    kingkingyyk3 Visitor (Welcome to the Jungle, Baby!)

    Ratings:
    +216 / 0 / -0
    Jasshelper allows you to make your own init function.
     
  19. W!†A_cRaft

    W!†A_cRaft Ultra Cool Member

    Ratings:
    +28 / 0 / -0
    within which segment of my "custom script converted trigger" and when will it fire?
     
  20. kingkingyyk3

    kingkingyyk3 Visitor (Welcome to the Jungle, Baby!)

    Ratings:
    +216 / 0 / -0
    JASS:
    scope <MyScopeName> initializer <My Init function name>
     

Share This Page