mickej Posted December 20, 2017 Share Posted December 20, 2017 (edited) Hi, I love playing as Webber. One problem with playing as Webber is that you can not utilise Chester properly, since spiders will attack Chester. This is why I want to make a mod that prevents spiders from attacking Chester and thus Webber players won't have to choose between using spider minions or Chester. I think a simple solution would be to create a function that would add a "monster" tag to Chester when the Mod is activated. I have never coded in Lua before, so even though this should be really simple, I can't make it to work. I have tried these lines of code. When I test the code by starting a new world and spawning an eye bone via console, spiders are still attacking Chester. Can anyone see the problem with my code or know another solution to prevent spiders from attacking Chester? I intend on using the mod for single player only, so the solution can be very basic. AddPrefabPostInit("chester_eyebone", function(inst) local chester = TheSim:FindFirstEntityWithTag("chester") --looks kind of dodgey, but if chester ~= nil then--sanity check chester:AddTag("monster") return true else return false end end) I was inspired by this mod: http://steamcommunity.com/sharedfiles/filedetails/?id=959893638&searchtext=chester . It does exactly what I want, but is a bit more complex since it add/removes the "monster" tag on Chester depending on what character holds the eye bone. The mod works perfectly when caves are disabled, but in worlds with caves, it crashes when eye bone spawn (attempt to index field "inventoryitem" (a nil value)). Since I don't know how to fix this issue, I decided to create my own mod that would be a bit simpler. If anyone know a fix to the already existing mod, feel free to share it since that would also resolve the issue. Any help will be greatly appreciated. I just want to be able to play as Webber without having spiders constantly chewing on poor Chester. Edited December 20, 2017 by mickej Link to comment https://forums.kleientertainment.com/forums/topic/85636-need-help-with-a-simple-mod-spiders-wont-attack-chester/ Share on other sites More sharing options...
mickej Posted December 21, 2017 Author Share Posted December 21, 2017 Or if anyone know another already existing working mod that prevents spiders from attacking Chester, feel free to share it! I know there are some mods available for DS single player, but I do not know how to port DS mod code so it works in DST. Link to comment https://forums.kleientertainment.com/forums/topic/85636-need-help-with-a-simple-mod-spiders-wont-attack-chester/#findComment-986320 Share on other sites More sharing options...
spideswine Posted December 21, 2017 Share Posted December 21, 2017 (edited) Why are you adding it to the eyebone? AddPrefabPostInit("chester", function(inst) inst:AddTag("monster") end) Mind you, this "might" cause things such as pigs and rabbits to attack chester, which is not something I'm sure you want, you can see if AddPrefabPostInit("chester", function(inst) inst:RemoveTag("character") end) gets you better results. Edited December 21, 2017 by spideswine Link to comment https://forums.kleientertainment.com/forums/topic/85636-need-help-with-a-simple-mod-spiders-wont-attack-chester/#findComment-986360 Share on other sites More sharing options...
mickej Posted December 25, 2017 Author Share Posted December 25, 2017 Sorry for the late reply, I was out travelling. Thank you so much for the help Spideswine, I will try it out tomorrow. I am alright with pigs and rabbits attacking Chester, since I only intend using this for single player. Peace with spiders justifies the trade off of having pigs and rabbits attack Chester (Can not ally them as Webber anyways) Link to comment https://forums.kleientertainment.com/forums/topic/85636-need-help-with-a-simple-mod-spiders-wont-attack-chester/#findComment-987333 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