Members | Sign In
All Forums > Mission Scripting
avatar

Dynamic ship naming

posted Jun 11, 2013 14:50:44 by matt.schillinger
Has anyone figured out a trick to dynamically name an object? I believe that I've got everything else dynamic, but when i look at science, instead of it parsing the variable, all the enemies have the same name, which is the name of the variable.
page   1
7 replies
avatar
RussJudge said Jun 11, 2013 16:38:28
This link: http://px2owffng8.embed.tal.ki/20130111/custom-ship-descriptionsscience-text-2234099/
discusses the use of set_ship_text, which accomplishes what you are wanting.
Russ
Author of Artemis Mod Loader.

Sign up for a free Dropbox account.
avatar
matt.schillinger said Jun 11, 2013 16:41:53
Awesome! That's just what I needed. I just hadn't read through set_ship_text close enough. Thanks!
avatar
matt.schillinger said Jun 11, 2013 17:04:47
Oh. I spoke too soon. I think I should provide more clarity as to what I am trying to do. Unfortunately set_ship_text isn't accomplishing it.

I would like to use a variable value to name a ship. in this case, 'enemy_count' is a variable that is tracking the number of enemy ships created. it is just a number. Unfortunately, the 'name' attribute in create object, and the rename attribute for set_ship_text do not seem to support using variable substitution. Instead, all the ships are named (in my example) 'enemy_count'.
[Last edited Jun 11, 2013 17:06:05]
avatar
RussJudge said Jun 11, 2013 17:31:42
Unfortunately, no--only objects and variables that accept numeric values can use a variable to be defined. objects and variables that require string values (such as the name of a ship) must use literal strings, not variables.

Perhaps it's something Thom will do for version 2, but that's unknown at this time.
Russ
Author of Artemis Mod Loader.

Sign up for a free Dropbox account.
avatar
badgeguy said Jun 12, 2013 01:52:25
My solution (see: Mission: Invasion) was to create a library of enemy ships to be created with a variety of names and randomly create the ships from the library.

The downsides to this are:
  • file size
  • performance of the script due to said file size, and
  • an inability to specifically reference any enemy ship due to the potential that is does not exist or is not where it is expected.
[Last edited Jun 12, 2013 01:55:40]
avatar
badgeguy said Jun 14, 2013 00:39:41
I am amazed at how much there is to learn with this language every time I read through these forums. Leaving a ship name blank upon creation will give it a random identifier. This could easily be incorporated into my code to reduce the size of it dramatically. It just means that if I want specific craft to trigger, I need to create the names and hard code them into the scenario.
avatar
matt.schillinger said Jun 14, 2013 00:58:11
Oh! Well, that is an option for random ships with default Ai stack. Thanks again!
Login below to reply: