Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
DizzyKungFu

Registered:
Posts: 87
Reply with quote  #1 
Within a script, is it possible to test what race the chosen player ship is? I.e. is the Artemis a TSN, Ximni, or Pirate ship?
ryleyra

Registered:
Posts: 2,906
Reply with quote  #2 
Unfortunately, no. If it were possible to retrieve hull id you could check this (in a rather blunt force manner) but IFAIK that value isn't accessible.

The closest you can come is to check the ship stats, for instance, compare front and rear shield strength to determine what "class" the ship is. Again, blunt force and very time consuming. Since most races have almost identical ships, though, you still wouldn't be able to tell a TSN from a Ximni unless you edited the vesselData file.

As a workaround, you could provide Comms with buttons to indicate which race they chose at startup. You could also hardcode the ship they get and make multiple versions of the script. Or possibly, let Comms choose the ship, and then destroy the player ship and recreate it, although that will require everyone to log back in.
Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 2,241
Reply with quote  #3 
Generally when I am writing a GM-less mission script I force the player ship class. But you make a great point - there are cases when it would be nice if the players could choose their ship's race and hull, and thereafter the script could react automatically.
__________________
"The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight."
- Winston Churchill
Darrin

Registered:
Posts: 86
Reply with quote  #4 
I've been thinking about this. It's almost possible to determine the hull type based on the number of torps, mines, nukes, EMP, pshock, tags, probes, beacons, etc. I wrote some code for a multiplayer mission where the players can request ammunition pods, but I didn't want to load too many torps/nukes past the normal maximum for the ship when it docks at a station. So the code tallies up how many types of torps/etc. each ship has. And there's enough difference between the different ship types that you can almost determine which hull type is which...

The pirate ships all have unique ordinance, so you can count the nukes, homing, and mines to determine if it's a Strongbow, Longbow, or Brigantine. 

TSN/Ximni is the tricky part, but the TSN Light Cruiser has 4 pshocks, while the Ximni Cruiser has 2 pshocks. So you can tell those apart. Unfortunately the Scouts, Battleship, Missile Cruiser, Dreadnought, and Carrier all have identical ordinance.

However, you can edit the vesselData info to change the number of pshocks, tags, etc. Give the Ximni scout 9 probes instead of 8, or give the TSN Battleship 6 pshocks instead of 5. You could then run through the ordinance on each ship at the beginning of the mission and determine the hull type that way.

Xavier Wise

Registered:
Posts: 1,056
Reply with quote  #5 
In the TSN Sandbox, there is a count at the beginning of all the ordnance on each individual ship as well. It was needed as part of the resupply code from an auxillary ship.

Why do you need to track the type of ship in your script? Depending on what you need and why can make a difference to what properties to track. There might be a solution out there that you need.

__________________
Fleet Captain Xavier Wise - TSN Sabre
Link to TSN RP Community website
DizzyKungFu

Registered:
Posts: 87
Reply with quote  #6 
Quote:
Originally Posted by Xavier Wise
Why do you need to track the type of ship in your script? Depending on what you need and why can make a difference to what properties to track. There might be a solution out there that you need.


My goal is to make different comms messages, popups, and even events based on the player race. E.g. have NPC Ximni ships greet players differently if they are the same race.
Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 2,241
Reply with quote  #7 
As it is the Helm Officer is the one selecting the race. You could formalize the choice by having the Comms officer choose between "TSN" and "Ximni" buttons when the mission starts.

Even before the Ximni were introduced in 2016 I wanted the Comms messages and NPC ships to be different for Ximni crews but that has never made it to the top of Thom's priority list. The Ximni dodn't even have their own space stations. [frown]

__________________
"The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight."
- Winston Churchill
Xavier Wise

Registered:
Posts: 1,056
Reply with quote  #8 
Mike's option is a good one; having the Comms officer select the race using a button. It is the most ideal solution. You could have a prompt come through a pop-up/ Comms message and the buttons displayed.

Another option is to set specific names that the player must use, or having specific ships spawn as specific races e.g. ship 1-4 are TSN, 5-8 are Ximni. The disadvantage is that the server mainscreen is ship 1, but you can have a client mainscreen instead. You could have the crew journey to a specific location on the map at the start of their mission as well, using a message to prompt them where to dock e.g. all Ximni crews report to base A, all TSN crews report to base B etc.

Those are some options I can think up off the top of my head.

There are some talented people put there who can make models for Ximni stations, but then that means you have to mod the game, which isn't great for a general mission script for the community.

__________________
Fleet Captain Xavier Wise - TSN Sabre
Link to TSN RP Community website
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.