Units not getting declared

WarLuvr3393

Hmmm...too many things to play (WoW, COD4, WC3)
Reaction score
54
Here's the script that I'm working on:

JASS:
function one takes nothing returns nothing
  local group g= CreateGroup()
  local unit array s
  local integer i= 1
  local destructable d= gg_dest_DTfx_0249
  
  set s[1]=gg_unit_ncop_160
  set s[2]=gg_unit_ncop_162
  set s[3]=gg_unit_ncop_163

  set g = GetUnitsInRectAll(gg_rct_Foot_1)
  if CountUnitsInGroup(g) == 0 then
    call DestructableRestoreLife(d , 100.0 , true)
    loop
      exitwhen i > 3
      if GetOwningPlayer(s<i>) == Player(0) then
        call SetUnitOwner(s<i> , Player(5) , true)
      else
        call SetUnitOwner(s<i> , Player(0) , true)
      endif
      set i = i + 1
    endloop
  else
    call KillDestructable(d)
    loop
      exitwhen i &gt; 3
      if GetOwningPlayer(s<i>) == Player(5) then
        call SetUnitOwner(s<i> , Player(0) , true)
      else
        call SetUnitOwner(s<i> , Player(5) , true)
      endif
      set i = i + 1
    endloop
  endif
  
  call DestroyGroup(g)
  set g = null
endfunction

function two takes nothing returns nothing
endfunction

function three takes nothing returns nothing
endfunction

function four takes nothing returns nothing
endfunction
//===========================================================================
function Init takes nothing returns nothing
  local integer i= 0
  
  loop
    exitwhen i &gt; 4
    set switch<i>=CreateTrigger()
    call TriggerRegisterTimerEvent(switch<i> , 0.03 , true)
    set i = i + 1
  endloop
  
  call TriggerAddAction(switch[1] , function one)
  call TriggerAddAction(switch[2] , function two)
  call TriggerAddAction(switch[3] , function three)
  call TriggerAddAction(switch[4] , function four)
endfunction</i></i></i></i></i></i></i></i>


And this is the error that comes up:

weirdsyntaxgl6.jpg


This is the unit declaration for Player(0):

JASS:
function CreateBuildingsForPlayer0 takes nothing returns nothing
    local player p= Player(0)
    local unit u
    local integer unitID
    local trigger t
    local real life

    set u = CreateUnit(p , &#039;ncop&#039; , - 2560.0 , 512.0 , 270.000)
    set gg_unit_ncop_0160 = CreateUnit(p , &#039;ncop&#039; , - 2560.0 , 640.0 , 270.000)
    set u = CreateUnit(p , &#039;ncop&#039; , - 2560.0 , 768.0 , 270.000)
    set gg_unit_ncop_0162 = CreateUnit(p , &#039;ncop&#039; , - 2560.0 , 896.0 , 270.000)
    set gg_unit_ncop_0163 = CreateUnit(p , &#039;ncop&#039; , - 2560.0 , 1024.0 , 270.000)
    set u = CreateUnit(p , &#039;ncop&#039; , - 2560.0 , 1152.0 , 270.000)
    set u = CreateUnit(p , &#039;ncop&#039; , - 2560.0 , 1280.0 , 270.000)
endfunction


As you can see, they are properly declared however it still gives me the error that they're undeclared.

Any ideas?
 

Romek

Super Moderator
Reaction score
963
gg_unit_ncop_0160 != gg_unit_ncop_160

The names declared aren't the same as what you're using.
That extra '0' does matter.
 

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
Sometimes you need to let the World Editor see it should be in a global.
This is done by creating an action, lets say for example Kill Unit, select the unit and then World Editor changes it into a global.

I don't do pre-placed unit a lot, so I'm not sure if it counts for units, however for destructables it does matter.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top