Grifuz Posted May 19, 2014 Share Posted May 19, 2014 So I'm trying to make it so this hat restores sanity and has insulation, i believe the insulation is actually working but the sanity boost is not. Any help? local assets = { Asset("ANIM", "anim/hat_d.zip"), Asset("IMAGE", "images/inventoryimages/hat_d.tex"), Asset("ATLAS", "images/inventoryimages/hat_d.xml"), } local function onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_hat", "hat_d", "swap_hat") owner.AnimState:Show("HAT") owner.AnimState:Show("HAT_HAIR") owner.AnimState:Hide("HAIR_NOHAT") owner.AnimState:Hide("HAIR") if owner:HasTag("player") thenowner.AnimState:Hide("HEAD")owner.AnimState:Show("HEAD_HAIR")end end local function onunequip(inst, owner) owner.AnimState:Hide("HAT") owner.AnimState:Hide("HAT_HAIR") owner.AnimState:Show("HAIR_NOHAT") owner.AnimState:Show("HAIR") if owner:HasTag("player") then owner.AnimState:Show("HEAD")owner.AnimState:Hide("HEAD_HAIR")endend local function fn(Sim)local inst = CreateEntity()local trans = inst.entity:AddTransform()local anim = inst.entity:AddAnimState() MakeInventoryPhysics(inst) inst:AddTag("hat_d") anim:SetBuild("hat_d") anim:PlayAnimation("anim") inst:AddComponent("inspectable") inst:AddComponent("inventoryitem")inst.components.inventoryitem.atlasname = "images/inventoryimages/hat_d.xml" inst:AddComponent("tradable") inst:AddComponent("equippable") inst.components.equippable.equipslot = EQUIPSLOTS.HEAD inst.components.equippable:SetOnEquip( onequip ) inst:AddComponent("insulator") inst.components.insulator.insulation = TUNING.INSULATION_SMALL inst:AddComponent("dapperness")inst.components.dapperness.dapperness = TUNING.DAPPERNESS_MEDIUM inst.components.equippable:SetOnUnequip( onunequip ) return instend return Prefab( "common/inventory/hat_d", fn, assets) Link to comment https://forums.kleientertainment.com/forums/topic/36600-help-sanity-boost-not-working-on-my-hat/ Share on other sites More sharing options...
DeathDisciple Posted May 19, 2014 Share Posted May 19, 2014 Vanilla game uses components.dapperness:GetDapperness(self.inst) , ROG uses components.equippable:GetDapperness(self.inst) Why was the change necessary, and why noone cared to even try to maintain compatibility... is question for someone else, but as it is right now, you have to check if rog is active (or just add dapperness field to both components and hope they don't change it again) Link to comment https://forums.kleientertainment.com/forums/topic/36600-help-sanity-boost-not-working-on-my-hat/#findComment-483940 Share on other sites More sharing options...
Grifuz Posted May 19, 2014 Author Share Posted May 19, 2014 (edited) -snip- Edited May 19, 2014 by Grifuz Link to comment https://forums.kleientertainment.com/forums/topic/36600-help-sanity-boost-not-working-on-my-hat/#findComment-484184 Share on other sites More sharing options...
Grifuz Posted May 19, 2014 Author Share Posted May 19, 2014 Vanilla game uses components.dapperness:GetDapperness(self.inst) , ROG uses components.equippable:GetDapperness(self.inst) Why was the change necessary, and why noone cared to even try to maintain compatibility... is question for someone else, but as it is right now, you have to check if rog is active (or just add dapperness field to both components and hope they don't change it again)What do i place after that? I get this errorps/common/dont_starve/data/scripts/mainfunctions.lua:70: Error loading file prefabs/hat_d...steamapps/common/dont_starve/data/../mods/clem/scripts/prefabs/hat_d.lua:65: unexpected symbol near '='Line 65 being64 inst:AddComponent("dapperness")65 components.equippable:GetDapperness(self.inst) = I tried using numbers, 3/60 and i tried 3 too. Link to comment https://forums.kleientertainment.com/forums/topic/36600-help-sanity-boost-not-working-on-my-hat/#findComment-484242 Share on other sites More sharing options...
Grifuz Posted May 19, 2014 Author Share Posted May 19, 2014 Dear Baron, add this to the component tag "equipable" inst.components.equippable.dapperness = TUNING.DAPPERNESS_MED Cheers. Link to comment https://forums.kleientertainment.com/forums/topic/36600-help-sanity-boost-not-working-on-my-hat/#findComment-484346 Share on other sites More sharing options...
Grifuz Posted May 19, 2014 Author Share Posted May 19, 2014 Dear Baron, add this to the component tag "equipable" inst.components.equippable.dapperness = TUNING.DAPPERNESS_MED Cheers. Oh gee! thanks myself!Nah just kidding, I guess I had to find out myself. Link to comment https://forums.kleientertainment.com/forums/topic/36600-help-sanity-boost-not-working-on-my-hat/#findComment-484350 Share on other sites More sharing options...
DeathDisciple Posted May 20, 2014 Share Posted May 20, 2014 Lol, I meant, the sanity checks are doing the calls above^, so for them to work you would need to set fields for appropriate components... but you figured it out anyway Link to comment https://forums.kleientertainment.com/forums/topic/36600-help-sanity-boost-not-working-on-my-hat/#findComment-484517 Share on other sites More sharing options...
Grifuz Posted May 20, 2014 Author Share Posted May 20, 2014 Lol, I meant, the sanity checks are doing the calls above^, so for them to work you would need to set fields for appropriate components... but you figured it out anyway Thanks for the help anyway, helped me Link to comment https://forums.kleientertainment.com/forums/topic/36600-help-sanity-boost-not-working-on-my-hat/#findComment-484847 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