• 🏆 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!

[Solved] Units arent created.

Status
Not open for further replies.
Level 3
Joined
Mar 2, 2012
Messages
27
Guys i need help from you, units aren't created, if someone could help me with this trigger.

JASS:
   function action2 takes nothing returns nothing
        local integer a
        local integer c = 2
        local integer counter = 0
        local integer b = 3
        set a = a + 1
        call DisplayTimedTextToForce( GetPlayersAll(), 30, "TRIGSTR_009" )
        loop
            exitwhen counter > c
            call CreateUnitAtLoc( Player(11), udg_UnitTypeSpawn[a], GetRectCenter(udg_SpawnRegion[GetRandomInt(1,b)]),180.)
            call IssuePointOrderLoc( GetLastCreatedUnit(), "attack", GetRectCenter(gg_rct_Base_Center_1))
            set counter = counter + 1
        endloop
    endfunction
    
    function action takes nothing returns nothing
        local timer timerz
        call TimerStart( timerz, 2., true, function action2)
    endfunction
    
    function InitTrig_SpawnTimer takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterTimerEventSingle(t, 1.)
        call TriggerAddAction(t, function action)
    endfunction
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
try this
also since ur learning jass u should learn how to inline.
JASS:
  function action2 takes nothing returns nothing
        local integer a
        local integer c = 2
        local integer counter = 0
        local integer b = 3
        local unit u 
        local integer r = GetRandomInt(1,b)
        local real x = GetRectCenterX(udg_SpawnRegion[r])
        local real y = GetRectCenterY(udg_SpawnRegion[r])
        local real x1 = GetRectCenterX(gg_rct_Base_Center_1)
        local real y1 = GetRectCenterX(gg_rct_Base_Center_1)
        set a = a + 1
        call DisplayTimedTextToForce( GetPlayersAll(), 30, "TRIGSTR_009" )
        loop
            exitwhen counter > c
            set u = CreateUnit( Player(11), udg_UnitTypeSpawn[a], x, y, 180.)
            call IssuePointOrder( u, "attack", x1, y1 )
            set counter = counter + 1
        endloop
    endfunction
    
    function action takes nothing returns nothing
        local timer timerz
        call TimerStart( timerz, 2., true, function action2)
        set timerz = null
    endfunction
    
    function InitTrig_SpawnTimer takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterTimerEvent( t, 1., false ) //set true if periodic
        call TriggerAddAction(t, function action)
    endfunction
 
Level 3
Joined
Mar 2, 2012
Messages
27
I am sorry @deathismyfriend but still units wont be spawned. I am actually planning for a spawning trigger wherein every 45 seconds, 15 units will be spawned once at a time with interval of 1.5 seconds each.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
make sure the trigger fires u might have a problem w a trigger above this one or below it tht is causing the triggers to glitch i did this once by forgetting to set t = createtrigger() in one of the triggers above the one i was working on. other than tht it should work if u cant find the problem paste the map or use degub messages to find out what fires and what doesnt fire.
 
Level 3
Joined
Mar 2, 2012
Messages
27
Still it wont work. I guess i need to post the map now.

Here is the map:
 

Attachments

  • Dual Square Arena.w3x
    41 KB · Views: 33
Status
Not open for further replies.
Top