Mission.lvl Modding - Basics Tutorial

Started by Phobos, April 19, 2011, 03:45:34 PM

Previous topic - Next topic
April 19, 2011, 03:45:34 PM Last Edit: November 10, 2011, 08:19:39 PM by Inactive
Mission.lvl Modding - Basics Tutorial
Written by: Phobos Developer
This guide was written with the intentions of helping modders who are somewhat new to modding SWBF, and as a reference page for server hosts who want to spice things up a bit.

The following modification techniques outlined are online compatible, meaning that players who join your modded server will not need to download anything in order to play. First you will need to download BattleBelk's mission builder. I have included this in a "BattleBelk Toolbox" for download here: http://www.mediafire.com/?i7vx4j53kagybpy

Once this is extracted open the readme and follow the instructions as well as this guide for reference. I will describe some simple, practical mods that can be made with this global mission builder.

-Removing Height Limits-
First we will start with removing height limits from maps. Start with platforms, which is bes1. Notice there are usually 2, sometimes even 3 scripts for each map.
bes1a = galactic civil war
bes1r = clone wars
bes1a_h = single player campaign

It is usually safe to ignore the _h scripts (unless you are modifying single player), and only modify the multiplayer ones. So let's say we are going to remove the height limit from platforms. Open up bes1a and bes1r and make the following changes:
SetMaxPlayerFlyHeight(220)
SetMaxFlyHeight(220)

Can be raised to something like:
SetMaxPlayerFlyHeight(2000)
SetMaxFlyHeight(2000)


It is also safe to ignore the MinFlyHeight commands unless you want to be able to fly to the bottom of the map, in which case deleting them sets them to 0. There are many other settings we can change with the mission builder, and we are just getting started.

-Changing Reinforcements-
You can change the values for this simply by editing the number:
SetReinforcementCount(ATT, 200)
SetReinforcementCount(DEF 200)


In this example teams are very unbalanced.
SetReinforcementCount(ATT, 500)
SetReinforcementCount(DEF, 30)


-Switching CPs For Teams-
The default values for cloud city are:
function ScriptInit()
--  Attacker is always #1
    local ALL = 1
    local IMP = 2
--  These variables do not change
    local ATT = 1
    local DEF = 2


You can switch these values so that empire spawns on rebel's side, and vice versa:
function ScriptInit()
--  Attacker is always #1
    local ALL = 2
    local IMP = 1
--  These variables do not change
    local ATT = 1
    local DEF = 2

-Removing Reinforcements Bleed-
Wherever you see lines such as:
AddBleedThreshold(ATT, 31, 0.0)
AddBleedThreshold(DEF, 31, 0.0)


Either remove them or add -- (-- is a null command for LUA, // is null for ODF) in front of them:
--AddBleedThreshold(DEF, 31, 0.0)

-Removing Spawn Timer-
Change this:
SetSpawnDelay(10.0, 0.25)

To this:
SetSpawnDelay(1.0, 0.25)

-Removing Death Regions-
This is easily done by hex editing the map LVL file, but another way is to null or remove these lines:
AddDeathRegion("DeathRegion");

-Increasing/Decreasing Landmine Limits-

If you've been in big servers like DOC Arena on maps like Jabba, you sometimes will notice that you cannot set landmines every time you try to. The reason why is due to the default total limit, which you can change to your liking:
SetMemoryPoolSize("EntityMine", 40)

This doesn't change how many landmines a player can set at once (default 4). You can modify that by editing the mine dispenser ODF, although anything over 10 often gets buggy and crashes.

-Changing Unit Selection-
Ever want to mod cloud city so that you can only play 1.0 style (no specials or pilots)? Easy. It is simple to modify the lineup for each team. Whatever units are loaded in the script are the ones that can be used. For example, I could modify bes2.lua in such a way as this:
--  Alliance Stats
      SetTeamName(ALL, "Alliance")
      SetTeamIcon(ALL, "all_icon")
      AddUnitClass(ALL, "all_inf_soldierurban",11)
      AddUnitClass(ALL, "all_inf_vanguard",5)
      AddUnitClass(ALL, "all_inf_lukeskywalker",5)
      AddUnitClass(ALL, "all_inf_marksman",4)
      AddUnitClass(ALL, "imp_inf_dark_trooper",3)
    SetHeroClass(ALL, "all_inf_lukeskywalker")


This would replace pilot with Skywalker (it is recommended you lower his health by modifying your SIDE files first), and replace wookie with jet. You can switch units between teams, but you cannot switch units between eras. No clones or droids in GCW, and vice versa for CW. You can also limit it to just 3 units (for 1.0), and there are 2 ways to do this:

The Shortcut Method:
      AddUnitClass(IMP, "imp_inf_storm_trooper",11)
      AddUnitClass(IMP, "imp_inf_shock_trooper",5)
--      AddUnitClass(IMP, "imp_inf_pilottie",5)
      AddUnitClass(IMP, "imp_inf_scout_trooper",4)
--      AddUnitClass(IMP, "imp_inf_dark_trooper",3)


The reason I do not advocate the "shortcut" method of simply adding nulls to pilot and jet is because it makes it so that players who join have to choose pilot to spawn as a sniper, and if they pick sniper or jet they will spawn as trooper (first unit). Remember, their spawn screen still looks the same as the shipped one and not your modified version. Therefore, the correct way to make this mod is as follows:
      AddUnitClass(IMP, "imp_inf_storm_trooper",11)
      AddUnitClass(IMP, "imp_inf_shock_trooper",5)
      AddUnitClass(IMP, "imp_inf_shock_trooper",5)
      AddUnitClass(IMP, "imp_inf_scout_trooper",4)
      AddUnitClass(IMP, "imp_inf_scout_trooper",3)


This way, they will spawn as sniper if they choose sniper or special, and vanguard if they choose pilot or vanguard. Here is my favorite way to make 1.0 style servers:
      AddUnitClass(ALL, "all_inf_soldierurban",11)
      AddUnitClass(ALL, "all_inf_vanguard",5)
      AddUnitClass(ALL, "imp_inf_shock_trooper",5)
      AddUnitClass(ALL, "all_inf_marksman",4)
      AddUnitClass(ALL, "imp_inf_scout_trooper",3)

      AddUnitClass(IMP, "imp_inf_storm_trooper",11)
      AddUnitClass(IMP, "imp_inf_shock_trooper",5)
      AddUnitClass(IMP, "all_inf_vanguard",5)
      AddUnitClass(IMP, "imp_inf_scout_trooper",4)
      AddUnitClass(IMP, "all_inf_marksman",3)


Also remember the numbers after each unit have to add up to the same amount as this value:
SetUnitCount(ATT, 28)
So if your totals only add up to 18, you have to change the SetUnitCount value to 18, or increase the numbers for each unit. This is designed as ratios for how many AI of each unit should spawn per team. The minimum amount for SetUnitCount is 1.

Note: You can also mix up natives, and have native wars. Here is some code for a survival-type game on Jabba with 300 Gammoreans vs. 24 Humans:
--      Republic Stats
    SetTeamName(REP, "Republic")
    SetTeamIcon(REP, "rep_icon")
    AddUnitClass(REP, "gam_inf_gamorreanguard",32)
     
--      CIS Stats
    SetTeamName(CIS, "CIS")
    SetTeamIcon(CIS, "cis_icon")
    AddUnitClass(CIS, "cis_inf_battledroid",0)
    AddUnitClass(CIS, "cis_inf_assault",1)
    AddUnitClass(CIS, "cis_inf_pilotdroid",0)
    AddUnitClass(CIS, "rep_inf_jet_trooper",0)
    AddUnitClass(CIS, "rep_inf_arc_trooper",0)

SetReinforcementCount(ATT, 300)
SetReinforcementCount(DEF, 24)


-Removing or Limiting Vehicles-
Let's take a look at tat1i.lua, the GCW script for Dune Sea. Normally you could just remove the "com_item_vehicle_spawn" values out of the map.lvl with hex editor, but modifying the script allows more precision as to WHAT vehicles you want removed much more quickly. I'll begin by identifying what values correspond to vehicles in LUAs.

SetMemoryPoolSize("EntityHover", 12)

This one is for the basic vehicles that "hover", such as speeder bikes, combatspeeders, STAPs, skiffs, and the other tanks. If you set this to 0 then no tanks can spawn. If you set it to 3 then only 3 tanks will spawn, but you do not get to pick whether they are skiffs, bikes or tanks (although this is possible through hex editing, one at a time and testing).

SetMemoryPoolSize("EntityFlyer", 5)
This controls how many ships can be loaded at once. I'm not sure why it is set to 5 on Dune Sea, considering there's only 4 ships. Maybe this allows one to respawn while another is flying around?

ClearWalkers()
This part seems confusing at first but it's really quite simple. For easier understanding, I've loaded the first section from the hot1i (Hoth) LUA, and the second from geo1r (Geonosis):

Hoth:
    AddWalkerType(0, 0) -- 0 droidekas
    AddWalkerType(1, 10) -- 6 atsts with 1 leg pairs each
    AddWalkerType(2, 2) -- 2 atats with 2 leg pairs each
    SetMemoryPoolSize("CommandWalker", 2)


Geo:
    AddWalkerType(0, 8) -- 8 droidekas (special case: 0 leg pairs)
    AddWalkerType(2, 2) -- 2 spider walkers with 2 leg pairs each
    AddWalkerType(3, 2) -- 2 attes with 3 leg pairs each
    SetMemoryPoolSize("CommandWalker", 2)


The first value before the comma is how many PAIRS OF LEGS the vehicle has. How many legs does an ATST have? It has 2 legs, which is 1 leg pair. How many ATSTs are on Hoth? 6, but you could add 4 more before reaching the limit. The tricky part is command walkers, which are ATATs and ATTEs. Since there are two ATTEs specified as "AddWalkerType(3, 2)", you also have to set a memory pool for Command Walkers.

In a case where you wanted to add 3 Spiderwalkers and 2 ATATs, you would have to make it look like this:
    AddWalkerType(2, 5) -- 3 spider walkers and 2 atats with 2 leg pairs each
    SetMemoryPoolSize("CommandWalker", 2)


-Other settings to play around with-
SetStayInTurrets(1)
1 enables and 0 disables.


SetAllowBlindJetJumps(0)
I think when this is set to 1 (0 is default), it will make enemy jet AI more likely to randomly jet jump as soon as their fuel recharges.

SetTeamAggressiveness(ALL, 1.0)
I think that increasing this makes AI follow paths better, but I'm not sure about min/max values.

SetDenseEnvironment("false")
No idea what this does, I assume it has something to do with textures or texture.option files.

Birds and Fish, taken from yav1i.lua. I think you need additional req or tga files for these to work.
--  Birdies
    SetNumBirdTypes(2);
    SetBirdType(0,1.0,"bird");
    SetBirdType(1,1.5,"bird2");

--  Fishies
    SetNumFishTypes(1);
    SetFishType(0,0.8,"fish");


Camera Shots:
AddCameraShot(0.685601, -0.253606, -0.639994, -0.236735, -65.939224, -0.176558, 127.400444);
These settings tells the camera what views to show you when the spawn timer is counting down (not very useful if you have made the spawntime instant). You can set your own camera coordinates by opening the map in SPtest, then using Freecam and Fake Console.

QuoteSetTeamAggressiveness(ALL, 1.0)
I think that increasing this makes AI follow paths better, but I'm not sure about min/max values.

SetDenseEnvironment("false")
No idea what this does, I assume it has something to do with textures or texture.option files./quote]

SetTeamAggressiveness is said to be obsolete by Psych0fred.
SetDenseEnvironment has to do with the ai, whether they are prepared for open combat (false) or close-quarters combat (true)
=AaTc= Forever

SALLY....

-Retired Modder

Quote from: SnΛke on April 20, 2011, 09:54:04 AM
SetTeamAggressiveness is said to be obsolete by Psych0fred.
SetDenseEnvironment has to do with the ai, whether they are prepared for open combat (false) or close-quarters combat (true)

So what is the difference between open style combat and close quarters combat when it comes to AI? Could be very important when it comes to zombies.

I'm not sure but I also found this in hoth .lua:

    SetDefenderSnipeRange(170)
=AaTc= Forever

SALLY....

-Retired Modder

Quote from: Buckler on January 01, 2012, 08:32:30 PM
I am not planning on banning you.  It looks like images have been removed from your posts.  Perhaps that was from the last round of deleting.  If so, my apologies.
I have not removed any images intentionally from my posts. It is possible that imgur or imageshack deleted the images, this happens. If you can find a way to upload and embed images directly through this website it may prevent those types of occurrences. If you can specify which thread are missing pictures I will look through my encyclopedia archives and try to restore them.

ok, i will delete the quote of the tutorial. thanks for the explanantion.
Quote from: Abraham Lincoln. on November 04, 1971, 12:34:40 PM
Don't believe everything you read on the internet

This is only a basics tutorial, at some point I want to write an advanced LUA tutorial. Maybe you can help Led since you are getting good with LUA mods.

I am trying to learn more each day.  I've made a WIP tutorial for things I find out while trying to work on the SWBFupdate.  That "EMPIRE" name thing really threw me for vehicle spawns.  I suspect you can name local units "EMPIRE" and get similar results too.
Quote from: Abraham Lincoln. on November 04, 1971, 12:34:40 PM
Don't believe everything you read on the internet

Quote from: Buckler on January 01, 2012, 08:42:04 PM
I am trying to learn more each day.  I've made a WIP tutorial for things I find out while trying to work on the SWBFupdate.  That "EMPIRE" name thing really threw me for vehicle spawns.  I suspect you can name local units "EMPIRE" and get similar results too.

you're talking about when you were adding CW era to Hoth Escape, right?
Current Projects:
Battlefront One and a Half Era Mod, v2.0. Making great progress (SWBF)

Quote from: jdee-barc on January 02, 2012, 12:36:12 AM
you're talking about when you were adding CW era to Hoth Escape, right?

yes
Quote from: Abraham Lincoln. on November 04, 1971, 12:34:40 PM
Don't believe everything you read on the internet