X2: The Threat

X2: The Threat

Odin Kree Apr 19, 2018 @ 10:17pm
script writing
Hey guys,i am playing x2 the threat for the second time,the first time i gave up because i couldn't get past the collect the black box mission i was able to get the box but my hydra would not under any circumstances jump out of the xenon system and eventually i would get killed,it may be because i added the extra shield and other options to the hydra they give u for the mission,well enough of that i wonder if someone can tell me how to write a script for cargo bay extensions,i have 1 script for 125mw shields because they are hard to get,i have tried writing the cargo bay script the same way i wrote the shield script but with no luck,can anybody help me please.
< >
Showing 1-13 of 13 comments
ormac Apr 21, 2018 @ 10:21pm 
001 *Select Atreus Clouds as start sector 002 get sector from universe index: x=3 , y=2 003 *Create my ship equip it properly and return it 004 $plship = create ship: type= Boron Hydra owner= Player add to=$sec x=0 y=0 z= 0 005 $plship > add default items to ship 006 $tmp = $plship> add 1 units of Singularity Engine Time Accelerator 007 $tmp = $plship> add 1 units of Boost Extention 008 * Find max number of upgrades and add to ship 009 $Maxcb = $plship > get max upgrades for upgrade Cargo bay extension 010 $tmp= $plship > add $Maxcb units of Cargo bay extension 011 return $plship

The above is a modified copy of galaxy.Example.initplayership.

Get Max Upgrades in in Genral Object Commands
add units is in the trade commands.

Creates a Hydra with a cargo space of 1500

You'll need to modfy your exisiting script and remeber to take extra energy cells to jump back.
Odin Kree May 1, 2018 @ 5:41am 
Thanks ormac,but what i really wanted is to write a script just to increase my cargo space alittle.
ormac May 1, 2018 @ 8:49pm 
That's alright iI took a guess with what you were trying to describe.

In that case you'll wantsomething like

(I'll assume your in the sip to begin with)

$plship =get player ship

$tmp= $plship > add 20 units of Cargo bay extension

return null. (I think)

IF you could post your 125M shield script or your cargobay script

screenshot the script editor with script open and transcribe or trim the xml elements out to improve readbility and I could see what lines of code need to be changed.
Odin Kree May 7, 2018 @ 4:43am 
ormac.ty for helping i will try the screen shot thing,but i already know how i wrote the script it goes like this, new script name of script aaaaa125mwshields3,new line no return value=player ship then number is 3 and lastly is select ware is 125mwshield esc. then save, pretty simple really but it wont work if u write a script that way for cargo extension,oh i forgot 1 thing u select the install to player ship or something like that there is 2 options 1 is to install and 1 is to add to player i chose the install first didnt work tho then i did add to player ship it didn't work either.
ormac May 9, 2018 @ 10:09pm 
001 * Adds cargobay extensions to the ship your in. Adds in increments of 10. 002 $myship = get player ship 003 $plumped = $myship > add 10 units of Cargo bay extension 004 return null

Alright that's the code to add cargobay extensions to the ship your in.
You'll need to enter your Hydra before running the script

feel free to adjust the number of units added.

Just run it with a null argument

the script takes the players location as the starting point and adds the cargobay extentions to the ship.

My earlier example spawned the ship in with the extentions added (to Maximum allowed)
Odin Kree May 10, 2018 @ 11:51am 
ormac,do u think u could be alittle more descriptive in the way to write this script,i tried it with a "null" value instead of inputting 10 or what ever as a number but it didn't work i am really a novice at scripts so i could use more detail,and i thank you very much for taking your time to help me with this, not many people would make the effort and i want you to know that i appreciate it very much. by the way i dont want to increase the cargo bay in a hydra but in my argon nova i am placing nav. sats. in sectors and i can either carry a few sats. or a few energy cells for jumps but not a lot of either.
ormac May 10, 2018 @ 7:42pm 
You may want to look at the MCSI Programmers Handbook.

https://forum.egosoft.com/viewtopic.php?t=48593
Egosoft Account required to download.


Now I'll try explaining the few lines of the last script

Originally posted by ormac:
001 * Adds cargobay extensions to the ship your in. Adds in increments of 10. 002 $myship = get player ship 003 $plumped = $myship > add 10 units of Cargo bay extension 004 return null

The in game scipt editor works by selecting the command (from the catergorised list) and then filling in the spaces.

The first line is a comment (which can be added by the script editor) but is there just for us.

<RetVar>= get player ship

could look like <?>= get player ship
you set a variable name in to use later. eg myship

$myship= get playership

<RetVar>= <Object> > add <amount> units of <ware>
you then hilight the line you want to edit and move alng filling in the blanks

plumped= $myship > add <?> units of <?>
first two steps is to devine a new variable plumped. And to use the variable indicating the player ship "Myship"

Next we define the value of amount as a number (I'll put in 10)

plumped= $myship > add 10 units of <?>

Finally we will choiose the ware to add (from the list that egosoft as defined) I'll scroll down to Cargobay Extentions.

$plumped = $myship > add 10 units of Cargo bay extension

All wares are in this list even the 125MW shields you added from your own script.

When ever we write a new script the editor defaults it to return null so we don't have to d anything else now.

Save the script. ( I called mine aor.plumpcargobay)

Now you pilot which ever ship you need and when you run the script it will add 10 cargobay extentsions to that ship. Run the script multiple times to add more.
Odin Kree May 11, 2018 @ 4:02am 
ormac,if i get this correctly udon't select the install/var option but u select the get player ship
? then the rest is pretty easy to follow,but i dont recall seeing a get player ship anywhere,but maybe i was just not looking good eough i will let u know how it comes out ty bro, 1 thing i am not quite ure about is where does the "plumped"come in at?
Odin Kree May 11, 2018 @ 4:54am 
ormac,where is the get player ship command i cant seem to find it.
ormac May 11, 2018 @ 7:43am 
get playership is in the General Object Commands (towards the bottom of that list) they can be tricky to find even when you know where and what you're looking for.

plumped was just what I thought of as a variable name.

I think the add command adds to the object and returns a null value to the plumped variable in this case.

You can pick a variable name that works for you.
The editor takes care of the syntax [adding a dollar sign ($) in front]

the galaxy.Example.initplayership is already included you can view that and see them use variable tmp (for temp) in exactly the same way.

They spawn the ship in after loading it with a few items.
Odin Kree May 11, 2018 @ 2:57pm 
ormac,i don't really want to spawn a whole ship all i want is to increase my cargo bay by about 100 extensions.i looked at that msci programming guide and i really dont see how any one could understand that mess,i also have watched some youtube videos and tried a few options from them but so far nothing has worked.
ormac May 11, 2018 @ 8:04pm 
Sorry if I confused you with talking about the other script.

It appears that the scripts cannot add more upgrages (cargobay extensions/engine tunings/rudder optimisations) than is allowed for the particular ship..

A Novas maximum cargospace is 236.

there is also the MSCI forum were it might be easier to reference the script commands

MSCI reference forum[forum.egosoft.com]
I had not realised it was public.

The M6's in X2 can dock your fighter (M5-M3) [Argon Discoverer/Buster/Nova] so you could carry a few more satalites and energy in the M6 with them and then transfer to the Nova to place the sats.
Last edited by ormac; May 11, 2018 @ 8:04pm
Odin Kree May 12, 2018 @ 12:51am 
ormac,ty bro i thought something like that maybe the cargo bay on a nova can't be increased,i will try it on a bigger ship and see if that works, thanks for all your help bro,the link to the forum is better than the msci handbook ty for that.
< >
Showing 1-13 of 13 comments
Per page: 1530 50