Author Topic: [Documentation] Spray Waypoints Explanation  (Read 2169 times)

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1709
  • Flamethrowers fry cyberdisk circuits
    • View Profile
[Documentation] Spray Waypoints Explanation
« on: July 15, 2018, 12:09:57 am »
TL;DR: Hold CTRL+SHIFT while clicking to auto shot to spray and pray when it's enabled.

The newest release of OXCE+ includes a bit of code I wrote for "spray" autoshot attacks, and since it uses some keyboard shortcuts/mechanics not used anywhere else, I wanted to provide an explanation for how it works.  First off, under the hood the engine is using waypoints similar to those placed for firing a blaster bomb, then placing the shots from an autoshot attack spaced out evenly along this waypoint path as if you were able to separately click the firing position for each shot.  That attack looks like this:



The laser rifle from that demonstration has the following lines added to its ruleset:
Code: [Select]
items:
  - type: STR_LASER_RIFLE
    autoShots: 10
    sprayWaypoints: 2
In addition, once the auto shot is selected, I am holding the CTRL+SHIFT keys in order to start placing the waypoints; if I had not, the autoshot would have just fired all 10 shots at the first location clicked.  The second waypoint clicked did not need CTRL+SHIFT held as it automatically fires the attack when the maximum number of waypoints is reached.  If you have the confirm fire mode option turned on, then you will need to click one more time anywhere to start the attack.  As with the blaster bomb waypoints, right-clicking will remove the last one placed.

With this code, it is possible to have more than two waypoints:



The laser rifle from that demonstration has sprayWaypoints increased to 3 from 2.  As before, the attack automatically fires once I place the last waypoint.  If you'd rather stop before the last waypoint, holding CTRL+SHIFT while clicking to place the final waypoint that you desire will execute the attack with only that many waypoints.  In this example I stop at 2 waypoints even though 3 are available:



For modders: the default value of sprayWaypoints is 0, which means this behavior is disabled on that particular weapon.  In order to turn it on, you must give a weapon more than 0 sprayWaypoints.
« Last Edit: July 17, 2018, 12:44:33 pm by Meridian »

Offline SIMON

  • Commander
  • *****
  • Posts: 695
    • View Profile
Re: Spray Waypoints Explanation
« Reply #1 on: July 15, 2018, 12:39:49 am »
Brilliant, this reminds of the full auto function for the heavy laser from ufo extender:

https://www.ufopaedia.org/index.php/UFOextender

ps: Will this work for TFTD as well?
« Last Edit: July 15, 2018, 12:41:40 am by SIMON »

Offline FeruEnzeru[RETIRED/I QUIT]

  • Colonel
  • ****
  • Posts: 430
  • retired, because of Meridian and his followers. 👎
    • View Profile
Re: Spray Waypoints Explanation
« Reply #2 on: July 15, 2018, 12:41:16 am »
Oh, that's very cool to see that happen in later OXCE+ versions. Thanks New OXC 2018! ^.^

Anyway i'll be installing the newest nightly along with new OXCE+ version maybe at 10:00 PM in the night in my country after MVII and MCDEdit Work stuff.


I feel like new stuff happens every time. I wish a OXC/OXCE+ version of the XCOM2 Shredder Gun (Or a Shredder Gun like weapon) will be like a shotgun that fires 5-12 projectiles/bullets instead of pellets maybe in a 2020s or 2030s real life future of OXCE+ versions, but we'll see.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1709
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: Spray Waypoints Explanation
« Reply #3 on: July 15, 2018, 01:23:09 am »
Yes, this will work for TFTD on any weapons that are modded to use it.

Offline SIMON

  • Commander
  • *****
  • Posts: 695
    • View Profile
Re: Spray Waypoints Explanation
« Reply #4 on: July 15, 2018, 01:26:39 am »
Yep I wasn't sure so that'll be nice for say the gauss rifle.

Offline FeruEnzeru[RETIRED/I QUIT]

  • Colonel
  • ****
  • Posts: 430
  • retired, because of Meridian and his followers. 👎
    • View Profile
Re: Spray Waypoints Explanation
« Reply #5 on: July 15, 2018, 01:41:17 am »
Yep I wasn't sure so that'll be nice for say the gauss rifle.
The Gauss Rifle?

Yeah, I was wanting to make Minigun (10-15 Auto Shots ) and HMG (10 Auto Shots) weapons (along with grenades and explosives that have a magnetic explosive with Alien Magnetics, including additional ammo types for Gauss Weapons instead of regular ammo) for the 3 Gauss Techs i have on my lists on Notepad (Mag, Coilgun and Railgun) since i was playing with mods that have Training, Rooms Gauss Weapons, other different mods and a Heavy Gauss Weapon (Because my female soldier "Yomi-Hoe" has more strength to carry a machine gun or minigun based Gauss Weapon back in February of this year), but problems are, they will overheat, melt and blow up the guns and fry the user by killing him or her if it's always automatic weapon that fires a swarm of bullets (Just like Scorch said).

In order for to make proper and appropriate Gauss Weapons instead a whole "Gauss Everything excluding Flamethrowers" thing, i have do is read Wikipedia articles and internet blogs and sites that have Coilguns, Railguns, Mass Drivers and Magnetic weapons so that i learn to see how they work.


If not, i want my TC to be free of Gauss Technology if i can not pleased to see to happen. I'll try learning Gauss for XCOM instead of making my own style of Gauss Weapon rulesets from scratch then.  :-\
« Last Edit: July 15, 2018, 02:00:34 am by FeruEnzeru »

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1248
    • View Profile
Re: [Documentation] Spray Waypoints Explanation
« Reply #6 on: July 27, 2018, 02:17:50 pm »
I'm not able to use more than 2 waypoints. Even when the weapon is set to do more waypoints, as soon as the second waypoint is set, it begins firing.

Code: [Select]
  - type: STR_HEAVY_AUTO_LASER
    power: 75
    accuracyAuto: 70
    tuAuto: 78
    autoShots: 8
    sprayWaypoints: 3

Online Meridian

  • Global Moderator
  • Commander
  • ***
  • Posts: 5471
  • Aaand we're back!
    • View Profile
    • My Wiki
Re: [Documentation] Spray Waypoints Explanation
« Reply #7 on: July 27, 2018, 02:21:55 pm »
I'm not able to use more than 2 waypoints. Even when the weapon is set to do more waypoints, as soon as the second waypoint is set, it begins firing.

1. Ctrl+Shift+click for first waypint
2. normal click for waypoints in the middle
3. Ctrl+Shift+click for last waypoint

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1709
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Documentation] Spray Waypoints Explanation
« Reply #8 on: July 27, 2018, 02:44:02 pm »
I'll add to that; you only need to CTRL+SHIFT+click for the first waypoint, the rest can just be normal click unless you want to end waypoint selection early.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1248
    • View Profile
Re: [Documentation] Spray Waypoints Explanation
« Reply #9 on: July 27, 2018, 03:22:50 pm »
Thanks. I was trying to hold ctrl+shift the whole time.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1248
    • View Profile
Re: [Documentation] Spray Waypoints Explanation
« Reply #10 on: August 08, 2018, 05:11:30 am »
I am getting a strange bug in which the soldier turns while firing, but continues to fire at the same spot. Is anyone else getting this issue?

It seems to be happening on weapons with arcing shot. Another problem I am getting with arcing shot and spray waypoints is very frequently the soldier ceases firing and claims there is no viable trajectory. This happens sometimes when there is a viable trajectory, such as while flying in the open field and trying to shoot (literally) the broad side of a barn.
« Last Edit: August 08, 2018, 05:23:52 am by The Reaver of Darkness »

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1709
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Documentation] Spray Waypoints Explanation
« Reply #11 on: August 08, 2018, 05:27:39 am »
This feature is not supported for arcing weapons for the same reasons that you cannot force-fire arcing weapons.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1248
    • View Profile
Re: [Documentation] Spray Waypoints Explanation
« Reply #12 on: August 08, 2018, 07:39:36 am »
I was about to ask why you can't force-fire arcing weapons when I realized perhaps why: Making the displayed shot travel on the correct arc is much simpler than solving its hit position repeatedly for every possible position along the arc. It can probably be done, but you'd have to make the game solve calculus equations on the fly, and that takes a programmer with a good grasp of calculus.

The other bug, however (each shot goes toward the same target) could be partially resolved by simply having the weapon progressively target each waypoint: ie. if the weapon fires 8 shots and has 4 waypoints, it would fire twice at each waypoint. With sufficiently low shot accuracy, the player may never realize this is what the weapon is doing.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1709
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Documentation] Spray Waypoints Explanation
« Reply #13 on: August 08, 2018, 01:38:08 pm »
I'm not getting the bug you mention, and the code does progressively target "waypoints" - just before firing it takes the waypoints you defined and interpolates between them for each shot to get a new target for each bullet.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1248
    • View Profile
Re: [Documentation] Spray Waypoints Explanation
« Reply #14 on: August 09, 2018, 12:36:34 am »
I'm glad to hear it does that. But I am definitely getting the bug and I don't know why.

Here's a video of it happening:

I'm using Extended+ 3.10b (v2018-07-21).

I've attached my mod. I'm not using any other mods.



- - - - - -

I also think the shot should not stop completely as soon as a single trajectory fails; rather it should continue attempting all of them until it runs out of shots.
« Last Edit: August 09, 2018, 12:38:28 am by The Reaver of Darkness »