• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

[Solved] Please help me for Library T32x

Status
Not open for further replies.
Level 3
Joined
Apr 4, 2010
Messages
11
Please help me for Implementing of Library Timer32 by Jesus4Lyf


JASS:
scope MarkofFire
//=========================================================================
//Mark of Fire
//
//Requires      : GroupUtils
//                Timer32x
//
//Credits       : Rising_Dusk {GroupUtils}
//                Jesus4Lyf {Timer32}
//                Baasee {Rupture Trigger}
//=========================================================================
//Variables Used
//
//
//=========================================================================
//This is my first Translate GUI->JASS Spells
//Sorry if i made some mistakes, yet I'll repair
//
//=========================================================================
globals
    
    private constant integer SPELL_ID_I     = 'A001' // raw code of ability "MoF Level I"
    private constant integer SPELL_ID_II    = 'A002' // raw code of ability "MoF Level II"
    
    private constant string EFFECT          = "NewMassiveEX.mdx" // effect spawned
    
    private constant attacktype ATP         = ATTACK_TYPE_NORMAL // attack type of damage
    private constant damagetype DTP         = DAMAGE_TYPE_MAGIC // damage type of damage
    
    private constant integer  MoF_R         = 100   //Floating Text Colour - Red
    private          integer  MoF_G         = 100   //Floating Text Colour - Green
    private          integer  MoF_B         = 100   //Floating Text Colour - Blue
    private constant integer  MoF_T         = 0     //Floating Text Colour - Transparency
    private constant integer  MoF_X         = 0     //Floating Text Loc    - X
    private constant real     MoF_S         = 15.0  //Floating Text Size
    
    private constant boolean NO_STACK       = true
    private constant boolean PRELOAD        = true
    
    private constant string MESSAGE         = "Target Unit has already Marked"
    
endglobals
//=========================================================================
private function MoF_CI takes nothing returns boolean
    return GetSpellAbilityId() == SPELL_ID_I
endfunction

private function MoF_CII takes nothing returns boolean
    return GetSpellAbilityId() == SPELL_ID_II
endfunction
//=========================================================================
private function dmg_i takes unit h returns real
    return I2R(GetHeroStatBJ(bj_HEROSTAT_INT, h, true)*1)
endfunction

private function dmg_ii takes unit h returns real
    return I2R(GetHeroStatBJ(bj_HEROSTAT_INT, h, true)*2)
endfunction

private function hit takes unit u,unit c returns nothing
    if MoF_CI then
    call UnitDamageTargetBJ(u,c,dmg_i,ATP,DTP)
    else
    if MoF_CII then
    call UnitDamageTargetBJ(u,c,dmg_ii,ATP,DTP)
    endif
    endif
endfunction

//=========================================================================
    globals
        
        private group       nostack
        private real        TIME       = 3.00 //Duration
        
    endglobals

    private struct MoF // the struct
        unit    c //casting unit
        unit    u //target unit
        real    d_i//Damage Level 1
        real    d_ii//Damage Level 2
        real    time//the duration
        real    x//Unit X
        real    y//Unit Y
        texttag ft
        //
        // creation method takes unit caster, unit target, real x of target, real y of target
        //
        static method create takes unit c, unit u,real x,real y returns MoF
            local MoF this  = MoF.allocate()
            set .c = c
            set .u = u
            set .d_i = dmg_i(h)
            set .d_ii = dmg_ii(h)
            set .time = TIME
            set .x = x
            set .y = y
            static if NO_STACK then
                call GroupAddUnit(nostack, u)
            endif
            call .startPeriodic()
            return this
        endmethod
        
        private method periodic takes nothing returns nothing
            local real Red      = MoF_R
            local real Green    = MoF_G - T32_PERIOD 
            local real Blue     = MoF_B - T32_PERIOD
            local real dx       = GetUnitX(.u)
            local real dy       = GetUnitY(.u)
            local effect e
            if .time > 0. and not IsUnitType(.u, UNIT_TYPE_DEAD)then //check if the spell has ended
                set .time = .time - T32_PERIOD //reduce the duration
                if Green != 0. then
                set Green = MoF_G - T32_PERIOD 
                endif
                if Blue != 0. then
                set Green = MoF_B - T32_PERIOD 
                endif
                call DestroyTextTagBJ(.ft)
                set .ft = CreateTextTagUnitBJ(R2S(.time),.u,MoF_X,MoF_S,Red,Green,Blue,MoF_T)
                call SetTextTagPermanentBJ( .ft, false )
            else
                //instance have ended then we clear leaks and removes the ability and also the buff
                call .stopPeriodic()
                call DestroyTextTagBJ(.ft)
                set e = AddSpecialEffect(EFFECT,dx,dy)
                call hit(.c,.u)
                static if NO_STACK then
                    call GroupRemoveUnit(nostack, .u)
                    call ReleaseGroup(nostack)
                endif
                call .destroy()
            endif
        endmethod
    
        private static method Conditions takes nothing returns boolean
            local unit c
            local unit u
            local real x
            local real y
            if MoF_CI or MoF_CII then
                set c = GetTriggerUnit()
                set u = GetSpellTargetUnit()
                call MoF.create(c,u,x,y)
            endif
            set c = null
            set u = null
            return false
        endmethod
        
        private static method Conditions2 takes nothing returns boolean
            local unit c
            local unit u
            local real x
            local real y
            local player p = GetTriggerPlayer()
            if if MoF_CI or MoF_CII then
                set c = GetTriggerUnit()
                set u = GetSpellTargetUnit()
                if IsUnitInGroup(u, nostack) == true then
                    call IssueImmediateOrder(c, "stop")
                    call SimError(p, MESSAGE)
                endif
            endif
            set c = null
            set u = null
            return false
        endmethod
        
    private static method onInit takes nothing returns nothing
            //start of the trigger
            local trigger t = CreateTrigger()
            local trigger trg
            call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
            // to prevent mana and cooldown loss if the constant NOSTACK is on
            static if NO_STACK then
                set trg = CreateTrigger()
                set nostack = CreateGroup()
                call TriggerRegisterAnyUnitEventBJ(trg, EVENT_PLAYER_UNIT_SPELL_CAST)
                call TriggerAddCondition(trg, Condition(function MoF.Conditions2))
            endif
            //conditions are faster than actions? so I've heard
            call TriggerAddCondition(t, Condition(function MoF.Conditions))
            //preload
            static if PRELOAD then
                call Preload(EFFECT)
            endif
        endmethod
   implement T32x
endstruct

//===========================================================================
endscope


1_2.jpg


2_2.jpg



I'm using the lastest JNGP (v5d], lastest JassHelper [0.A.2.B.jasshelper], the lastest Grimoire [v1.5a]


please help me to Implementing this triggers T_T
 
Status
Not open for further replies.
Top