Page 1 of 1

Ambushing running after a timer has elapsed

Posted: Fri Aug 07, 2009 3:29 pm
by YaNkFaN
I'm trying to make an ambush run on once a timer and the .lua isn't liking it i've tried just the plain function Ambush() with the right parameters in the "()" so here is my script or the relavent pieces
Hidden/Spoiler:
[code]SetupAmbushTrigger("dropshipambush", "dropship_spawn", 6, dropshipspawn)
DeactivateRegion("dropshipambush")--this part is further up before the objectives are run


Objective2 = ObjectiveAssault:New{teamATT = ATT, teamDEF = DEF, text = "level.IC0.obj.2", popupText = "level.IC0.obj.pop.2"}
Objective2:AddTarget(Mainframe01)
Objective2:AddTarget(Mainframe02)


Objective2.OnSingleTargetDestroyed = function(self, target)
local numTargets = self:GetNumSingleTargets()
if numTargets > 0 then
ShowMessageText(MainframeString .. (numTargets + 1), 1)
ScriptCB_SndPlaySound("MYG_obj_04")
end
end
Objective2.OnStart = function(self)
SetProperty("turret1", "MaxHealth", 1000)
SetProperty("turret1", "CurHealth", 1000)
SetProperty("turret2", "MaxHealth", 1000)
SetProperty("turret2", "CurHealth", 1000)
Objective2.atkGoal1 = AddAIGoal(ATT, "Destroy", 3000, "turret1")
Objective2.atkGoal2 = AddAIGoal(ATT, "Destroy", 3000, "turret2")
Objective2.defGoal1 = AddAIGoal(DEF, "Defend", 3000, "turret1")
Objective2.defGoal2 = AddAIGoal(DEF, "Defend", 3000, "turret2")
ShowMessageText("level.IC0.obj.c2c", 1)
dropship_land = CreateTimer("land")
SetTimerValue(land, 30)

end
Objective2.OnComplete = function(self)
ShowMessageText("game.objectives.complete", ATT)
ShowMessageText("level.IC0.obj.c2c", 1)

PlayAnimationFromTo("dropshipnew",0.0,30)
StartTimer(land)
OnTimerElapse(
function(timer)
ActivateRegion("dropshipambush")
ShowTimer(nil)
end,
land
)


--Deleting Goals

DeleteAIGoal(Objective2.atkGoal1)
DeleteAIGoal(Objective2.atkGoal2)
DeleteAIGoal(Objective2.defGoal1)
DeleteAIGoal(Objective2.defGoal2)
ATT_ReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, ATT_ReinforcementCount + 20)
if self.winningTeam == DEF then
ScriptCB_SndPlaySound("MYG_obj_15")
else
ScriptCB_SndPlaySound("MYG_obj_18")
end
end[/code]

Re: Ambushing running after a timer has elapsed

Posted: Fri Aug 07, 2009 4:27 pm
by Frisbeetarian
YaNkFaN wrote:I've tried just the plain function Ambush()
Ambush.lua wrote:--Designers: use this function to set up an ambush (don't call Ambush() directly, please)
To help you with your current script, could you post the whole thing; I need to know what "dropshipspawn" is.

Re: Ambushing running after a timer has elapsed

Posted: Fri Aug 07, 2009 4:44 pm
by YaNkFaN
o sorry about that

--Ambushstuff--
dropshipspawn =3
DRP=dropshipspawn

it just sets up the ambush team so in this function

SetupAmbushTrigger("dropshipambush", "dropship_spawn", 6, dropshipspawn)

dropshipambush=region in ZE
dropship_spawn=spawn path in ZE
6= number of dudes being spawned=number of path nodes
dropshipspawn=name of team they are being spawned from

also here is the error bf is popping out

Message Severity: 3
.\Source\LuaHelper.cpp(312)
CallProc failed: bad argument #2 to `OnTimerElapse' (string expected, got nil)
stack traceback:
[C]: in function `OnTimerElapse'
(none): in function `OnComplete'
(none): in function <(none):274>

Re: Ambushing running after a timer has elapsed

Posted: Fri Aug 07, 2009 5:36 pm
by [RDH]Zerted
Everywhere you use land as a timer, but it in quotes.

Re: Ambushing running after a timer has elapsed

Posted: Fri Aug 07, 2009 5:56 pm
by YaNkFaN
it fixed the error but still no dudes

there's also this error could that mean that the dropship is on top of the spawn paths (it looks like a vehicle spawn in ZE so i can't really tell and that the dudes are unable to spawn



Message Severity: 2
.\Source\ConnectivityGraphFollower.cpp(382)
No valid positions for type [SOLDIER] radius [0.24] in node [Hub92]

Message Severity: 2
.\Source\ConnectivityGraphFollower.cpp(382)
No valid positions for type [SOLDIER] radius [0.48] in node [Hub92]
release self.dittyTimerResponse

Re: Ambushing running after a timer has elapsed

Posted: Fri Aug 07, 2009 6:57 pm
by 501st_commander
i had those same errors. how i fixed them is remove the nodes, clean, replace them, munged.

Re: Ambushing running after a timer has elapsed

Posted: Fri Aug 07, 2009 7:00 pm
by Frisbeetarian
YaNkFaN wrote:there's also this error could that mean that the dropship is on top of the spawn paths
Then move the spawn path.

Re: Ambushing running after a timer has elapsed

Posted: Fri Aug 07, 2009 7:07 pm
by YaNkFaN
move the spawn paths really far from from the thing no luck i will try clean and remunge

Re: Ambushing running after a timer has elapsed

Posted: Fri Aug 07, 2009 7:29 pm
by Frisbeetarian
Sorry, I didn't read those errors you put. Those look like planning errors, though they may be something else. Note that it was suggested to remove the nodes, not just move them by someone else. That could work, though, as mentioned, they may be totally unrelated. Once you clean, post the entire BFront2.log (throw away errors edited out of course) if it still doesn't work.

Re: Ambushing running after a timer has elapsed

Posted: Fri Aug 07, 2009 8:32 pm
by YaNkFaN
cleaning and munging worked hmm guess i'll never really figure out why this happened but it's fixed so thanks guys

Re: Ambushing running after a timer has elapsed

Posted: Fri Aug 07, 2009 8:33 pm
by Maveritchell
You set up your timer wrong. Please post the scriptpostload of your lua.

Edit: Oh wait I suppose you did. Change every instance of "land" (in reference to your timer) to "dropship_land" (no quotes), except for the one that is already in quotes (CreateTimer("land")).

Re: Ambushing running after a timer has elapsed

Posted: Sat Aug 08, 2009 12:19 am
by Frisbeetarian
Maveritchell wrote:Change every instance...
YaNkFaN wrote:but it's fixed so thanks guys
I think that it's fine how he has it.