Author Topic: One-Stop-Shop Player-Flyable Capship Tutorial  (Read 4251 times)

0 Members and 1 Guest are viewing this topic.

Offline Lepanto

  • 210
  • Believes in Truth
    • Skype
One-Stop-Shop Player-Flyable Capship Tutorial
One-Stop-Shop Capship Tutorial

For 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:

Code: [Select]
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.

Code: [Select]
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.

Code: [Select]
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:

Code: [Select]
$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.


END


Tada! 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.

CREDITS

BP team, for inventing the original capship script and stuff

Dragon and others, for modularizing the capship script
« Last Edit: February 10, 2014, 07:49:48 pm by Lepanto »
"We have now reached the point where every goon with a grievance, every bitter bigot, merely has to place the prefix, 'I know this is not politically correct, but...' in front of the usual string of insults in order to be not just safe from criticism, but actually a card, a lad, even a hero. Conversely, to talk about poverty and inequality, to draw attention to the reality that discrimination and injustice are still facts of life, is to commit the sin of political correctness. Anti-PC has become the latest cover for creeps. It is a godsend for every curmudgeon and crank, from fascists to the merely smug."
Finian O'Toole, The Irish Times, 5 May 1994

Blue Planet: The Battle Captains: Missions starring the Admirals of BP: WiH
Frontlines 2334+2335: T-V War campaign
GVB Ammit: Vasudan strike bomber
Player-Controlled Capship Modding Tutorial

 

Offline fightermedic

  • 29
  • quite a nice guy, no really, i am
Re: One-Stop-Shop Player-Flyable Capship Tutorial
all the thumbs up for this tutorial!
>>Fully functional cockpits for Freespace<<
>>Ships created by me<<
Campaigns revised/voice-acted by me:
Lightning Marshal 1-4, The Regulus Campaign, Operation: Savior, Operation: Crucible, Titan Rebellion, Fall of Epsilon Pegasi 1.1Aftermath 2.1,
Pandora's Box 2.2, Deep Blood

Other Campaigns I have participated in:
The Antagonist, Warzone, Phantoms & Echo-Gate

All the stuff I release is free to use or change in any way for everybody who likes to do so; take whatever you need

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Re: One-Stop-Shop Player-Flyable Capship Tutorial
Nice tutorial. Good to see that this modified CSC script is of use for someone afterall. :)

 

Offline Lepanto

  • 210
  • Believes in Truth
    • Skype
Re: One-Stop-Shop Player-Flyable Capship Tutorial
Nice tutorial. Good to see that this modified CSC script is of use for someone afterall. :)

Thanks. Yes, yes it is.  ;)
"We have now reached the point where every goon with a grievance, every bitter bigot, merely has to place the prefix, 'I know this is not politically correct, but...' in front of the usual string of insults in order to be not just safe from criticism, but actually a card, a lad, even a hero. Conversely, to talk about poverty and inequality, to draw attention to the reality that discrimination and injustice are still facts of life, is to commit the sin of political correctness. Anti-PC has become the latest cover for creeps. It is a godsend for every curmudgeon and crank, from fascists to the merely smug."
Finian O'Toole, The Irish Times, 5 May 1994

Blue Planet: The Battle Captains: Missions starring the Admirals of BP: WiH
Frontlines 2334+2335: T-V War campaign
GVB Ammit: Vasudan strike bomber
Player-Controlled Capship Modding Tutorial

 

Offline procdrone

  • Formerly TheHound
  • 29
  • Balance breaker! Thats me!
    • Skype
Re: One-Stop-Shop Player-Flyable Capship Tutorial
It's nice, very nice.

I've tried with the similar system before, but it could not handle missile launchers and beams targeting.
Do anyone can confirm they work with this?
--Did it! It's RELEASED! VeniceMirror Thread--

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: One-Stop-Shop Player-Flyable Capship Tutorial
Missile launchers worked in The Blade Itself, and beam targeting worked in Lepanto's mission No Time to Bleed.

 

Offline Lepanto

  • 210
  • Believes in Truth
    • Skype
Re: One-Stop-Shop Player-Flyable Capship Tutorial
FYI, the Capship Control Script doesn't recognize turrets with weird names, like the Orion's chin-mounted BGreen, which is labeled 'turret01a'.
"We have now reached the point where every goon with a grievance, every bitter bigot, merely has to place the prefix, 'I know this is not politically correct, but...' in front of the usual string of insults in order to be not just safe from criticism, but actually a card, a lad, even a hero. Conversely, to talk about poverty and inequality, to draw attention to the reality that discrimination and injustice are still facts of life, is to commit the sin of political correctness. Anti-PC has become the latest cover for creeps. It is a godsend for every curmudgeon and crank, from fascists to the merely smug."
Finian O'Toole, The Irish Times, 5 May 1994

Blue Planet: The Battle Captains: Missions starring the Admirals of BP: WiH
Frontlines 2334+2335: T-V War campaign
GVB Ammit: Vasudan strike bomber
Player-Controlled Capship Modding Tutorial

 

Offline procdrone

  • Formerly TheHound
  • 29
  • Balance breaker! Thats me!
    • Skype
Re: One-Stop-Shop Player-Flyable Capship Tutorial
So it only takes to change the names in the table file, and it should be good.

Good to hear. I will see to test this shortly.
--Did it! It's RELEASED! VeniceMirror Thread--

 

Offline Lepanto

  • 210
  • Believes in Truth
    • Skype
Re: One-Stop-Shop Player-Flyable Capship Tutorial
It's not that easy, I'm afraid. You'd have to change the POF model's turret names first, and I don't know how to do that myself.
"We have now reached the point where every goon with a grievance, every bitter bigot, merely has to place the prefix, 'I know this is not politically correct, but...' in front of the usual string of insults in order to be not just safe from criticism, but actually a card, a lad, even a hero. Conversely, to talk about poverty and inequality, to draw attention to the reality that discrimination and injustice are still facts of life, is to commit the sin of political correctness. Anti-PC has become the latest cover for creeps. It is a godsend for every curmudgeon and crank, from fascists to the merely smug."
Finian O'Toole, The Irish Times, 5 May 1994

Blue Planet: The Battle Captains: Missions starring the Admirals of BP: WiH
Frontlines 2334+2335: T-V War campaign
GVB Ammit: Vasudan strike bomber
Player-Controlled Capship Modding Tutorial

 

Offline procdrone

  • Formerly TheHound
  • 29
  • Balance breaker! Thats me!
    • Skype
Re: One-Stop-Shop Player-Flyable Capship Tutorial
But this IS possible to do.

But... I won't be using the Orion so well, it's just theory speaking :D
--Did it! It's RELEASED! VeniceMirror Thread--

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Re: One-Stop-Shop Player-Flyable Capship Tutorial
FYI, the Capship Control Script doesn't recognize turrets with weird names, like the Orion's chin-mounted BGreen, which is labeled 'turret01a'.
My version should, I've used it on ships with turrets called "turret01a". I originally tested it on Scooby's destroyer, which did have such turrets. Though it was a long time ago, maybe it was a different version, simpler version (I've originally messed with BP CSC script attempting to convert it for other ships).

 

Offline Lepanto

  • 210
  • Believes in Truth
    • Skype
Re: One-Stop-Shop Player-Flyable Capship Tutorial
I've used it on the Orion, and it isn't recognizing the forward chin BGreen turret; all the other beams, with turretXX names, work just fine, but it definitely isn't working for me.
"We have now reached the point where every goon with a grievance, every bitter bigot, merely has to place the prefix, 'I know this is not politically correct, but...' in front of the usual string of insults in order to be not just safe from criticism, but actually a card, a lad, even a hero. Conversely, to talk about poverty and inequality, to draw attention to the reality that discrimination and injustice are still facts of life, is to commit the sin of political correctness. Anti-PC has become the latest cover for creeps. It is a godsend for every curmudgeon and crank, from fascists to the merely smug."
Finian O'Toole, The Irish Times, 5 May 1994

Blue Planet: The Battle Captains: Missions starring the Admirals of BP: WiH
Frontlines 2334+2335: T-V War campaign
GVB Ammit: Vasudan strike bomber
Player-Controlled Capship Modding Tutorial

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Re: One-Stop-Shop Player-Flyable Capship Tutorial
I was pretty convinced it worked, but it might have something to do with this being a beam. Do the large blobs work properly? The guns I've used on "turretXXa" were also blobs.

 

Offline Lepanto

  • 210
  • Believes in Truth
    • Skype
Re: One-Stop-Shop Player-Flyable Capship Tutorial
I know this is rather late, but I've finally tested the Orion's blob turrets with your script. Oddly enough, the CSC script recognizes 6 out of 7 of the Orion's standard laser turrets, of which 4 are blob turrets. I haven't detected why the script recognizes most of the Orion's turrets, but ignores a couple of them. I'm hoping to release the next Battle Captains mission by the end of the month, so if you could help me fix the problem and get all the Orion's beams working with the CSC script, that would be appreciated. Thank you!  :)

Attached is the modified version of your CSC script I'm using (named bp2-csc-sct to override the version already found in WiH), if that'll help. The only changes should be the addition of some new group and weapon entries.

[attachment deleted by an evil time traveler]
"We have now reached the point where every goon with a grievance, every bitter bigot, merely has to place the prefix, 'I know this is not politically correct, but...' in front of the usual string of insults in order to be not just safe from criticism, but actually a card, a lad, even a hero. Conversely, to talk about poverty and inequality, to draw attention to the reality that discrimination and injustice are still facts of life, is to commit the sin of political correctness. Anti-PC has become the latest cover for creeps. It is a godsend for every curmudgeon and crank, from fascists to the merely smug."
Finian O'Toole, The Irish Times, 5 May 1994

Blue Planet: The Battle Captains: Missions starring the Admirals of BP: WiH
Frontlines 2334+2335: T-V War campaign
GVB Ammit: Vasudan strike bomber
Player-Controlled Capship Modding Tutorial

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Re: One-Stop-Shop Player-Flyable Capship Tutorial
I have less time than I'd want to have, but I'll take a look. One thing you could check yourself is case consistency. IIRC, a whole lot of things in LUA are case-sensitive, and that might include turret names. It's just a guess, but this kind of odd behavior might stem from turret being named, for instance, "Turret01A" instead of "turret01a". I'll test when I have the time, but I'm afraid it might not be the case for quite some time.

 

Offline Lepanto

  • 210
  • Believes in Truth
    • Skype
Re: One-Stop-Shop Player-Flyable Capship Tutorial
Thanks for the suggestion, but switching turret name cases in the table file didn't fix the problem. I guess I'll just work around it for right now.
"We have now reached the point where every goon with a grievance, every bitter bigot, merely has to place the prefix, 'I know this is not politically correct, but...' in front of the usual string of insults in order to be not just safe from criticism, but actually a card, a lad, even a hero. Conversely, to talk about poverty and inequality, to draw attention to the reality that discrimination and injustice are still facts of life, is to commit the sin of political correctness. Anti-PC has become the latest cover for creeps. It is a godsend for every curmudgeon and crank, from fascists to the merely smug."
Finian O'Toole, The Irish Times, 5 May 1994

Blue Planet: The Battle Captains: Missions starring the Admirals of BP: WiH
Frontlines 2334+2335: T-V War campaign
GVB Ammit: Vasudan strike bomber
Player-Controlled Capship Modding Tutorial

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Re: One-Stop-Shop Player-Flyable Capship Tutorial
Well, check the model, too. I don't know which name is taken, but in all cases that worked for me, case was 100% consistent between the model (both in properties and model itself), table and script.

  

Offline JSRNerdo

  • 28
  • A literal [`_`]ist
Re: One-Stop-Shop Player-Flyable Capship Tutorial
The weapon-recharge-pct SEXP doesn't actually give you the ETS value. It gives you the percentage of weapon energy you have. You want get-ets-values Weapons, which returns between 0 to 12, apparently.
Inferno: It's the I in Inferno / It's the beam spam delight / Risin' up to a shock jump arrivaaaaaal
Between The Ashes: Look just a really cool and neat thing, OK?
The Last Stand: A very episodic capship command mini-campaign
Breakthrough: A pretty standard but not really capship command mission