gaurding something that is guarding something
Posted: 24 May 2009, 23:16
I've been having some weird problems getting this to work for some reason. There's three units, a bulldog, a warrior, and a lightning tank. The bulldog guards the warrior and the warrior guards the lightning tank. It should be simple but it doesn't work. When the script runs only the warrior is guarding the lightning tank. If that order is commented out (its the second one down) then the bulldog will be guarding the warrior when the script runs. Somehow the order given to the warrior is interfering with the bulldog or something. It doesn't matter what order the commands come in, the end result is the same.
So what might I be doing wrong here?
So what might I be doing wrong here?
Code: Select all
local CreateUnit = Spring.CreateUnit
local GiveOrderToUnit = Spring.GiveOrderToUnit
local AddBuildOrders = Spring.AddBuildOrders
local CreateFeature = Spring.CreateFeature
if (gadgetHandler:IsSyncedCode()) then
if (Game.mapName ~= "Grts_Cookedwell_001.smf") then
gadgetHandler:RemoveGadget()
return
end
local u = {}
local function SpawnShit()
u[461] = CreateUnit("armwar",9190,754.88049316406,1407,0, 0)
u[8638] = CreateUnit("armbull",9209.30078125,754.88049316406,1265.8809814453,0, 0)
u[4968] = CreateUnit("armlatnk",9190,754.88049316406,1546,0, 0)
GiveOrderToUnit(u[8638],25,{u[461],},16)
GiveOrderToUnit(u[461],25,{u[4968],},16)
Spring.MarkerAddPoint( 8674, 756.88049316406, 1444, "HI" )
end
function gadget:GameFrame(n)
if (n == 0) then
SpawnShit()
end
end
end