AI that cant spawn at CP

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
Lorul1
Rebel Colonel
Rebel Colonel
Posts: 562
Joined: Wed Apr 24, 2013 10:34 pm
Projects :: Assault on Theed
Games I'm Playing :: Battlegrounds
xbox live or psn: No gamertag set
Location: Your House

AI that cant spawn at CP

Post by Lorul1 »

Is there any posible way how to make a certain class not spawn at a command post. For example the jedi class cant spawn at CP3 (because CP3 is a mothership, and i dont want jedi flying planes). Maybe there is something that I need to put in a jedi lua to make them not spawn at a certain CP. and lastly im guessing that if you could do this it would only apply to AI and im fine with that. 8) is there any way this can be done ?
Dreadnot9
Chief Warrant Officer
Chief Warrant Officer
Posts: 341
Joined: Wed Jun 06, 2012 2:05 pm
Projects :: Rising Conflict CW v2.0
Games I'm Playing :: Skyrim TF2 FTL
xbox live or psn: Steam is Dreadnot9

Re: AI that cant spawn at CP

Post by Dreadnot9 »

You could create a third team with solely the jedi units on it, and then give them unique spawn paths (or their own command posts for that matter). This would allow you to easily control where they spawn, while still maintaining the units you desire.
The only issue with this is that you would not be able to spawn as the jedi. If you want to be able to play as your jedi units, then you can't prevent them from spawning at a team-owned cp (to the best of my knowledge). Hope this helped.
User avatar
Locutus
1st Lieutenant
1st Lieutenant
Posts: 420
Joined: Fri Jun 04, 2010 10:08 am
Projects :: Stargate Battlefront Pegasus
Location: Germany
Contact:

Re: AI that cant spawn at CP

Post by Locutus »

I think you can do it via Lua, too.

Place a region around your spawn path at the CP and add sth. like this:

OnCharacterSpawn(
function(character)
if GetCharacterClass(character) == "YOURJEDICLASS" then
checkJediRegion()
end
end
end
)

checkJediRegion()
OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
print("Do nothing because jedi is human")
elseif GetCharacterClass(player) == "YOURJEDICLASS" then
KillObject (player)
end
end,
"YOURREGIONNAME"
)
end


This code kills a Jedi as soon as it's spawned and not controlled by a player.
Everything untested.
THEWULFMAN
Space Ranger
Posts: 5557
Joined: Tue Aug 17, 2010 3:30 pm
Projects :: Evolved 2
Location: Columbus, Ohio
Contact:

Re: AI that cant spawn at CP

Post by THEWULFMAN »

That could work. Another option is to make the Jedi class unplayable by the player, and put them on a local team, spawning on their own CPs which are everywhere but the mothership CP.
User avatar
Lorul1
Rebel Colonel
Rebel Colonel
Posts: 562
Joined: Wed Apr 24, 2013 10:34 pm
Projects :: Assault on Theed
Games I'm Playing :: Battlegrounds
xbox live or psn: No gamertag set
Location: Your House

Re: AI that cant spawn at CP

Post by Lorul1 »

thanks for the ideas. :greeny: Ill see if that script works first, then try the other ideas.
Post Reply