Ok, this is my first attempt at doing anything in jass. Basically what i want to do is order all units owned by Player 11 (darkgreen) and order each units to attack the location of a random unit owned by the other force ( allies of red )
Im using jasscraft and the debug errors are just confusing me and i cannot figure it out. Could someone take a look at this code?
Im using jasscraft and the debug errors are just confusing me and i cannot figure it out. Could someone take a look at this code?
JASS:
function kodoattacktarget takes nothing returns nothing
local group origgroup = ForGroupBJ(GetUnitsOfPlayerAll(Player(10)))
local group g = CreateGroup()
call GroupAddGroup(origgroup, g)
loop
local unit u = FirstOfGroup(g)
exitwhen u == null
local unit k = GroupPickRandomUnit(GetUnitsOfPlayerAll(ForcePickRandomPlayer(GetPlayersAllies(Player(0)))))
call IssuePointOrderLocBJ(u , attack , GetUnitLoc(k) )
set unit k = null
call GroupRemoveUnit(g, u)
endloop
call DestroyGroup(g)
endfunction