Author Topic: Gun Melee for mod weapons  (Read 2421 times)

Offline prayuth01

  • Squaddie
  • *
  • Posts: 1
    • View Profile
Gun Melee for mod weapons
« on: February 07, 2018, 11:19:55 am »
As I found out, Gun Melee mod only works with standard weapons, but not with weapons added by mods. After some search and some help from #yaml@freenode.net I made a Perl script that makes a similar .rul file for every weapon of the types it knows. Currently it goes like this:

STR_PISTOLS
meleePower    =  20;
tuMelee       =  15;
accuracyMelee = 100;

STR_BOWS
meleePower    =  20;
tuMelee       =  15;
accuracyMelee = 100;

STR_SMGS
meleePower    =  20;
tuMelee       =  15;
accuracyMelee = 100;

STR_SHOTGUNS
meleePower    =  50;
tuMelee       =  40;
accuracyMelee = 100;

STR_RIFLES
meleePower    =  50;
tuMelee       =  40;
accuracyMelee = 100;

STR_SNIPER_RIFLES
meleePower    =  50;
tuMelee       =  40;
accuracyMelee = 100;

STR_CANNONS
meleePower    =  65;
tuMelee       =  50;
accuracyMelee = 100;

STR_MACHINE_GUNS
meleePower    =  65;
tuMelee       =  50;
accuracyMelee = 100;

STR_LAUNCHERS
meleePower    =  80;
tuMelee       =  80;
accuracyMelee = 100;


So far I have processed only items_XCOMFILES.rul for "The X-COM Files". Should I add weapons from other mods? Should I create separate melee mods for other large projects?

One problem so far: hitting enemies doesn't stun them, but kills.
ufabet
Update: the script treated clips as weapons; fixed that.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1931
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: Gun Melee for mod weapons
« Reply #1 on: February 07, 2018, 03:57:40 pm »
Since you're using OXCE+, you can define the melee damage type directly:
Code: [Select]
items:
  - type: STR_SOME_GUN
    meleeType: 6 # stun damage
There's a lot you can do with gun melee attacks in OXCE+ - much of it is documented here.

However, you should be careful with this mod, as some guns already have a melee attack that could get overriden, such as the SKS's bayonet attack.