Stop AI from trying to capture a 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
theITfactor
Chief Warrant Officer
Chief Warrant Officer
Posts: 327
Joined: Wed Jun 28, 2006 12:56 pm
Projects :: The Pwnfest and Games Complex
Games I'm Playing :: SWTOR
xbox live or psn: You and I Know
Location: The Old Republic
Contact:

Stop AI from trying to capture a cp?

Post by theITfactor »

How can I stop my AI from trying to capture a cp?

I tried hubs and connections, tried adding
AICanCaptureCP("cp9", ATT, false)
AICanCaptureCP("cp9", DEF, false)

and tried adding barriers but they still try to reach it.
Taivyx
2008 Best Games Related Avatar
Posts: 1706
Joined: Thu Jun 07, 2007 3:34 pm
Projects :: Terra Strife - discontinued
Games I'm Playing :: none
xbox live or psn: No gamertag set
Contact:

RE: Stop AI from trying to capture a cp?

Post by Taivyx »

Delete the line:
conquest:AddCommandPost(cp#)
theITfactor
Chief Warrant Officer
Chief Warrant Officer
Posts: 327
Joined: Wed Jun 28, 2006 12:56 pm
Projects :: The Pwnfest and Games Complex
Games I'm Playing :: SWTOR
xbox live or psn: You and I Know
Location: The Old Republic
Contact:

Re: RE: Stop AI from trying to capture a cp?

Post by theITfactor »

Taivyx wrote:Delete the line:
conquest:AddCommandPost(cp#)
never was there in the first place
User avatar
trainmaster611
Sith Lord
Sith Lord
Posts: 1779
Joined: Thu Aug 24, 2006 5:22 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Building a railway to Coruscant
Contact:

RE: Re: RE: Stop AI from trying to capture a cp?

Post by trainmaster611 »

--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("setup_teams")

-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;


function ScriptPostLoad()


--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}



--This sets up the actual objective. This needs to happen after cp's are defined
conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF,
textATT = "game.modes.con",
textDEF = "game.modes.con2",
multiplayerRules = true}

--This adds the CPs to the objective. This needs to happen after the objective is set up
conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp2)
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)


conquest:Start()

EnableSPHeroRules()

end

See the part I bolded? THats where you are supposed to list the cps that are set as objectives for the AI (and possibly player).

If you don't want AI to capture, lets say cp2, then you delete the cp2 line out of the bolded section. The cp will still be capturable but the AI won't try to capture it and it won't be worth any points to capture (including player).
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: Re: RE: Stop AI from trying to capture a cp?

Post by [RDH]Zerted »

Both of you are assuming theITfactor is making a conquest map and removing conquest:AddCommandPost() won't prevent the AI from captuing it anyway. It only prevents the CP from being counted towards bleed values, towards the final victory countdown, and a few other minor things.

I would have recommended AICanCaptureCP(), but I also have noticed it doesn't seem to affect anything. You can mess around with AI goals, but we would need more info about your map and what exactly you are trying to do before I can tell if it would be ok for your map.

As a last resort, you can use OnEnterRegion to kill any AI who enters the CP's capture region.
theITfactor
Chief Warrant Officer
Chief Warrant Officer
Posts: 327
Joined: Wed Jun 28, 2006 12:56 pm
Projects :: The Pwnfest and Games Complex
Games I'm Playing :: SWTOR
xbox live or psn: You and I Know
Location: The Old Republic
Contact:

Post by theITfactor »

I have five main cps that I want the AI to try and capture. I have a 6th cp far away that is for quick access to the hidden areas of my map, ie only for player use that I don't want AI to try and get.

Invisible cps I tried first but they didn't work online, so I'm trying a normal cp but I don't want AI to go after it.
User avatar
jangoisbaddest
Lieutenant General
Lieutenant General
Posts: 661
Joined: Mon Feb 27, 2006 12:10 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: All Along The Watchtower

Post by jangoisbaddest »

Stop me if I'm wrong, but can't you just surround the CP completely with Barriers, then set the AI spawn weight for that CP to 0?
computergeek
General
General
Posts: 770
Joined: Thu Jun 07, 2007 6:26 pm
Projects :: Halo Warthog vehicle for SWBF2
Games I'm Playing :: Bioware RPGs - Halo
xbox live or psn: No gamertag set
Location: Far Far away....

Post by computergeek »

could you help me with barriers, because I put some in my map and it dosnt stop anything, not even flyers..
:bobba:
User avatar
jangoisbaddest
Lieutenant General
Lieutenant General
Posts: 661
Joined: Mon Feb 27, 2006 12:10 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: All Along The Watchtower

Post by jangoisbaddest »

It probably doesn't stop flyers because you didn't select flyers when you placed the barrier. Look off to the side - there should be six selectable types of units that the barrier will affect. Whatever is highlighted (ex: flyer, soldier) is what the barrier will stop (note: barriers prevent AI from taking a path to a CP that you don't want (ex off a cliff); they have no effect on anything else).
computergeek
General
General
Posts: 770
Joined: Thu Jun 07, 2007 6:26 pm
Projects :: Halo Warthog vehicle for SWBF2
Games I'm Playing :: Bioware RPGs - Halo
xbox live or psn: No gamertag set
Location: Far Far away....

Post by computergeek »

ok thanks
:bobba:
theITfactor
Chief Warrant Officer
Chief Warrant Officer
Posts: 327
Joined: Wed Jun 28, 2006 12:56 pm
Projects :: The Pwnfest and Games Complex
Games I'm Playing :: SWTOR
xbox live or psn: You and I Know
Location: The Old Republic
Contact:

Post by theITfactor »

jangoisbaddest wrote:Stop me if I'm wrong, but can't you just surround the CP completely with Barriers, then set the AI spawn weight for that CP to 0?
Would that work if the cp is really far away from the rest of the battle?

The four cps the ai spawn from at the start are really far from the fifth one, the one i dont want them to capture.
User avatar
jangoisbaddest
Lieutenant General
Lieutenant General
Posts: 661
Joined: Mon Feb 27, 2006 12:10 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: All Along The Watchtower

Post by jangoisbaddest »

Unless the CPs in question overlap (since pathing and barriers are 2D), it should make no difference - in fact, I believe the AI is set up so that they go for the closest enemy/neutral CP, then plan a path to that CP following the pathing and avoiding the barriers. If a CP is surrounded by barriers, that leaves no way for the AI to navigate to that command post. I haven't tested this method, but it should work, logically - just make sure there are no gaps. Also, setting the AI spawn weight to 0 DOES work, as I have indeed used spawn weights successfully numerous times.
Post Reply