How create CTF objective? (No game mode)
Moderator: Moderators
-
ForceMaster
- Lieutenant General

- Posts: 737
- Joined: Fri Aug 08, 2008 11:27 pm
- Projects :: Tron The Grid
- xbox live or psn: No gamertag set
- Location: C:\Program Files\ForceMaster\Bin\ForceMaster.exe
How create CTF objective? (No game mode)
Hello friends, I hope not to be annoyed with these questions may be basic.
I need to create a objective of "capture the flag", so far I do not know what code to use in the LUA.
My situation is this:
I have a different flag mnodel, no the conventional flag, is just another geometric object; and i have a different flag carried model.
What code use in the lua? assuming it would be one of several objectives.
and
I just put the "flag" in Zero editor as any model?
thanks guys!
I need to create a objective of "capture the flag", so far I do not know what code to use in the LUA.
My situation is this:
I have a different flag mnodel, no the conventional flag, is just another geometric object; and i have a different flag carried model.
What code use in the lua? assuming it would be one of several objectives.
and
I just put the "flag" in Zero editor as any model?
thanks guys!
- Frisbeetarian
- Jedi

- Posts: 1233
- Joined: Wed Sep 12, 2007 3:13 pm
Re: How create CTF objective? (No game mode)
It would help to check the campaign scripts, many of them have a capture the flag type objective and none of them use the flag mesh. For Geonosis, check the 5th objective.
No, you don't need it in ZE at all.ForceMaster wrote:I just put the "flag" in Zero editor as any model?
-
ForceMaster
- Lieutenant General

- Posts: 737
- Joined: Fri Aug 08, 2008 11:27 pm
- Projects :: Tron The Grid
- xbox live or psn: No gamertag set
- Location: C:\Program Files\ForceMaster\Bin\ForceMaster.exe
Re: How create CTF objective? (No game mode)
ok i understand. only put it in the world/msh folder? or common/msh folder?
- Frisbeetarian
- Jedi

- Posts: 1233
- Joined: Wed Sep 12, 2007 3:13 pm
Re: How create CTF objective? (No game mode)
I think if you just have with the rest of the maps files, it should be fine. That's how Geonosis does it.
When looking at an objective, make sure to check the end of the previous objective:
When looking at an objective, make sure to check the end of the previous objective:
geo1c_c.lua Objective4.OnComplete wrote:Code: Select all
--spawn the flag object for the next objective plans_spawn = GetPathPoint("plans_spawn", 0) --gets the path point CreateEntity("geo1_flag_disk", plans_spawn, "plans") --spawns the flag
-
ForceMaster
- Lieutenant General

- Posts: 737
- Joined: Fri Aug 08, 2008 11:27 pm
- Projects :: Tron The Grid
- xbox live or psn: No gamertag set
- Location: C:\Program Files\ForceMaster\Bin\ForceMaster.exe
Re: How create CTF objective? (No game mode)
ok I need to show the flag just before the start the objective.
but do not know if this flag must be in the folder common / mshs or world / MSH. where it should be the geometry of the flag?
(and thanks my friend)
but do not know if this flag must be in the folder common / mshs or world / MSH. where it should be the geometry of the flag?
(and thanks my friend)
- Frisbeetarian
- Jedi

- Posts: 1233
- Joined: Wed Sep 12, 2007 3:13 pm
Re: How create CTF objective? (No game mode)
Loading through your world folder should be fine.
- Eggman
- Master Bounty Hunter

- Posts: 1516
- Joined: Mon Jul 16, 2007 1:30 pm
- Projects :: Battlefront Chronicles
- Location: Las Vegas
Re: How create CTF objective? (No game mode)
Yup. For example, the flag models/odfs for Felucia's ctf objective are in its world folders.Frisbeetarian wrote:Loading through your world folder should be fine.
-
ForceMaster
- Lieutenant General

- Posts: 737
- Joined: Fri Aug 08, 2008 11:27 pm
- Projects :: Tron The Grid
- xbox live or psn: No gamertag set
- Location: C:\Program Files\ForceMaster\Bin\ForceMaster.exe
Re: How create CTF objective? (No game mode)
ok, i check the scripts for campaing in coruscant, the 4th or 5th objective and the geonosis script.
I'm testing with a holocron of coruscant.
this is my objective now
I add a path for spawn, "holocron_spawn" with a only node "0" in the conquest layer
the objective begins but no spawn the holocron.
I'm testing with a holocron of coruscant.
this is my objective now
Code: Select all
Objective8 = ObjectiveCTF:New{teamATT = ATT, teamDEF = DEF, captureLimit = 1, text = "level.CRP.objectives.campaign.8",
popupText = "level.CRP.objectives.campaign.8popup"}
Objective8:AddFlag{name = "holocron1", captureRegion = "cp6_capture"}
Objective8.OnStart = function (self)
Holocron1Spawn = GetPathPoint("holocron_spawn", 0)
CreateEntity("cor1_item_holocron", Holocron1Spawn, "holocron1")
SetProperty ("holocron1", "AllowAIPickUp", 0)
holocron_capture_on = OnFlagPickUp(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapAddEntityMarker("cp6", "hud_objective_icon_circle", 4.0, ATT, "YELLOW", true)
end
end,
"holocron"
)
holocron_capture_off = OnFlagDrop(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapRemoveEntityMarker("Veranda_CP")
end
end,
"holocron"
)
end
Objective8.OnComplete = function (self)
ShowMessageText("game.objectives.complete", ATT)
ReleaseFlagPickUp(holocron_capture_on)
ReleaseFlagDrop(holocron_capture_off)
MapRemoveEntityMarker("cp6")
DeleteAIGoal(att_obj8_aigoal)
DeleteAIGoal(def_obj8_aigoal)
DeleteAIGoal(def_obj8_aigoal2)
end
the objective begins but no spawn the holocron.
-
theultimat
- Lieutenant General

- Posts: 679
- Joined: Sun Apr 13, 2008 1:39 pm
- Location: UK
Re: How create CTF objective? (No game mode)
I don't know if this is the problem, but in one line you have
But on another line you have
You could try changing so that they ware both the same as the path name in ZE.
Hope that helps.
Code: Select all
holocron_spawnCode: Select all
Holocron_spawnHope that helps.
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
Re: How create CTF objective? (No game mode)
You should always check your debug log.
- Maveritchell
- Jedi Admin

- Posts: 7366
- Joined: Mon Aug 21, 2006 11:03 pm
Re: How create CTF objective? (No game mode)
I am not sure what the above posters meant by "it's ok to load it just through the worlds folder," but you need to do more than just have it in the worlds folder and munge. None of those munged files are compiled into a .lvl file that the game reads unless the .lvl file has a reason to call for them. This means that somewhere, a .req file is going to have to reference your flag, directly or indirectly.
The easiest way to do this will simply be dropping a flag into your map somewhere in an unreachable location, then you can create flags with CreateEntity to your heart's content.
The easiest way to do this will simply be dropping a flag into your map somewhere in an unreachable location, then you can create flags with CreateEntity to your heart's content.
-
ForceMaster
- Lieutenant General

- Posts: 737
- Joined: Fri Aug 08, 2008 11:27 pm
- Projects :: Tron The Grid
- xbox live or psn: No gamertag set
- Location: C:\Program Files\ForceMaster\Bin\ForceMaster.exe
Re: How create CTF objective? (No game mode)
I add this to the .req of the world
but no spawn the holocron
this is the error in Bfront2.log
Code: Select all
REQN
{
"class"
"cor1_item_holocron"
}this is the error in Bfront2.log
Code: Select all
Message Severity: 3
.\Source\LuaHelper.cpp(312)
CallProc failed: (none):0: attempt to call method `AddFlag' (a nil value)
stack traceback:
(none): in function `ScriptPostLoad'-
Xavious
- Sith Master

- Posts: 2783
- Joined: Mon Jun 12, 2006 3:46 pm
Re: How create CTF objective? (No game mode)
Do you have the Capture the Flag script loaded in your campaign?
Code: Select all
ScriptCB_DoFile("ObjectiveCTF")-
ForceMaster
- Lieutenant General

- Posts: 737
- Joined: Fri Aug 08, 2008 11:27 pm
- Projects :: Tron The Grid
- xbox live or psn: No gamertag set
- Location: C:\Program Files\ForceMaster\Bin\ForceMaster.exe
Re: How create CTF objective? (No game mode)
Yes sr.
EDIT:
this is my actual objective
EDIT:
this is my actual objective
Code: Select all
(THIS SECTION AT THE END OF THE PREVIUS OBJECTIVE)
--spawn the flag object for the next objective
plans_spawn = GetPathPoint("holocron_spawn", 0) --gets the path point
CreateEntity("cor1_item_holocron", plans_spawn, "plans") --spawns the flag
--SetProperty("plans", "GeometryName", "cor1_prop_holocron")
--SetProperty("plans", "CarriedGeometryName", "cor1_prop_holocron")
Objective8 = ObjectiveCTF:New{teamATT = ATT, teamDEF = DEF, captureLimit = 1, text = "level.CRP.objectives.campaing.8", popupText = "level.CRP.objectives.campaing.8popup", AIGoalWeight = 0}
Objective5:AddFlag{name = "plans", homeRegion = "", captureRegion = "cp6_capture",
capRegionMarker = "hud_objective_icon", capRegionMarkerScale = 3.0,
mapIcon = "flag_icon", mapIconScale = 2.0}
Objective8.OnStart = function(self)
att_obj8_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj8_aigoal = AddAIGoal(DEF, "Defend", 50, "cp6")
def_obj8_aigoal2 = AddAIGoal(DEF, "Deathmatch", 50)
plans_capture_on = OnFlagPickUp(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapAddEntityMarker("cp6", "hud_objective_icon", 4.0, ATT, "YELLOW", true)
end
end,
"plans"
)
plans_capture_off = OnFlagDrop(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapRemoveEntityMarker("cp6")
end
end,
"plans"
)
end
Objective8.OnComplete = function (self)
ShowMessageText("game.objectives.complete", ATT)
ReleaseFlagPickUp(plans_capture_on)
ReleaseFlagDrop(plans_capture_off)
MapRemoveEntityMarker("cp6")
DeleteAIGoal(att_obj8_aigoal)
DeleteAIGoal(def_obj8_aigoal)
DeleteAIGoal(def_obj8_aigoal2)
end
-
Xavious
- Sith Master

- Posts: 2783
- Joined: Mon Jun 12, 2006 3:46 pm
Re: How create CTF objective? (No game mode)
Why is it Objective5:AddFlag? Shouldn't that be an 8?
-
ForceMaster
- Lieutenant General

- Posts: 737
- Joined: Fri Aug 08, 2008 11:27 pm
- Projects :: Tron The Grid
- xbox live or psn: No gamertag set
- Location: C:\Program Files\ForceMaster\Bin\ForceMaster.exe
Re: How create CTF objective? (No game mode)
EDIT3
IS WORKING!!!
Yes, only need put the memorypool in the LUA.
good, a TENTATIVE tutorial for others modders that want to make a CTF objective in a campaign.
1) Get the .odf, .msh and .tgao f your flag or holocron (i use the cor1_item_holocron) and paste it in the C:\BF2_ModTools\data_XXX\Worlds\XXX\odf and C:\BF2_ModTools\data_XXX\Worlds\XXX\msh folders. (XXX is your map 3 letters name)
2) Go to data_XXX\Worlds\XXX\world1 and open your XXX.REQ file with note pad and ad this lines and save:
3) Open your world in ZE and change the layer to "conquest", then go to "path" and add a new path with only one node where you want. rename your path to holocron_spawn save your world and exit.
4) (Now, if you are working in a campaign for your map I recommend using Mission Scripter, is easy to use.) You need a new LUA for your objectives, change one of these for this code:
(IMPORTANT: This is my 8th objective, you change the "8" in the objective for the number of yours. you change the "cp6" for the CP to receive the flag and "cp6_control" for the name of the CP's control region.)
(THIS SECTION AT THE END OF YOUR PREVIUS OBJECTIVE)
(THIS IS THE OBJECTIVE)
5) now you add this line to the memory pools
6) Munge and play.
It works for me...
Thanks friends.
EDIT4
(please lock this topic)
IS WORKING!!!
Yes, only need put the memorypool in the LUA.
good, a TENTATIVE tutorial for others modders that want to make a CTF objective in a campaign.
1) Get the .odf, .msh and .tgao f your flag or holocron (i use the cor1_item_holocron) and paste it in the C:\BF2_ModTools\data_XXX\Worlds\XXX\odf and C:\BF2_ModTools\data_XXX\Worlds\XXX\msh folders. (XXX is your map 3 letters name)
2) Go to data_XXX\Worlds\XXX\world1 and open your XXX.REQ file with note pad and ad this lines and save:
Code: Select all
REQN
{
"class"
"cor1_item_holocron"
}3) Open your world in ZE and change the layer to "conquest", then go to "path" and add a new path with only one node where you want. rename your path to holocron_spawn save your world and exit.
4) (Now, if you are working in a campaign for your map I recommend using Mission Scripter, is easy to use.) You need a new LUA for your objectives, change one of these for this code:
(IMPORTANT: This is my 8th objective, you change the "8" in the objective for the number of yours. you change the "cp6" for the CP to receive the flag and "cp6_control" for the name of the CP's control region.)
(THIS SECTION AT THE END OF YOUR PREVIUS OBJECTIVE)
Code: Select all
--spawn the flag object for the next objective
plans_spawn = GetPathPoint("holocron_spawn", 0) --gets the path point
CreateEntity("cor1_item_holocron", plans_spawn, "plans") --spawns the flag
--SetProperty("plans", "GeometryName", "cor1_prop_holocron")
--SetProperty("plans", "CarriedGeometryName", "cor1_prop_holocron")Code: Select all
Objective8 = ObjectiveCTF:New{teamATT = ATT, teamDEF = DEF, captureLimit = 1, text = "level.CRP.objectives.campaing.8", popupText = "level.CRP.objectives.campaing.8popup", AIGoalWeight = 0}
Objective8:AddFlag{name = "plans", homeRegion = "", captureRegion = "cp6_capture",
capRegionMarker = "hud_objective_icon", capRegionMarkerScale = 3.0,
mapIcon = "flag_icon", mapIconScale = 2.0}
Objective8.OnStart = function(self)
att_obj8_aigoal = AddAIGoal(ATT, "Deathmatch", 100)
def_obj8_aigoal = AddAIGoal(DEF, "Defend", 50, "cp6")
def_obj8_aigoal2 = AddAIGoal(DEF, "Deathmatch", 50)
plans_capture_on = OnFlagPickUp(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapAddEntityMarker("cp6", "hud_objective_icon", 4.0, ATT, "YELLOW", true)
end
end,
"plans"
)
plans_capture_off = OnFlagDrop(
function(flag, carrier)
if IsCharacterHuman(carrier) then
MapRemoveEntityMarker("cp6")
end
end,
"plans"
)
end
Objective8.OnComplete = function (self)
ShowMessageText("game.objectives.complete", ATT)
ReleaseFlagPickUp(plans_capture_on)
ReleaseFlagDrop(plans_capture_off)
MapRemoveEntityMarker("cp6")
DeleteAIGoal(att_obj8_aigoal)
DeleteAIGoal(def_obj8_aigoal)
DeleteAIGoal(def_obj8_aigoal2)
end
Code: Select all
SetMemoryPoolSize("FlagItem", 2)It works for me...
EDIT4
(please lock this topic)
