Ambushing running after a timer has elapsed

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
YaNkFaN
Field Commander
Field Commander
Posts: 943
Joined: Sat Dec 13, 2008 8:17 am

Ambushing running after a timer has elapsed

Post 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]
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: Ambushing running after a timer has elapsed

Post 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.
YaNkFaN
Field Commander
Field Commander
Posts: 943
Joined: Sat Dec 13, 2008 8:17 am

Re: Ambushing running after a timer has elapsed

Post 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>
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: Ambushing running after a timer has elapsed

Post by [RDH]Zerted »

Everywhere you use land as a timer, but it in quotes.
YaNkFaN
Field Commander
Field Commander
Posts: 943
Joined: Sat Dec 13, 2008 8:17 am

Re: Ambushing running after a timer has elapsed

Post 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
501st_commander
Master Bounty Hunter
Master Bounty Hunter
Posts: 1570
Joined: Wed Dec 10, 2008 7:48 pm

Re: Ambushing running after a timer has elapsed

Post by 501st_commander »

i had those same errors. how i fixed them is remove the nodes, clean, replace them, munged.
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: Ambushing running after a timer has elapsed

Post 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.
YaNkFaN
Field Commander
Field Commander
Posts: 943
Joined: Sat Dec 13, 2008 8:17 am

Re: Ambushing running after a timer has elapsed

Post by YaNkFaN »

move the spawn paths really far from from the thing no luck i will try clean and remunge
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: Ambushing running after a timer has elapsed

Post 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.
YaNkFaN
Field Commander
Field Commander
Posts: 943
Joined: Sat Dec 13, 2008 8:17 am

Re: Ambushing running after a timer has elapsed

Post by YaNkFaN »

cleaning and munging worked hmm guess i'll never really figure out why this happened but it's fixed so thanks guys
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Ambushing running after a timer has elapsed

Post 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")).
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: Ambushing running after a timer has elapsed

Post 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.
Post Reply