• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] XE and vJASS help

Status
Not open for further replies.
Level 13
Joined
Jul 26, 2008
Messages
1,009
Alright so I've got a simple main question. Can XE Colliders be used to make a unit rush another unit like a missile? If so, how?

Otherwise I'm creating a spell using XEFx as the base. Basically it's going to be a tornado that grows in size. As it grows, units are sucked into it in a swirling motion and raised as they go, until the spell ends and they're dropped for a damage dependant on their Z height.

Problem is that when using XE Fx I can't get the FX to dissappear after the timer and I can get it to grow either. Unfortunately I'm not learned on all the functionality of vJASS and have been learning as I go. So how do I remedy this? I assume it's because I'm not using this. declarations.

Appreciated :3 So is any help offered in creating this trigger, like the math.

JASS:
scope Whirlwind initializer Init

globals
    private constant integer SPELLID    = 'WhWi'
    private constant real tick          = 0.5
    private unit TEMP
endglobals

private struct Data extends xefx

    real dur
    unit caster

    static method GroupEm takes nothing returns nothing
    
    endmethod

    static method onLoop takes nothing returns nothing
     local timer tim = GetExpiredTimer()
     local Data xc = Data(GetTimerData(tim))
     local real lvl = GetUnitAbilityLevel(TEMP, SPELLID)
        set xc.dur = xc.dur + tick
        if xc.dur >= 2*lvl or GetUnitCurrentOrder(TEMP) != OrderId("tornado") then
            call ReleaseTimer(tim)
            call xc.terminate()
        else
            set xc.scale = 0.3+0.2*xc.dur
        endif
    endmethod

    static method create takes unit c, real x, real y returns Data
     local Data xc = Data.allocate(x, y, 0)
     local timer tim = NewTimer()
     local real lvl = GetUnitAbilityLevel(c, SPELLID)
        call SetTimerData(tim,xc)
        call TimerStart(tim, tick, true, function Data.onLoop)
     return xc
    endmethod

endstruct


private function Actions takes unit c returns nothing
 local Data xc
    set xc = Data.create(c, GetSpellTargetX(), GetSpellTargetY())
    set xc.fxpath = "Abilities\\Spells\\Other\\Tornado\\TornadoElemental.mdl"
    set xc.scale = 0.4
    set xc.caster = c
endfunction

private function Conditions takes nothing returns boolean
    if GetSpellAbilityId() == SPELLID then
        call Actions(GetTriggerUnit())
    endif
 return false
endfunction

//===========================================================================
public function Init takes nothing returns nothing
 local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
    call TriggerAddCondition( t, function Conditions )
    call XE_PreloadAbility(SPELLID)
endfunction

endscope
 
Normally, the end of the struct is signified by the onDestroy method. If your put your "DestroyEffect" command there, you may experience more luck. I've not looked through XE's code before, due to the fact that he just put it all in that one map and called it a day (I almost never look at a code that I'm forced to open in that slow piece of crap World Editor).
 
Status
Not open for further replies.
Top