OpenXcom Forum

Modding => OpenXcom Extended => OXCE Suggestions DONE => Topic started by: ohartenstein23 on February 06, 2017, 09:02:46 pm

Title: [Documentation] Craft Tractor Beams
Post by: ohartenstein23 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:

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. (https://github.com/ohartenstein23/OpenXcom/commit/2dfb648680bae85fce6cf32d9b13c265398c29e5)

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.
Title: Re: [EXE] Craft Tractor Beams
Post by: Thirsk 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!
Title: Re: [EXE] Craft Tractor Beams
Post by: ohartenstein23 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.  :)
Title: Re: [EXE] Craft Tractor Beams
Post by: Thirsk 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
Title: Re: [EXE] Craft Tractor Beams
Post by: Meridian 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...
Title: Re: [EXE] Craft Tractor Beams
Post by: ohartenstein23 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.
Title: Re: [EXE] Craft Tractor Beams
Post by: Yankes 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.
Title: Re: [EXE] Craft Tractor Beams
Post by: davide on February 19, 2017, 10:09:28 am
+1 for craft tracktor beams :D
Title: Re: [EXE] Craft Tractor Beams
Post by: Meridian on February 20, 2017, 05:22:53 pm
Cherry-picked into OXCE+.
Title: Re: [EXE] Craft Tractor Beams
Post by: ohartenstein23 on February 20, 2017, 05:33:29 pm
Cherry-picked into OXCE+.

Awesome, thanks!
Title: Re: [EXE] Craft Tractor Beams
Post by: Meridian on February 20, 2017, 09:23:03 pm
Awesome, thanks!

Here's a few cosmetic changes I did, hopefully didn't break anything: https://github.com/MeridianOXC/OpenXcom/commit/4a7cc6da74e5e1559efa20dba3c628fd702f89dd
Title: Re: [EXE] Craft Tractor Beams
Post by: ohartenstein23 on February 20, 2017, 09:28:59 pm
Looks fine to me, I'll test it later.
Title: Re: [EXE] Craft Tractor Beams
Post by: Yankes on February 28, 2017, 01:48:11 am
ohartenstein23 could you show some more examples that I could test your code better?
Title: Re: [EXE] Craft Tractor Beams
Post by: ohartenstein23 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.
Title: Re: [EXE] Craft Tractor Beams
Post by: Yankes on March 03, 2017, 11:59:19 pm
lol, I post in wrong thread :>