Possibly hitting the op limit?

AdamGriffith

You can change this now in User CP.
Reaction score
69
Hello,

I was just wondering why this function does not work.
(All the BJDebugMsg's are displayed.)

JASS:
function Trig_AI_Actions takes nothing returns nothing
    local integer i = GetPlayerState(Player(1), PLAYER_STATE_RESOURCE_GOLD)
    call BJDebugMsg("Running.")
    call BJDebugMsg(I2S(i))
    if i > 50000 then
        call IssueImmediateOrderById(gg_unit_h01A_0015, 'n00D')
    elseif i > 30000 then
        call IssueImmediateOrderById(gg_unit_h01A_0015, 'u002')
    elseif i > 20000 then
        call IssueImmediateOrderById(gg_unit_h01A_0015, 'n009')
    elseif i > 15000 then
        call IssueImmediateOrderById(gg_unit_h01A_0015, 'n004')
    elseif i > 12000 then
        call IssueImmediateOrderById(gg_unit_h01A_0015, 'n006')
    elseif i > 10000 then
        call IssueImmediateOrderById(gg_unit_h01A_0015, 'n00B')
    elseif i > 7500 then
        call IssueImmediateOrderById(gg_unit_h01A_0015, 'n003')
    elseif i > 4000 then
        call IssueImmediateOrderById(gg_unit_h01A_0015, 'n002')
    elseif i > 2000 then
        call IssueImmediateOrderById(gg_unit_h01A_0015, 'o000')
    elseif i > 1000 then
        call IssueImmediateOrderById(gg_unit_h01A_0015, 'h01H')
    elseif i > 750 then
        call IssueImmediateOrderById(gg_unit_h00T_0014, 'h01B')
    elseif i > 350 then
        call IssueImmediateOrderById(gg_unit_h00T_0014, 'n007')
    elseif i > 200 then
        call IssueImmediateOrderById(gg_unit_h00T_0014, 'u001')
    elseif i > 160 then
        call IssueImmediateOrderById(gg_unit_h00T_0014, 'n00A')
    elseif i > 100 then
        call IssueImmediateOrderById(gg_unit_h00T_0014, 'n000')
    elseif i > 75 then
        call IssueImmediateOrderById(gg_unit_h00T_0014, 'h00U')
    elseif i > 60 then
        call IssueImmediateOrderById(gg_unit_h00T_0014, 'n005')
    elseif i > 40 then
        call IssueImmediateOrderById(gg_unit_h00T_0014, 'u000')
    elseif i > 22 then
        call IssueImmediateOrderById(gg_unit_h00T_0014, 'u003')
    elseif i > 10 then
        call IssueImmediateOrderById(gg_unit_h00T_0014, 'n00C')
    elseif i > 5 then
        call IssueImmediateOrderById(gg_unit_h00T_0014, 'n00E')
    endif
    call BJDebugMsg("Completed.")
endfunction

//===========================================================================
function InitTrig_AI takes nothing returns nothing
    set gg_trg_AI = CreateTrigger()
    call TriggerRegisterTimerEvent(gg_trg_AI, 1.00, true)
    call TriggerAddAction(gg_trg_AI, function Trig_AI_Actions)
endfunction
 

Flare

Stops copies me!
Reaction score
662
You don't issue the order by rawcode - the ById functions' integer parameter is a 6 (i think) digit figure, you can obtain it for most abilities using OrderId (orderString). If there is an order string, you may as well just use it (just for simplicity, and there wouldn't be a need to acquire an order ID if you alread have a valid order string), but there are some things that are only do-able with ById (I think the Wand of Illusion order requires an order ID)

Anyway, if all the DebugMsg's are displayed, you (probably) can't be hitting the op limit
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
I converted GUI code.
It took the unit raw code as a argument :S

It seems that separating all the if then elses into seperate ones worked however there is now alot more operations and I dont think it is working how I planned it too. :(
 

Naga'sShadow

Ultra Cool Member
Reaction score
49
One does the unit have all the abilities it needs? Two try using UnitIssueOrder() Well actually search first, I may not be giving you the right one. Is this an ability order or a build order? As there is a different command for each of them?
 

Flare

Stops copies me!
Reaction score
662
It took the unit raw code as a argument
What the...? What kind of orders are you giving :confused: - if anything, it'd take an ability rawcode, right?

EDIT: Wait, are you issuing a Train Unit order? Seems like the only logical explanation for the GUI requiring a unit's rawcode :p If you are, have you tried changing the value to the base unit's rawcode i.e. if you based 'h000' off of 'hfoo', then use 'hfoo' as the parameter instead?
 

Exide

I am amazingly focused right now!
Reaction score
448

AdamGriffith

You can change this now in User CP.
Reaction score
69
It seems that separating all the if then elses into seperate ones worked however there is now alot more operations and I dont think it is working how I planned it too. :(

Thanks for the suggestions guys.
It seems that seperating them into seperate if then elses is function correctly anyway so it shouldnt be a problem :)
 

Sooda

Diversity enchants
Reaction score
318
There is limit on 'If/ Then/ Else' actions in function, I don't know exactly, but I guess it was around 27 per function (or 'If/ Then/ Else' block, don't know that exactly also).
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top