HEAN Posted July 5, 2019 Share Posted July 5, 2019 I finally made the character mod to work! But unfortunately when I tried to put my custom weapon to the game it crashes... Can someone give me an example of how to put custom weapon to mod character? Also, is it possible to make custom bonfire item that can resurrect when you interact to it? Link to comment Share on other sites More sharing options...
Ultroman Posted July 5, 2019 Share Posted July 5, 2019 This mod makes firepits able to resurrect players. You could take a look at that code, to see how to do this. If you want to create a new custom prefab from the firepit, do that first since it'll give you enough trouble as it is to make a duplicate of that, and then take a look at the code for this mod to see what code is needed to make your new prefab do this. Did your custom weapon work before you put it into your character mod? Which error do you get in your logs? If you post a log file, I would also need to see a zip of your mod. Is this item supposed to be "locked" to your character somehow? Like, only your char can craft it or pick it up or something? There are plenty of mod characters who have custom weapons. Check out the code for those. It might even be easier to start by making the item as a stand-alone mod, and then when it works you can move it into your character mod. Once you've created your weapon, if you want to make a character-specific recipe for it or make other characters unable to pick it up, this post shows how to do that. That post also has a small paragraph at the beginning, which tells you how to move a stand-alone item mod into a character mod. Link to comment Share on other sites More sharing options...
HEAN Posted July 6, 2019 Author Share Posted July 6, 2019 Thank you Ultroman. 1. I made the character mod first and after that I tried making weapon in the same file. 2.here you go. The character itself is functioning good but I can't see or spawn the weapon as it crash as soon as I spawn it. 3. The weapon itself is locked on to the character as well as to craft or pick it up. I've been looking at others mod a while but it does help me somehow the coding is all different. I can't figure out which form I should take.. artorias.zip client_log.txt Link to comment Share on other sites More sharing options...
Akarinnnnnn Posted July 6, 2019 Share Posted July 6, 2019 see Icey Link to comment Share on other sites More sharing options...
Ultroman Posted July 6, 2019 Share Posted July 6, 2019 When the game crashes after choosing a character, i.e., also while playing, the error is printed in the server logs, not the client log, so we'll need that. Link to comment Share on other sites More sharing options...
HEAN Posted July 6, 2019 Author Share Posted July 6, 2019 Where can I view the sever logs? All I can see is client log. The game only crashes when I try to spawn custom weapon. Link to comment Share on other sites More sharing options...
Ultroman Posted July 7, 2019 Share Posted July 7, 2019 Check out the debugging section of the newcomer post. Link to comment Share on other sites More sharing options...
HEAN Posted July 7, 2019 Author Share Posted July 7, 2019 Here server.ini Link to comment Share on other sites More sharing options...
Ultroman Posted July 7, 2019 Share Posted July 7, 2019 That's not it. They're called server_log.txt. The paths are in the newcomer post. If there are no such files, then you need to let the game run for at least one clock segment before making it crash (sometimes the server log files aren't generated until this point). Link to comment Share on other sites More sharing options...
HEAN Posted July 7, 2019 Author Share Posted July 7, 2019 Oh that's why the file didn't show up. Thank you I will do that right away Link to comment Share on other sites More sharing options...
HEAN Posted July 10, 2019 Author Share Posted July 10, 2019 I've done it! Huge thank you Ultroman! If I want to make custom character to be stronger against certain mobs what should I write down in my custom mod lua file? Link to comment Share on other sites More sharing options...
Ultroman Posted July 10, 2019 Share Posted July 10, 2019 (edited) You're welcome 2 hours ago, HEAN said: If I want to make custom character to be stronger against certain mobs Look at the combat component. There's a function called CalcDamage. You can extend that, and multiply the damage done if the target is one of those mobs. You can make a dictionary of modifiers with prefab names as keys, in order to easily change or add entries. -- Put this first part somewhere above your character's master_postinit: -- damage_modifiers is a dictionary with creature prefab names as keys -- and the modifiers as values. local damage_modifiers = { butterfly = 1.2, -- 20% damage increase crow = 0.8, -- 20% damage decrease } -- Put this next part at the bottom of your character Lua's master_postinit: local oldCalcDamage = inst.components.combat.CalcDamage inst.components.combat.CalcDamage = function(self, target, weapon, multiplier, ...) local damage = oldCalcDamage(self, target, weapon, multiplier, ...) if damage ~= 0 and target.prefab ~= nil then -- We look up the kill penalty in our dictionary, using the prefab-variable (prefab name) -- of the target we are attacking. local damage_modifier = damage_modifiers[target.prefab] -- If we found an entry in our damage_modifiers dictionary for the target, apply the modifier. if damage_modifier ~= nil then damage = damage * damage_modifier end end return damage end) Edited July 10, 2019 by Ultroman Link to comment Share on other sites More sharing options...
HEAN Posted July 10, 2019 Author Share Posted July 10, 2019 Umm am I doing it right? Do I need to add anything more? -- Put this first part somewhere above your character's master_postinit: -- damage_modifiers is a dictionary with creature prefab names as keys -- and the modifiers as values. local damage_modifiers = { crawlinghorror = 1.2, -- 20% damage increase crawlingnightmare = 1.2, terrorbeak = 1.2, nightmarebeak = 1.2, stalker = 1.25, stalker_forest = 1.25, stalker_atrium = 1.25, shadow_knight = 1.25, shadow_bishop = 1,25, shadow_rook = 1.25, } -- This initializes for the server only. Components are added here. local master_postinit = function(inst) local oldCalcDamage = inst.components.combat.CalcDamage inst.components.combat.CalcDamage = function(self, target, weapon, multiplier, ...) local damage = oldCalcDamage(self, target, weapon, multiplier, ...) if damage ~= 0 and target.prefab ~= nil then -- We look up the kill penalty in our dictionary, using the prefab-variable (prefab name) -- of the target we are attacking. local damage_modifier = damage_modifiers[target.prefab] -- If we found an entry in our damage_modifiers dictionary for the target, apply the modifier. if damage_modifier ~= nil then damage = damage * damage_modifier end end return damage end) Link to comment Share on other sites More sharing options...
Ultroman Posted July 10, 2019 Share Posted July 10, 2019 (edited) That looks good (as long as that's just a snippet of your character Lua and not the whole thing ) Edited July 10, 2019 by Ultroman Link to comment Share on other sites More sharing options...
HEAN Posted July 10, 2019 Author Share Posted July 10, 2019 It's working! Thank you so much!! Link to comment Share on other sites More sharing options...
Ultroman Posted July 10, 2019 Share Posted July 10, 2019 You're very welcome 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