System "doesn't work"

Moon_Raven

New Member
Reaction score
8
Ok, so there is no point in posting all triggers involved, after some debugging I found out that after this is executed:
JASS:
//=======================SUMMONS PLAYERS AT START=====================
function Summon takes nothing returns nothing
local integer n = 0
local integer m = 0
local location l
local string e ="Abilities\\Spells\\Items\\TomeOfRetraining\\TomeOfRetrainingCaster.mdl" 
local effect x
loop
exitwhen(n==udg_Num_of_Players)
    set l = GetUnitLoc(udg_Circles_of_Power[n])
    call AddSpecialEffectLoc(e,l)
    set x = bj_lastCreatedEffect
    call CreateUnitAtLoc(udg_PlayersActive[n],'h000',l,90.00)
    set udg_Highlanders[n] = GetLastCreatedUnit()
    set udg_AliveHighlanders = udg_AliveHighlanders + 1
set n = n+1
call RemoveLocation(l)
call DestroyEffect(x)
endloop
call ConditionalTriggerExecute( gg_trg_Set_Players )
call DisplayTextToPlayer(Player(0),0,0,"udg_Num_of_Players = "+I2S(udg_Num_of_Players))
call DisplayTextToPlayer(Player(0),0,0,"udg_AliveHighlanders = "+I2S(udg_AliveHighlanders))
endfunction

When I run this trigger:
Trigger:
  • Debug Bool is highlanderdead
    • Events
      • Player - Player 1 (Red) types a chat message containing debug bool as An exact match
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Highlanders[0] is alive) Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: true
        • Else - Actions
          • Game - Display to (All players) the text: false

The game displays false! OF COURSE the unit is alive, nothing happened to it, it just got summonede and I typed debug bool and it displays false!!! Why does the damn edtor think my poor highlander isn't alive?? :'(
EDIT: FAIL! It doesn't even set the unit to udg_Highlanders[n]! I debuged the game to display the name of udg_Highlanders[0] and it didn't display anything! I don't get it! GetLasteCreatedUnit() works for CreateUnitAtLoc()?
 

Artificial

Without Intelligence
Reaction score
326
JASS:
call CreateUnitAtLoc(udg_PlayersActive[n],'h000',l,90.00)
set udg_Highlanders[n] = GetLastCreatedUnit()

CreateUnitAtLoc doesn't set a value for bj_lastCreatedUnit (which is what GetLastCreatedUnit() returns), only some BJ functions do (the variable is named bj_lastCreatedUnit, after all). So change these lines to this:
JASS:
set udg_Highlanders[n] = CreateUnitAtLoc(udg_PlayersActive[n],'h000',l,90.00)
 
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