OpenXcom Forum
Modding => Work In Progress => Topic started by: 4ppl354u53 on November 23, 2018, 12:33:53 pm
-
Hey, I've been trying to get into modding Openxcom but have immediately run into something i don't quite get. When searching the forums for a way to learn someone (cant remember the post sorry) said the best way to make a beginner mod is to modify an existing one.
I've been wanting to add more melee weapons to the game so i started with NeoWorm's Alloy Sword mod (https://openxcom.org/forum/index.php/topic,2819.0.html) links never work for me but put here anyway
Opened the Ruleset in Notepad++ and had a look
First of all i noticed that i had to add "clipSize: -1" on the line beneath "tuMelee:" but i assume that might have been my fault at some point
also for people getting the
[ERROR] failed to load 'AlloySword'; mod disabled for next startup
C:\Users\Ryan\Documents\OpenXcom\mods\AlloySword/Ruleset/AlloySword.rul: yaml-cpp: error at line 16, column 1: illegal tab when looking for indentation
error its because you pressed tab to line up the lines not press space 4 times (i know its weird)
BUT what thus long rambling post was meant to be getting to was: Can anyone tell me what each of the values are on the weapon? most are self explanatory but there are a few that I'm not sure about
List of ones on this weapon for reference:
- type: STR_ALLOY_SWORD
requires:
- STR_ALLOY_SWORD
size: 0.1
costSell: 15000
weight: 2
bigSprite: 60
floorSprite: 80
handSprite: 130
power: 150
strengthApplied: true
damageType: 1
accuracyMelee: 80
tuMelee: 15
clipSize: -1
battleType: 3
invWidth: 1
invHeight: 3
flatRate: true
armor: 100
skillApplied: true
listOrder: 4510
My Guesses for what they are
- type: NAME
requires:
- Research requirement
size: Cargo Space
costSell: Profit from manufacture+sell?
weight: Weight
bigSprite: Sprite in HUD
floorSprite: Sprite on floor
handSprite: Sprite in hand
power: Damage?
strengthApplied: Strength added to damage?
damageType: ? ? ?
accuracyMelee: Accuracy (this value+soldier stat+accuracy?)
tuMelee: Time units (Will be tuSnap if can shoot?)
clipSize: Ammo when fully loaded (-1 for infinite/0 ammo, thanks crashing for letting me know)
battleType: ? ? ?
invWidth: space in inv (can make didproportionate?)
invHeight: space in inv (can make didproportionate?)
flatRate: ? ? ?
armor: ? ? ?(how much it armor pierces?)
skillApplied: ? ? ?
listOrder: Make sure you dont overlap with an existing item?
Blank one if want for corrections
- type:
requires:
-
size:
costSell:
weight:
bigSprite:
floorSprite:
handSprite:
power:
strengthApplied:
damageType:
accuracyMelee:
tuMelee:
clipSize:
battleType:
invWidth:
invHeight:
flatRate:
armor:
skillApplied:
listOrder:
Help would be much appreciated. Thanks to anyone who gives a reply and hope this becomes useful to other modding beginners (though a proper tutorial will probably help more)
EDIT*
also is there a way to have held items add Front Armor (for Shields) or is that a proper coding thing I'd have to do for OpenxcomExtended (i think that's what its called anyway)
-
Hello and welcome to the fantastic world of OXC modding!
Instead of answering point by point, let me direct you straight to the source (https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)). Please familiarize yourself with this document, as it will give you a good overview of how things work. Of course feel free to ask questions.
-
Hello and welcome to the fantastic world of OXC modding!
Instead of answering point by point, let me direct you straight to the source (https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)). Please familiarize yourself with this document, as it will give you a good overview of how things work. Of course feel free to ask questions.
Thanks, this is exactly what i was looking for.
-
When searching the forums for a way to learn someone (cant remember the post sorry) said the best way to make a beginner mod is to modify an existing one.
It might have been me, I've said that before. But it could have been anyone else, since it's just generally good advice.
[ERROR] failed to load 'AlloySword'; mod disabled for next startup
C:\Users\Ryan\Documents\OpenXcom\mods\AlloySword/Ruleset/AlloySword.rul: yaml-cpp: error at line 16, column 1: illegal tab when looking for indentation
error its because you pressed tab to line up the lines not press space 4 times (i know its weird)
Yep, the dreaded syntax error. I just encountered one not an hour ago, when I forgot a space after the colon. Some more good advice: learn what a syntax error looks like, and be very careful to check and make sure you spot tiny, almost invisible differences in syntax that may have caused it, like a tab vs 4 spaces.
BUT what thus long rambling post was meant to be getting to was: Can anyone tell me what each of the values are on the weapon?
- type: String value of name (referenced through language files)
costSell: sell price in the sell screen
power: used to determine damage, it rolls a random modifier, compares against resistance, subtracts armor, and that's the final damage.
strengthApplied: true means net power = (power + strength)
damageType: 1=armor piercing, 2= incendiary, etc. Checks against corresponding resistance.
accuracyMelee: same way other accuracy values work, multiplies with soldier melee accuracy. So a 50 accuracy attack done by a soldier with 80 accuracy has a 40% chance to hit.
tuMelee: tu cost of the melee attack, separate from snap shot, aimed shot, and auto shot.
clipsize: if clipsize is on the weapon, it comes with that much without an ammo clip. If it's on the ammo clip, the clip must be inserted into the weapon. Don't put it on both.
battleType: the type of item it is on the battlescape. 1=weapon, 2=ammo, 3=melee weapon, 5=grenade, etc. I'm not sure what it's for, maybe auto-equipping soldiers?
invWidth: how many squares wide it is
invHeight: how many squares tall it is - make sure these match the graphic used, or it will look funny
flatRate: true means the TU cost is exactly how many TUs it takes, but false means it's that percentage of the soldier's max TUs
armor: this is how much damage it takes to destroy it when it's on the ground
skillApplied: whether or not it uses soldier's melee accuracy--defaults to false, vanilla stun rod always hits
listOrder: unimportant, used to determine where it shows up in the list. It's nice to sort your lists to make it easier for the player. (https://www.ufopaedia.org/index.php/Ruleset_List_Order_(OpenXcom)) Most modders ignore this, but I think keeping things sorted is an important bit of polish that makes your mod really feel professional and well-built.
EDIT*
also is there a way to have held items add Front Armor (for Shields) or is that a proper coding thing I'd have to do for OpenxcomExtended (i think that's what its called anyway)
Probably requires OXCE. I believe Dioxine had a discussion going about adding shields, and a script came up for making leftArmor different from rightArmor. I don't remember the details and I can't find a link to it. You might be able to find it in the OXCE ruleset reference (https://www.ufopaedia.org/index.php/Ruleset_Reference_OXCE%2B_(OpenXcom)). I don't know if you can do it with held items, but Dioxine's proposal involved armor suits that visibly had a shield in the off-hand and blanked out that inventory slot as a result.
Edit: I found an older post than the one I am remembering, but it is on the same topic: https://openxcom.org/forum/index.php/topic,1109.15.html (https://openxcom.org/forum/index.php/topic,1109.15.html)
This one doesn't have a solution, but I know there's a thread out there somewhere that has more details and results.
We in the OpenXcom Extended community (pretty much all of us modders and even most players) refer to OpenXcom as OXC and OpenXcom Extended as OXCE. OXC is primarily managed by SupSuper and Warboy. OXCE is primarily managed by Meridian and Yankes. You'll see plenty of Meridian and Solarius Scorch on this forum. Meridian is our greatest code writer, and Solarius Scorch is our benevolent moderator.
-
Can absolutely say that dismantling an existing mod is the best way to learn :)
Also start small like just one item and then build up from there!
-
EDIT*
also is there a way to have held items add Front Armor (for Shields) or is that a proper coding thing I'd have to do for OpenxcomExtended (i think that's what its called anyway)
yes, but you need to use Yankes Script for it. there is a proper script, made, i think, by ohartenstein23 (sorry, if im wrong)
its decent level of modding, and if you want to modify existing mecanic of it, you need to learn Yankes scripting. i take a fast look, if there is something about it, i guess, you just need to add this to your item (ive not tried it myself, so need to test)
tags:
PHYSICAL_SHIELD_ARMOR: 10 #dont belove my numbers, they are random
ITEM_SHIELD_BLOCK_MELEE_COEFFICIENT: 3
ITEM_SHIELD_BLOCK_REACTIONS_COEFFICIENT: 3
ITEM_IS_MELEE: 3
use this as refer
# Item Physical Shield - damage reduction on handheld items, chance to block
# hitUnit - offset: 3
#
# Hits on units are reduced according to the tag PHYSICAL_SHIELD_ARMOR, if an
# item with that tag is in the unit's hand. Melee attacks have a chance to be
# completely negated, according to the unit stats and the tags
# ITEM_SHIELD_BLOCK_MELEE_COEFFICIENT and ITEM_SHIELD_BLOCK_REACTIONS_COEFFICIENT.
# Melee attacks are considered hits with battle action type 10, BA_HIT or hits
# from ranged weapons with the tag ITEM_IS_MELEE set not equal to 0.
#
# When hit, a unit's hands are checked for an item with the PHYSICAL_SHIELD_ARMOR
# tag, first the left and then the right. The dodge coefficients are taken
# from the first item found with the armor tag set. Next, the type of damage
# is compared to a list of damage types that should bypass physical shields -
# if it is one of those types, the script returns at this point without
# modifying damage. Next, melee hits take into account the dodge coefficients.
# The unit's melee stat is multiplied by ITEM_SHIELD_BLOCK_MELEE_COEFFICIENT as
# a percentage, and the same is done for reactions and its coefficient, then
# both are added together. A 0-100 dice roll is made, and if the roll is less
# than this sum, then the power of the hit is set to 0 and the script returns.
#
# Finally, the armor value of the physical shield item is modified by a set of
# standard resistances (lower numbers mean the shield is more effective
# against that damage type) and by a multiplier for the side of the unit that
# was hit. This armor value is then subtracted from the power of the hit and
# the script returns.