• 🏆 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] Help in moving a dummy unit.

Status
Not open for further replies.
Level 3
Joined
Jul 6, 2008
Messages
42
How do I moving a dummy unit with Jass and make it MUI ?

Eh , i mean 2 trigger , a trigger created a dummy unit and another trigger move it a certain range every 0.04 seconds for a certain duration . How can I make this 2 trigger into 1 trigger and MUI , or make it seperatly but MUI ?

Someone help me :cry:
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
A simple projectile example in vJass. The arrays and such are for storage of structs.

JASS:
scope myProjectile
private struct Data
    unit u
    real xv
    real yv
    //more stuff?
endstruct

globals
    private timer T = CreateTimer()
    private Data array darr
    private integer max = 0
endglobals

private function Loop takes nothing returns nothing
    local integer i = 0
    local Data dat
    loop
        exitwhen i >= max
        set dat = darr[i]
        call SetUnitX(dat.u,GetUnitX(dat.u)+dat.xv)
        call SetUnitY(dat.u,GetUnitY(dat.u)+dat.yv)
        if <end> then
            set max = max - 1
            set darr[i] = darr[max]
            if max == 0 then
                call PauseTimer(T)
            endif
            call dat.destroy()
        else
            set i = i + 1
        endif
    endloop
endfunction

private function Actions takes nothing returns nothing
    local Data dat = Data.create()
    set dat.u = CreateUnit(...)
    set dat.xv = (your x velocity)
    set dat.yv = (your y velocity)
    set darr[max] = i
    if max == 0 then
        call TimerStart(T,.04,true,function Loop)
    endif
    set max = max + 1
endfunction

//...
endscope
 
Status
Not open for further replies.
Top