OpenXcom Forum
Modding => Help => Topic started by: Kzer-Za on August 04, 2019, 11:28:57 am
-
I was thinking of adding a possibility for soldiers to hit enemies with bare hands. Just for fun mostly, and as a complementary thing to Gun Melee mod. Seeing as a pistol deals 25 melee damage in that mod, I think it's reasonable to make unarmed damage equal to strength/4. I made the following ruleset, but I seem to be missing something, because it doesn't work:
soldiers:
- type: XCOM
meleeWeapon: XCOM_WEAPON
items:
- type: XCOM_WEAPON
weight: 0
clipSize: -1
damageType: 7
accuracyMelee: 100
tuMelee: 30
battleType: 3
fixedWeapon: true
recover: false
damageBonus:
strength: 0.25
-
Soldiers don't have a meleeWeapon attribute.
-
Is there any way around this then?
And by the way, aliens do have this attribute, so if I give them the unarmed attack with this method (for after they drop their weapons), it is gonna work, I suppose?
-
1/ Yes, both XcomFiles and Piratez have unarmed combat, check there... I assume it was done via built-in-weapons per armor. Not sure.
2/ Probably, best to test.
-
Yes, that's how it works in X-Com Files. The unarmed attack is determined by the armour, as there are several different melee "weapons" for different types of armour: standard unarmed, armoured gloves, power suit, etc.
For example on basic suit (which is the starting outfit in XCF), the item entry looks like this:
items:
- type: STR_UNARMED_SUIT
weight: 0
bigSprite: 822
meleeHitSound: 109
meleeAnimation: 0
power: 0
damageType: 6
damageBonus:
strength: 0.2
melee: 0.2
reactions: 0.1
damageAlter:
RandomType: 1
FixRadius: 0
IgnoreDirection: false
ArmorEffectiveness: 1.5
ToHealth: 0.15
accuracyMelee: 100
meleeMultiplier:
melee: 0.5
reactions: 0.5
confMelee:
name: STR_PUNCH
costMelee:
time: 8
energy: 2
flatRate: true
battleType: 3
clipSize: -1
experienceTrainingMode: 13
invWidth: 2
invHeight: 2
fixedWeapon: true
recover: false
specialUseEmptyHand: true
The key property is "specialUseEmptyHand: true", which means that this weapon is activated if you click on an empty hand slot.
The item entry must also be declared on the armour:
armors:
- type: STR_SUIT_UC
specialWeapon: STR_UNARMED_SUIT
-
Thanks! It's a very helpful example. I also found this: https://openxcom.org/forum/index.php?topic=6289.0
For my personal use I will probably make the damage dependent on strength only, without melee and reactions: I prefer to keep things simple. But the idea about stun damage with only 15% of the damage going to the target health (if I understood the code correctly) is very nice :)
-
Hm, with soldiers it works, but with aliens not. Neither with meleeWeapon (I thought it would work since this seems to be the method for Lobstermen), nor with adding specialWeapon through armor. Has anyone added unarmed attacks to aliens?
On second thought, do I even need to try to add them that ability? Is it supported by AI? I mean, some terrorist species attack you in melee, but sentient species do not seem to attack in melee even when they do have this ability, via Gun Melee mod. I tried unloading their weapons and throwing away the clips under mind control, and while they are mind controlled, I can make them attack in melee with unloaded guns, but when the control is returned to the AI, they are just hanging around without trying to hit the soldiers, even if they are on adjacent tiles.
-
Yes, the AI uses such weapons fairly well. Please post your code for the weapon and the armour.
-
I have tried to ways. Number one:
units:
- type: STR_SNAKEMAN_SOLDIER
stats:
reactions: 120
melee: 120
psiStrength: 1 # for testing purposes, to make them easier to MC
meleeWeapon: SNAKEMAN_SOLDIER_WEAPON
items:
- type: SNAKEMAN_SOLDIER_WEAPON
weight: 0
power: 5
clipSize: -1
damageType: 7
accuracyMelee: 110
tuMelee: 30
battleType: 3
fixedWeapon: true
recover: false
damageBonus:
strength: 0.25
Number two:
units:
- type: STR_SNAKEMAN_SOLDIER
stats:
reactions: 120
melee: 120
psiStrength: 1 # for testing purposes, to make them easier to MC
items:
- type: SNAKEMAN_SOLDIER_WEAPON
weight: 0
power: 5
clipSize: -1
damageType: 7
accuracyMelee: 110
tuMelee: 30
battleType: 3
fixedWeapon: true
recover: false
damageBonus:
strength: 0.25
specialUseEmptyHand: true
armors:
- type: SNAKEMAN_ARMOR0
specialWeapon: SNAKEMAN_SOLDIER_WEAPON
Neither one is working. What's more, they don't even use guns for melee, as I have already said, and I didn't mess with items apart from installing Alien Armoury expanded and adding melee attacks to the new weapons that didn't have them — but I didn't touch the weapons that already had melee attacks due to Gun Melee mod, i.e. all original weapons like plasma rifle and heavy plasma, but aliens do not use (for melee, I mean) even them.
Besides, they do not pick up their weapons either, though I enabled mod Aliens Pick Up Weapons.
openxcom.log has no errors or warnings.
-
I'm very sorry about the confusion I must have caused, it was my lack of attention. Changes for soldiers and enemy units are in separate files, and I forgot to change the extension of the second file from txt to rul. Now that I changed it, the unarmed attacks work. Though I still don't understand why they do not pick up weapons, even lying under their feet, even with "pickUpWeaponsMoreActively: 1".
-
Are you sure you have the right syntax?
ai:
pickUpWeaponsMoreActively: true
-
If it is in the ai section, wouldn't it also affect terror units? I don't wot chryssalids running around picking up weapons :) So I used it on a per unit basis, i.e. like this:
units:
- type: STR_SNAKEMAN_SOLDIER
stats:
pickUpWeaponsMoreActively: 1
According to this (https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Items), it can be used this way.
-
Chryssalids etc. have no inventory. :P
-
If it is in the ai section, wouldn't it also affect terror units? I don't wot chryssalids running around picking up weapons :) So I used it on a per unit basis, i.e. like this:
units:
- type: STR_SNAKEMAN_SOLDIER
stats:
pickUpWeaponsMoreActively: 1
According to this (https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Items), it can be used this way.
where is it written it belongs under "stats"?
if you're not sure about the syntax, better use the ruleset validator: https://openxcom.org/forum/index.php/topic,6552.0.html
-
Chryssalids etc. have no inventory. :P
Oh, I didn't know that :)
-
where is it written it belongs under "stats"?
if you're not sure about the syntax, better use the ruleset validator: https://openxcom.org/forum/index.php/topic,6552.0.html
Thanks!