One-Stop-Shop Capship TutorialFor anyone who wants to put flyable capships in their mod, but didn't know how, here's a guide to everything you need to get a working capship in-game. Dunno how much demand there is for a capship tutorial, but since I haven't seen any complete tutorials on how to mod player-flyable capships, so I'm just putting this up here.
You need to: create working entries for each player-flyable capship in your ships.tbl/shp.tbm; download the Capship Control Script, and input every ship, weapons group, and capship weapon which you are using into it; and properly set up your mission in FRED.
I'll add a capship abilities tutorial later, if there is enough demand.
To see capship control in action, check out Blue Planet's mission 'The Blade Itself', or my totally awesome in-progress series of mini-campaigns,
Blue Planet: The Battle Captains. [/shamelessplug]
SHIPS.TBM:All player-flyable capships should have the following table edits. You should make a separate table entry for every player-flyable capship. If you're using an existing capship class, and that ship class doesn't show up anywhere else in the campaign, you can save some work by just adding the following features to its table with +nocreate. Otherwise, copy over a full new ship table entry, named (Ship Class)#Player (if you're copying over a retail ship's table, you may want to add the original ship's MediaVPs updates to your new Ship#Player table.)
Add the following flags to the flags list: "player_ship" "generate icon" "no pain flash" "show ship"
This will make your ship player-flyable, show up without needing icons, and not show the red pain flash everytime it's hit.
Optional: If you want to make your player-capship quicker and more responsive than the original, raise its speed and reduce its turn times (probably not by too much, though.) Set your capship's max overclock speed to an appropriate-seeming value.
If you want the capship control script to properly label each class of turret on your ship during gameplay, add the following line as the second line of every turret entry in your ship's
table entry:
$Alt Subsystem Name: (X)
(X) will be the turret's name in the capship control script's turret list (in the lower-left-hand corner of the screen during gameplay); if the turret carries a Terran Huge Turret, write Heavy Turret; if it's an AAAf, write AAA Beam; and so on. Just keep the turret names short.
(YOURMODHERE)-CSC-SCT.TBM:The capital ship control script is the most important part of making a flyable capship, and also the most complicated.
Dragon's modular capship control script, which I'm using here, is the simplest capship control option out there, and it's still complicated. You should probably read that post over, so you know the basics of how the script functions.
Download this and extract it to your mod's root folder; it contains the capship control script, and a
couple scripts which it needs to work.
Open the CSC script; yeah, it's intimidating to the non-LUA-savvy among us. Fortunately, you can add new ships and weapons to it without touching most of it, or understanding any LUA.
If your capship has shields, and you still want the player to be able to shift shield power around like in a fighter, that's a bit more complicated; see Dragon's post.
The following two sets of entries specify what weapon groups and weapons the capship command script will recognize in-game. This script already supports (all retail and some Blue Planet) Terran, Vasudan, and UEF capship weapons, but if you want to add new types of capship weapons in your mod, add them here; otherwise, skip these two entries.
Anyway, scroll down until you see this part:
function defineTurrets()
function defineTurrets()
csc.turretGroup = {}
csc.turretStatus = {}
csc.turretColors = {}
csc.turretMode = {}
csc.turretDisplay = {}
-- config stuff start
-- turret group, UI display, R, G, B, Brace padding
--
turretInit("pd", "point defense turrets: ", 61, 93, 255, 8)
turretInit("flak", "flak turrets: ", 61, 93, 255, 8)
turretInit("md", "mass drivers: ", 255, 93, 48, 11)
Etc . . . . .
Each of the turretInit lines specifies one group of weapons which the script will recognize in-game: "pd" corresponds to your point-defense laser turrets, "beam" to your standard beam cannons, "slash" to your slashing beams, etc.
The first entry is the weapon group's name in the script; it will not show up in game, but whenever you're referring to that weapon group in the script, use this name. The second entry is the weapon group's name in-game. The next three numbers are the RGB values for that weapon group entry's color; this isn't very important. I dunno what Brace padding is.
Next, specify individual weapons, and which group they fall under.
function defineWeapons()
csc.weapondef = {}
--weaponClassName -> turret group
weaponInit("Point Defense Turret", "pd")
weaponInit("PD Turret#Player", "pd")
weaponInit("Burst Flak", "flak")
weaponInit("Mass Driver", "md")
weaponInit("Gauss Cannon", "gauss")
Etc . . . . . .
Here, each line's first entry specifies a weapon from your weapons.tbl or .tbm. The second entry puts that weapon in a weapon group. Give an entry to each new capship weapon which you are using.
Last, but not least, is the ships section. Give each flyable capship in your mod its own entry.
function defineShips()
csc.shipdef = {}
local
--Solaris
--Entry number - don't forget to change while copypasting this one
i = 1
csc.shipdef[i] = {}
csc.shipdef[i].shipClassName = "UED Solaris#Player"
--turrets showing target braces
csc.shipdef[i].turretTargets={"pd", "flak", "md", "gauss", "torpedo"}
--turrets aviable in UI
csc.shipdef[i].turretControl={"md", "gauss", "torpedo"}
--turrets to calculate target range
csc.shipdef[i].turretRange={"turret01", "turret02", "turret03", "turret04"}
-- possible turret weapon groups:
-- {"pd", "flak", "md", "gauss", "torpedo", "gattler", "missile", "aaa", "beam", "slash", "pulse, "GTVAtorpedo"}
--Custos
i = 2
csc.shipdef[i] = {}
Etc . . . . . .
FYI, all lines preceded by a -- are commented-out in LUA; they are ignored by the game, so you don't need to copy them.
i = x: Just give your ships consecutive i = numbers (i = 1, i = 2, etc.), and you'll be fine.
csc.shipdef.shipClassName = "x": Here, x is the ship's table name.
csc.shipdef.turretTargets={"x", "y", "z"}: Here, specify each weapon group with any weapons mounted on this ship.
csc.shipdef.turretControl={"x", "y", "z"}: List each weapon group on your ship which you want the player to be able to control in-game. You probably want to only list your big anti-capital weapons (like beams) here, to minimize screen clutter in-mission.
csc.shipdef.turretRange={"x", "y", "z"} : List each TURRET (not weapon group) on your ship which you want the script's rangefinder to measure its range. The rangefinder isn't critical, and can be annoying if you have a dozen large ships in-mission, so you may just want to leave this entry blank anyway.
Aaand that's it for the table script.
FRED:If your ships.tbl/.tbm and csc-sct.tbm are properly set up, you should now be able to set the player's ship as a capship in FRED, and run the mission. However, there are some things you need to keep in mind when FREDding a capship mission.
Every time you save or load the mission, if your capship doesn't have any native primary weapons, FRED will whine about it every time you save or load the mission; just hit Enter to skip the error message.
In Mission Specs, check the No Traitor and (probably) Scramble flags. No Traitor will prevent you from turning traitor by, say, accidentally hitting allied fighters with your flak guns. Scramble will lock your ship and weapon selection, preventing the game from crashing when you try to alter the primary weapons of a ship which doesn't have any primary weapons banks. (Ignore this if your capship has one or more native primary weapons, in addition to its turrets.)
Make your capship its own wing; name this wing (Your Capship's Name)#. FRED will now recognize your capship as (Your Capship's Name)# 1, as it is the first ship in a wing, but the game will just identify your capship as (Your Capship's Name). If you're also commanding one or more strikecraft wings, rename them as appropriate. Retitle the wing names under Mission Specs/Custom Wing Names to match your new names, or FRED will whine about that too.
To make your ETS settings affect your ship's turrets' fire rates, open your mission in FRED, go to Events, and paste the following event:
$Formula: ( when
( true )
( when
( >
( weapon-recharge-pct "Katana# 1" )
99
)
( change-ai-class
"General"
"Katana# 1"
)
)
( when
( and
( >
( weapon-recharge-pct "Katana# 1" )
82
)
( <
( weapon-recharge-pct "Katana# 1" )
100
)
)
( change-ai-class
"General"
"Katana# 1"
)
)
( when
( and
( >
( weapon-recharge-pct "Katana# 1" )
65
)
( <
( weapon-recharge-pct "Katana# 1" )
83
)
)
( change-ai-class
"Colonel"
"Katana# 1"
)
)
( when
( and
( >
( weapon-recharge-pct "Katana# 1" )
48
)
( <
( weapon-recharge-pct "Katana# 1" )
66
)
)
( change-ai-class
"Colonel"
"Katana# 1"
)
)
( when
( and
( >
( weapon-recharge-pct "Katana# 1" )
30
)
( <
( weapon-recharge-pct "Katana# 1" )
49
)
)
( change-ai-class
"Major"
"Katana# 1"
)
)
( when
( and
( >
( weapon-recharge-pct "Katana# 1" )
12
)
( <
( weapon-recharge-pct "Katana# 1" )
31
)
)
( change-ai-class
"Captain"
"Katana# 1"
)
)
( when
( and
( >
( weapon-recharge-pct "Katana# 1" )
-1
)
( <
( weapon-recharge-pct "Katana# 1" )
13
)
)
( change-ai-class
"Lieutenant"
"Katana# 1"
)
)
)
+Name: check ets
+Repeat Count: -1
+Trigger Count: 999999999
+Interval: 1
This SEXP will raise or lower your ship's AI class (which controls turret fire rates) if you raise or lower guns power on the ETS. If your mod has different AI classes than retail, replace retail AI classes with your custom classes, in appropriate descending order (all the cool people should be using custom AI anyway.)
Use Ctrl+R to replace all instances of "Katana" with the name of your ship.
When FREDding a capship-control mission, you need to approach mission design and balancing differently than if you were FREDding a standard strikecraft mission. Your capship is a lot slower and less maneuverable than strikecraft are (how much so depends on how big the capship is), but has many weapons, some of which are quite long-range. Memorize your chosen capship's main weapons, their ranges, and its strong and weak firing arcs (and tell your player about their ship in a command briefing or something.) Tactical planning and positioning become more important than twitch reflexes; design scenarios which will force the player to think ahead and position their ship in the right position to blow away enemy capships and attacking fighter wings with the mighty power of its weapons batteries. Still, it's boring to just sit there and wait for your turrets to kill your enemy; give the player some strikecraft wings to command, manually-firing beams, and cool but well-balanced capship abilities, so they have something else to do.
ENDTada! You should now have a working, player-flyable capship in-game. A well-made capship mission requires a lot of effort, and both the FREDder and the player have to approach it in a different way than your standard strikecraft mission, but it provides its own unique and awesome kind of gameplay and challenge.
If any of these instructions are unclear, or if I missed anything, complain about it.
CREDITSBP team, for inventing the original capship script and stuff
Dragon and others, for modularizing the capship script