Author Topic: Need a script to fire a turret fire-beam style  (Read 1552 times)

0 Members and 1 Guest are viewing this topic.

Offline Woolie Wool

  • 211
  • Fire main batteries
Need a script to fire a turret fire-beam style
I was wondering if anyone could write a script that would fire a specific turret on a specific ship at a specific target and could be called via sexp. Basically this would be fire-beam for regular turrets, and would greatly increase the amount of control I have over railgun turrets in Twist of Fate (which are the predecessors of, and are used like, beams on FS2 ships). Is anybody interested?
16:46   Quanto   ****, a mosquito somehow managed to bite the side of my palm
16:46   Quanto   it itches like hell
16:46   Woolie   !8ball does Quanto have malaria
16:46   BotenAnna   Woolie: The outlook is good.
16:47   Quanto   D:

"did they use anesthetic when they removed your sense of humor or did you have to weep and struggle like a tiny baby"
--General Battuta

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Need a script to fire a turret fire-beam style
Use turret-tagged-only and tag the target, hide the tag color with an iff color sexp.

 

Offline Black Wolf

  • Twisted Infinities
  • Global Moderator
  • 212
  • Hey! You! Get off-a my cloud!
    • Visit the TI homepage!
Re: Need a script to fire a turret fire-beam style
I remember asking for this yeeeears ago, in sexp form. There was a specific reason it wasn't possible at the time, though I can't remember why now - maybe scripting has changed that?
TWISTED INFINITIES · SECTORGAME· FRONTLINES
Rarely Updated P3D.
Burn the heretic who killed F2S! Burn him, burn him!!- GalEmp

 

Offline Woolie Wool

  • 211
  • Fire main batteries
Re: Need a script to fire a turret fire-beam style
Use turret-tagged-only and tag the target, hide the tag color with an iff color sexp.

I've actually done this, but I really need something more flexible, and the ability to synchronize other events with the turret firing.
16:46   Quanto   ****, a mosquito somehow managed to bite the side of my palm
16:46   Quanto   it itches like hell
16:46   Woolie   !8ball does Quanto have malaria
16:46   BotenAnna   Woolie: The outlook is good.
16:47   Quanto   D:

"did they use anesthetic when they removed your sense of humor or did you have to weep and struggle like a tiny baby"
--General Battuta

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Anims: 420, Cutscenes: 10, Mainhalls: 7, Logos: 52
    • Steam
    • Twitter
    • Mix-Hai Productions
Re: Need a script to fire a turret fire-beam style
In BtA we gained this control over the torpedo turrets by simply locking the turrets and using weapon-create as needed. The entire last mission is actually played with the torpedo turrets locked the entire time. Using weapon-create, you can get the "firing turret's" position with get-objecy-xyz, and then get the parent ship's heading +/- whatever amount to make it fire from the broadside or whatever.

This gave us very specific control over how often the turret fired and what it's specific target would be every time.
Cutscene Upgrade Project - Mainhall Remakes - MixaelANITools - Between the Ashes - MjnMixael's Render Boutique - Mix-Hai Productions
Youtube Channel - P3D Model Box - Photobucket Albums - Model Releases - Downloads
Between the Ashes is looking for committed testers, PM me for details.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!

 

Offline Woolie Wool

  • 211
  • Fire main batteries
Re: Need a script to fire a turret fire-beam style
Good lord, that sounds cumbersome, and you'd have to recalculate the position of both the firing ship and the target every single time, while with my idea you'd just call a single sexp, specify the firing turret and intended target, and the scripting and turret AI would handle the rest, and then add a repeat count so that the same turret can fire at the same target over and over, just like with fire-beam. That this is done through a sexp is especially important because in certain missions warships will overcharge their railguns, which means they will do more damage but the recoil will damage the firing ship, so the sabotage-subsystem sexp must be synchronized with the railgun firing.

Also there are two other problems, which are (a) railguns produce huge and extremely obvious muzzle flashes and to have them drawn in the wrong spot or not at all would be immediately noticeable, and (b) at one point an Orion uses overcharge, and one of the railguns is mounted on the same multipart where its BGreen is located in FS2. For the railgun to fire without the turret tracking the target would also look silly.
« Last Edit: November 02, 2016, 12:34:49 pm by Woolie Wool »
16:46   Quanto   ****, a mosquito somehow managed to bite the side of my palm
16:46   Quanto   it itches like hell
16:46   Woolie   !8ball does Quanto have malaria
16:46   BotenAnna   Woolie: The outlook is good.
16:47   Quanto   D:

"did they use anesthetic when they removed your sense of humor or did you have to weep and struggle like a tiny baby"
--General Battuta

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Anims: 420, Cutscenes: 10, Mainhalls: 7, Logos: 52
    • Steam
    • Twitter
    • Mix-Hai Productions
Re: Need a script to fire a turret fire-beam style
You don't have to "recalculate" anything at all. The SEXP does that for you. See here.



That controls turret08 on the HLD Cardinal.  It has a trigger count and interval time. As set, it fires every 12 seconds whenever the conditions are true, which in this case involves where the Cardinal is located along its waypoints. There are similar SEXPs that control the Intepid's turrets except that the target (argument 9 in weapon-create) is a string variable and we change the variable with other SEXPs to dynamically change who that turret is firing at.

If you're worried what it looks like, go watch the cutscene "controlpart1a.ogg" in BtA's modpack. It's directly recorded from FSO using those sexps to fire the Intrepid's torpedoes at about 12 seconds in.

If you want to get suuuper specific with weapon create positions, you can also get relative positions of the turrets with get-object-xyz.
Cutscene Upgrade Project - Mainhall Remakes - MixaelANITools - Between the Ashes - MjnMixael's Render Boutique - Mix-Hai Productions
Youtube Channel - P3D Model Box - Photobucket Albums - Model Releases - Downloads
Between the Ashes is looking for committed testers, PM me for details.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!

 
Re: Need a script to fire a turret fire-beam style
I don't see any reason why scripting can't do it. If the script doesn't check wether firing is a good idea (turret not ready to fire, wrong target, wrong side of ship, whatever) then "only" the names of the firing ship and subsystem (=turret) as well as the names of the target and target subsystem have to be passed to the script. Which is most likely too long for the usual maximum length of a scripting call (unless that limit has been bumped).

Now seeing that you want to use a multipart where only one of the weapons actually fires - while not so much of a problem, it needs even more input and the script has to be very generic to cover all the possible combinations.


I guess a sexp solution like the one mjn.mixael showed might be the better and faster way to do it...
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script

 
Re: Need a script to fire a turret fire-beam style
In BtA we gained this control over the torpedo turrets by simply locking the turrets and using weapon-create as needed.
I feel better now that I know I'm not the only person doing hacks with weapon-create :P


Which is most likely too long for the usual maximum length of a scripting call (unless that limit has been bumped).
Behold, the script-eval-block SEXP ! Saying "screw you" to the 32 char limit since [insert date here].




 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Anims: 420, Cutscenes: 10, Mainhalls: 7, Logos: 52
    • Steam
    • Twitter
    • Mix-Hai Productions
Re: Need a script to fire a turret fire-beam style
I love script-eval-block so much... :)
Cutscene Upgrade Project - Mainhall Remakes - MixaelANITools - Between the Ashes - MjnMixael's Render Boutique - Mix-Hai Productions
Youtube Channel - P3D Model Box - Photobucket Albums - Model Releases - Downloads
Between the Ashes is looking for committed testers, PM me for details.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!