Page 1 of 1

Where have all the ship roles gone

Posted: Fri Apr 25, 2008 10:12 pm
by Lestradae
There really should be a "learning scripting questions" forum here, you know. I hereby attempt to request one. No one learns this over night or without asking a lot of questions. Perhaps that would be interesting for other people relatively new at that like me, too - and it would stop me from spamming the Expansion Forum with such questions. And it could be pointed to more easily if a specific question has already been answered.

But alas, here it comes.

Yes, I have read the wiki and looked at diverse example oxps. I can`t get my head around the way how subentities are assigned roles. For example, the Constitution ship from NavyStarships has the following subentities defined:

Code: Select all

         <string>s-dock -0.1 -72.7 -237.6 0 1 0 0</string>
                        <string>s-doors 0.0 0.0 0.0 1 0 0 0 </string>

                        <string>DummyNI -16 -80 0.0 1 0 0 0</string>
                        <string>DummyNI -16 -80 -80 1 0 0 0</string>
                        <string>DummyNI -16 -80 -160 1 0 0 0</string>
                        <string>DummyOrb 16 -70 0.0 1 0 0 0</string>
                        <string>DummyMer 16 -80 -80 1 0 0 0</string>
                        <string>DummyKes 16 -80 -160 1 0 0 0</string>

                        <string>bridge 0.0 0.0 0.0 1 0 0 0 </string>
                        <string>nacelles 0.0 0.0 0.0 1 0 0 0 </string>
                        <string>neck 0.0 0.0 0.0 1 0 0 0 </string>
                        <string>phaser 0.0 0.0 0.0 1 0 0 0 </string>
                        <string>pylons 0.0 0.0 0.0 1 0 0 0 </string>
                        <string>rearphot 0.0 0.0 0.0 1 0 0 0 </string>
                        <string>saucer 0.0 0.0 0.0 1 0 0 0 </string>
... so, and all of those subentities then have their listing and have a role assigned (which in that case happens to be of the same designation as the ship subentity part, like "s-dock" having the role "s-dock" assigned and so on.

So, now the question. If I read the wiki allright, some unique role like:

Code: Select all

<key>roles</key>
<string>uniquely_named_role</string>
... should be defined as a role in an accompanying script.plist.

But I don`t find one in the abovementioned example, yet the subentities seem to work (well, most of the time) in the game.

Which ways are there to define a unique role? Only in a script.plist? Or somewhere else? Or will the game "fall back on" a standard role if none is defined?

Please, can someone who knows either explain or drop me an url or such where I can read about this?

Thanks @any meaningful answer in advance :?

L

Posted: Fri Apr 25, 2008 10:15 pm
by Cmdr James

.

Posted: Fri Apr 25, 2008 10:18 pm
by Lestradae
Hm, I thought this was only for scripting request not beginner questions? :oops:

Note: Should start training to read soon :(

The question is still standing, by the way.

And: Could someone please move this to the Scripter`s Cove :idea:

Posted: Sat Apr 26, 2008 1:29 am
by JensAyton
Describing the attributes of ships is not scripting.

The roles entry for a subentity does not belong in script.plist but in shipdata.plist. A subentity is a type of ship intended to be glued onto another ship (just as asteroids and cargo pods are “types of ship”).

.

Posted: Sat Apr 26, 2008 7:04 am
by Lestradae
Describing the attributes of ships is not scripting.

The roles entry for a subentity does not belong in script.plist but in shipdata.plist. A subentity is a type of ship intended to be glued onto another ship (just as asteroids and cargo pods are “types of ship”).
I am really not good in making understandable what I mean :(

I know all of the above; what I am asking is, if I have a "unique_ship_role", where is it defined what the role DOES? In the wiki it says it would be defined in a script-plist. The shipdata.plist, as far as I understand, makes scripts which place ships, be they standard (pirate trader hunter etc) or unique (dredger cobraclipper etc.) choose from the ships which have those roles defined in their shipdata.plist.

But again, where (in which plist or plists) is it or could it be defined what a role attributed in the shipdata.plist actually DOES?

Hope that was more understandable :oops:

L

Posted: Sat Apr 26, 2008 8:19 am
by LittleBear
Oolite (itself - without running any scripts) adds ships with the roles "Pirate" "hunter" "trader" etc automaticaly. More pirates are added (and fewer police) in dangerous systems for example. If you call a ship "pirate" then it will be on the list of pirate ships and can appear whenever Oolite adds pirates. If you give it a special role like "victim1" for example, the ship will NEVER be added by Oolite itself. It will only appear when your script calls it into existance. This allows you to have special ships appear at special times (eg: In Assassins the fighting Dictatorship and Rebel ships only appear when the Civil War breaks out and only in this particular system). You decide when and how many to add. Eg:-

Code: Select all

{ 
					conditions = ( 
						"mission_assassins equal assassins_STAGE1",
 						"galaxy_number equal 6",
						"planet_number equal 73", 
						"status_string equal STATUS_EXITING_WITCHSPACE" 
					); 
					do = ( "checkForShips: victim1", 
						{ conditions = ( "shipsFound_number equal 0" ); 
						do = ( "addShipsAtPrecisely: victim1 1 pwm -3721 2780 361753"); 
						}, 
					); 
				},
victim1 is a custom role given to the Wire Frame Adder flown by the OXP Character Be Soin. By having these conditions in the script adding him, Be Soin won't pop up willy nilly. He only appears in a particular system if you are there and have accepted the mission to assassinate him. And once dead he stays dead! The ship's death actions advance the mission_stage variable, so the conditions to add him will never again be met.

YOU as the scripter decide when and where a ship with a custom role will appear.

@Little Bear

Posted: Sat Apr 26, 2008 9:00 am
by Lestradae
@Little Bear:

Thanks for the explanation! 8)

So, did I get that alright that any custom role will have to be defined in a script.plist?

:?:

L

Posted: Sat Apr 26, 2008 9:06 am
by LittleBear
You'd define it in Shipdata. But a ship with a custom role will never appear in game unless you specifically call it with a script command.

.

Posted: Sat Apr 26, 2008 9:29 am
by Lestradae
You'd define it in Shipdata. But a ship with a custom role will never appear in game unless you specifically call it with a script command.
Thank you: now we`re there: That`s what I wanted to know all along! :D

*back to plisting*

L