Hey....again
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
'Ship' wrecks
Board Index » X3: Albion Prelude » 'Ship' wrecks
RobertSchafer
Skillguey (7)
Skillguey (7)
---- X3ap Battlestar Galactica mod ----
Latest update: 06/01/2014.
Team recruitment: Texture artist
Mod updater/downloader via our website:
www.x-battlestar.com
Latest update: 06/01/2014.
Team recruitment: Texture artist
Mod updater/downloader via our website:
www.x-battlestar.com
Roguey
Trueguey (22)
Trueguey (22)
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.
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
Specoguey (14)
Specoguey (14)
There is a script in the Ego mod library that allows players to repair and claim ship/station wrecks Very cool script, might be worth you looking at Robert I can't remember off hand what it's called, so you might need to trawl through the library till you find it
Madder than a Bastard on fathers day.
My DiDs: Peace(s) of Eight - Way of the Gun - Status: Online, A Xenon DiD
My DiDs: Peace(s) of Eight - Way of the Gun - Status: Online, A Xenon DiD
RobertSchafer
Skillguey (7)
Skillguey (7)
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 , 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
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
Latest update: 06/01/2014.
Team recruitment: Texture artist
Mod updater/downloader via our website:
www.x-battlestar.com
Roguey
Trueguey (22)
Trueguey (22)
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:
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>:
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
$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
Skillguey (7)
Skillguey (7)
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
Latest update: 06/01/2014.
Team recruitment: Texture artist
Mod updater/downloader via our website:
www.x-battlestar.com
RobertSchafer
Skillguey (7)
Skillguey (7)
Follows on from your post:
So lets say i call mine wreck.check:
- i need one script called al.plugin.wreck.check with:
- one script called al.wreck.check with:
- and one further script called plugin.robert.wreck.check....
Thats what i have understood but excuse my inability to script if im wrong haha
cheers for the help,
Robert Schafer
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
$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
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
Latest update: 06/01/2014.
Team recruitment: Texture artist
Mod updater/downloader via our website:
www.x-battlestar.com
Roguey
Trueguey (22)
Trueguey (22)
looks about right just remmeber to change the following things;
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
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.
$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
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
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
Skillguey (7)
Skillguey (7)
Oh i know i asked haha, and yes make that the marianas trench i jumped into .
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
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
---- X3ap Battlestar Galactica mod ----
Latest update: 06/01/2014.
Team recruitment: Texture artist
Mod updater/downloader via our website:
www.x-battlestar.com
Latest update: 06/01/2014.
Team recruitment: Texture artist
Mod updater/downloader via our website:
www.x-battlestar.com
Roguey
Trueguey (22)
Trueguey (22)
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
1
You need to log-in to post here.