Page 1 of 1
Stop AI from trying to capture a cp?
Posted: Sun Jul 01, 2007 4:41 pm
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.
RE: Stop AI from trying to capture a cp?
Posted: Sun Jul 01, 2007 4:48 pm
by Taivyx
Delete the line:
conquest:AddCommandPost(cp#)
Re: RE: Stop AI from trying to capture a cp?
Posted: Sun Jul 01, 2007 4:50 pm
by theITfactor
Taivyx wrote:Delete the line:
conquest:AddCommandPost(cp#)
never was there in the first place
RE: Re: RE: Stop AI from trying to capture a cp?
Posted: Sun Jul 01, 2007 5:33 pm
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).
RE: Re: RE: Stop AI from trying to capture a cp?
Posted: Sun Jul 01, 2007 6:02 pm
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.
Posted: Sun Jul 01, 2007 6:19 pm
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.
Posted: Mon Jul 02, 2007 1:14 am
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?
Posted: Sat Jul 14, 2007 5:55 am
by computergeek
could you help me with barriers, because I put some in my map and it dosnt stop anything, not even flyers..
:bobba:
Posted: Sat Jul 14, 2007 12:21 pm
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).
Posted: Sat Jul 14, 2007 1:22 pm
by computergeek
ok thanks
:bobba:
Posted: Mon Jul 16, 2007 7:42 pm
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.
Posted: Tue Jul 17, 2007 1:39 pm
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.