planet numbers for missions

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Re: planet numbers for missions

Post by Kaks »

If you look inside shipdata.plist, you should find roles = as part of the asp definition. Here I see:

Code: Select all

roles = "hunter pirate asp-pirate";
That means if you do

"addShips: asp-pirate 40"

you should get 40 asp pirates to appear near the witchpoint.

If you did

"addShips: pirate 40"

you'd get 40 assorted pirate ships.

It's always a good idea to give a ship a unique role, othewise the user might get the 'wrong' ships - I believe there's a number of asp variants out there, some tougher than others...
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
CheeseRedux
---- E L I T E ----
---- E L I T E ----
Posts: 827
Joined: Fri Oct 02, 2009 6:50 pm

Re: planet numbers for missions

Post by CheeseRedux »

I think you could just cannibalize the script from the Eagle.oxp
Hang on a sec.

There we go:

Code: Select all

{ 
	"0 129" = 
{
			
			"script_actions" = 
(
				"checkForShips: eagle2", 												
{
					conditions = ("shipsFound_number lessthan 150");
					do = ( "addShipsAtPrecisely: eagle2test 15 wpm 0 0 10" );
				}
			);
		};
	
}

That's a planetinfo.plist in the Oxp's main folder.
You'd have to change the 129 (Zaonce) and obviously the ship type (and number) to add.
You might have to tweak or remove the conditions, but other than that it should work.

Disclaimer: I haven't been anywhere near Zaonce since the days of 1.74, so something could have been changed in the code to make this no longer work without me noticing.

Discaimer2: The code is from eagle2.oxp, which has no license file attached. Selezen is still around though.

Edit: cleaned up a typo or two
Last edited by CheeseRedux on Sun May 01, 2011 6:35 pm, edited 2 times in total.
"Actually this is a common misconception... I do *not* in fact have a lot of time on my hands at all! I just have a very very very very bad sense of priorities."
--Dean C Engelhardt
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: planet numbers for missions

Post by Commander McLane »

It's really much easier to do in a JS-script than in any plist.

Perhaps an incentive to learn something new, Staer9. :wink:
User avatar
Staer9
---- E L I T E ----
---- E L I T E ----
Posts: 570
Joined: Fri Feb 18, 2011 4:53 pm
Location: Hatfield, Hertfordshire (poor industrial)

Re: planet numbers for missions

Post by Staer9 »

Commander McLane wrote:
Perhaps an incentive to learn something new, Staer9. :wink:
haha... you at least would know just how long it takes me to learn something, just think back to the Hauler P30, the problem is I have these great ideas, but they come in a chunk so most don't end up working... or work, but only just. JS-script is currently above me

and where exactly should I put this script?
Image
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: planet numbers for missions

Post by Commander McLane »

Staer9 wrote:
and where exactly should I put this script?
Which? The one posted by CheeseRedux?
CheeseRedux wrote:
That's a planetinfo.plist in the Oxp's main Config folder.
Copied with correction.

Step-by-step:
You should already have a folder named 'Config' in your OXP. That's where you have put the shipdata.plist and shipyard.plist (if any). In that same folder you need another text file named 'planetinfo.plist'. The contents of that file is what CheeseRedux posted above.
User avatar
CheeseRedux
---- E L I T E ----
---- E L I T E ----
Posts: 827
Joined: Fri Oct 02, 2009 6:50 pm

Re: planet numbers for missions

Post by CheeseRedux »

Gotta correct your correction there, McLane: The planetinfo.plist from eagle2.oxp sits squarely in its main folder. I freely admit I've no clue if that's where it's supposed to sit, though. It is what it is, however, and as witnessed by all the distraught players who have come to the forum wondering why they always get jumped by a bunch of Eagles when going to Zaonce, its location has not hindered its proper execution.
"Actually this is a common misconception... I do *not* in fact have a lot of time on my hands at all! I just have a very very very very bad sense of priorities."
--Dean C Engelhardt
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: planet numbers for missions

Post by Commander McLane »

CheeseRedux wrote:
Gotta correct your correction there, McLane: The planetinfo.plist from eagle2.oxp sits squarely in its main folder.
You're right, it does sit there (just checked). However, it doesn't belong there, but inside Config, if only for clarity.

Wild guess: Oolite would recognize all relevant files in a main folder (AIs, plists, textures, models, images, JS-scripts). The sub-folder structure of an OXP (and of Oolite/Contents/Resources, for that matter) is purely for convenience and tidiness. But since we have it, why not use it?
User avatar
Staer9
---- E L I T E ----
---- E L I T E ----
Posts: 570
Joined: Fri Feb 18, 2011 4:53 pm
Location: Hatfield, Hertfordshire (poor industrial)

Re: planet numbers for missions

Post by Staer9 »

just tested it with this code:

Code: Select all

{
   "0 45" =
{
         
         "script_actions" =
(
            "checkForShips: asp",                                     
{
               conditions = ("shipsFound_number lessthan 150");
               do = ( "addShips: asp-pirate 40" );
            }
         );
      };
   
}
it didn't work
Image
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: planet numbers for missions

Post by Eric Walch »

Staer9 wrote:
just tested it with this code:
....
it didn't work
It should work. Because a ship with role 'asp' does not exist, the script should than always return '0' and thus always add the pirates. But what I don't understand is why you check for a 'asp' in the first place? It would make more sense to just write:

Code: Select all

{
   "0 45" =
{
         
         "script_actions" =
         (
                 "addShips: asp-pirate 40"
         );
      };
   
}
The only reason for counting ships in planetInfo is to prevent double additions when the player adds two copies of the oxp to the addOn folder. But than you should at least count the ships you intend to add and not any other ship.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Re: planet numbers for missions

Post by Kaks »

One other thing to bear in mind is that you might be checking for a different planet to the one you've just jumped in! Internally planet numbers & galaxy numbers always start with 0, however some charts start with the more human-compatible 1, which shifts all planet numbers by one!


Using the js console, I got this info for you:

> System.systemNameForID(45)
Socelage

> System.systemNameForID(44)
Esesla

Hope it's useful.


PS: just one more thing: use the Force, Luke! :P
Since we got the js console working on all platform, just about any OXP maker has been finding it extremely useful for debugging their own OXPs! ;)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6671
Joined: Wed Feb 28, 2007 7:54 am

Re: planet numbers for missions

Post by another_commander »

Kaks wrote:
PS: just one more thing: use the Force, Luke! :P
Since we got the js console working on all platform, just about any OXP maker has been finding it extremely useful for debugging their own OXPs! ;)
This. In my opinion, anyone writing OXPs and not using the JS Debug Console are just making lives hard for themselves.

Also, I fully recommend completely dropping the backwards legacy scripting style. The time spent on learning the basics of JavaScript is time well spent and will pay off at the long term, since there is just so much one can do with JS that legacy can't even begin to imagine.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: planet numbers for missions

Post by Switeck »

This code was made for something in Galaxy 8, at systems near Oresrati (whose system.ID = 162). But I'll toss in some other stuff just to hopefully make this useful to you.
&& = and
|| = or
() works the same in if statements as it does for algebra.
Basically the if statement says:
If the system's sun exists (= true) AND in galaxy 8 AND in either system 121 OR 9 AND there's fewer than 2 asp-pirate ships already...
Then add 40 asp-pirate ships around the witchpoint beacon (location 0 along the route). Location 1 along the route would probably be touching the planet's surface.

Code: Select all

this.shipWillLaunchFromStation = this.shipExitedWitchspace = function()
{
// galaxyNumber starts at 0 = galaxy 1, so 7 = galaxy 8
// the system.ID number should be: 121 = Aatedire  ...but 9 may not be Leater!
	if(system.sun  && galaxyNumber == 7 && (system.ID == 121 || system.ID == 9) && system.countShipsWithRole("asp-pirate") <2)
	{
		system.addShipsToRoute("asp-pirate", 40, 0); // to be right near the witchpoint buoy
	}
}
You could instead use:
system.addGroupToRoute("asp-pirate", 40, 0, "wp");
...If you wanted them to fight together as a more organized group, as opposed to 40 lone ships.
User avatar
Staer9
---- E L I T E ----
---- E L I T E ----
Posts: 570
Joined: Fri Feb 18, 2011 4:53 pm
Location: Hatfield, Hertfordshire (poor industrial)

Re: planet numbers for missions

Post by Staer9 »

Kaks wrote:
Using the js console, I got this info for you:

> System.systemNameForID(45)
Socelage
ARHHHH so therefore the question I was asking at the begining STILL hasn't been answered and the wiki is therefore incorrect. All I want to know is what number reidquat is, and if it isn't 45 (which the wiki says it is) then what is it???

@switeck, that was helpfull, but what do I call it and where do I put it (in the oxp folder) if I change galaxy to 1 and planet to riedquat (whatever number it is)
Image
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: planet numbers for missions

Post by Smivs »

Hi Stear9, try this.

Code: Select all

// Standard attributes 
this.name           = "spawn-asps_script"; 
this.author         = "Smivs"; 
this.copyright      = "This script is hereby placed in the public domain."; 
this.version        = "1.0"; 
this.description    = "Script to spawn 40 asps on exiting witchspace at Riedquat." 

// Configuration
this.role = "asp-pirate"; 
this.count = 40;

this.shipWillExitWitchspace = function() 
{
   if (galaxyNumber == 0 && system.ID == 46)
        {
        system.addShips(this.role, this.count, player.ship.position, 10000);
        }
};
I think it wasn't helping that you've got the wrong planet number - Riedquat is 46 not 45.

It won't just work if placed in AddOns as it is. Place it in a folder called 'Scripts', and then in the Config folder, add a world-scripts.plist like this

Code: Select all

/*
   asps
*/
( 
   spawn-asps_script.js
)
so if you just want to try it (it does work!) make an OXP. A folder called 'asps.oxp' or whatever containing a Config folder with the worldscripts.plist, and a Scripts folder containing the 'spawn-asps_script.js'.
Last edited by Smivs on Mon May 02, 2011 6:20 pm, edited 1 time in total.
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Staer9
---- E L I T E ----
---- E L I T E ----
Posts: 570
Joined: Fri Feb 18, 2011 4:53 pm
Location: Hatfield, Hertfordshire (poor industrial)

Re: planet numbers for missions

Post by Staer9 »

Thank you so much Smivs :D

by the look of it that is script.js rather than planetinfo.js so I will move it and test it.
I also added an extra line so it should write in the log the "Generated 40 asps for commander testing purposes"

presumably that goes in the Config folder of the oxp
Image
Post Reply