Page 15 of 56
Posted: Wed Feb 18, 2009 11:24 am
by Commander McLane
While it is true that you cannot script commodity prices or quantities in a main station (or any station that uses the "default" entry from commodities.plist), and especially you cannot change anything anymore in a station that is already spawned, you
can via OXP replace the main station with another station which can have its custom commodities.plist entry. This is the basic technical idea behind
specialevents.oxp.
Of course you are still bound by how
commodities.plist works, but I am sure with a little work you will be able to
understand it.
Posted: Wed Feb 18, 2009 3:37 pm
by Frame
Another way, change system stats, just before spawning a station... coriolis or dodec or whatever.
Code: Select all
This.originalGovernment = system.government
system.gorvenment = ourgovernment
This.originalEconomy = system.government
system.economy = ourEconomy
spawn("coriolis",1,x,y,z)
// restore system stats..
// you can do this to all system statistics... (i Use it in solarSystems oxp)
system.gorvernment = this.originalGovernment
system.economy = this.originalEconomy
Posted: Wed Feb 18, 2009 4:16 pm
by Cmd. Cheyd
@ Cmd. McLane- Did SpecialEvents.oxp ever finish? Or even reach a WiP stage? I'd love to get my hands on it, if nothing else, to steal some ideas be inspired by it...
Posted: Wed Feb 18, 2009 6:52 pm
by Thargoid
Commander McLane wrote:While it is true that you cannot script commodity prices or quantities in a main station (or any station that uses the "default" entry from commodities.plist), and especially you cannot change anything anymore in a station that is already spawned, you
can via OXP replace the main station with another station which can have its custom commodities.plist entry. This is the basic technical idea behind
specialevents.oxp.
Of course you are still bound by how
commodities.plist works, but I am sure with a little work you will be able to
understand it.
I don't think that would work. As soon as you remove the main station to replace it, another station in the system automagically becomes the main station. So when you spawn your replacement one, it will probably no longer be the main station.
I recall a long while ago having a similar thought and giving it a quick try to see what happens when the main station was removed, and the system ended up as I recall with a main station rock hermit
Posted: Wed Feb 18, 2009 7:30 pm
by Cmd. Cheyd
Could you remove the main station, spawn the replacement and assign station.ismainstation = true?
Posted: Wed Feb 18, 2009 9:38 pm
by Kaks
@Cmd. Cheyd: nope, but it's a very nice idea for the wish list!
In the meantime:
Thargoid wrote:I don't think that would work. As soon as you remove the main station to replace it, another station in the system automagically becomes the main station. So when you spawn your replacement one, it will probably no longer be the main station.
I have a solution for that!
Way back then when I javascriptified (
) Little Bear's Asteroid Storm the windows version of Oolite wouldn't let me destroy the main station.
In order to destroy it anyway I moved the 'real' station to the opposite side of the sun a split second before the explosion, replaced it with a weaker copy in exactly the same place - facing exactly the same way - and blew the copy away.
You could do the same here.
For a start, you'll have to disable the docking computer ('temporary malfunction, commander, nothing to worry about') to avoid instant docking.
Then you can swap the main station with its clone once your ship is a few inches from the docking slot... For a couple of seconds before docking the aegis will disappear, but not many people would notice that...
There might even be a second way of doing this trick.
Instead of an actual replacement station, why not use the 'docking barrel' technique from planetfall? Outbound traffic is created just inside of the slot, but there might be just enough clearance in there for a tiny station right in the middle of the docking slot!
You'll still need a real main station, though, at least for load/save purposes...
Posted: Wed Feb 18, 2009 9:44 pm
by Thargoid
It would then break any OXP which relies on system.mainStation or anything like that (e.g. PlanetFall Taxi and Traffic Control that I can think of offhand as they're mine).
Also as a question what would it do to things like the station aegis? Is that actually tied dynamically to the main station's position? Similarly the square indicator on the standard (non-Advanced) space compass when you get near the planet?
Posted: Wed Feb 18, 2009 9:54 pm
by Kaks
All valid points! The switch will only happen 1-2 seconds before you actually dock, though.
The Aegis & indicator are tied to the actual main station position, and any script fnding the main station will start to go to the other side of the sun.
You still need to switch things back once you launch, and if you don't spend more than a few minutes inside, the main planet < - > main station traffic won't be disrupted too much...
Posted: Wed Feb 18, 2009 10:13 pm
by Cmd. Cheyd
Seems like an awfully long way around just to change system commodity pricing... Or is it just me?
Posted: Thu Feb 19, 2009 4:28 am
by Kaks
True! I'd personally wait & see if something like station.ismainstation = true is going to happen... I wouldn't hold my breath too much, though: there's a big pile of bugs down at berlios, and I'd say it's more or less a priority for now...
Cheers,
Kaks.
Posted: Fri Feb 20, 2009 9:57 am
by Commander McLane
I don't understand why you are thinking so incredibly complicated here.
The only thing you have to do to replace the main station with a custom one is to declare it
in planetinfo.plist with the station property.
So this
Code: Select all
{
"0 7" = {
description = "Lave is most famous for its vast rain forests and the Laveian tree grub. Due to a population explosion among the tree grubs there is currently a shortage of food on Lave which has led to high food prices.";
station = "my_custom_station";
};
}
in planetinfo.plist is all you need to replace Lave's main station with your custom station. I guess
my_custom_station has to be the primary role. Then you create a commodities.plist entry for
my_custom_station, which is the same as the default entry, except for a higher price for food. VoilĂ !
Note: any changes in planetinfo.plist will of course be permanent, which you probably do
not want. Fortunately there is also
infoForSystem (JS) or
setSpecificPlanetInfo (legacy), which are reversible. Note also: These have to be set
before the player jumps into the system in question, in order to replace the main station with your custom station.
....
Posted: Fri Feb 20, 2009 10:28 am
by Lestradae
Commander McLane wrote:any changes in planetinfo.plist will of course be permanent
Is it possible to set conditions in front of a planetary description? That way, a system's content could also be altered dynamically via the planetinfo.plist.
Posted: Fri Feb 20, 2009 10:35 am
by LittleBear
Not sure, but you can do that in a script anyway by setting the conditions and then using the do (in legacy) or equivilent in JS. Assassins does this so the descriptions, tech levels and govenments change as events happen effecting systems. You could swap the main staition as well by having clones like-shiped with different commodoties attached.
eg:-
Code: Select all
{
conditions = ("gui_screen_string oneof GUI_SCREEN_STATUS, GUI_SCREEN_EQUIP_SHIP, GUI_SCREEN_MARKET, GUI_SCREEN_SHORT_RANGE_CHART", "dockedAtMainStation_bool equal YES", "mission_assassins equal assassins_STAGE3", "mission_assassins_jumpcount greaterthan 4", "galaxy_number equal 6", "score_number greaterthan 823");
do = (
"setMissionMusic: none",
"setMissionImage: assassins.png",
setGuiToMissionScreen,
"addMissionText: hitbrief_3",
"set: mission_assassins assassins_STAGE3a",
"set: mission_assassins_jumpcount 0",
"setMissionDescription: assassins_header6",
"setSpecificPlanetInfo: 6=73=description=Orramaor is noted for its companion world Apollodorus. Formaly the corporate headquarters of Soin Classic Shipyards Ltd, the Planet Orramaor is now famous for a large crater on the southern continent."
);
},
In this eg only the description is changed, but could change the station tech level or anything else you liked with the same code.
Re: ....
Posted: Fri Feb 20, 2009 10:38 am
by Commander McLane
Lestradae wrote:Commander McLane wrote:any changes in planetinfo.plist will of course be permanent
Is it possible to set conditions in front of a planetary description? That way, a system's content could also be altered dynamically via the planetinfo.plist.
I am not sure. But I don't think so. Conditions in planetinfo.plist can only be used in
script_actions, as far as I understand. And if you use
setSpecificPlanetInfo in a
script_actions in planetinfo.plist, what's the advantage over doing it directly in your script.plist?
Re: ....
Posted: Fri Feb 20, 2009 11:00 am
by Lestradae
Commander McLane wrote:And if you use setSpecificPlanetInfo in a script_actions in planetinfo.plist, what's the advantage over doing it directly in your script.plist?
Well, personally I would find that more clearly arranged (especially with my oxp having a bazillion of different XML and Java scripts simultanously running) but perhaps that's a matter of taste.
LittleBear wrote:do = (
"setMissionMusic: none"
That one's interesting. Is there a XML command for the planetinfo.plist that lets a piece of music or a sound file be played when the player enters a system? I could use something like that for my special systems.