Creating misssion oxp
Moderators: winston, another_commander
explosive_shrapnel is actually a defined entity in the shipdata.plist of the OXP, which is spawned (multiple times) by the death_action of the ship (in the same plist). To replace it with a cargo pod full of gold (or multiples thereof, or a different item that scoops as gold) you'll need to define such an entity in the same way, and then spawn that.
It's not difficult, and you can use the explosive_shrapnel entity as an example template. But it's a little more complicated than just changing the explosive_shrapnel in the death_actions line to Gold.
It's not difficult, and you can use the explosive_shrapnel entity as an example template. But it's a little more complicated than just changing the explosive_shrapnel in the death_actions line to Gold.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
So i've discovered thank you for confirming. Another idea i have had is to try thisThargoid wrote:explosive_shrapnel is actually a defined entity in the shipdata.plist of the OXP, which is spawned (multiple times) by the death_action of the ship (in the same plist). To replace it with a cargo pod full of gold (or multiples thereof, or a different item that scoops as gold) you'll need to define such an entity in the same way, and then spawn that.
It's not difficult, and you can use the explosive_shrapnel entity as an example template. But it's a little more complicated than just changing the explosive_shrapnel in the death_actions line to Gold.
Code: Select all
<key>death_actions</key>
<array>
<string>set: mission_bolts_targetdead TRUE</string>
<key>script_actions</key>
<array>
<string>awardCargo: 20 gold</string>
<string>commsMessage: scooped 20 gold</string>
</array>
</array>
maybe
Code: Select all
<key>death_actions</key>
<array>
<string>set: mission_bolts_targetdead TRUE</string>
<string>awardCargo: 20 gold</string>
<string>commsMessage: scooped 20 gold</string>
</array>
so instead in script i have
Code: Select all
{
conditions = (
"mission_bolts_targetdead equal TRUE",
"mission_bolts equal STAGE1"
);
do =(
"awardCargo: 20 gold",
"set: mission_bolts STAGE2"
);
}
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
- LittleBear
- ---- E L I T E ----
- Posts: 2880
- Joined: Tue Apr 04, 2006 7:02 pm
- Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.
You can do it by spawning a special pod (a shipdata entry like_shiped to a normal pod but with a unique entry name). Spawn one of these. Add a JS to it that awards the gold when scooped. If you check the Mining Pods in Random Hits, you can use that code. These pods are lauched by the mining machines. The player can scoop them and gets a ton of minerals and a ton of machinary (the pod). But nicking GalMine's stuff is against the law, so the player also gets an increase in legal status. The JS script awards the minerals and the fine. So you could mod that to just award the gold but take out the line fining the player for pilfering.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
Thanks for all your help.LittleBear wrote:You can do it by spawning a special pod (a shipdata entry like_shiped to a normal pod but with a unique entry name). Spawn one of these. Add a JS to it that awards the gold when scooped. If you check the Mining Pods in Random Hits, you can use that code. These pods are lauched by the mining machines. The player can scoop them and gets a ton of minerals and a ton of machinary (the pod). But nicking GalMine's stuff is against the law, so the player also gets an increase in legal status. The JS script awards the minerals and the fine. So you could mod that to just award the gold but take out the line fining the player for pilfering.
If the player ship has full cargo he won't be able to receive his award, so i may stick to the sloppy method i came up with. Although i will be looking at your above suggestion so i know how to do in future when i attempt js.
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
- Commander McLane
- ---- 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:
As you already discovered there is no need to insert script_actions into death_actions. Both are essentially the same, the only difference is the moment they are triggered. (See the Scripts within shipdata-page for more info on this.)Rustybolts wrote:*edit* Displays comms message but doesnt award the cargoCode: Select all
<key>death_actions</key> <array> <string>set: mission_bolts_targetdead TRUE</string> <string>awardCargo: 20 gold</string> <string>commsMessage: scooped 20 gold</string> </array>
so instead in script i haveCode: Select all
{ conditions = ( "mission_bolts_targetdead equal TRUE", "mission_bolts equal STAGE1" ); do =( "awardCargo: 20 gold", "set: mission_bolts STAGE2" ); }
Therefore the above solution works. The reason it doesn't (and also the below version shouldn't) is a syntax error in the awardCargo: method. Again quoting from the methods-documentation, this time the Player rewards and penalties / Cargo-section:
Code: Select all
awardCargo: <amount> <Commodity name>
// awards a quantity of the cargo named
// the cargo name must match the name in commodities.plist exactly
// only positive numbers are allowed.
Code: Select all
<string>awardCargo: 20 Gold</string>
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
Just checked my working script.plist and i had gold and not Gold but it still works.Commander McLane wrote:As you already discovered there is no need to insert script_actions into death_actions. Both are essentially the same, the only difference is the moment they are triggered. (See the Scripts within shipdata-page for more info on this.)Rustybolts wrote:*edit* Displays comms message but doesnt award the cargoCode: Select all
<key>death_actions</key> <array> <string>set: mission_bolts_targetdead TRUE</string> <string>awardCargo: 20 gold</string> <string>commsMessage: scooped 20 gold</string> </array>
so instead in script i haveCode: Select all
{ conditions = ( "mission_bolts_targetdead equal TRUE", "mission_bolts equal STAGE1" ); do =( "awardCargo: 20 gold", "set: mission_bolts STAGE2" ); }
Therefore the above solution works. The reason it doesn't (and also the below version shouldn't) is a syntax error in the awardCargo: method. Again quoting from the methods-documentation, this time the Player rewards and penalties / Cargo-section:The hint is the second point. The names in commodities.plist are capitalized. Therefore the correct syntax is:Code: Select all
awardCargo: <amount> <Commodity name> // awards a quantity of the cargo named // the cargo name must match the name in commodities.plist exactly // only positive numbers are allowed.
Code: Select all
<string>awardCargo: 20 Gold</string>
Must only be in shipdata you need the complete correct syntax eg Gold.
By doing it in the script sometimes there is a delay upto 10secs from killing ship to awarding gold. It may have awarded it quicker by applying it in death actions, i dunno any thoughts?
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
- Cmdr James
- Commodore
- Posts: 1357
- Joined: Tue Jun 05, 2007 10:43 pm
- Location: Berlin
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
Ty for advice will change and re-uploadCmdr James wrote:Something that works but is wrong might not work on all platforms, or on all versions. There may well be a fix in a future version that might stop your OXP from working properly.
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
- Commander McLane
- ---- 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:
Well noticed. This is because of the way the scripting engine is working. Your script is in legacy (plist) format. Plist scripts are executed by the engine at intervals of roughly 10 seconds by a so-called "tickle". There are ways of forcing an immediate execution, but it is not advisable to use these ways, because on every tickle all scripts are executed. And generally the 10-second-interval should be something everybody can rely on.Rustybolts wrote:By doing it in the script sometimes there is a delay upto 10secs from killing ship to awarding gold. It may have awarded it quicker by applying it in death actions, i dunno any thoughts?
The death_actions, while technically working as a script, are not triggered by a timer, but by the death of the entity they are ascribed to. And this can happen anytime, of course.
You find more general information on how scripts work in the wiki as well, notably on the OXP_howto, OXP_howto_plist, and in case of script.plist and the modalities of its executions, the Script.plist-page (the information about the 10-second-intervalls is in its Structure-section).
And by the way, JavaScript-scripts are handled completely differently. They are not triggered by a timer every 10 seconds, but by certain pre-defined events. Which (among other things) means that anything ascribed to the event of a ship being destroyed will be executed immediatly. Actually, this is exactly what happens with your death_actions, because all types of scripts within shipdata.plist are automatically translated and handled as JS-scripts by the engine.
Out of curiosity: Why are you bothering to script in the (deprecated) legacy plist-system in the first place? Why not learning JS-scripting right from the onset of your career as an OXPer? It is way more powerful than the legacy plist-system, which gives you only very limited possibilities for things you can do. A good place to start learning would of course be the Scripting_Oolite_with_JavaScript-page in the wiki, which gives a first overview and links to all relevant information.
And again I strongly suggest you study all this information linked to here in the wiki. It is there for a reason, and people have invested their time and their goodwill to put it there in a structured way.
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
I started writing legacy as at hand i could find more information on how to script this way. Also from making ships it was a little bit more familiar to me. At first glance on the wiki it mainly deals with legacy unless you delve a little deeper. any questions i have asked on the forum i have already searched on the wiki either through not understanding or the text not being clear enough i have then found the forum to be more helpfull. It was always my intention to learn java script and have since doing my oxp found out some information in this regard in thanks partly to do with kind peeps pointing me in the right direction. Now i have a working oxp, to learn java script my first task will be to convert it.
Many thanks
Many thanks
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
- Commander McLane
- ---- 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:
That's a very good idea and first step.Rustybolts wrote:Now i have a working oxp, to learn java script my first task will be to convert it.
And the information is really there. As said above, the general information is the first thing you should study, followed by the object model (although this is a little outdated). If you've understood the concept of events, the list of event handlers gives you a good clue what kind of events there are in Oolite. Finally all documents which start with "Oolite JavaScript Reference" (all available through the Category:Oolite_scripting-page) contain the necessary information about properties (values you can read and/or manipulate) and methods (commands you can give in the case of any event). And that's basically it.
Just jump right into it and have fun!
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
Any ideas on a basic javascript mission oxp i can study as i find it easier to learn by taking apart someone else's script. The only one i can think of is scourge of the black baron is this a good one to dissect?Commander McLane wrote:That's a very good idea and first step.Rustybolts wrote:Now i have a working oxp, to learn java script my first task will be to convert it.
And the information is really there. As said above, the general information is the first thing you should study, followed by the object model (although this is a little outdated). If you've understood the concept of events, the list of event handlers gives you a good clue what kind of events there are in Oolite. Finally all documents which start with "Oolite JavaScript Reference" (all available through the Category:Oolite_scripting-page) contain the necessary information about properties (values you can read and/or manipulate) and methods (commands you can give in the case of any event). And that's basically it.
Just jump right into it and have fun!
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
ty n1Svengali wrote:Take a look in Eric's demoScript.js (included in UPS-courier). This shows and explains a bit more how to set up a missionscreen and do the populating. It is specially designed to avoid the clashes between oxps.
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
Or have a look at the mission in my Aquatics OXP.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link