System help...


I lurk for pizza
Reaction score
I'm no JASS master but I made a small cast time system that I use it for every spell on my heroes only and some items. I was wondering how to get the instance of a struct without copy/pasting this on every spell I have, maybe similar to KT2's KT_GetData()...

scope CT initializer onInit

    private struct Cast
        unit caster
        real time
        real t = 0.00
        integer order
        unit bar
        static method Update takes nothing returns boolean
            local Cast c = KT_GetData()
            set c.t = c.t + 0.01
            call SetUnitAnimationByIndex(, R2I( ( c.t / c.time ) * 20 ) + 1 )
            if c.t >= c.time or GetUnitCurrentOrder( c.caster ) != c.order then
                // call function here
                call c.destroy()
                return true
            return false
        method onDestroy takes nothing returns nothing
            call UnitApplyTimedLife( .bar, 'BTLF', 0.25 )
            call FadeUnit( .bar, 255.00, 0.00, 0.25 ) //custom function
            call IssueImmediateOrder( .caster, "stop" )
            set .caster = null

    public function Apply takes unit caster, real time, string order returns Cast
        local Cast c = Cast.create()
        set c.caster = caster
        set c.time = time
        set c.order = OrderId( order )
        set = CreateUnit( GetOwningPlayer( c.caster ), 'h00P', GetUnitX( c.caster ), GetUnitY( c.caster ), 270.00 ) // Hatebreeder's w/e Bars-modeled unit
        call SetUnitAnimationByIndex(, 0 )

        call KT_Add( function Cast.Update, c, 0.01 )
        return c


I want to be able to do something like this but don't know how.
struct Spell
    unit caster
    unit target
    static method After 
        local Spell s = Cast.GetData()
        call KillUnit( )
        call something( s.caster )

function Test1
    local Spell s = Spell.create()
    set s.caster = GetTriggerUnit()
    set = GetSpellTargetUnit()
    call CT_Apply( s.caster, 2.00, "holybolt", function Spell.After )

Any suggestions? Also, is it fast/efficient?
TIA :)


I lurk for pizza
Reaction score
ok, i read it in the jass manual and have 1 question..
how do i determine which are function interfaces and which are not?


Hey Listen!!
Reaction score
interface myFunc
    function //....................

struct myStruct extends myFunc


If I remember right..

Edit: PS: You should do all with struct (at your code posted before...)


Level 1 Crypt Lord
Reaction score
Attach the data to the casting unit via a hash table or a unit indexing attachment.
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    Damn here come the bots again - 193 online but they are totally invisible to any stats - bunch of bots!'
  • C cubanismo:
    Re: Taco Tuesday, if there were some way to share edible tacos over the internet, technology would be complete.
  • The Helper The Helper:
    One can only wish!
  • tom_mai78101 tom_mai78101:
    I'm back from Taiwan
  • The Helper The Helper:
    I am reorganizing the site I know nobody will notice but I am not done quite yet but the main forums order has been changed and there is a new news category in Other News which is all the remaining headline news stuff not categorized - Headline News is just the stuff that shows on the main page now and the news archive is off the main forums page
  • The Helper The Helper:
    and the real archive lives off of headline news
  • The Helper The Helper:
    Happy Monday!
    Happy Saturday!
  • The Helper The Helper:
    Happy Saturday Night!

    The Helper Discord

    Members online

    No members online now.


    Hive Workshop NUON Dome World Editor Tutorials

    Network Sponsors

    Apex Steel Pipe - Buys and sells Steel Pipe.