How to keep vehicles from spawning [Solved]

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
User avatar
StarkillerMarek
Rebel Colonel
Rebel Colonel
Posts: 611
Joined: Wed Aug 12, 2009 4:42 pm
Location: I may be back.

How to keep vehicles from spawning [Solved]

Post by StarkillerMarek »

I have been recently scripting a mission for a map I made, and I was wondering if there was a way to keep vehicles form spawning at the begining of a mission but then spawn at a later time, like the Geonosis mission. I read the campaign script for the Geonosis mission but could not figure out how to do it. Any help would be appreciated.
Xavious
Sith Master
Sith Master
Posts: 2783
Joined: Mon Jun 12, 2006 3:46 pm

Re: How to keep vehicles from spawning

Post by Xavious »

I'd think you could kill the vehicle spawn at the start of the map and respawn it when you wanted vehicles to be available.

For example

Code: Select all

KillObject("VehicleSpawnName")
Then when you wanted it back

Code: Select all

RespawnObject("VehicleSpawnName")
User avatar
StarkillerMarek
Rebel Colonel
Rebel Colonel
Posts: 611
Joined: Wed Aug 12, 2009 4:42 pm
Location: I may be back.

Re: How to keep vehicles from spawning

Post by StarkillerMarek »

I tried that already and it didn't work. Any other suggestions?
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: How to keep vehicles from spawning

Post by Maveritchell »

The easiest way to do it is tie your vehicles to a control region of a command post, kill that command post at the beginning of the mission, and then respawn your command post later. KillObject and RespawnObject don't work on every object, but they do work on CPs.
User avatar
StarkillerMarek
Rebel Colonel
Rebel Colonel
Posts: 611
Joined: Wed Aug 12, 2009 4:42 pm
Location: I may be back.

Re: How to keep vehicles from spawning

Post by StarkillerMarek »

I can't really do that. The control region is tied to a CP that I need.
Is there any other way?
Xavious
Sith Master
Sith Master
Posts: 2783
Joined: Mon Jun 12, 2006 3:46 pm

Re: How to keep vehicles from spawning

Post by Xavious »

Create an invisible CP and associate the control region and vehicle spawns with it, then use Mav's method above.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: How to keep vehicles from spawning

Post by Maveritchell »

StarkillerMarek wrote:I can't really do that. The control region is tied to a CP that I need.
Is there any other way?
Make a second CP? You can always force spawn a vehicle using CreateEntity, but that is not the best solution. What is the exact circumstance you're trying to make happen?
User avatar
StarkillerMarek
Rebel Colonel
Rebel Colonel
Posts: 611
Joined: Wed Aug 12, 2009 4:42 pm
Location: I may be back.

Re: How to keep vehicles from spawning

Post by StarkillerMarek »

Okay I don't want to reveal to much, but the first objective requires the team to defend a certain area for a certain amount of time, then after the timer(and the objective) the vehicles will spawn.

The problem I have with creating a second CP is that my new mode reads the conquest layer(which is where the vehicles and CPs are) and if I change the control zone then the other team during conquest mode cannot stop the other teams vehicles from spawning.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: How to keep vehicles from spawning

Post by Maveritchell »

All you need to do is make a new CP in your layer for spawning units (instead of using that specific CP from conquest). Once you're ready to use the conquest-layer CP, kill the one you've been using and respawn the conquest one. Then you'll be able to spawn units from the objective-mode-only CP before the event and after the event you spawn units from the conquest-CP.
User avatar
StarkillerMarek
Rebel Colonel
Rebel Colonel
Posts: 611
Joined: Wed Aug 12, 2009 4:42 pm
Location: I may be back.

Re: How to keep vehicles from spawning

Post by StarkillerMarek »

I tried what Mav said and it did not work. The CP was changed but the vehicle were still there.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: How to keep vehicles from spawning

Post by Maveritchell »

StarkillerMarek wrote:I tried what Mav said and it did not work. The CP was changed but the vehicle were still there.
Then show us your lua, please, as there's a chance you made an error.
User avatar
StarkillerMarek
Rebel Colonel
Rebel Colonel
Posts: 611
Joined: Wed Aug 12, 2009 4:42 pm
Location: I may be back.

Re: How to keep vehicles from spawning

Post by StarkillerMarek »

But I don't want to reveal the whole mission to everyone, I would rather have vehicles where their not supposed to be then that.
501st_commander
Master Bounty Hunter
Master Bounty Hunter
Posts: 1570
Joined: Wed Dec 10, 2008 7:48 pm

Re: How to keep vehicles from spawning

Post by 501st_commander »

then give us the unit part
User avatar
StarkillerMarek
Rebel Colonel
Rebel Colonel
Posts: 611
Joined: Wed Aug 12, 2009 4:42 pm
Location: I may be back.

Re: How to keep vehicles from spawning

Post by StarkillerMarek »

That doesn't have anything to do with it, does it?
501st_commander
Master Bounty Hunter
Master Bounty Hunter
Posts: 1570
Joined: Wed Dec 10, 2008 7:48 pm

Re: How to keep vehicles from spawning

Post by 501st_commander »

yes it does, but if you have anything wrong with the script part you need to give us the entire lua
User avatar
StarkillerMarek
Rebel Colonel
Rebel Colonel
Posts: 611
Joined: Wed Aug 12, 2009 4:42 pm
Location: I may be back.

Re: How to keep vehicles from spawning

Post by StarkillerMarek »

I figured out a workaround that worked, so I'm good.
Post Reply