'Ship' wrecks

Home Board Index » X3: Albion Prelude » 'Ship' wrecks

RobertSchafer

RobertSchafer avatar
Level badge Skillguey (7)
Posted 10 years ago.

Hey....again :p

I have another question this time concerning wrecks. By this I mean when a ship explodes a wreck is left.
Now x3 has a built in system for this but it is not used, presumably because it would be rediculous to have 100s of wrecks floating arounds.
I however would like to implement it into a mod and was wondering whether a script could be created that would periodically check the universe
for wrecks and if these are above a certain amount remove a certain amount?

Thanks,

Robert schafer

---- X3ap Battlestar Galactica mod ----
Latest update: 06/01/2014.
Team recruitment: Texture artist
Mod updater/downloader via our website:
www.x-battlestar.com
Roguey

Roguey avatar
Level badge Trueguey (22)
Posted 10 years ago.

hi there,

well adding wrecks would cause a lot of extra objects, and has such wrecks dont do much (unless you code something). The other thing is there isnt a wreck model for each ship, so you would have to use the same one over-and-over for many different ships (which may become rather boring)... well, unless you plan on modelling wreck versions of each ship.

Kirlack

Kirlack avatar
Level badge Specoguey (14)
Posted 10 years ago.

There is a script in the Ego mod library that allows players to repair and claim ship/station wrecks Smile Very cool script, might be worth you looking at Robert Smile I can't remember off hand what it's called, so you might need to trawl through the library till you find it Wink

Madder than a Bastard on fathers day.
My DiDs: Peace(s) of Eight - Way of the Gun - Status: Online, A Xenon DiD
RobertSchafer

RobertSchafer avatar
Level badge Skillguey (7)
Posted 10 years ago.

Cheers for the replies. I know they don't do anything as such unless you code something (there is a mod that replaces damaged ships with nave boys that have equipment ect not a fan of it though). My issue is ive sort of had enough of the boring old explosions and then nothing :P, so for a couple of ships i have modeled some wrecks and they work perfectly. But my issue is im worried that after a while sectors may be littered with them over a long period and so thats why i was wondering if one could code a script as explained above... Any ideas roguey?

Thanks kirlack, i will take a look at that! I think i have heard of it, so ile trawl through the library haha

---- X3ap Battlestar Galactica mod ----
Latest update: 06/01/2014.
Team recruitment: Texture artist
Mod updater/downloader via our website:
www.x-battlestar.com
Roguey

Roguey avatar
Level badge Trueguey (22)
Posted 10 years ago.

sounds like you want an AI plug-in; a script which is ran every-so-often (depending on your timer). The script could then check the number of the wrecks in each sector then remove some if there are too many - keeping them under-control.

Below is an AI script from my X3 Mod: al.random.race.respond:

$AL.STATE.VERSION = 0
$AL.STATE.ENABLED = 1

$al.state = get global variable: name=$al.PluginID
if not $al.state
$al.state = array alloc: size=2
$version = get script version
$al.state[$AL.STATE.VERSION] = $version
$al.state[$AL.STATE.ENABLED] = [TRUE]
set global variable: name=$al.PluginID value=$al.state
end

if $al.Event == 'init' OR $al.Event == 'reinit'
* once created
$Name.Formatted = sprintf: pageid=999888 textid=88, null, null, null, null, null
al engine: set plugin $al.PluginID description to $Name.Formatted
al engine: set plugin $al.PluginID timer interval to 420 s

else if $al.Event == 'start'
* called everytime user selects start
$al.state[$AL.STATE.ENABLED] = [TRUE]

else if $al.Event == 'stop'
* called everytime user selects stop
$al.state[$AL.STATE.ENABLED] = [FALSE]

else if $al.Event == 'isenabled'
* returns the current AL state
$al.retval = $al.state[$AL.STATE.ENABLED]
return $al.retval

else if $al.Event == 'timer'
* timer event
skip if not $al.state[$AL.STATE.ENABLED]
@ START [THIS] -> call script 'plugin.roguey.race.response' :
end

return null


The script plugin.roguey.race.response is the one that is ran every-so-often, so just replace with your script.

Oh, and youre need to register your script too. This is done by having a script named something like al.plugin.<name>:

al engine: register script='al.random.race.respond'

RobertSchafer

RobertSchafer avatar
Level badge Skillguey (7)
Posted 10 years ago.

Yes roguey! that's exactly what i mean haha just wasn't sure how to word it. Thanks for the ai script that's a great help. Ok, well the next step is building the script, as i don't have any experience what so ever i was wondering whether there are any good tutorials around on scripting? I've had a look but haven't been able to find anything substantial.

---- X3ap Battlestar Galactica mod ----
Latest update: 06/01/2014.
Team recruitment: Texture artist
Mod updater/downloader via our website:
www.x-battlestar.com
RobertSchafer

RobertSchafer avatar
Level badge Skillguey (7)
Posted 10 years ago.

Follows on from your post:

So lets say i call mine wreck.check:

- i need one script called al.plugin.wreck.check with:

al engine: register script='al.wreck.check'


- one script called al.wreck.check with:

$AL.STATE.VERSION = 0
$AL.STATE.ENABLED = 1

$al.state = get global variable: name=$al.PluginID
if not $al.state
$al.state = array alloc: size=2
$version = get script version
$al.state[$AL.STATE.VERSION] = $version
$al.state[$AL.STATE.ENABLED] = [TRUE]
set global variable: name=$al.PluginID value=$al.state
end

if $al.Event == 'init' OR $al.Event == 'reinit'
* once created
$Name.Formatted = sprintf: pageid=999888 textid=88, null, null, null, null, null
al engine: set plugin $al.PluginID description to $Name.Formatted
al engine: set plugin $al.PluginID timer interval to 420 s

else if $al.Event == 'start'
* called everytime user selects start
$al.state[$AL.STATE.ENABLED] = [TRUE]

else if $al.Event == 'stop'
* called everytime user selects stop
$al.state[$AL.STATE.ENABLED] = [FALSE]

else if $al.Event == 'isenabled'
* returns the current AL state
$al.retval = $al.state[$AL.STATE.ENABLED]
return $al.retval

else if $al.Event == 'timer'
* timer event
skip if not $al.state[$AL.STATE.ENABLED]
@ START [THIS] -> call script 'plugin.robert.wreck.check' :
end

return null


- and one further script called plugin.robert.wreck.check....

Thats what i have understood but excuse my inability to script if im wrong haha :P

cheers for the help,

Robert Schafer

---- X3ap Battlestar Galactica mod ----
Latest update: 06/01/2014.
Team recruitment: Texture artist
Mod updater/downloader via our website:
www.x-battlestar.com
Roguey

Roguey avatar
Level badge Trueguey (22)
Posted 10 years ago.

looks about right just remmeber to change the following things;

$Name.Formatted = sprintf: pageid=999888 textid=88, null, null, null, null, null
al engine: set plugin $al.PluginID description to $Name.Formatted
al engine: set plugin $al.PluginID timer interval to 420 s


You probably dont need a nice formatted string (loaded from a lang file), so just use a text string instead (ie. description to 'My AI name'). You may want to adjust the timer too.

I wouldnt say learning how to do AI scripts is good for newcomers although - kind-of jumped you in the deep-end.. Although you did ask how to do it Smile

You need to code two parts; a timer (AI script) and what to do when the timer triggers.

In the script wreck.check you would get an array of objects, then you would have to run through them via some loops to count them. Once done, then you can decide what to do with the wrecks.

RobertSchafer

RobertSchafer avatar
Level badge Skillguey (7)
Posted 10 years ago.

Oh i know i asked haha, and yes make that the marianas trench i jumped into :P.

I have no clue what im doing so im just looking at other scripts and comparing and contrasting from there. I thought it would be a relatively simple one to do but guess i was wrong haha.

thanks for the above ile see how far i get, probably best though to find someone who could do it for me! Ile see if there is something smaller i could maybe start on :P

---- X3ap Battlestar Galactica mod ----
Latest update: 06/01/2014.
Team recruitment: Texture artist
Mod updater/downloader via our website:
www.x-battlestar.com
Roguey

Roguey avatar
Level badge Trueguey (22)
Posted 10 years ago.

lol, yea I do think you need to learn how to do the simple scripts before taking-on one with AI scripts. However atleast you know its possible to do in the end Smile

1


You need to log-in to post here.