Proc Posted June 25, 2019 Share Posted June 25, 2019 So, I am still working on my modded character, and i'm quite happy with how she's coming along: I succesfuly added a heavy axe that only she can craft, has damage on par with the battle spear and can still be used to chop wood. And thanks to the help i got here previosuly she also has a considerable downside: she will randomly hit herself when in combat. Now, I was thinking of ways to help make her survivable and fit my playstyle, which involves a lot of exploring. See, I like to carry a backpack almost all of the time so i dont like to wear armor, and while football helmets are nice, they arent as easily accesible as, say, log suits. I considered giving her a crafted helmet just like Wigfrid, but I really wanted to try something different before falling back to that. Would it be possible to give her grass armor levels of damage absorption when not wearing armor? so I can feel more confident fighting things and healing between rounds with food or salves, but still needing to equip real armor if i plan to face anything thats actually a threat. Of course, a main concern would be to make sure this damage resist doesnt stack with new armor she puts on top. Link to comment Share on other sites More sharing options...
Ultroman Posted June 26, 2019 Share Posted June 26, 2019 Take a look at my write-up about a similar thing here. Those are damage multipliers, but the combat component also has externaldamagetakenmultipliers. These multipliers take effect AFTER all armor-pieces have absorbed their damage. Link to comment Share on other sites More sharing options...
Proc Posted June 26, 2019 Author Share Posted June 26, 2019 Hmm, ok, so looking at that dample and pondering a bit, on my character.lua I added this line below her stats inst.components.combat.externaldamagetakenmultipliers:SetModifier("myuniquemodifierkey", 0.6) If i understand this correctly, the uniquemodifier key should be something i set up to check if the character if wearing armor, and if false, then enable the damage taken multiplier? Link to comment Share on other sites More sharing options...
Ultroman Posted June 26, 2019 Share Posted June 26, 2019 Yes, if you only want the modifier to be on when the character is not wearing armor, then you can listen to the "equip" and "unequip" events on your character, which send you both the item and the equipment slot they were unequipped from, so you can check if an armor was unequipped. And the same for when equipping an armor. It's pretty straight-forward. Look at the inventory component, inventory.lua, and search for: PushEvent You can see what data it sends along, and you can trace what that data is. For examle, 'eslot' is an enum, so it might be EQUIPSLOTS.HANDS or EQUIPSLOTS.BODY or EQUIPSLOTS.HEAD. Link to comment Share on other sites More sharing options...
Proc Posted June 26, 2019 Author Share Posted June 26, 2019 Hmm, i'm hitting a snag here, I tried to just add inst.components.combat.externaldamagemultipliers:SetModifier(0.4) to see if i could first get the damage resistance to kick in without keys, even if its active all the time, but nothing happens to the damage my character takes, its still the same. I dont get an error of any kind, the line just doesnt seem to have any effect? Did i skip a step somewhere? is there something i have to set up prior to this code in here or a diferent .lua? I apologize, my understanding of scripting is pretty limited. Link to comment Share on other sites More sharing options...
Ultroman Posted June 26, 2019 Share Posted June 26, 2019 You can't omit parameters to the left of the right-most parameter you are using. You have to have the first parameter for both functions, and for SetModifier you have to have at least the two first. Link to comment Share on other sites More sharing options...
Proc Posted June 26, 2019 Author Share Posted June 26, 2019 Ah, indeed, I left the code as is and added a special armor variable. for now I just set it as true for testing, and as expected, my character now shaves off 60% of incoming damage, but it stacks with armor so yeah i will have to work out those exceptions. Would it be more complicated if i tried to call the armor pieces in the game one by one by name?, since some are helmets and others are body equipment, and i dont want the buff to go away if, say, im wearing both a backpack and a straw hat. Link to comment Share on other sites More sharing options...
Ultroman Posted June 26, 2019 Share Posted June 26, 2019 (edited) You can check whether the HEAD or BODY item being equipped or unequipped has an armor component on. I don't understand the first part of your post. Can I see the code you have? Edited June 26, 2019 by Ultroman Link to comment Share on other sites More sharing options...
Proc Posted June 26, 2019 Author Share Posted June 26, 2019 sorry i didnt reply, i went to sleep after my last post. This is my character.lua, if it helps. Since my knowledge of scripting is very limited, right now I am just taking bits and pieces of other mods and tweaking until they work. darna.lua Link to comment Share on other sites More sharing options...
Ultroman Posted June 26, 2019 Share Posted June 26, 2019 I may need the code for the axe as well. This character code you sent me just sets a constant modifier on the combat component. When do you want to turn it on/off? Link to comment Share on other sites More sharing options...
Proc Posted June 26, 2019 Author Share Posted June 26, 2019 this would be the weapon. havent really fine tuned it for balance yet, just trying to get everything working first. To keep it simple, what i desire is for her passive damage resistance to not stack with armors. So i guess it should be disabled when anything that would give her damage absorb is equipped, be it a football helmet, a marble suit, or what have you. darnaxe.lua Link to comment Share on other sites More sharing options...
Ultroman Posted June 27, 2019 Share Posted June 27, 2019 Sounds good. And then enable it again when an item was unequipped and there are no more items equipped which have the armor component. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now