Add "Dark Times II" modes to your own map/mod

Discussion, progress updates, and downloads for the Dark Times and Rising Son mods.

Moderator: Moderators

Jedi Admin
User avatar
Posts: 7384
Joined: Mon Aug 21, 2006 11:03 pm

Add "Dark Times II" modes to your own map/mod

Postby Maveritchell » Sat Jun 11, 2011 10:43 am

Here is the pertinent information if you want to add either "wave" mode, "control" mode, or "VIP" mode to your map/mod. All of the following makes some basic assumptions; namely, you are familiar with how to add new modes to a previously-created map. Adding wave mode will require intermediate-level scripting knowledge.

Adding VIP Mode to your map:

1) Download "ObjectiveVIP.lua"

2) Put "ObjectiveVIP.lua" into your "data_MODID\common\scripts" folder

3) Add "ObjectiveVIP" to the "scripts" section of your mission.req (located in "data_MODID\common" folder):
Hidden/Spoiler:
Code: Select all
    REQN
    {
        "script"
        "setup_teams"
        "gametype_conquest"
        "gametype_capture"
        "Objective"
        "MultiObjectiveContainer"
        "ObjectiveCTF"
        "ObjectiveAssault"
        "ObjectiveSpaceAssault"
        "ObjectiveConquest"
        "ObjectiveTDM"
        "ObjectiveOneFlagCTF"
   "SoundEvent_ctf"
        "ObjectiveGoto"       
        "LinkedShields"
        "LinkedDestroyables"
        "LinkedTurrets"
        "Ambush"
        "PlayMovieWithTransition"
   "TFURandom"
   "AIHeroSupport"
   "ObjectiveControl"
   "ObjectiveVIP"
   "ObjectiveHints"
    }


4) Create a script for that mode (I use a script with the "_ins" suffix, e.g. "CCR1_ins"). You will need to add your script to your mission.req, you will need to create a .req file for it (in the "data_MODID\common\mission" folder), and you will need to add it to the addme.lua - see tutorials on "how to add a game mode" for more detail.

4.1) If you want to use the _ins suffix, note that this will not immediately localize to "VIP" mode, as the 1.3 patch doesn't support something called "VIP" natively. You are free to use the "dtshell.lvl" from Dark Times II to load in the necessary data (see the 1.3 patch documentation). The code for this in your addme.lua will look like this:
Hidden/Spoiler:
Code: Select all
sp_n = table.getn(sp_missionselect_listbox_contents)
sp_missionselect_listbox_contents[sp_n+1] = { red = 251, blue = 59, green = 224, isModLevel = 1, mapluafile = "SJC%s_%s", era_1 = 1, mode_con_1 = 1, mode_ctrl_1 = 1, mode_ins_1 = 1, mode_eli_1 = 1, change = {
      era_1 = { name="Dark Times", icon2="darktimes_icon" }, mode_ins = { name="V.I.P.", icon="vip_icon", about="Protect the leader - or hunt him down!" },
      },}


5) In your MODIDera_ins script (e.g. cor1g_ins), make the section above ScriptInit look like this (the whole upper half of the .lua file - this is designed to be extensible, so this part should be easy):
Hidden/Spoiler:
Code: Select all
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveVIP")
ScriptCB_DoFile("TFURandom")

   --  Empire Attacking (attacker is always #1)
    ALL = 2
    IMP = 1
    --  These variables do not change
    ATT = 1
    DEF = 2
   
function ScriptPostLoad()

    SetProperty("cp4", "team", 1)
    SetProperty("cp6", "team", 2)

    ObjectiveVIPSetup(2, 3, 80)
    ObjectiveVIPAddSpawnCP("cp1","cp1_spawn")
    ObjectiveVIPAddSpawnCP("cp2","cp2_spawn")
    ObjectiveVIPAddSpawnCP("cp3","cp3_spawn")
    ObjectiveVIPAddSpawnCP("cp4","cp4_spawn")
    ObjectiveVIPAddSpawnCP("cp5","cp5_spawn")
    ObjectiveVIPAddSpawnCP("cp6","cp6_spawn")
    ObjectiveVIPStart()

    SetProperty("cp1", "captureregion", " ")
    SetProperty("cp2", "captureregion", " ")
    SetProperty("cp3", "captureregion", " ")
    SetProperty("cp4", "captureregion", " ")
    SetProperty("cp5", "captureregion", " ")
    SetProperty("cp6", "captureregion", " ")

   EnableSPHeroRules()


 end


---------------------------------------------------------------------------
-- FUNCTION:    ScriptInit
-- PURPOSE:     This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES:       The name, 'ScriptInit' is a chosen convention, and each
--              mission script must contain a version of this function, as
--              it is called from C to start the mission.
---------------------------------------------------------------------------

A couple notes:
-You are going to need to make sure none of your CPs can be captured (the "SetProperty"s that kill the capture regions do this)
-You will need to load in all your CPs as "VIP CPs" and their spawn paths (as seen above)
-The "ObjectiveVIPSetup" line loads in these parameters: first, the team that will always be the "Defending" team online (no random effects online, offline games are random), second, the number of "Defending" reinforcements (number of times the hero needs to be killed), and third, the number of "Attacking" reinforcements

6) You need to set up your "SetupTeams" section in the script this way:
Hidden/Spoiler:
Code: Select all
   ReadDataFile("dc:SIDE\\dark.lvl",
               "all_hero_bail",
                    allsoldier,
                    allheavy,
                    allmarksman,
                    "all_inf_moncaleng",
                    allsupport,
                    bothan,
               impsoldier,
               impmarksman,
               impheavy,
               "imp_inf_gunner",
               impsupport,
               "imp_inf_commando",
               "imp_inf_jumptrooper",
               supportstrAll,
               supportstrEmp)

    ReadDataFile("dc:SIDE\\lead.lvl",
               herostrAll,
               herostrEmp)

   defendingunits = 25

   SetupTeams{
      all = {
         team = ALL,
         units = defendingunits,
         reinforcements = 150,
         soldier   = { allsoldier,9, 25},
         assault   = { allheavy,1,4},
         engineer = { "all_inf_moncaleng",1,4},
         sniper   = { allmarksman,1,4},
         officer   = { allsupport,1,4},
         special   = { bothan,1,4},

      },
      imp = {
         team = IMP,
         units = defendingunits,
         reinforcements = 150,
         soldier   = { impsoldier,9, 25},
         assault   = { impheavy,1,4},
         engineer = { "imp_inf_gunner",1,4},
         sniper   = { impmarksman,1,4},
         officer   = { impsupport,1,4},
         special   = { "imp_inf_jumptrooper",1,4},
      },

   }




   AddUnitClass(IMP, supportstrEmp, 1, 4)
   AddUnitClass(ALL, supportstrAll, 1, 4)

   VIPHeroALL = herostrAll
   VIPHeroIMP = herostrEmp

   SetTeamName(3, "all")
      --AddUnitClass (4, ControlHeroALL, 1, 1)
      SetUnitCount (3, 1)
      --first number is numteam, second is numunits
      AddAIGoal(3, "Deathmatch", 100)
      
   SetTeamAsNeutral(1,3)
      SetTeamAsNeutral(3,1)
      SetTeamAsNeutral(2,3)
      SetTeamAsNeutral(3,2)      

    --  Level Stats
    ClearWalkers()
    AddWalkerType(0, 0) -- special -> droidekas
    AddWalkerType(1, 0) -- 1x2 (1 pair of legs)
    AddWalkerType(2, 0) -- 2x2 (2 pairs of legs)
    AddWalkerType(3, 0) -- 3x2 (3 pairs of legs)

A few notes:
-Note the presence of the "defendingunits" variable - this should pretty much always be "25" (that's what the mode is balanced for), but I left the option open to the user to modify this: this is the number of units on the defending team (the number of units on the attacking team is modified in the Objective script, and there are some other things done with it).
-Note that the heroes are not loaded with AddHeroClass(Unit?) - they use the variable "VIPheroTEAM."

-----------------------------------------------------------------------------------------------------------

Adding Control Mode to your map:

Control Mode ZE setup

1) This is important! Control mode needs to use its own special layer. Download com.zip and extract its contents (the folder "com") directly into your world1 folder. There should now be a "com" folder in your world1 along with your "odf," "msh," etc. folders.

2) Create a layer (see the "adding hunt" tutorial for how to set up a layer appropriately for use in a new mode) called "control." You are going to set up two types of CPs in this layer - team spawn CPs and control CPs.

3) Create a set of regular uncapturable CPs to spawn from (just like in hero assault) - I call them "ctrl_cp#," but you can call them whatever you like. These will be the CPs you choose to spawn from and do not contribute to the control count.

4) Create your control CPs by using either the "com_bldg_controlcp" object or the "com_bldg_controlcp_small" (the latter is for areas where the antenna would clip through geometry). These must follow the following naming conventions! Each of the control CPs should be named "control_#". Each control CP should have a capture region named "controlreg_#".

5) Create the hero spawn paths for the control CPs - these are not spawn paths assigned to the CPs! These are separate, single-node paths named "control_#_spawn" that should be placed very near the control CP object.

6) Save your layer and munge. Remember to load it in the script:
Hidden/Spoiler:
Code: Select all
    SetSpawnDelay(10.0, 0.25)
    ReadDataFile("dc:CCR\\CCR.lvl", "CCR_conquest")


Control Mode script setup

1) Download "ObjectiveControl.lua"

2) Put "ObjectiveControl.lua" into your "data_MODID\common\scripts" folder

3) Add "ObjectiveControl" to the "scripts" section of your mission.req (located in "data_MODID\common" folder):
Hidden/Spoiler:
Code: Select all
    REQN
    {
        "script"
        "setup_teams"
        "gametype_conquest"
        "gametype_capture"
        "Objective"
        "MultiObjectiveContainer"
        "ObjectiveCTF"
        "ObjectiveAssault"
        "ObjectiveSpaceAssault"
        "ObjectiveConquest"
        "ObjectiveTDM"
        "ObjectiveOneFlagCTF"
   "SoundEvent_ctf"
        "ObjectiveGoto"       
        "LinkedShields"
        "LinkedDestroyables"
        "LinkedTurrets"
        "Ambush"
        "PlayMovieWithTransition"
   "TFURandom"
   "AIHeroSupport"
   "ObjectiveControl"
   "ObjectiveVIP"
   "ObjectiveHints"
    }


4) Create a script for that mode with the "_ctrl" suffix, e.g. "CCR1_ctrl". You will need to add your script to your mission.req, you will need to create a .req file for it (in the "data_MODID\common\mission" folder), and you will need to add it to the addme.lua - see tutorials on "how to add a game mode" for more detail.

5) In your MODIDera_ctrl script (e.g. cor1g_ctrl), make the section above ScriptInit look like this (the whole upper half of the .lua file - this is designed to be extensible, so this part should be easy):
Hidden/Spoiler:
Code: Select all
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveControl")
ScriptCB_DoFile("TFURandom")

   --  Empire Attacking (attacker is always #1)
    ALL = 2
    IMP = 1
    --  These variables do not change
    ATT = 1
    DEF = 2
   
function ScriptPostLoad()

    SetProperty("ctrl_cp3", "team", 2)
    SetProperty("ctrl_cp4", "team", 1)

    PlayControl(5)

   EnableSPHeroRules()


 end


---------------------------------------------------------------------------
-- FUNCTION:    ScriptInit
-- PURPOSE:     This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES:       The name, 'ScriptInit' is a chosen convention, and each
--              mission script must contain a version of this function, as
--              it is called from C to start the mission.
---------------------------------------------------------------------------

A couple notes:
-You may want to make sure that each team has one control CP when they start(as assigned above - this is your choice)
-The "PlayControl" line loads in the total number of command posts loaded in your "control" layer in ZE.

6) You need to set up your "SetupTeams" section in the script this way:
Hidden/Spoiler:
Code: Select all
   ReadDataFile("dc:SIDE\\dark.lvl",
               "all_hero_bail",
                    allsoldier,
                    allheavy,
                    allmarksman,
                    "all_inf_moncaleng",
                    allsupport,
                    bothan,
               impsoldier,
               impmarksman,
               impheavy,
               "imp_inf_gunner",
               impsupport,
               "imp_inf_commando",
               "imp_inf_jumptrooper",
               supportstrAll,
               supportstrEmp)

    ReadDataFile("dc:SIDE\\lead.lvl",
               herostrAll,
               herostrEmp)

   -----------------------
   --Manhunt Classes Setup
   -----------------------

   ALLsoldierclass = allsoldier
   ALLassaultclass = allheavy
   ALLsniperclass =  allmarksman
   IMPsoldierclass = impsoldier
   IMPassaultclass = impheavy
   IMPsniperclass =  impmarksman
   IMPsupportclass = supportstrEmp

   ALLengineerclass = "all_inf_moncaleng"
   ALLofficerclass = allsupport
   ALLspecialclass =  bothan
   IMPengineerclass = "imp_inf_gunner"
   IMPofficerclass = impsupport
   IMPspecialclass =  "imp_inf_jumptrooper"
   ALLsupportclass = supportstrAll

   -----------------------------
   --Use the above classes below
   -----------------------------


   SetupTeams{
      all = {
         team = ALL,
         units = 20,
         reinforcements = 90,
         soldier   = { ALLsoldierclass,9, 25},
         assault   = { ALLassaultclass,1,4},
         engineer = {ALLengineerclass,1,4},
         sniper   = { ALLsniperclass,1,4},
         officer   = { ALLofficerclass,1,4},
         special   = { ALLspecialclass,1,4},

      },
      imp = {
         team = IMP,
         units = 20,
         reinforcements = 90,
         soldier   = { IMPsoldierclass,9, 25},
         assault   = { IMPassaultclass,1,4},
         engineer = { IMPengineerclass,1,4},
         sniper   = { IMPsniperclass,1,4},
         officer   = { IMPofficerclass,1,4},
         special   = { IMPspecialclass,1,4},
      },

   }

   AddUnitClass(IMP, IMPsupportclass, 1, 4)
   AddUnitClass(ALL, ALLsupportclass, 1, 4)
   
if ScriptCB_InMultiplayer() then
   SetClassProperty(ALLsoldierclass, "AddShield", 1.0)
   SetClassProperty(ALLsoldierclass, "MaxShield", 1)
   SetClassProperty(ALLassaultclass, "AddShield", 1.0)
   SetClassProperty(ALLassaultclass, "MaxShield", 1)
   SetClassProperty(ALLsniperclass, "AddShield", 1.0)
   SetClassProperty(ALLsniperclass, "MaxShield", 1)
   SetClassProperty(ALLengineerclass, "AddShield", 1.0)
   SetClassProperty(ALLengineerclass, "MaxShield", 1)
   SetClassProperty(ALLofficerclass, "AddShield", 1.0)
   SetClassProperty(ALLofficerclass, "MaxShield", 1)
   SetClassProperty(ALLspecialclass, "AddShield", 1.0)
   SetClassProperty(ALLspecialclass, "MaxShield", 1)
   SetClassProperty(ALLsupportclass, "AddShield", 1.0)
   SetClassProperty(ALLsupportclass, "MaxShield", 1)
   SetClassProperty(IMPsoldierclass, "AddShield", 1.0)
   SetClassProperty(IMPsoldierclass, "MaxShield", 1)
   SetClassProperty(IMPassaultclass, "AddShield", 1.0)
   SetClassProperty(IMPassaultclass, "MaxShield", 1)
   SetClassProperty(IMPsniperclass, "AddShield", 1.0)
   SetClassProperty(IMPsniperclass, "MaxShield", 1)
   SetClassProperty(IMPengineerclass, "AddShield", 1.0)
   SetClassProperty(IMPengineerclass, "MaxShield", 1)
   SetClassProperty(IMPofficerclass, "AddShield", 1.0)
   SetClassProperty(IMPofficerclass, "MaxShield", 1)
   SetClassProperty(IMPspecialclass, "AddShield", 1.0)
   SetClassProperty(IMPspecialclass, "MaxShield", 1)
   SetClassProperty(IMPsupportclass, "AddShield", 1.0)
   SetClassProperty(IMPsupportclass, "MaxShield", 1)
end


   ControlHeroALL = herostrAll
   ControlHeroIMP = herostrEmp

   SetTeamName(3, "imp")
      AddUnitClass (3, ControlHeroIMP, 1, 1)
      SetUnitCount (3, 1)
      --first number is numteam, second is numunits
      AddAIGoal(3, "Deathmatch", 100)


   SetTeamName(4, "all")
      AddUnitClass (4, ControlHeroALL, 1, 1)
      SetUnitCount (4, 1)
      --first number is numteam, second is numunits
      AddAIGoal(4, "Deathmatch", 100)


   SetTeamAsEnemy(1,4)
      SetTeamAsEnemy(4,1)
      SetTeamAsFriend(2,4)
      SetTeamAsFriend(4,2)
   SetTeamAsEnemy(2,3)
      SetTeamAsEnemy(3,2)
      SetTeamAsFriend(1,3)
      SetTeamAsFriend(3,1)

    --  Level Stats
    ClearWalkers()
    AddWalkerType(0, 0) -- special -> droidekas
    AddWalkerType(1, 0) -- 1x2 (1 pair of legs)
    AddWalkerType(2, 0) -- 2x2 (2 pairs of legs)
    AddWalkerType(3, 0) -- 3x2 (3 pairs of legs)

A few notes:
-Sorry about all the sloppy code. This was something that I never took the time to optimize as best as possible. It's not really a pain, but it's just a little long.
-Note that the heroes are not loaded with AddHeroClass(Unit?) - they use the variable "ControlHeroTEAM."

-----------------------------------------------------------------------------------------------------------

Adding Wave Mode to your map:

1) Download this example of a wave mode (Death Star wave). Be aware that this is not a blank template. This is a soft example - you will have to do a little modification to make your wave mode unique. I used Death Star wave as an example because it is the most "vanilla" of my wave modes - it was the one I used for a template for the rest of them.

2) Create a script for that mode with the "_wav" suffix, e.g. "dea1g_wav". You will need to add your script to your mission.req, you will need to create a .req file for it (in the "data_MODID\common\mission" folder), and you will need to add it to the addme.lua - see tutorials on "how to add a game mode" for more detail.

3) Go to town on the example you have! - Okay, I know there's not a lot of clarification here, so here are a few notes:

-Note that aside from some configuration at the top of the mode (all this will be the stuff from ScriptPostLoad, really), wave mode is constructed of sequential timer functions.

-Note at the end how conditional victory conditions exist - this has the "hidden" seventh wave shown, and how to add in that kind of option.

-There may be a lot of commented-out code. This was a testbed when I created it, so feel free to ignore all that stuff.

-Caveat emptor! Remember, you should only be making my version of wave mode if you're comfortable with scripting things.

-----------------------------------------------------------------------------------------------------------

Enjoy, guys. Let me know if you have any questions. Please try to avoid questions that are more fundamental in nature (like "how do I make a new layer, etc.). Tutorials exist for these in other places. If you have a bug you can't see - log file and script. Thanks!

Just as a matter of CYA, please do not substantially modify and then redistribute these. You're welcome to use these as learning examples or as additions to your map/mod. I just ask that you'd make sure to let me know - I always enjoy seeing people use something I've worked on.

Space Ranger
User avatar
Posts: 6119
Joined: Tue Aug 17, 2010 3:30 pm
Location: Working on The Clone Wars
Projects :: The Clone Wars
Games I'm Playing :: SWBF2 TCW Mod

Re: Add "Dark Times II" modes to your own map/mod

Postby THEWULFMAN » Sat Jun 11, 2011 10:53 am

That's awesome, glad to see how it works, makes perfect sense too.



While I am sure you are fine with us using these modes for non DT2 modes, like for my TCW mod, I think I will only use them for maps that I add DT2 too, like I did with Ryloth. I feel its more respectful that way. Although, Wave will be so awesome, I may want to make an exception to that rule. With your permission.

Jedi Admin
User avatar
Posts: 7384
Joined: Mon Aug 21, 2006 11:03 pm

Re: Add "Dark Times II" modes to your own map/mod

Postby Maveritchell » Sat Jun 11, 2011 10:43 pm

New modes added (Control and Wave).

THEWULFMAN wrote:Although, Wave will be so awesome, I may want to make an exception to that rule. With your permission.

Credit's all I ask for if you're going to use wave mode wherever.

Jedi High Council
User avatar
Posts: 2299
Joined: Sat Nov 15, 2008 1:57 pm
Projects :: I should probably start one...
Games I'm Playing :: TOR AC
xbox live or psn: ShadowScorch88

Re: Add "Dark Times II" modes to your own map/mod

Postby Twilight_Warrior » Sun Jun 12, 2011 11:37 am

Maveritchell wrote:Credit's all I ask for

Hidden/Spoiler:
Image

Credits will be fine.

Master Bounty Hunter
User avatar
Posts: 1464
Joined: Fri Dec 11, 2009 6:24 pm
Location: minisnowta
Projects :: BFSM
Games I'm Playing :: SWBFII
xbox live or psn: skelltor95

Re: Add "Dark Times II" modes to your own map/mod

Postby skelltor » Sun Jun 12, 2011 12:02 pm

Wow thanks a ton Mav :D I will probobly add wave sometime to bfsm as an addon. (Letting Mav know)

Master Bounty Hunter
User avatar
Posts: 1649
Joined: Thu Jul 08, 2010 5:53 pm
Location: New York, USA
Projects :: WIP. I will reveal what it is later on..
Games I'm Playing :: SWBF2-SWRC
xbox live or psn: No gamertag set

Re: Add "Dark Times II" modes to your own map/mod

Postby Cerfon Rournes » Thu Jun 23, 2011 5:27 pm

Sweetness! Thanks Mav!

Return to The Dark Times

Who is online

Users browsing this forum: No registered users and 1 guest