EnglishGermanFrenchRussianItalianSpanish
Log inRegister
 
Disruptor Missle "fix" mod?
Post new topic Reply to topic
View previous topic :: View next topic
Author Message
Eightbal1





Joined: 07 Jan 2015



PostPosted: Wed, 29. Jul 15, 03:42    Post subject: Disruptor Missle "fix" mod? Reply with quote Print

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.

Back to top
View user's profile Send private message
RoverTX



MEDALMEDALMEDAL

Joined: 16 Nov 2011
Posts: 669 on topic

Thank you for registering your game
PostPosted: Wed, 29. Jul 15, 04:16    Post subject: Reply with quote Print

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

Code:
<RefObj> set ship speed to <Var/Number>


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.


_________________
NPC Traders With Jump Drives O My
Station Capture Through TL Boarding
B.A.M. - Bad *ss Marines
Back to top
View user's profile Send private message
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)

MEDALMEDALMEDAL

Joined: 02 Apr 2006
Posts: 20390 on topic

Thank you for registering your game
PostPosted: Wed, 29. Jul 15, 10:22    Post subject: Reply with quote Print

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.


_________________
Besteht Interesse an einem Nopileos-Hörbuch?

Farnhams Legende und Nopileos als E-Books!

"People who think they know everything are a great annoyance to those of us who do." - Isaac Asimov

"If it's not impossible, there must be a way to do it." - Sir Nicholas Winton
Back to top
View user's profile Send private message Visit poster's website
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)

MEDAL

Joined: 20 Nov 2005
Posts: 13458 on topic

Thank you for registering your game
PostPosted: Wed, 29. Jul 15, 16:23    Post subject: Reply with quote Print

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...


_________________
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 Wink

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help Wink
Back to top
View user's profile Send private message
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)

MEDALMEDALMEDAL

Joined: 02 Apr 2006
Posts: 20390 on topic

Thank you for registering your game
PostPosted: Thu, 30. Jul 15, 12:42    Post subject: Reply with quote Print

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:

UniTrader wrote:
you get the missile you just launched with the launch command as retvar if I am not mistaken


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.


_________________
Besteht Interesse an einem Nopileos-Hörbuch?

Farnhams Legende und Nopileos als E-Books!

"People who think they know everything are a great annoyance to those of us who do." - Isaac Asimov

"If it's not impossible, there must be a way to do it." - Sir Nicholas Winton
Back to top
View user's profile Send private message Visit poster's website
JSDD





Joined: 21 Mar 2014
Posts: 668 on topic
Location: Belt of Aguilar ... JSDD Headquarters
Thank you for registering your game
PostPosted: Thu, 30. Jul 15, 17:58    Post subject: Reply with quote Print

UniTrader wrote:
Disadvantage of this method is that all scripts launching missiles must be modified for this...


... i've just tested an alternative with the mission director:
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:

<?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>


... and the msci script collects every missile and (when necessary) keeps track of them until there is no disruptor in the sector
Code:

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   


the result is:
--> 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 Wink


_________________
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.
Back to top
View user's profile Send private message
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)

MEDALMEDALMEDAL

Joined: 02 Apr 2006
Posts: 20390 on topic

Thank you for registering your game
PostPosted: Thu, 30. Jul 15, 18:26    Post subject: Reply with quote Print

That's a neat solution. Thumb up


_________________
Besteht Interesse an einem Nopileos-Hörbuch?

Farnhams Legende und Nopileos als E-Books!

"People who think they know everything are a great annoyance to those of us who do." - Isaac Asimov

"If it's not impossible, there must be a way to do it." - Sir Nicholas Winton
Back to top
View user's profile Send private message Visit poster's website
Eightbal1





Joined: 07 Jan 2015



PostPosted: Tue, 4. Aug 15, 04:05    Post subject: Reply with quote Print

So, it sounds like a pretty hard task. Cool ideas though, just beyond me and my schedule right now.

Back to top
View user's profile Send private message
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)

MEDALMEDALMEDAL

Joined: 02 Apr 2006
Posts: 20390 on topic

Thank you for registering your game
PostPosted: Thu, 6. Aug 15, 09:46    Post subject: Reply with quote Print

Actually, if JSDD script and MD code works, most of the task is done already.


_________________
Besteht Interesse an einem Nopileos-Hörbuch?

Farnhams Legende und Nopileos als E-Books!

"People who think they know everything are a great annoyance to those of us who do." - Isaac Asimov

"If it's not impossible, there must be a way to do it." - Sir Nicholas Winton
Back to top
View user's profile Send private message Visit poster's website
JSDD





Joined: 21 Mar 2014
Posts: 668 on topic
Location: Belt of Aguilar ... JSDD Headquarters
Thank you for registering your game
PostPosted: Mon, 10. Aug 15, 22:32    Post subject: Reply with quote Print

... it works !! Wink ... 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


_________________
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.
Back to top
View user's profile Send private message
Eightbal1





Joined: 07 Jan 2015



PostPosted: Tue, 11. Aug 15, 11:28    Post subject: Reply with quote Print

Awesome! I wish I could've been more help than just planting the idea. Could you post the finished mod or spk or whatever? Very Happy I'd love to try it out.

Back to top
View user's profile Send private message
JSDD





Joined: 21 Mar 2014
Posts: 668 on topic
Location: Belt of Aguilar ... JSDD Headquarters
Thank you for registering your game
PostPosted: Tue, 11. Aug 15, 12:03    Post subject: Reply with quote Print

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? Very Happy I'd love to try it out.


... hmm, to say it with unitrader's words:

unihaendler wrote:
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help


Razz

... 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:
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

try doing something like this:
Code:

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

then create a new script "new.script.name.here":
Code:

@ wait 2000 ... 5000 ms
... means that for this time the target will do nothing & his speed will sink to 0


if you want the pilot to eject from ship => there is also a command for this
Code:
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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic Reply to topic
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
Control Panel
Login Data
The time now is Fri, 17. Nov 17, 23:12

All times are GMT + 2 Hours


Board Security

Copyright © EGOSOFT 1989-2017
Powered by phpBB © 2001, 2005 phpBB Group
Template created by Avatar & BurnIt!
Debug: page generation = 0.74478 seconds, sql queries = 27