Crazybait24 Posted January 11, 2015 Share Posted January 11, 2015 Ok I'm like ripping my hair out at this code I'm working on... I can't get the fuel to work on the item. Here's me codesthe itemlocal assets ={ Asset("ANIM", "anim/cursedsword.zip"), Asset("ANIM", "anim/swap_cursedsword.zip"), Asset("IMAGE", "images/inventoryimages/cursedsword.tex"), Asset("ATLAS", "images/inventoryimages/cursedsword.xml"),} local function onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_cursedsword", "swap_nightmaresword") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") if inst.components.fueled then inst.components.fueled:StartConsuming() end owner.components.sanity.inducedinsanity = true owner:PushEvent("goinsane", {})endlocal function onunequip(inst, owner) owner.AnimState:Hide("ARM_carry") owner.AnimState:Show("ARM_normal") if inst.components.fueled then inst.components.fueled:StopConsuming() end owner.components.sanity.inducedinsanity = false owner:PushEvent("gosane", {})endlocal function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("nightmaresword") inst.AnimState:SetBuild("cursedsword") inst.AnimState:PlayAnimation("idle") inst:AddTag("sharp") if not TheWorld.ismastersim then return inst end inst.entity:SetPristine() inst:AddComponent("inspectable") inst:AddComponent("weapon") inst.components.weapon:SetDamage(TUNING.SPEAR_DAMAGE * 1.6) inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/cursedsword.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip( onequip ) inst.components.equippable:SetOnUnequip( onunequip ) inst:AddComponent("fueled") inst.components.fueled.fueltype = "CURSED" inst.components.fueled:InitializeFuelLevel(500) inst.components.fueled.accepting = true return instend return Prefab("common/inventory/cursedsword", fn, assets)and the fuellocal assets ={ Asset("ANIM", "anim/cursedfuel.zip"),}local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("livinglog") inst.AnimState:SetBuild("cursedfuel") inst.AnimState:PlayAnimation("idle") if not TheWorld.ismastersim then return inst end inst.entity:SetPristine() inst:AddComponent("fuel") inst.components.fuel.fueltype = "CURSED" inst.components.fuel.fuelvalue = 150 inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/cursedfuel.xml" inst:AddComponent("stackable") inst.components.stackable.maxsize = TUNING.STACK_SIZE_LARGEITEM return instendreturn Prefab("common/inventory/cursedfuel", fn, assets) Link to comment https://forums.kleientertainment.com/forums/topic/48961-needing-help-with-adding-a-new-fueltype/ Share on other sites More sharing options...
rezecib Posted January 12, 2015 Share Posted January 12, 2015 (edited) @Crazybait24, I'm guessing it correctly burns the fuel when you equip it, but that it's not letting you refuel it with the cursedfuel? Although I'm looking at mininglantern and lightbulb and it looks like your code should work... Edit: Ah, looks like you need to be adding the fueltype to the FUELTYPE table, too, since that's what the FUEL componentaction checks. Edited January 12, 2015 by rezecib Link to comment https://forums.kleientertainment.com/forums/topic/48961-needing-help-with-adding-a-new-fueltype/#findComment-600785 Share on other sites More sharing options...
Crazybait24 Posted January 12, 2015 Author Share Posted January 12, 2015 I'm just decided to set it to FUELTYPE.NIGHTMARE Anyways thanks for trying to help Link to comment https://forums.kleientertainment.com/forums/topic/48961-needing-help-with-adding-a-new-fueltype/#findComment-601016 Share on other sites More sharing options...
rezecib Posted January 12, 2015 Share Posted January 12, 2015 @Crazybait24, You can use "cursed" as a fueltype... you just also need to have this:GLOBAL.FUELTYPE.CURSED = "CURSED" Link to comment https://forums.kleientertainment.com/forums/topic/48961-needing-help-with-adding-a-new-fueltype/#findComment-601040 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