• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Crash with CreateUnit

Status
Not open for further replies.
Level 3
Joined
Jan 1, 2012
Messages
50
hi, i've the biggest problem of the world !!

this is my triggers :
JASS:
function CreateMobCondition takes nothing returns boolean
return IsPlayerInForce(GetTriggerPlayer(), udg_Creater)
endfunction

function Trig_create_mob_Actions takes nothing returns nothing
    local integer i = GetPlayerId(GetTriggerPlayer())
    
    call IssueImmediateOrder(udg_hero_j[i], "stop")
    if udg_Wait_action[i] == false then
        set udg_Wait_action[i] = true
        set udg_Futur_rect_a_x[udg_J] = GetOrderPointX()
        set udg_Futur_rect_a_y[udg_J] = GetOrderPointY()
        call BJDebugMsg(R2S(udg_Futur_rect_a_x[udg_J]))
        call BJDebugMsg(R2S(udg_Futur_rect_a_y[udg_J]))
        set udg_Unit_in_creation[i] = CreateUnit(Player(11), udg_Mob, udg_Futur_rect_a_x[udg_J], udg_Futur_rect_a_y[udg_J], 0)
        set udg_Unit_created[udg_L] = udg_Unit_in_creation[i]
        set udg_L = udg_L + 1
    elseif udg_Wait_action[i] == true then
        set udg_Wait_action[i] = false
        set udg_Futur_rect_b_x[udg_J] = GetOrderPointY()
        set udg_Futur_rect_b_y[udg_J] = GetOrderPointY()
        call IssuePointOrder(udg_Unit_in_creation[i], "patrol", udg_Futur_rect_b_x[udg_J], udg_Futur_rect_b_y[udg_J])
        set udg_J = udg_J + 1
        set udg_Unit_in_creation[i] = null
    endif
endfunction

//===========================================================================
function InitTrig_create_mob takes nothing returns nothing
    set gg_trg_create_mob = CreateTrigger(  )
    call TriggerAddCondition(gg_trg_create_mob, Condition(function CreateMobCondition))
    call TriggerAddAction( gg_trg_create_mob, function Trig_create_mob_Actions )
endfunction

JASS:
function CreateMobCondition2 takes nothing returns boolean
return IsPlayerInForce(GetTriggerPlayer(), udg_Creater2)
endfunction

function Trig_create_roc_Actions takes nothing returns nothing
    local integer i = GetPlayerId(GetTriggerPlayer())

    call IssueImmediateOrder(udg_hero_j[i], "stop")
    set udg_Futur_rect_roc_x[udg_K] = GetOrderPointX()
    set udg_Futur_rect_roc_y[udg_K] = GetOrderPointY()
    set udg_Unit_created[udg_L] = CreateUnit(Player(11), udg_pierre, udg_Futur_rect_roc_x[udg_K], udg_Futur_rect_roc_y[udg_K], 0)
    set udg_K = udg_K + 1
    set udg_L = udg_L + 1
endfunction

//===========================================================================
function InitTrig_create_roc takes nothing returns nothing
    set gg_trg_create_roc = CreateTrigger(  )
    call TriggerAddCondition(gg_trg_create_roc, Condition(function CreateMobCondition2))
    call TriggerAddAction( gg_trg_create_roc, function Trig_create_roc_Actions )
endfunction

if i put all the code within function/endfunction in comments, i have a big spike.
else, i crash.

who has an idea ?
 
First off,
JASS:
elseif udg_Wait_action[i] == true then
can become a plain
JASS:
else

JASS:
set udg_Unit_in_creation[i] = CreateUnit(Player(11), udg_Mob, udg_Futur_rect_a_x[udg_J], udg_Futur_rect_a_y[udg_J], 0)
set udg_Unit_created[udg_L] = udg_Unit_in_creation[i]
This can be:
JASS:
set udg_Unit_created[udg_L] = CreateUnit(Player(11), udg_Mob, udg_Futur_rect_a_x[udg_J], udg_Futur_rect_a_y[udg_J], 0)

How exactly do you fire these triggers? I am guessing you use another function, since there are no events.
 
Level 3
Joined
Jan 1, 2012
Messages
50
it's my triggers.
and i need make 2 variables unit.
i juste want know why my triggers crash, with CPU 100%...

if you want trigger, look it :

JASS:
    loop
        exitwhen i == 10
        set udg_Apm_j[i] = 0
        set udg_Time_on_ice[i] = 0
        set udg_Wait_action[i] = false
        call TriggerRegisterPlayerUnitEvent( gg_trg_create_roc, Player(i), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, null)
        call TriggerRegisterPlayerUnitEvent( gg_trg_create_mob, Player(i), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, null)
    endloop

and it for add player to force :

JASS:
    if name == "create" or name == "crt" then
        set trg_player = GetPlayerId(GetTriggerPlayer())
        if (param == "m" or param == "mob") and udg_Wait_action[trg_player] == false then
            call DisplayTimedTextToPlayer(Player(trg_player), 0, 0, 5, "2 clicks for 1 patrol.")
            call ForceAddPlayer(udg_Creater, Player(trg_player))
        elseif (param == "r" or param == "roc") and udg_Wait_action[trg_player] == false then
            call ForceAddPlayer(udg_Creater2, Player(trg_player))
            call DisplayTimedTextToPlayer(Player(trg_player), 0, 0, 5, "1 click for 1 roc.")
        else
            call DisplayTimedTextToPlayer(Player(trg_player), 0, 0, 5, "sorry you can't")
        endif
    endif


i think you think i'm a noob, it's wrong.
if you need more, i can add informations.
 
Status
Not open for further replies.
Top