"Wait" help.

cleeezzz

The Undead Ranger.
Reaction score
268
JASS:
call CAS_SA('h00J',u,cx,cy,tx,ty,0.03,33,MaxDist(i),Damage(i),false,0,null,0,0,null)
    call CAS_SA('h00K',u,cx,cy,tx,ty,0.03,33,MaxDist(i),Damage(i),true,'A00A',"flamestrike",i,250.00,"Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl")


CAS_SA creates an arrow that goes straight, but i want the 2nd function to happen about .03 seconds after the first one, right now, they're instant so they overlap each other, whats the best way to do this
 
Reaction score
456
With so low periods, you have to use a timer.

If you're using vJass, you can do it easily by using a struct:
JASS:
struct Data
    timer t = CreateTimer()

    //add your stuff here
endstruct

globals
    Data array Data_ar
    integer counter = 0
endglobals

function SomeFunction_handler takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer loopA = 0
    
    loop
        exitwhen loopA >= counter
        if Data_ar[loopA].t = t then
        
            //launch the second arrow
            
            call PauseTimer(t)
            call DestroyTimer(t)
            call Data_ar[counter].destroy()
            set counter = counter - 1
        endif
        set loopA = loopA + 1
    endloop
endfunction

function SomeFunction takes nothing returns boolean
    local Data dat = Data.create()

    //set some data for the struct
    
    //launch first arrow
    
    call TimerStart(dat.t, 0.03, false, function SomeFunction_handler)
    
    set Data_ar[counter] = dat
    set counter = counter + 1
endfunction

If you don't know vJass, you're not getting anywhere with that code.

With TT:
JASS:
struct Data
    //add your stuff here
endstruct

function SomeFunction_handler takes nothing returns nothing
    local Data dat = TT_GetData()
    
    //launch second arrow
    
    call dat.destroy()

    return true
endfunction

function SomeFunction takes nothing returns nothing
    local Data dat = Data.create()

    //set some data for the struct
    
    //launch first arrow
    
    call TT_Start(function SomeFunction_handler, dat)
endfunction


Correct me if I am wrong. I don't have wc3/newgen or anything.
 

Hatebreeder

So many apples
Reaction score
381
Create a Timer that runs just once.
Simple, efficient and proberbly acurate =)
Problem is, you will proberbly need a Attachment System.
Also, if you are doing stuff like this, I recomend you use something like TT by Cohadar, since you will have to create + destroy the Timer >.<
 
Reaction score
456
The Data_ar is array of Data structs, and counter is counting how many "things" (can't figure out a word for it now) there are in the Data_ar. In the handler function we are looping each through the Data_ar.
 

cleeezzz

The Undead Ranger.
Reaction score
268
hmm

JASS:
function SomeFunction_handler takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer loopA = 0
    
    loop
        exitwhen loopA &gt;= counter
        if Data_ar[loopA].t = t then
        
            //launch the second arrow
            
            call PauseTimer(t)
            call DestroyTimer(t)
            call Data_ar[counter].destroy()
            set counter = counter - 1
        endif
        set loopA = loopA + 1
    endloop
endfunction


but i cant launch the arrow in a separate function unless i load the struct right?

heres what i got so far.

JASS:
scope HA initializer Init

private function Damage takes integer i returns real
    return 350.00+(100.00*i)
endfunction

private function Damage2 takes integer i returns real
    return 100.00*i
endfunction

private function MaxDist takes integer i returns real
    return 1500.00+(500.00*i)
endfunction

private function Conditions takes nothing returns boolean
        return GetSpellAbilityId() == &#039;A006&#039;
endfunction

private struct Data
    timer t = NewTimer()
    unit u
    real cx
    real cy
    real tx
    real ty
    integer i
endstruct

    

private function Shockwave takes nothing returns nothing //i know this doesn&#039;t work yet

    call CAS_SA(&#039;h00K&#039;,u,cx,cy,tx,ty,0.03,33,MaxDist(i),Damage(i),true,&#039;A00A&#039;,&quot;flamestrike&quot;,i,250.00,&quot;Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl&quot;)

endfunction

private function Actions takes nothing returns nothin
    local Data d = Data.create()
    local l = GetSpellTargetLoc()
    set d.u = GetTriggerUnit()
    set i = GetUnitAbilityLevel(d.u,GetSpellAbilityId())
    set d.cx = GetUnitX(d.u)
    set d.cy = GetUnitY(d.u)
    set d.tx = GetLocationX(l)
    set d.ty = GetLocationY(l)
    
    call CAS_SA(&#039;h00J&#039;,d.u,d.cx,d.cy,d.tx,d.ty,0.03,33,MaxDist(i),Damage(i),false,0,null,0,0,null)
    call TimerStart(d.t,0.05,false,function Shockwave)
    
    call RemoveLocation(l)
endfunction


//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( trig, Condition( function Conditions ) )
    call TriggerAddAction( trig, function Actions)
endfunction
   
endscope
 
Reaction score
456
JASS:
scope HA initializer Init

private function Damage takes integer i returns real
    return 350.00+(100.00*i)
endfunction

private function Damage2 takes integer i returns real
    return 100.00*i
endfunction

private function MaxDist takes integer i returns real
    return 1500.00+(500.00*i)
endfunction

private function Conditions takes nothing returns boolean
        return GetSpellAbilityId() == &#039;A006&#039;
endfunction

private struct Data
    timer t = NewTimer()
    unit u
    real cx
    real cy
    real tx
    real ty
    integer i
endstruct

globals
    private Data array Data_ar
    private integer counter = 0
endglobals
    
private function Shockwave takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer loopA = 0
    
    loop
        exitwhen loopA &gt;= counter
        if Data_ar[loopA].t = t then
        
            call CAS_SA(&#039;h00K&#039;,Data_ar[loopA].u,Data_ar[loopA].cx,Data_ar[loopA].cy,Data_ar[loopA].tx,Data_ar[loopA].ty,0.03,33,MaxDist(i),Damage(i),true,&#039;A00A&#039;,&quot;flamestrike&quot;,i,250.00,&quot;Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl&quot;)
            
            call PauseTimer(t)
            call DestroyTimer(t)
            call Data_ar[counter].destroy()
            set counter = counter - 1
        endif
        set loopA = loopA + 1
    endloop
endfunction

private function Actions takes nothing returns nothin
    local Data d = Data.create()
    local l = GetSpellTargetLoc()
    set d.u = GetTriggerUnit()
    set i = GetUnitAbilityLevel(d.u,GetSpellAbilityId())
    set d.cx = GetUnitX(d.u)
    set d.cy = GetUnitY(d.u)
    set d.tx = GetLocationX(l)
    set d.ty = GetLocationY(l)
    
    call CAS_SA(&#039;h00J&#039;,d.u,d.cx,d.cy,d.tx,d.ty,0.03,33,MaxDist(i),Damage(i),false,0,null,0,0,null)
    call TimerStart(d.t,0.05,false,function Shockwave)
    
    set Data_ar[counter] = d
    set counter = counter + 1
    
    call RemoveLocation(l)
endfunction


//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( trig, Condition( function Conditions ) )
    call TriggerAddAction( trig, function Actions)
endfunction
   
endscope

I used the struct array and counter method in that. Oh, you should also store the i variable it seems.
 

cleeezzz

The Undead Ranger.
Reaction score
268
Solved

JASS:
scope HA initializer Init

private function Damage takes integer i returns real
    return 350.00+(100.00*i)
endfunction

private function Damage2 takes integer i returns real
    return 100.00*i
endfunction

private function MaxDist takes integer i returns real
    return 1500.00+(500.00*i)
endfunction

private function Conditions takes nothing returns boolean
        return GetSpellAbilityId() == &#039;A006&#039;
endfunction

private struct Data
    timer t = NewTimer()
    unit u
    real cx
    real cy
    real tx
    real ty
    integer i
    private method onDestroy takes nothing returns nothing
        set .u = null
        call ReleaseTimer(.t)
    endmethod
endstruct

globals
    private Data array Array
    private integer c = 0
endglobals

    

private function Shockwave takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer l = 0
    
    loop
        exitwhen l &gt;= c
        if Array[l].t = t then     //syntax error
            call CAS_SA(&#039;h00K&#039;,Array[l].u,Array[l].cx,Array[l].cy,Array[l].tx,Array[l].ty,0.03,33,MaxDist(Array[l].i),Damage(Array[l].i),true,&#039;A00A&#039;,&quot;flamestrike&quot;,Array[l].i,250.00,&quot;Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl&quot;)
            call d.destroy()
            return
        endif
        set l = l + 1
    endloop
endfunction

private function Actions takes nothing returns nothing
    local Data d = Data.create()
    local location l = GetSpellTargetLoc()
    set d.i = GetUnitAbilityLevel(d.u,GetSpellAbilityId())
    set d.u = GetTriggerUnit()
    set d.cx = GetUnitX(d.u)
    set d.cy = GetUnitY(d.u)
    set d.tx = GetLocationX(l)
    set d.ty = GetLocationY(l)
    
    call CAS_SA(&#039;h00J&#039;,d.u,d.cx,d.cy,d.tx,d.ty,0.03,33,MaxDist(d.i),Damage(d.i),false,0,null,0,0,null)
    call TimerStart(d.t,0.05,false,function Shockwave)
    
    set Array[c] = d
    set c = c + 1


    
    call RemoveLocation(l)
endfunction


//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( trig, Condition( function Conditions ) )
    call TriggerAddAction( trig, function Actions)
endfunction
   
endscope
theres a comment in the code



edit: solved it with attachment.
which way is better, this way? or attachment systems?
 
Reaction score
456
Syntax error is caused by single =. It should be ==. Sorry, I've been working with other languages.

Also, I have to say I am sorry for giving you the wrong solution, this should fix it:

JASS:
private function Shockwave takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer l = 0
    
    loop
        exitwhen l &gt;= c
        if Array[l].t == t then
            call CAS_SA(&#039;h00K&#039;,Array[l].u,Array[l].cx,Array[l].cy,Array[l].tx,Array[l].ty,0.03,33,MaxDist(Array[l].i),Damage(Array[l].i),true,&#039;A00A&#039;,&quot;flamestrike&quot;,Array[l].i,250.00,&quot;Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl&quot;)
            set Array[c] = Array[l]
            set c = c - 1
            set l = l - 1
            call d.destroy()
            return
        endif
        set l = l + 1
    endloop
endfunction
 

cleeezzz

The Undead Ranger.
Reaction score
268
JASS:
scope HA initializer Init

private function Damage takes integer i returns real
    return 350.00+(100.00*i)
endfunction

private function Damage2 takes integer i returns real
    return 100.00*i
endfunction

private function MaxDist takes integer i returns real
    return 1500.00+(500.00*i)
endfunction

private function Conditions takes nothing returns boolean
        return GetSpellAbilityId() == &#039;A006&#039;
endfunction

private struct Data
    timer t
    unit u
    real cx
    real cy
    real tx
    real ty
    integer i
    private method onDestroy takes nothing returns nothing
        set .u = null
        call ReleaseTimer(.t)
    endmethod
endstruct

    

private function Shockwave takes nothing returns nothing
    local Data d = GetCSData(GetExpiredTimer())
    call CAS_SA(&#039;h00K&#039;,d.u,d.cx,d.cy,d.tx,d.ty,0.03,150,33,MaxDist(d.i),Damage2(d.i),true,&#039;A00A&#039;,&quot;flamestrike&quot;,d.i,250.00,&quot;Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl&quot;)
    call d.destroy()
endfunction

private function Actions takes nothing returns nothing
    local Data d = Data.create()
    local location l = GetSpellTargetLoc()
    set d.t = NewTimer()
    set d.u = GetTriggerUnit()
    set d.i = GetUnitAbilityLevel(d.u,GetSpellAbilityId())
    set d.cx = GetUnitX(d.u)
    set d.cy = GetUnitY(d.u)
    set d.tx = GetLocationX(l)
    set d.ty = GetLocationY(l)
    
    call CAS_SA(&#039;h00J&#039;,d.u,d.cx,d.cy,d.tx,d.ty,0.03,75,33,MaxDist(d.i),Damage(d.i),false,0,null,0,0,null)
    call TimerStart(d.t,0.08,false,function Shockwave)

    call SetCSData(d.t, d)
    call RemoveLocation(l)
endfunction


//===========================================================================
private function Init takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( trig, Condition( function Conditions ) )
    call TriggerAddAction( trig, function Actions)
endfunction
   
endscope


lol i just wanted to make it work, so this attachment way works

but, which way is "better"? ill change it if it makes a difference.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top