Search the Community
Showing results for tags 'scripting'.
Found 2 results
I'd like to find a way to make a character refuse to equip certain items (based on tags). I've found examples of this in other mods and posts but in all of them the item is equipped, checked and then unequipped if necessary. I got that working, and if I must then I'll keep that, but I would rather have the character refuse to equip it in the first place. I.e.: When right-clicking the equipment (armor) in the inventory, it will not be equipped at all and the character will say something about it - as opposed to what happens now, where it gets equipped, unequipped and then the characters says something about it. When the equipment is picked up and the character's equip slot is empty, it should go into the inventory without being equipped - as opposed to what happens now, where... (same as above) When equipping would cause a currently-equipped item to be unequipped, I'd like for the currently equipped item to remain equipped. In other words, as I said, the character should refuse to equip it, with the behavior you'd expect when that happens. Similarly, rather than using tags, I'd like to make specific items usable only by specific characters. I'm guessing that'll be similar though. Any ideas or leads would be appreciated. =) Edit: Problem solved; see the bottom part of my own reply below.
I'm trying to modify damage taken before armor checks and in a non-multiplicative manner. Specifically, I'm making a "heavy armor" component which grants a fixed damage reduction that should go before everything else. For example, if the damage reduction is 10 then when a character wearing this armor is attacked, the damage should be reduced by 10 and then the entire combat mechanism should do its job. After the damage reduction takes place I want the normal armor damage reduction, so I can't make the armor component do this work. I also don't want any of the absorbed damage to affect the equipped armors and wear them down. Ideally I would wrap the function Inventory:ApplyDamage with my mechanism and alter the damage before the inventory does its work, but I can't do that since it's a local function. I looked at combat.lua to see if I could interject in the process somehow. I found Combat:GetAttacked and Combat:CalcDamage, but I didn't see any way for me to do what I want. The effects should occur after the damage calculation is performed but before the inventory applies the damage to the equipped armor. Any ideas on how I can do this? Of course, I could always replace inventory.lua or combat.lua, but that seems extremely intrusive and I imagine it would require constant updating with the game.