[Tutorial] Adding captureable command posts to your CTF mode
Posted: Tue Nov 17, 2009 7:48 pm
This doesn't seem like an extremely simple procedure to me, and I don't see any other tutorials on the subject, so here goes. I am assuming that you are familiar with the usage of ZE in writing this tutorial.
First, on your map in ZeroEditor, make sure you're in the ctf layer.
Find one CP that should be capturable, and change its Capture Reigon on the right of the window to cpX_capture (X being the number of the CP) Next, create a new reigon and name it cpX_capture and make its property cpX_capture, and position it where you want your CPs capture reigon to be. Now, repeat this process for every CP you want capturable.
This is all fine and dandy; you are able to capture the CPs when you play on the map. However, the AI will not even try to capture them. Now you need to make the AI realize that there are some CPS, ripe for the taking.
So now you need to go to your DATA_ABC\Common\Scripts\ABC folder and find ABCc_ctf.lua
The first several lines of the file will look like this:
But our focus is on these lines:
It's difficult to explain well what needs to be done, so here's an example, where CPs 1 and 2 are uncapturable (these are home CPs, this is CTF, after all) and CPs 3 and 4 can be captured.
As you can see, you must add the lines
for each CP
And these lines next
and then these
for each CP.
Note that, though the AI will go for the CPs using this, the flags seem to be a bit more of a priority.
First, on your map in ZeroEditor, make sure you're in the ctf layer.
Find one CP that should be capturable, and change its Capture Reigon on the right of the window to cpX_capture (X being the number of the CP) Next, create a new reigon and name it cpX_capture and make its property cpX_capture, and position it where you want your CPs capture reigon to be. Now, repeat this process for every CP you want capturable.
This is all fine and dandy; you are able to capture the CPs when you play on the map. However, the AI will not even try to capture them. Now you need to make the AI realize that there are some CPS, ripe for the taking.
So now you need to go to your DATA_ABC\Common\Scripts\ABC folder and find ABCc_ctf.lua
The first several lines of the file will look like this:
Hidden/Spoiler:
Code: Select all
function ScriptPostLoad()
SoundEvent_SetupTeams( REP, 'rep', CIS, 'cis' )
SetProperty("flag1", "GeometryName", "com_icon_republic_flag")
SetProperty("flag1", "CarriedGeometryName", "com_icon_republic_flag_carried")
SetProperty("flag2", "GeometryName", "com_icon_cis_flag")
SetProperty("flag2", "CarriedGeometryName", "com_icon_cis_flag_carried")
--This makes sure the flag is colorized when it has been dropped on the ground
SetClassProperty("com_item_flag", "DroppedColorize", 1)
--This is all the actual ctf objective setup
ctf = ObjectiveCTF:New{teamATT = REP, teamDEF = CIS, captureLimit = 5, textATT = "game.modes.ctf", textDEF = "game.modes.ctf2", hideCPs = true, multiplayerRules = true}
ctf:AddFlag{name = "flag1", homeRegion = "team1_capture", captureRegion = "team2_capture",
capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0,
icon = "", mapIcon = "flag_icon", mapIconScale = 3.0}
ctf:AddFlag{name = "flag2", homeRegion = "team2_capture", captureRegion = "team1_capture",
capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0,
icon = "", mapIcon = "flag_icon", mapIconScale = 3.0}
ctf:Start()
EnableSPHeroRules()
endIt's difficult to explain well what needs to be done, so here's an example, where CPs 1 and 2 are uncapturable (these are home CPs, this is CTF, after all) and CPs 3 and 4 can be captured.
Code: Select all
function ScriptPostLoad()
SoundEvent_SetupTeams( REP, 'rep', CIS, 'cis' )
SetProperty("flag1", "GeometryName", "com_icon_republic_flag")
SetProperty("flag1", "CarriedGeometryName", "com_icon_republic_flag_carried")
SetProperty("flag2", "GeometryName", "com_icon_cis_flag")
SetProperty("flag2", "CarriedGeometryName", "com_icon_cis_flag_carried")
--This makes sure the flag is colorized when it has been dropped on the ground
SetClassProperty("com_item_flag", "DroppedColorize", 1)
--This is all the actual ctf objective setup
ctf = ObjectiveCTF:New{teamATT = REP, teamDEF = CIS, captureLimit = 5, textATT = "game.modes.ctf", textDEF = "game.modes.ctf2", hideCPs = true, multiplayerRules = true}
ctf:AddFlag{name = "flag1", homeRegion = "team1_capture", captureRegion = "team2_capture",
capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0,
icon = "", mapIcon = "flag_icon", mapIconScale = 3.0}
ctf:AddFlag{name = "flag2", homeRegion = "team2_capture", captureRegion = "team1_capture",
capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0,
icon = "", mapIcon = "flag_icon", mapIconScale = 3.0}
--This defines the CPs. These need to happen first
cp3 = CommandPost:New{name = "ctf_cp3"}
cp4 = CommandPost:New{name = "ctf_cp4"}
--This sets up the actual objective. This needs to happen after cp's are defined
ctf = Objectivectf: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
ctf:AddCommandPost(cp3)
ctf:AddCommandPost(cp4)
ctf:Start()
EnableSPHeroRules()
endCode: Select all
cp3 = CommandPost:New{name = "ctf_cp3"}
cp4 = CommandPost:New{name = "ctf_cp4"}And these lines next
Code: Select all
ctf = Objectivectf:New{teamATT = ATT, teamDEF = DEF,
textATT = "game.modes.con",
textDEF = "game.modes.con2",
multiplayerRules = true}Code: Select all
ctf:AddCommandPost(cp3)
ctf:AddCommandPost(cp4) Note that, though the AI will go for the CPs using this, the flags seem to be a bit more of a priority.