• 🏆 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] Problems with movement and spawn

Status
Not open for further replies.
Level 11
Joined
Sep 30, 2009
Messages
697
I have a problem with the movement of my units in this trigger:


JASS:
scope MoveAndSpawn initializer init

globals
    private group g = CreateGroup()
    private integer Ghoul = 'ugho'
    private integer Necro = 'unec'
endglobals

private function Spawn_Actions takes nothing returns nothing
    call GroupAddUnit(g, CreateUnit(Player(11), Ghoul, -1000.00, 800.00, 315.00))
    call GroupAddUnit(g, CreateUnit(Player(11), Ghoul, -1000.00, 800.00, 315.00))
    call GroupAddUnit(g, CreateUnit(Player(11), Necro, -1000.00, 800.00, 315.00))
endfunction

private function Move_Actions takes nothing returns nothing
    local unit u
    local group temp = g
    
    loop
        set u = FirstOfGroup(temp)
        exitwhen u == null
        call GroupRemoveUnit(temp, u)
        call IssuePointOrder(u, "attack", 9300.00, -9600.00)
    endloop
    
    call DestroyGroup(temp)
endfunction

private function init takes nothing returns nothing
    local trigger Move = CreateTrigger()
    local trigger Spawn = CreateTrigger()
    
    call TriggerRegisterTimerEvent(Move, 0.5, true)
    call TriggerAddAction(Move, function Move_Actions)
    
    call TriggerRegisterTimerEvent(Spawn, 10.00, true)
    call TriggerAddAction(Spawn, function Spawn_Actions)

endfunction

endscope


The spawn works fine, but the movements bugs.

Help will give +rep :)
 
Level 11
Joined
Apr 29, 2007
Messages
826
JASS:
scope MoveAndSpawn initializer init

globals
    private group g = CreateGroup()
    private group temp = CreateGroup()
    private integer Ghoul = 'ugho'
    private integer Necro = 'unec'
endglobals

private function Spawn_Actions takes nothing returns nothing
    call GroupAddUnit(g, CreateUnit(Player(11), Ghoul, -1000.00, 800.00, 315.00))
    call GroupAddUnit(g, CreateUnit(Player(11), Ghoul, -1000.00, 800.00, 315.00))
    call GroupAddUnit(g, CreateUnit(Player(11), Necro, -1000.00, 800.00, 315.00))
endfunction

private function FillTemp takes nothing returns nothing
    call GroupAddUnit(temp, GetEnumUnit())
endfunction

private function Move_Actions takes nothing returns nothing
    local unit u

    call ForGroup(g, function FillTemp)
    
    loop
        set u = FirstOfGroup(temp)
        exitwhen u == null
        call GroupRemoveUnit(temp, u)
        call IssuePointOrder(u, "attack", 9300.00, -9600.00)
    endloop
endfunction

private function init takes nothing returns nothing
    local trigger Move = CreateTrigger()
    local trigger Spawn = CreateTrigger()
    
    call TriggerRegisterTimerEvent(Move, 0.5, true)
    call TriggerAddAction(Move, function Move_Actions)
    
    call TriggerRegisterTimerEvent(Spawn, 10.00, true)
    call TriggerAddAction(Spawn, function Spawn_Actions)

endfunction

endscope
Try this :)
 
Status
Not open for further replies.
Top