JennaBelle Posted August 20, 2021 Share Posted August 20, 2021 I'm working on a custom character that's supposed to be an ice mage and I need her to be immune to cold, preferably by adjust maximum and minimum temperature, and have the powers of the Ice Staff without actually wielding the Ice Staff. I'm not sure how to do either though. It's been a while since I've made a mod for this game and I've forgotten a lot. Link to comment https://forums.kleientertainment.com/forums/topic/132831-immunity-to-cold-and-ice-staff-powers/ Share on other sites More sharing options...
Monti18 Posted August 20, 2021 Share Posted August 20, 2021 (edited) inst.components.temperature.mintemp = 10 inst.components.temperature.maxtemp = 30 Add this to the master postinit of your character and change the values to what you want to adjust her min and max temperature. As for the ice staff, I'm not sure what the best way is, you could try adding this to your modmain and character prefab: Spoiler --ModMain GLOBAL.EQUIPSLOTS.MIND = "mind" AddClassPostConstruct("components/combat", function(self) local old_getweapon = self.GetWeapon or function() end self.GetWeapon = function(self,...) local ret = old_getweapon(self,...) if ret == nil then if self.inst.components.inventory ~= nil then local icestaff = self.inst.components.inventory:GetEquippedItem(GLOBAL.EQUIPSLOTS.MIND) return icestaff ~= nil and icestaff or nil end else return ret end end end) local function OnUsesDepleted(inst) local owner = inst.components.inventoryitem.owner if owner then if owner.components.inventory.equipslots[GLOBAL.EQUIPSLOTS.MIND] == inst then inst.components.finiteuses:SetPercent(1) inst:RemoveTag("usesdepleted") else inst.SoundEmitter:PlaySound("dontstarve/common/gem_shatter") inst:Remove() end else inst.SoundEmitter:PlaySound("dontstarve/common/gem_shatter") inst:Remove() end end AddPrefabPostInit("icestaff",function(inst) if not TheWorld.ismastersim then return inst end inst.components.finiteuses:SetOnFinished(OnUsesDepleted) end) --Character Prefab in master postinit if inst.components.inventory:GetEquippedItem(EQUIPSLOTS.MIND) == nil then inst.components.inventory.equipslots[EQUIPSLOTS.MIND] = SpawnPrefab("icestaff") end This should theoretically add an icestaff to your character that is only used if you have no weapon equipped. As you create a new equipslot (mind is just a name I came up with, you can change it if you want), you will have it equipped but nobody will see that it's equipped. The icestaff thing is untested, so no idea if it works as it should, but it should give you an idea of what you need to do Edited August 20, 2021 by Monti18 1 Link to comment https://forums.kleientertainment.com/forums/topic/132831-immunity-to-cold-and-ice-staff-powers/#findComment-1487282 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