Disruptor Missle "fix" mod?
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
Disruptor Missle "fix" mod?
How hard could it be? Has anyone made or tried to make a disruptor missile mod that made them do what their description states they do? I'm not even sure they really did that in Reunion, let alone TC or AP, but it would be nice if they had a percentage chance of disabling a ship and forcing a bailout, or maybe just forcing an engine failure.
With how bailing works in X3TC and X3AP I would think they would be a little overpowered in their X3R form.
Though I was thinking it might not be that hard to give them a chance to force a ship to stop. So like a 1/20 chance, lower for larger ships, that a ships engine might flip off for a few seconds, ie just keep hitting the damaged ship with a
to force speed set to 0. A player might be able to get around this by hitting the boost key over and over again though...
The hard part would be making sure this only had a chance to happen when they where hit with a disruptor missile. I think it is possible, but I would have to refresh myself on the script commands before I could say for sure.
Though I was thinking it might not be that hard to give them a chance to force a ship to stop. So like a 1/20 chance, lower for larger ships, that a ships engine might flip off for a few seconds, ie just keep hitting the damaged ship with a
Code: Select all
<RefObj> set ship speed to <Var/Number>
The hard part would be making sure this only had a chance to happen when they where hit with a disruptor missile. I think it is possible, but I would have to refresh myself on the script commands before I could say for sure.
- X2-Illuminatus
- Moderator (Deutsch)
- Posts: 24965
- Joined: Sun, 2. Apr 06, 16:38
Afaik you can neither track the event when a missile hits a target nor when the missile is fired. What you can do, is getting the missiles currently aiming at a certain object using the following two Fly Commands:
<RetVar> = <RefObj> find nearest missile aiming to me
<RetVar> = <RefObj> get array of missiles aiming to me
So in theory you could check if missiles are aiming at the refobj, regularly check their distance to the refobj and when one missile is very close to the refobj, execute the specific 'disruptor missile effect'. Constantly running such a script on all ships IS, especially if lots of missiles are fired, could result in quite a performance hit though. Also I'm not sure, how reliable the distance check would be with regards to missile defences.
<RetVar> = <RefObj> find nearest missile aiming to me
<RetVar> = <RefObj> get array of missiles aiming to me
So in theory you could check if missiles are aiming at the refobj, regularly check their distance to the refobj and when one missile is very close to the refobj, execute the specific 'disruptor missile effect'. Constantly running such a script on all ships IS, especially if lots of missiles are fired, could result in quite a performance hit though. Also I'm not sure, how reliable the distance check would be with regards to missile defences.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
There is another way to get missiles iirc, just for NPC though (basically the launch event) - you get the missile you just launched with the launch command as retvar if I am not mistaken - just check if it was a Disruptor missile that was launched and if yes spawn a global task which does basically:
Argument 1: missile var/object
while $missile - > exists
$pos = $missile - > get position
@wait 1ms
end
* find objects near $pos to apply disruption effect to
It does not work for the player though, but to keep track of missiles launched by the player at a specific target with the method suggested by x2 should not affect the performance that much - just find Disruptor missiles Launched at the player target which are originating near the player on a global task and call the aforementioned script for them, too
Disadvantage of this method is that all scripts launching missiles must be modified for this...
Argument 1: missile var/object
while $missile - > exists
$pos = $missile - > get position
@wait 1ms
end
* find objects near $pos to apply disruption effect to
It does not work for the player though, but to keep track of missiles launched by the player at a specific target with the method suggested by x2 should not affect the performance that much - just find Disruptor missiles Launched at the player target which are originating near the player on a global task and call the aforementioned script for them, too
Disadvantage of this method is that all scripts launching missiles must be modified for this...
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
- X2-Illuminatus
- Moderator (Deutsch)
- Posts: 24965
- Joined: Sun, 2. Apr 06, 16:38
That's indeed a good idea. Shouldn't be too difficult to implement.
I guess Disruptor missiles are not really used by NPC ships though?
How does the player gets them?
Edit:
I guess Disruptor missiles are not really used by NPC ships though?
How does the player gets them?
Edit:
Just tested this and unfortunately it's just a true/false value, which is returned. You still get to track the launch event that way.UniTrader wrote:you get the missile you just launched with the launch command as retvar if I am not mistaken
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
... i've just tested an alternative with the mission director:UniTrader wrote:Disadvantage of this method is that all scripts launching missiles must be modified for this...
you can get missiles flying around in a sector without passing args through (such as objects firing missiles or the target of the missile)
mission director script:
this one check every 5 seconds if there is any disruptor flying around
when true, it finds all disruptors in the player sector and runs <<missile.count>> times a script (to pass every missile), which will do the rest ...
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet href="director.xsl" type="text/xsl" ?>
<director name="test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="director.xsd">
<!--...-->
<cues>
<!--check for missiles-->
<cue name="disruptor_effect" delay="5s" instantiate="static">
<condition>
<check_all>
<count_objects min="1" category="missile" typename="SS_MISSILE_F">
<sector sector="{player.sector}"/>
</count_objects>
</check_all>
</condition>
<action>
<do_all>
<find_object group="disruptor_effect.listofmissiles" multiple="1" category="missile" typename="SS_MISSILE_F">
<sector sector="{player.sector}"/>
</find_object>
<do_all exact="{group.object.count@disruptor_effect.listofmissiles}" counter="c">
<run_script script="AAA.disruptor.appendtolist" task="1">
<scriptargs>
<scriptvalue datatype="object" datavalue="{group.object.{counter@c}@disruptor_effect.listofmissiles}"/>
</scriptargs>
</run_script>
</do_all>
</do_all>
</action>
</cue>
</cues>
</director>
Code: Select all
Script AAA.disruptor.appendtolist
Version: 0
for Script Engine Version: 53
Description
Description
Arguments
1: Missile , Value , 'Missile'
Source Text
001
002 write to player logbook $Missile
003
004 * check args
005 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
006
007 skip if $Missile -> exists
008 |return null
009
010 do if $Missile -> is of class Ware Container
011 |return null
012
013 * init list
014 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
015
016 $Name.ListOfMissiles = '_disruptor_list_'
017 $ListOfMissiles = get global variable: name=$Name.ListOfMissiles
018
019 if not is datatype[ $ListOfMissiles ] == DATATYPE_ARRAY
020 |$ListOfMissiles = array alloc: size=0
021 |set global variable: name=$Name.ListOfMissiles value=$ListOfMissiles
022 end
023
024 * append missile to list
025 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
026
027 skip if find $Missile in array: $ListOfMissiles
028 |append $Missile to array $ListOfMissiles
029
030 * watcher loop
031 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
032
033 $Name.ScriptInstance = '_disruptur_instance_'
034 do if get global variable: name=$Name.ScriptInstance
035 |return null
036
037 set global variable: name=$Name.ScriptInstance value=[TRUE]
038 $Array.Positions = array alloc: size=0
039
040 while size of array $ListOfMissiles
041 |
042 |$Index = size of array $ListOfMissiles
043 |resize array $Array.Positions to $Index
044 |
045 |while $Index > 0
046 ||dec $Index =
047 ||$Missile = $ListOfMissiles[$Index]
048 ||if $Missile -> exists
049 |||$Position = $Missile -> get position as array
050 |||$Array.Positions[$Index] = $Position
051 ||else
052 |||gosub Apply.Effect
053 |||remove element from array $ListOfMissiles at index $Index
054 |||remove element from array $Array.Positions at index $Index
055 ||end
056 |end
057 |
058 @ |= wait 400 ms
059 |
060 end
061
062 set global variable: name=$Name.ScriptInstance value=null
063
064 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
065
066 return null
067
068
069 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
070 Apply.Effect:
071
072 * arg = Index
073
074 $Position = $Array.Positions[$Index]
075 $X = $Position[0]
076 $Y = $Position[1]
077 $Z = $Position[2]
078
079 $Message = 'missile exploded at position: ( %s , %s , %s )'
080 write to player logbook: printf: fmt=$Message, $X, $Y, $Z, null, null
081 play sample 1008
082
083 endsub
084 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
085
086
087 return null
088
--> only 1 md script running in background (checking every 5sec for missiles)
--> max 1 msci script running globally when missiles found
// unfortunately, the md cant pass arrays/groups to the msci, therefore the script must be called <<missile.count>> times
// little side effect: the md script finds also ware containers, but the msci script can filter them out
To err is human. To really foul things up you need a computer.
Irren ist menschlich. Aber wenn man richtig Fehler machen will, braucht man einen Computer.
Mission Director Beispiele
Irren ist menschlich. Aber wenn man richtig Fehler machen will, braucht man einen Computer.
Mission Director Beispiele
- X2-Illuminatus
- Moderator (Deutsch)
- Posts: 24965
- Joined: Sun, 2. Apr 06, 16:38
That's a neat solution.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
- X2-Illuminatus
- Moderator (Deutsch)
- Posts: 24965
- Joined: Sun, 2. Apr 06, 16:38
Actually, if JSDD script and MD code works, most of the task is done already.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)
Neuauflage der fünf X-Romane als Taschenbuch
The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!
... it works !! ... without problems, except the fact that this method could affect performance / fps when many disruptor missiles are around
// for every missile a script call by md is needed to pass the missiles to the global array, unfortunately there is no way to pass "groups" as arrays to the msci
// for every missile a script call by md is needed to pass the missiles to the global array, unfortunately there is no way to pass "groups" as arrays to the msci
To err is human. To really foul things up you need a computer.
Irren ist menschlich. Aber wenn man richtig Fehler machen will, braucht man einen Computer.
Mission Director Beispiele
Irren ist menschlich. Aber wenn man richtig Fehler machen will, braucht man einen Computer.
Mission Director Beispiele
... hmm, to say it with unitrader's words:Eightbal1 wrote:Awesome! I wish I could've been more help than just planting the idea. Could you post the finished mod or spk or whatever? I'd love to try it out.
unihaendler wrote:I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
... if you want try to finish this "mod", just edit the scripts sub-function "Apply.Effect" (and delete the first line "write to logbook ..")
instead of:
Code: Select all
079 $Message = 'missile exploded at position: ( %s , %s , %s )'
080 write to player logbook: printf: fmt=$Message, $X, $Y, $Z, null, null
081 play sample 1008
Code: Select all
Sector = [playership] -> get sector
Flags = [Find.Nearest] | [Find.Enemy]
TARGET = find ship: sector=Sector ... flags=Flags ... x=X y=Y z=Z
if TARGET -> exists
... here the effect
Target -> interrupt task 0 with script: "new.script.name.here" and prio 100
end
Code: Select all
@ wait 2000 ... 5000 ms
... means that for this time the target will do nothing & his speed will sink to 0
Code: Select all
Target -> eject pilot from ship ...
To err is human. To really foul things up you need a computer.
Irren ist menschlich. Aber wenn man richtig Fehler machen will, braucht man einen Computer.
Mission Director Beispiele
Irren ist menschlich. Aber wenn man richtig Fehler machen will, braucht man einen Computer.
Mission Director Beispiele