Turret Missile defence?

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

Phezzan
Posts: 126
Joined: Mon, 12. Nov 07, 05:48
x4

Turret Missile defence?

Post by Phezzan »

Short backstory:

Recently picked up an assassinate mission: I can handle a Balor or two just fine...
Unfortunately they spawned in my home zone - which was full of trade and construction ships (capital ships).
Needless to say I quit without saving.

In previous games the Anti-missile fire would've blocked at least half those 80k shots. I was very surprised that no such response occurred. (in fact no response at all - ships are far too stoic here)

I looked at the better turrets mod - but there is no mention of missile defense in the forum, and the source doesn't appear to scan for missiles.

I am perfectly happy to 'fix' this, but:
- am I missing something? did I need to set the captains to 'run away' or defense officers to 'try not to die' ?
- where do I find documentation for 'find_gravidar_XXX' and the like?

Thanks,
Phez
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

while testing another mod recently and seeing a balor attacking a tarains i shot down its Missiles because i was bored - and noticed that this is how Missile Defense should work: the Drones or Fighters shoot the incoming Missiles down and the Mothership focuses on the Attacker - old Freespace2-Style Torpedo Defense-Missions-like.. just an idea for anyone who wants to implement a Missile Defense ^^
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 ;)
oliverjanda
Posts: 309
Joined: Sun, 14. Feb 10, 17:47
xr

Post by oliverjanda »

I think bradines is working on something that's more or less working but it will probably take some more time unitl he publishes it (if at all).
bradines
Posts: 31
Joined: Fri, 27. Mar 15, 20:58

Post by bradines »

i have something but lets just say its troublesome... i haven't worked on it in a bit been too busy.. the principal was accidentally discovered during a an advanced mining script test... a missile flew too close during a scan process and some how the turret thought it was a rock and fried it... the other 3 missiles hit my ship... it was not fast enough on tracking to shoot them all down. i am still trying to get it to target missiles better a big help would be if some one know where the event that causes the incoming missile warning on the skunk is located. maybe i could dissect it and figure out a better function than calling all the known missile objects when i search out.


Ps how we identified that the script didn't just get lucky was it returned a report that read 4 asteriods at .5KM after the last scan had reported we were crushing rocks at near 3km from the ship and once the missles hit we had 3 errors rocks not found....then it went back to 3km... repeated tests have yielded every now and then it hits something but its very hit and miss... and it only works with mining lasers atm have been working on adding the lar but its all for nothing till i fix the targeting...
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

bradines wrote:i am still trying to get it to target missiles better a big help would be if some one know where the event that causes the incoming missile warning on the skunk is located.
<event_object_incoming_missile/> - just place it inside an <interrupts><handler/></interrupts> and let the Script jump to the related Section ;)
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 ;)
bradines
Posts: 31
Joined: Fri, 27. Mar 15, 20:58

Post by bradines »

thanks unitrader, do we know if that works for ai ships when a player shoots at them?

or how to identify the object that is a missile in space... i mean i got something that kinda works but its like 9 times out of 10 it misses even seeing the target and even when it does fire it has no friend foe setting...i have hit missles moving away from my ship more often than enemy incoming missles lol i have not refined the orrignal search pattern from the mining algoritum that some how picked it up with a collection of rocks... and because it had the highest hull it target it first... and if other objects have higher hulls i never hit it... which that is not usign this event to try to improve the odds. but any thoughts would be nice.
ominous1
Posts: 108
Joined: Thu, 14. Sep 06, 01:04
xr

Post by ominous1 »

i think it would be cool to have a anti missile drone. but maybe instead of it flying it just walks around on the hull like a spider and shoots something weak like a welding laser but more stronger. would be kinda cool watching 10 or more running around on a ship blasting things and the better the def off the more acc they are or something.
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

bradines wrote:thanks unitrader, do we know if that works for ai ships when a player shoots at them?
i think as long as they are aimed at the ship/have a lock on it yes.. for dumbfire missiles i doubt that it would work, but you can also check for player launched Missiles:
<xs:element name="event_player_launched_missile"><xs:annotation><xs:documentation>
Event for when the player launches a missile (param = target component, param2 = missile)
bradines wrote:or how to identify the object that is a missile in space... i mean i got something that kinda works but its like 9 times out of 10 it misses even seeing the target and even when it does fire it has no friend foe setting...i have hit missles moving away from my ship more often than enemy incoming missles lol i have not refined the orrignal search pattern from the mining algoritum that some how picked it up with a collection of rocks... and because it had the highest hull it target it first... and if other objects have higher hulls i never hit it... which that is not usign this event to try to improve the odds. but any thoughts would be nice.
<find_object name="$result" class="class.missile" space="this.zone" multiple="true">
<match_distance object="this.ship" max="***max distance****"/>
</find_object>
results in a list of all nearby missiles - and you can check their Target with $missile.target - note that this will result in null for dumbfire missiles (or regular ones abused as such) so you should ckeck if its heading towards your Ship in this case. i think this should be do-able by
A) searching for your own Ship with a <match_is_in_view_of object="$missile" horizontal="5deg" vertical="5deg" /> - if this results in your own ship the Missile is heading towards you, if not then ignore it.
B) see if the Missile will be in your collision Box when it maintains its current heading:
<transform_position name="$Position" refposition="$missile.position" refrotation="$missile.rotation">
<position x="0m" y="0m" z="$missile.distanceto.{this.ship}"/>
</transform_position>
<do_if value="this.ship.distanceto.{$Position} lt this.ship.size">
<!-- Missile is aimed at us-->
</do_if>
<do_else>
<!-- someone else is the unlucky one -->
</do_else>
i think method B is more efficient ^^
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 ;)
bradines
Posts: 31
Joined: Fri, 27. Mar 15, 20:58

Post by bradines »

updating code unitrader...thanks ill try to get this done this afternoon, but knowing me it might be next week... part of the update i have planned for missile defense will involve putting a type of mining laser on military ships so they can use this if it works..
User avatar
Lander1979
Posts: 1017
Joined: Mon, 4. Aug 14, 05:18
x4

Post by Lander1979 »

Messing around with the SkunkTurrets Mod I think I came across variables that control the tracking speed of the turrets various rotors.

I suggest trying to tweak these variables in the turrets macro, if possible, to provide faster target tracking.
0101...0011...0011...0101...2!
bradines
Posts: 31
Joined: Fri, 27. Mar 15, 20:58

Post by bradines »

<handler>
<conditions>
<event_object_incoming_missile object="this"/>
</conditions>
<actions>
<debug_text text="'%1 at player age %2 have %3 and %4'.[this.ship.knownname, player.age, event.param, event.param2 ]" chance="100"/>
</actions>
</handler>
i got no data in the logs about the missiles fired, does this code look right or did we mess somethign up?
bradines
Posts: 31
Joined: Fri, 27. Mar 15, 20:58

Post by bradines »

[Scripts] *** aicontext<fight.defend.capital,0x9423>: Player may have shot at PMC Warden Destroyer Taranis at player age 129236.849
[Scripts] *** aicontext<fight.defend.capital,0x926c>: Player may have shot at BIG BAD LEROY BROWN at player age 129236.849
i can now detect player missile launch, but i still need a way to do ship verse ship...
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

bradines wrote:
<handler>
<conditions>
<event_object_incoming_missile object="this.ship"/>
</conditions>
<actions>
<debug_text text="'%1 at player age %2 have %3 and %4'.[this.ship.knownname, player.age, event.param, event.param2 ]" chance="100"/>
</actions>
</handler>
i got no data in the logs about the missiles fired, does this code look right or did we mess somethign up?
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 ;)
bradines
Posts: 31
Joined: Fri, 27. Mar 15, 20:58

Post by bradines »

am kicking myself... you know those days when you make a simple mistake and yet your not thinking clearly enough to see it... yep... well good news.
[Scripts] *** aicontext<fight.defend.capital,0x80d531>: Player shot missle 0x851c04 at 129209.185 at at a ship named PMC Warden Destroyer Taranis
[Scripts] *** aicontext<fight.defend.capital,0x80d531>: PMC Warden Destroyer Taranis at player age 129209.185 sees missile 0x851c04
in English that was 2 events happening... me firing a missile and the script i wrote to figure out who i shot at trigger and returning that data.. then the new part, the ship i shot at saw the missile coming with the missile incoming event that is not tied to just player actions saying hey i got incoming... now i got to tie it into guns where its a high priority because lets face it this is a ticking bomb and needs to be defused before impact not a target that can wait...

Return to “X Rebirth - Scripts and Modding”