aliens

Author Topic: [Documentation] Craft Tractor Beams  (Read 8914 times)

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
[Documentation] Craft Tractor Beams
« on: February 06, 2017, 09:02:46 pm »
New feature for dogfights: Tractor beams for your craft!  They allow you to effectively decrease the maximum speed of a UFO during interception, preventing their escape.  If you have powerful enough beams targeting the UFO, you can even cause it to land or splash down in the water!

The new ruleset parameters are:
  • tractorBeamPower: 0 - Set this parameter on a craft weapon to determine how much it slows down the max speed of a UFO when it's in range and the weapon is active.  Defaults to 0.
  • ufoTractorBeamSizeModifiers: A global set of mod values to determine how much each size of UFO is affected by a tractor beam.  The default is 4x for very small, 2x for small, 1x for medium, 1/2x for large, 1/4x for very large.

If the UFO's max speed minus the sum of all the active tractor beams multiplied by the size modifier is less than your craft's speed, the UFO cannot escape.  If that sum multiplied by the size modifier is zero, the UFO either lands for between 30 and 120 minutes, or is destroyed when over water (except in TFTD, where water = landing), granting you points as if you crashed it.

See here for the commit on GitHub.

Sample ruleset and strings:
Code: [Select]
craftWeapons:
  - type: STR_TRACTOR_BEAM_UC
    sprite: 0
    range: 65
    launcher: STR_TRACTOR_BEAM
    tractorBeamPower: 1000

ufoTractorBeamSizeModifier:
  - 400 # very small, tractor beams are 400% or 4x as effective
  - 200
  - 100
  - 50
  - 25 # very large, tractor beams are 25% or 1/4x as effective

extraStrings:
  - type: en-US
    strings:
      STR_TRACTOR_BEAM_ENGAGED: "TRACTOR BEAM IS ENGAGED!"
      STR_TRACTOR_BEAM_DISENGAGED: "DISENGAGING TRACTOR BEAM"

Edit 171110: This is an official part of OXCE+, so the links for my repository above are deprecated.  This post will remain for documentation.
« Last Edit: July 17, 2018, 03:25:04 pm by Meridian »

Offline Thirsk

  • Captain
  • ***
  • Posts: 62
    • View Profile
Re: [EXE] Craft Tractor Beams
« Reply #1 on: February 06, 2017, 11:13:10 pm »
Ohartenstein let me be the first to say, I love your scripts!! Each of them are amazing!

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [EXE] Craft Tractor Beams
« Reply #2 on: February 07, 2017, 01:52:56 am »
Well thank you, but this isn't exactly a script, it's an engine change waiting for Meridian's approval to include in OXCE+, and a proposed feature for use in Dioxine's XPiratez.

The scripting is fun though too, and I love how quickly small new features can be written, tested, and released without waiting for inclusion in an exe.  :)

Offline Thirsk

  • Captain
  • ***
  • Posts: 62
    • View Profile
Re: [EXE] Craft Tractor Beams
« Reply #3 on: February 07, 2017, 02:37:10 am »
Haha you're right, I'm lucky I didn't try this out yet or else I'd be splitting hair for hours.

Oh I'm happy to hear that, because the first thing I do when I visit the forums is check for any new scripts :P

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9106
    • View Profile
Re: [EXE] Craft Tractor Beams
« Reply #4 on: February 07, 2017, 10:37:19 am »
The scripting is fun though too, and I love how quickly small new features can be written, tested, and released without waiting for inclusion in an exe.  :)

Yeah, everything has its ups and downs too.

For example it is close to impossible to debug the scripts...

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [EXE] Craft Tractor Beams
« Reply #5 on: February 07, 2017, 02:48:44 pm »
Yeah, no debug mode for scripts sucks, especially since they just turn off if there's an issue.  The only way to check things is to use debug_log to print ints (in hex!) to log or put tags on an item, unit, or the BattleGame so they show up in a battlescape save.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [EXE] Craft Tractor Beams
« Reply #6 on: February 07, 2017, 08:24:04 pm »
Yeah, no debug mode for scripts sucks, especially since they just turn off if there's an issue.  The only way to check things is to use debug_log to print ints (in hex!) to log or put tags on an item, unit, or the BattleGame so they show up in a battlescape save.
I think that I can improve logging in 3.7, you will be able to pass any script variable to it and it will show meaningful information like name of unit or item.

Offline davide

  • Commander
  • *****
  • Posts: 565
    • View Profile
Re: [EXE] Craft Tractor Beams
« Reply #7 on: February 19, 2017, 10:09:28 am »
+1 for craft tracktor beams :D

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9106
    • View Profile
Re: [EXE] Craft Tractor Beams
« Reply #8 on: February 20, 2017, 05:22:53 pm »
Cherry-picked into OXCE+.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [EXE] Craft Tractor Beams
« Reply #9 on: February 20, 2017, 05:33:29 pm »
Cherry-picked into OXCE+.

Awesome, thanks!

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9106
    • View Profile
Re: [EXE] Craft Tractor Beams
« Reply #10 on: February 20, 2017, 09:23:03 pm »

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [EXE] Craft Tractor Beams
« Reply #11 on: February 20, 2017, 09:28:59 pm »
Looks fine to me, I'll test it later.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [EXE] Craft Tractor Beams
« Reply #12 on: February 28, 2017, 01:48:11 am »
ohartenstein23 could you show some more examples that I could test your code better?

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [EXE] Craft Tractor Beams
« Reply #13 on: February 28, 2017, 03:04:50 pm »
Do you mean this code, or since you were reviewing the vertical terrain commit, that code? I can work up a few more vertical tests, sure, or since Solarius Scorch already has a mission implemented that uses it, I can ask him if it's alright if I send you his WIP version of the mod.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [EXE] Craft Tractor Beams
« Reply #14 on: March 03, 2017, 11:59:19 pm »
lol, I post in wrong thread :>