Page 10 of 17
Posted: Thu Jan 08, 2009 10:37 pm
by Thargoid
And replied. You've forgotten to change the dockedStation roles that are checked in the script. Also you've chopped too much out of the script, it still needs a header and the guiScreenChanged function. All you've left is the core code of that function without it's "wrapping".
The script you want is:
Code: Select all
this.name = "PlanetFall_famousPlanets";
this.author = "PAGroove and Thargoid";
this.copyright = "Creative Commons: attribution, non-commercial, sharealike.";
this.description = "Locations for Famous Planets";
this.version = "1.0";
this.startUp = function()
{
if (0 < oolite.compareVersion("1.72"))
{
// 1.71.x or earlier
this.thePlayerShip = player;
}
else
{
// 1.72 or later
this.thePlayerShip = player.ship;
}
}
this.guiScreenChanged = function()
{
if(!this.thePlayerShip.docked) // for GUI screen changes whilst in flight, which we can ignore
{ return; }
if(!this.thePlayerShip.dockedStation.hasRole("planetFall_surface")) // if we're at a trunk or other OXP's station
{ return; }
if(this.thePlayerShip.dockedStation.hasRole("planetFall_mainSurface_disoPlace") || this.thePlayerShip.dockedStation.hasRole("planetFall_subSurface_disoPlace") || this.thePlayerShip.dockedStation.hasRole("planetFall_moonSurface_disoPlace"))
{
if(guiScreen == "GUI_SCREEN_EQUIP_SHIP" || guiScreen == "GUI_SCREEN_MARKET")
{
mission.runMissionScreen("planetFall_noTrade", "planetFall_Veersmountains.png", null, null, null);
}
}
}
The image will need a little work, as it's the wrong dimensions (it needs to be in dimensions that are multiples of 512, eg 1024 x 512 rather than 800x600), plus the mission text in yellow doesn't show up very well against it and the red title across the top also gets in the way of the image a bit.
But with the above script saved as script.js in the config folder it works as desired.
Posted: Fri Jan 09, 2009 12:33 pm
by pagroove
Thnx I will look at it tonight.
Now more locations are possible !
Posted: Sat Jan 10, 2009 6:09 pm
by pagroove
Well I did several planetfalls but I never end up at the new location. I updated the script with your code but I think the fault is now in the shipdata.plist file as I also never see the name of the location. BTW can you post a screenshot of my image in the missionscreen. You tested it also didn't you?
Code in the shipdata.plist is:
Code: Select all
{
"planetFall_mainSurface_disoPlace" =
{
like_ship = "planetFall_genericSurface";
name = "Los Disos";
roles = "planetFall_mainSurface_disoPlace planetFall_mainSurface_externalOXP station(0) planetFall_surface";
conditions = ("galaxy_number equal 0", "planet_number equal 147");
};
"planetFall_subSurface_disoPlace" =
{
like_ship = "planetFall_genericSurface";
name = "Veers Mountains";
roles = "planetFall_subSurface_disoPlace planetFall_subSurface_externalOXP station(0) planetFall_surface";
conditions = ("galaxy_number equal 0", "planet_number equal 147");
};
"planetFall_moonSurface_disoPlace" =
{
like_ship = "planetFall_genericSurface";
name = "Mona Diso Moonbase";
roles = "planetFall_moonSurface_disoPlace planetFall_moonSurface_externalOXP station(0) planetFall_surface";
conditions = ("galaxy_number equal 0", "planet_number equal 147");
};
}
Posted: Sat Jan 10, 2009 6:32 pm
by Thargoid
It works fine for me, but don't forget everything's random.
There's a 15% chance (iirc) that this particular type of station (the externalOXP one) will appear when you land, and that 15% is spread across all external OXP stations (so if you've got the Black Monks and hOopy casino add-ons installed too, your station only has a 5% chance of appearing).
You can increase the weighting of this station compared to the other OXP stations by adding a weighting factor after the planetFall_mainSurface_externalOXP role (e.g. if you change it to planetFall_mainSurface_externalOXP(3) with the other two add-ons installed, there's a 3 in 5 chance of your appearing when you land on Diso and the selector chooses the externalOXP role to spawn (the 15% chance mentioned before), and only a 1 in 5 for the other two.
The 15% is coded into the main OXP script, so can't be influenced without hacking that.
Your shipdata.plist looks fine though, you just need to be patient and keep landing and taking off until you see it But as your locations are very specific to the planets, I would have no problem with you giving them a high weighting factor (e.g. planetFall_mainSurface_externalOXP(1000)) so that they essentially over-ride all other external OXPs but for those specific planets.
I did test it yes and it works fine for me. I'll try and sort out a screenshot for you when I have chance (do you want me to rescale it to 1024x512 first, or do you want the shot as-is at 800x600?).
Posted: Sat Jan 10, 2009 7:36 pm
by pagroove
Post it here in 800X600. I'il be more patient.
Posted: Sat Jan 10, 2009 9:54 pm
by Thargoid
pagroove wrote:Post it here in 800X600. I'il be more patient.
There ya go. As you can see the game engine's cropped it as it's not 1024x512, the mission text is getting a bit lost in the yellow sky and the mission title and grey bar are also compromising things.
I think I would rescale things first and then see how things look. It would be quite simple to move the yellow text down by using your own missiontext plist in the OXP, but you can't do anything about the colour nor the mission title/grey bar.
Posted: Sat Jan 10, 2009 10:21 pm
by pagroove
Gr8:
I rescaled the image already. But there's the proof!
Posted: Sat Jan 10, 2009 10:41 pm
by Thargoid
The only thing I would comment is that I landed on the main planet, and your image is Veers Mountain (the sub planet location).
In the script currently it's only checking if it's one of the three and if it is using the image. Once you have all three images done you'll probably want to split the test rather than being if it's one of the three to three separate tests (if statements) and then use your different images via the missionscreen command within each of those now separate if commands.
Something like the code below, in place of your current guiScreenChanged script function (keep the other bits as they are):
Code: Select all
this.guiScreenChanged = function()
{
if(this.thePlayerShip.dockedStation.hasRole("planetFall_mainSurface_disoPlace"))
{
if(guiScreen == "GUI_SCREEN_EQUIP_SHIP" || guiScreen == "GUI_SCREEN_MARKET")
{
mission.runMissionScreen("planetFall_noTrade", "planetFall_LosDisos.png", null, null, null);
}
}
if(this.thePlayerShip.dockedStation.hasRole("planetFall_subSurface_disoPlace"))
{
if(guiScreen == "GUI_SCREEN_EQUIP_SHIP" || guiScreen == "GUI_SCREEN_MARKET")
{
mission.runMissionScreen("planetFall_noTrade", "planetFall_Veersmountains.png", null, null, null);
}
}
if(this.thePlayerShip.dockedStation.hasRole("planetFall_moonSurface_disoPlace"))
{
if(guiScreen == "GUI_SCREEN_EQUIP_SHIP" || guiScreen == "GUI_SCREEN_MARKET")
{
mission.runMissionScreen("planetFall_noTrade", "planetFall_MonaDisoMoonbase.png", null, null, null);
}
}
}
You get the idea anyway. It's the same as the existing script, except specific if's for each of the three locations and individual images rather than one if statement with the OR (||) and a single image.
Posted: Sat Jan 10, 2009 11:09 pm
by pagroove
Ok so sub-surface is not the main planet. That must be the reason why I couldn't get the correct location to show up. I tried several landings at the main planet.
Posted: Sun Jan 11, 2009 12:32 am
by FSOneblin
Ok, so, I have an Idea of how to choose were you want to land. The first station will come and say "were do you want to land?" so, when you chose, you would launch, one more station would come up, like capital city, if you chose that. Do you understand? or do I have to word it better?
FSOneblin
Posted: Sun Jan 11, 2009 9:04 am
by Thargoid
pagroove wrote:Ok so sub-surface is not the main planet. That must be the reason why I couldn't get the correct location to show up. I tried several landings at the main planet.
"Main" is the main planet of the system (the one that the main station is in orbit around, the planet that appears if you run Oolite without any OXPs or in strict mode).
"Sub" are any other planets which are added by OXPs, for example System Redux or Solar System. "Moon" is along the same lines as sub, but are moons that are added in the same way.
In the code so far the location that will appear on the main planet is Los Disos.
FSOneblin wrote:Ok, so, I have an Idea of how to choose were you want to land. The first station will come and say "were do you want to land?" so, when you chose, you would launch, one more station would come up, like capital city, if you chose that. Do you understand? or do I have to word it better?
I did consider something like that, but it gets complicated as you'd have to spawn one station (for the choice), let the player make their choice then launch from (and remove) that station and then immediately dock them with another one (the station of their choice).
It's do-able, but rather messy. Plus there's no way to ensure things like the trumble offering wouldn't pop up at the choice station and screw everything up. Hence why I kept it simple and random.
Plus it would also disallow the opportunity to OXP-extend the concept such as I've done with adding BlackMonk and casino, and PAGroove's doing with Famous Planets.
Posted: Sun Jan 11, 2009 12:16 pm
by pagroove
Ok, I've managed to resize the image and I was able to land on Diso Prime-Veers Mountains. The problem is that the image stays in memory. Is that fixable.
I have a nice add on idea. What if you landed (for example in my Veers-mountains) a question could come up. Commander do you want to search for natural resources?
Then there could be a chance that you find % ton minerals (mountains) % Gold or even % platinum. A sea would generate food etc. A sort of treasure hunting. Then visiting planets would be sometimes give you nice goodies. Even some equipment can be found?
Posted: Sun Jan 11, 2009 1:26 pm
by Thargoid
pagroove wrote:Ok, I've managed to resize the image and I was able to land on Diso Prime-Veers Mountains. The problem is that the image stays in memory. Is that fixable.
The image is displayed as the background of a mission screen, so that part's all done via the trunk code. If the image stays in memory, it will do so for all such images displayed behind mission screens. It's a question for the coders, as the OXP itself is just using trunk code here.
pagroove wrote:I have a nice add on idea. What if you landed (for example in my Veers-mountains) a question could come up. Commander do you want to search for natural resources?
Then there could be a chance that you find % ton minerals (mountains) % Gold or even % platinum. A sea would generate food etc. A sort of treasure hunting. Then visiting planets would be sometimes give you nice goodies. Even some equipment can be found?
It's do-able. At the moment the mission screen is really just used for display purposes, there are no choices offered. But that's easily done by changing the mission screen a bit. My only comment would be is it really realistic? The ships aren't really equipped for mining (even with a mining laser installed) or for digging out and gathering together minerals/metals once found. Similarly for the seas, I would hate to think how long it would take to gather a ton of fish without specialised equipment.
As for equipment, there are already one or two locations in various places which can be good for getting equipment But as part of a mission or somesuch it's perfectly feasible to have a specific location which offers a specialised piece of equipment perhaps (not via purchase, but awarded to perform a mission or as a reward for doing so).
Posted: Sun Jan 11, 2009 1:40 pm
by pagroove
It's do-able. At the moment the mission screen is really just used for display purposes, there are no choices offered. But that's easily done by changing the mission screen a bit. My only comment would be is it really realistic? The ships aren't really equipped for mining (even with a mining laser installed) or for digging out and gathering together minerals/metals once found. Similarly for the seas, I would hate to think how long it would take to gather a ton of fish without specialized equipment.
As for equipment, there are already one or two locations in various places which can be good for getting equipment But as part of a mission or somesuch it's perfectly feasible to have a specific location which offers a specialised piece of equipment perhaps (not via purchase, but awarded to perform a mission or as a reward for doing so).
[/quote]
Well I'ts not very realistic but it would give some meaning to locations 'in the field'. For now the planetary option and the repairs are a bit expensive in comparison with the benefits from it. But I agree. There are some good mission writers out here who could generate some great missions.
Posted: Sun Jan 11, 2009 1:55 pm
by Eric Walch
Thargoid wrote:pagroove wrote:The problem is that the image stays in memory. Is that fixable.
The image is displayed as the background of a mission screen, so that part's all done via the trunk code. If the image stays in memory, it will do so for all such images displayed behind mission screens.
The JS command runMissionScreen does try to clear the image immediately after showing. Maybe it does not clear memory when an image is at display.
Anyhow, in the past it was always necessary to clean the screen first before showing a mission screen. runMissionScreen does that by itself by passing a null picture when none is defined. In legacy the script must always do that itself.