Page 1 of 1

[DEBUG] Set Object Team, CreateEntity

Posted: Wed Oct 28, 2009 8:38 am
by Ace_Azzameen_5
I've got this set up where I have an MTT setup as a command post. It gets blown up, a new one spawns (CreateEntity) at a path node or some other Entity Matrix and is animated into place, subsequently it is set to team 2 (CIS).
Unfortunately I can't get the team to set. Originally the system worked with about 3 pre-placed MTTS but object spaces are at a premium on this map.
Here is (I believe - I'm rusty) the relevant segment of code, the lua file is attached.
Hidden/Spoiler:
[code]CreateTimer("MTTReEnterTimer")

MTTtur1StartMatrix = GetEntityMatrix("mtttur1")
OnObjectKillName(
function()
print("MTT CRASH? 1")
if landerdestroyed ~= 1 then
print("MTT CRASH? 2")
--DeleteEntity("mtttur1")
KillObject("mtttur1")
print("MTT CRASH? 3")
MapRemoveEntityMarker("mtttur1", 1)
MapRemoveEntityMarker("mtttur1", 2)
print("MTT CRASH? 4")
PauseAnimation("MTTEnter")
RewindAnimation("MTTEnter")
CreateEntity("MttTur Cp", MTTtur1StartMatrix, "mtttur1")
-- UpdatePostMapMarker("mtttur1")
-- UpdateState()
PlayAnimation("MTTEnter")
StopTimer("MTTReEnterTimer")
SetTimerValue("MTTReEnterTimer", 18)
StartTimer("MTTReEnterTimer")
ShowMessageText("level.ace.campaigncw.objectives.ArcRescue.onedown", REP)
end
end,
"mtttur1"
)

OnTimerElapse(
function(timer)
cp11 = CommandPost:New{name = "mtttur1"}
SetObjectTeam("mtttur1", 2)
AddAIGoal( 1, "Destroy", 20, "mtttur1")
end,
"MTTReEnterTimer"
)

OnObjectKillName(
function()
ShowMessageText("level.ace.campaigncw.objectives.ArcRescue.onedown", REP)
mtt1destroyed = 1
end,"mtttur"
)

OnTimerElapse(
function(timer)
SetProperty("ace_bldg_bombarder4", "AutoFire", 1)
CreateTimer("BombardDuration")
SetTimerValue("BombardDuration", 15)
StartTimer("BombardDuration")
end,
"TimeTillVenatorBombard"
)

OnTimerElapse(
function(timer)
SetProperty("ace_bldg_bombarder4", "AutoFire", 0)
end,
"BombardDuration"
)

OnObjectKillName(
function()
Area2Victory()
landerdestroyed = 1
end,
"CIS_Lander"
)

Area2Victory = function()
ShowMessageText("level.ace.campaigncw.objectives.ArcRescue.winthisround", REP)
ShowMessageText("level.ace.campaigncw.cisobjectives.ArcPlateau.AreaLost", CIS)
Area3Brief()
PlayAnimation("MTT_Idle")
RespawnObject("cp6cam")
RespawnObject("cp7cam")
RespawnObject("cp4cam")
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp5)
conquest:AddCommandPost(cp6)
if BFXPresent == 1 then --I suppose its safe to have these back, now.
AddUnitClass (2, "cis_inf_commander", 1,4)
AddUnitClass (1, "rep_inf_ep3_commander", 1,4)
end
--Conquer the Caves!
ClearAIGoals(1)
ClearAIGoals(2)
AddAIGoal( 1, "Conquest", 1 );
AddAIGoal( 2, "Conquest",1);
KillObject("cp2cam")
end[/code]
P.S.
mighty Jawa Web Guru, add .lua to allowed extensions for max funtimes.
Now its talking about an attachment quota...xfire me for my LUA....

P.P.S.
Thanks :cpu:

Re: [DEBUG] Set Object Team, CreateEntity

Posted: Wed Oct 28, 2009 6:12 pm
by [RDH]Zerted
Put a print statement inside the timer handler to make sure the set team code is running. Why do you have the cp11 line?