Author Topic: Reaction vs Melee Enable  (Read 14900 times)

Offline peirceg

  • Captain
  • ***
  • Posts: 72
    • View Profile
Reaction vs Melee Enable
« on: May 04, 2020, 09:15:07 am »
Is there any way for to enable reaction shots/strikes with melee weapons against melee weapon strikes? A nice simple edit somewhere?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile

Offline peirceg

  • Captain
  • ***
  • Posts: 72
    • View Profile
Re: Reaction vs Melee Enable
« Reply #2 on: May 06, 2020, 04:21:32 pm »
Thank you very much! How can I incorporate this into my game? What files do I have to edit? Sorry for being a newb.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: Reaction vs Melee Enable
« Reply #3 on: May 06, 2020, 04:28:05 pm »
How can I incorporate this into my game?

Edit, compile, run.

What files do I have to edit?

file MeleeAttackBState.cpp at lines 172-175

Offline vadracas

  • Colonel
  • ****
  • Posts: 285
  • Just another player/modder combo.
    • View Profile

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: Reaction vs Melee Enable
« Reply #5 on: May 06, 2020, 04:57:04 pm »
Is this already enabled in OXCE?

no

Offline peirceg

  • Captain
  • ***
  • Posts: 72
    • View Profile
Re: Reaction vs Melee Enable
« Reply #6 on: May 06, 2020, 05:12:30 pm »
I couldnt find the MeleeAttackBState.cpp file in my xpiratez download folder. I am going to assume that I need to download a seperate OXCE from somewhere?

Offline vadracas

  • Colonel
  • ****
  • Posts: 285
  • Just another player/modder combo.
    • View Profile
Re: Reaction vs Melee Enable
« Reply #7 on: May 06, 2020, 05:18:36 pm »
I couldnt find the MeleeAttackBState.cpp file in my xpiratez download folder. I am going to assume that I need to download a seperate OXCE from somewhere?

Nope, this is c++ code, you have to fork OXC/OXCE on GitHub, and make that edit on it, then compile it according to the instructions on the OXCE subforum except substituting your fork for meridian's link.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: Reaction vs Melee Enable
« Reply #8 on: May 06, 2020, 05:19:32 pm »
I couldnt find the MeleeAttackBState.cpp file in my xpiratez download folder. I am going to assume that I need to download a seperate OXCE from somewhere?

PirateZ has a compiled version of OXCE, not the source code.

Also for OXCE, it's in a difference file: https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Battlescape/TileEngine.cpp#L2012

Offline peirceg

  • Captain
  • ***
  • Posts: 72
    • View Profile
Re: Reaction vs Melee Enable
« Reply #9 on: May 06, 2020, 05:57:20 pm »
Just want to confirm, because I am very new to this,

1.Create a fork on github for this https://github.com/OpenXcom/OpenXcom/blob/master/src/Battlescape/MeleeAttackBState.cpp#L171
2. Delete lines 171-175 then commit those changes
3 Follow instructions here about compiling https://openxcom.org/forum/index.php/topic,7048.0.html

Replace stage 2 here with the link to my newly forked version ;

"1. Download, install and update Visual Studio 2019 Community Edition: https://visualstudio.microsoft.com/downloads/
2. Clone OXCE repo: https://github.com/MeridianOXC/OpenXcom.git
3. Download and extract the pre-compiled dependencies (into repo's root): openxcom-deps-win-vc2017-newest.zip
4. Open solution "src/OpenXcom.2010.sln"
5. Click "Build" from menu or toolbar"

4. Compile then overwrite with the newly compiled OXCE into my xpiratez folder.

Offline vadracas

  • Colonel
  • ****
  • Posts: 285
  • Just another player/modder combo.
    • View Profile
Re: Reaction vs Melee Enable
« Reply #10 on: May 06, 2020, 06:03:00 pm »
2. Delete lines 171-175 then commit those changes

All steps are correct except the quoted ones, don't delete the lines, just remove the comments from the code, other than the obvious comment at the start.

Comments are the // symbols.

Offline peirceg

  • Captain
  • ***
  • Posts: 72
    • View Profile
Re: Reaction vs Melee Enable
« Reply #11 on: May 06, 2020, 06:16:46 pm »
All steps are correct except the quoted ones, don't delete the lines, just remove the comments from the code, other than the obvious comment at the start.

Comments are the // symbols.

https://imgur.com/a/KOpEddH

I am going to assume that this is now correct? I am going to assume with these edits units will not be able to reaction fire with their equipped weapons when engaged by enemies in melee?

Offline vadracas

  • Colonel
  • ****
  • Posts: 285
  • Just another player/modder combo.
    • View Profile
Re: Reaction vs Melee Enable
« Reply #12 on: May 06, 2020, 06:23:34 pm »
https://imgur.com/a/KOpEddH

I am going to assume that this is now correct? I am going to assume with these edits units will not be able to reaction fire with their equipped weapons when engaged by enemies in melee?

Units WILL be able to react with those edits

Offline peirceg

  • Captain
  • ***
  • Posts: 72
    • View Profile
Re: Reaction vs Melee Enable
« Reply #13 on: May 06, 2020, 06:27:17 pm »
sorry had a bit of brainfar, its pretty late here. Thanks a lot for your help guys. I didnt like my melee units standing defenceless as they got whapped on by aliens in their turn.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: Reaction vs Melee Enable
« Reply #14 on: May 06, 2020, 06:47:21 pm »
Just want to confirm, because I am very new to this,

1.Create a fork on github for this https://github.com/OpenXcom/OpenXcom/blob/master/src/Battlescape/MeleeAttackBState.cpp#L171
2. Delete lines 171-175 then commit those changes
3 Follow instructions here about compiling https://openxcom.org/forum/index.php/topic,7048.0.html


This is if you want OXC.

If you want OXCE, you need to download a different repo and change different file and different line... as written above.

The rest is OK.

PS: no need to fork unless you want to publish your changes, downloading existing repo is enough
« Last Edit: May 06, 2020, 06:49:34 pm by Meridian »