- Joined
- Dec 1, 2008
- Messages
- 7
I have a small problem when tryign to assign creating Units to unit groups, after the first created unit, the script stops. No further Units are created / and the first is not assigned to a Unit group.
I tried setting each unit to a local variable u and then use the variable to add the unit to the group, with the same result.
All units are spawned properly if the GroupAddUnit are taken out, but obviously they are then not added to a group.
thanks in advance.
I tried setting each unit to a local variable u and then use the variable to add the unit to the group, with the same result.
All units are spawned properly if the GroupAddUnit are taken out, but obviously they are then not added to a group.
JASS:
local group SpawnedGroup
local integer x = GetRandomInt(2, 3)
local integer y = GetRandomInt(0, 1)
local location TmpUnitPoint = GetRandomLocInRect(udg_PirateSpawn[x])
call CreateUnitAtLoc( Player(11), 'h00O', TmpUnitPoint, bj_UNIT_FACING )
call GroupAddUnit(SpawnedGroup, bj_lastCreatedUnit)
call CreateUnitAtLoc( Player(11), 'h00O', TmpUnitPoint, bj_UNIT_FACING )
call GroupAddUnit(SpawnedGroup, bj_lastCreatedUnit )
call CreateUnitAtLoc( Player(11), 'h00O', TmpUnitPoint, bj_UNIT_FACING )
call GroupAddUnit(SpawnedGroup, bj_lastCreatedUnit )
set TmpUnitPoint = GetRandomLocInRect(udg_PirateSpawn[y])
call GroupPointOrderLocBJ( SpawnedGroup, "patrol", TmpUnitPoint )
set TmpUnitPoint = null
set SpawnedGroup = null
thanks in advance.