Members | Sign In
All Forums > Mission Scripting
avatar

Custom ship descriptions/Science text

posted Jan 11, 2013 19:39:12 by CaptainZach
Another new feature available to mission scriptors in Artemis v1.7 is custom text fields for science. The command to use this is set_ship_text. To use the set_ship_text command, the syntax is:

set_ship_text name newname race class desc scan_desc

name: The ship you want to alter.
newname: A different name, you can change the ship's name with this.
race: The ship's race field
class: The ship's class field
desc: Text that will appear if Science targets the ship
scan_desc: Text that will appear if Science scans the ship twice!

Here is an example showcasing the command. Artemis is under attack from enemy vessels, but one of them has the elite commander Kurak Starkiller. In an earlier comms message, it is learned that if Artemis can destroy his ship, it will break enemy morale and attacking ships might flee. For this scenario, There are 5 attack ships, KR01-KR05. KR03 is the elite ship, but this is not immediately obvious - it looks like the other Kralien cruisers. When creating the ships, insert this command...

<set_ship_text name="KR03" race="Kralien" class="Cruiser" desc="Cruiser on attack vector" scan_desc="Kurak Starkiller in command." />

That bit about Kurak Starkiller won't show up unless the science station scans TWICE. If the science officer is doing their job, the players will discover that fact, and target that ship first. Since I like to throw in a little bit of randomness in my scripts, I would include a 50/50 chance that the attackers will surrender when the ship is destroyed.

<event>
<if_not_exists name="KR03" />
<if_exists name="KR01" />
<if_variable name="retreat_check" value="1" comparator="!=" />
<set_variable name="KR01_surrender" randomIntHigh="10" randomIntLow="1" />
<set_variable name="retreat_check" value="1" />
</event>

<event>
<if_variable name="KR01_surrender" value="5" comparator="LESS_EQUAL" />
<if_object_property name="KR01" value="hasSurrendered" value="1" comparator="!=" />
<incoming_comms_text from="KR01" >
The command ship is down! We can't challenge a ship this powerful! All ships, prepare to retreat!
</incoming_comms_text>
<set_ship_text name="KR01" desc="Morale broken, ship in retreat configuration" />
<set_object_property name="KR01" property="hasSurrendered" value="1" />
<add_ai name="KR01" type="DIR_THROTTLE" value1="72" value2="2" />
</event>

<event>
<if_variable name="KR01_surrender" value="6" comparator="GREATER_EQUAL" />
<if_variable name="reinforce" value="1" comparator="!=" />
<incoming_comms_text from="KR01" >
The command ship is down!! Press the attack, and call for reinforcements!
</incoming_comms_text>
<set_ship_text name="KR01" desc="Ship transmitting reinforcement request" />
<set_variable name="reinforce" value="1" />
</event>

At that point you could set a timer, have more ships attack, etc. The point of this post
was to demonstrate the set_ship_text command. It seems to work for enemies,
but it does not work for neutrals, stations, and of course generic_meshes(since science
cannot target them). Feel to use this code snippet in your mission scripts. Happy scripting!
page   1
6 replies
avatar
ChrisHayes said Mar 01, 2013 03:02:50
Is the fact that it doesn't work for neutrals and stations a known bug? Or is it intentional (do we know?). I've spent most of the day trying to figure out how to get a neutral to give me lifesigns. Sigh. Oh well. At least I know that it doesn't work so I can stop trying that route. Thanks for the heads up.
avatar
CaptainZach said Mar 01, 2013 03:41:16
This is what I discovered, I don't know if not being able to assign text to neutrals was intentional. As a workaround you could try using if_player_is_targeting on the neutral in question, then send a warning_popup to science about how lifesigns are detected.
avatar
Mike_Substelny said Mar 01, 2013 13:54:35
I believe the set_ship_text name *is* supposed to work for neutrals because the latest mission-file-docs.txt says so. I can confirm that it does not work for neutrals so I'd say it is a bug.
"Damn the torpedoes! Four bells, Captain Drayton!"

(Likely actual words of Admiral David Farragut, USN, at the battle of Mobile Bay. Four bells was the signal for the engine room to make full steam ahead).
avatar
ChrisHayes said Mar 01, 2013 18:11:41
Roger that. I thought about using the if_player_is_targeting command but I assumed that only worked for tactical. Is a science scan also considered targeting?
avatar
ChrisHayes said Mar 01, 2013 20:20:29
Thanks for the tip CaptainZach. It's a solid workaround. Perhaps the custom text issue will be fixed for v2.0
avatar
TreChipman said Mar 10, 2013 15:06:48
Nice work, CaptainZach! Any chance you could cross post this to the Code Snippets thread?
I'm not a mad scientist. I'm an angry one. You'd be wise to fear the latter.

Visit Artemis Command!
Login below to reply: