Jump to content

Recommended Posts

After spending at least half the day trying to cannibalize the coding for Willow's lighter, I've FINALLY managed to add a special lighter to my friend's character mod. Only problem now is that it's completely invisible in the inventory bar and when dropped on the ground.

 

I have all the images, *.tex, and *.xml files where they should be so I'm not sure what's going on. It's driving me crazy.

 

The lua for the character herself

local MakePlayerCharacter = require "prefabs/player_common"local prefabs = {		"jinlighter",	}	local assets = {        Asset( "ANIM", "anim/player_basic.zip" ),        Asset( "ANIM", "anim/player_idles_shiver.zip" ),        Asset( "ANIM", "anim/player_actions.zip" ),        Asset( "ANIM", "anim/player_actions_axe.zip" ),        Asset( "ANIM", "anim/player_actions_pickaxe.zip" ),        Asset( "ANIM", "anim/player_actions_shovel.zip" ),        Asset( "ANIM", "anim/player_actions_blowdart.zip" ),        Asset( "ANIM", "anim/player_actions_eat.zip" ),        Asset( "ANIM", "anim/player_actions_item.zip" ),        Asset( "ANIM", "anim/player_actions_uniqueitem.zip" ),        Asset( "ANIM", "anim/player_actions_bugnet.zip" ),        Asset( "ANIM", "anim/player_actions_fishing.zip" ),        Asset( "ANIM", "anim/player_actions_boomerang.zip" ),        Asset( "ANIM", "anim/player_bush_hat.zip" ),        Asset( "ANIM", "anim/player_attacks.zip" ),        Asset( "ANIM", "anim/player_idles.zip" ),        Asset( "ANIM", "anim/player_rebirth.zip" ),        Asset( "ANIM", "anim/player_jump.zip" ),        Asset( "ANIM", "anim/player_amulet_resurrect.zip" ),        Asset( "ANIM", "anim/player_teleport.zip" ),        Asset( "ANIM", "anim/wilson_fx.zip" ),        Asset( "ANIM", "anim/player_one_man_band.zip" ),        Asset( "ANIM", "anim/shadow_hands.zip" ),        Asset( "SOUND", "sound/sfx.fsb" ),        Asset( "SOUND", "sound/willow.fsb" ),				-- Don't forget to include your character's custom assets!        Asset( "ANIM", "anim/jinyoung.zip" ),}local start_inv = {	"jinlighter",} local fn = function(inst)		-- choose which sounds this character will play	inst.soundsname = "willow"	-- a minimap icon must be specified	inst.MiniMapEntity:SetIcon( "willow.png" )	-- todo: Add an example special power here.	inst.components.locomotor.walkspeed = 6	inst.components.locomotor.runspeed = 8	inst.components.health.fire_damage_scale = 0	inst.components.sanity.maxsanity = 175	inst.components.health.maxhealth = 200	inst.components.hunger.maxhunger = 150	inst.components.inventory:GuaranteeItems({"jinlighter"})		endSTRINGS.CHARACTERS.JINYOUNG=require "speech_jinyoung"return MakePlayerCharacter("jinyoung", prefabs, assets, fn, start_inv) 

 

and the lua for the lighter

local assets ={	Asset("ANIM", "anim/jinlighter.zip"),	Asset("ANIM", "anim/swap_jinlighter.zip"),	Asset("ATLAS", "images/inventoryimages/jinlighter.xml"),    Asset("IMAGE", "images/inventoryimages/jinlighter.tex"),} local prefabs ={	"lighterfire",	"jinlighter",}    local function onequip(inst, owner)     inst.components.burnable:Ignite()    owner.AnimState:OverrideSymbol("swap_object", "swap_jinlighter", "swap_jinlighter")    owner.AnimState:Show("ARM_carry")     owner.AnimState:Hide("ARM_normal")         inst.SoundEmitter:PlaySound("dontstarve/wilson/lighter_LP", "torch")    inst.SoundEmitter:PlaySound("dontstarve/wilson/lighter_on")    inst.SoundEmitter:SetParameter( "torch", "intensity", 3 )    inst.fire = SpawnPrefab( "lighterfire" )    local follower = inst.fire.entity:AddFollower()    follower:FollowSymbol( owner.GUID, "swap_object", 35, -35, 1 )endlocal function onunequip(inst,owner) 	inst.fire:Remove()    inst.fire = nil        inst.components.burnable:Extinguish()    owner.components.combat.damage = owner.components.combat.defaultdamage     owner.AnimState:Hide("ARM_carry")     owner.AnimState:Show("ARM_normal")    inst.SoundEmitter:KillSound("torch")    inst.SoundEmitter:PlaySound("dontstarve/wilson/lighter_off")        endlocal function fn(Sim)	local inst = CreateEntity()	local trans = inst.entity:AddTransform()	local anim = inst.entity:AddAnimState()    local sound = inst.entity:AddSoundEmitter()    anim:SetBank("jinlighter")    anim:SetBuild("jinlighter")    anim:PlayAnimation("idle")    MakeInventoryPhysics(inst)    inst:AddTag("irreplaceable")    local minimap = inst.entity:AddMiniMapEntity()    minimap:SetIcon( "jinlighter.tex" )        inst:AddComponent("weapon")    inst.components.weapon:SetDamage(TUNING.LIGHTER_DAMAGE)    inst.components.weapon:SetAttackCallback(        function(attacker, target)            if target.components.burnable then                if math.random() < TUNING.LIGHTER_ATTACK_IGNITE_PERCENT*target.components.burnable.flammability then                    target.components.burnable:Ignite()                end            end        end    )        -----------------------------------    inst:AddComponent("lighter")    -----------------------------------        inst:AddComponent("inventoryitem")    -----------------------------------        inst:AddComponent("equippable")    inst.components.equippable:SetOnPocket( function(owner) inst.components.burnable:Extinguish()  end)        inst.components.equippable:SetOnEquip( onequip )         inst.components.equippable:SetOnUnequip( onunequip )        -----------------------------------        inst:AddComponent("inspectable")            -----------------------------------        inst:AddComponent("heater")    inst.components.heater.equippedheat = 6     -----------------------------------        inst:AddComponent("burnable")    inst.components.burnable.canlight = false    inst.components.burnable.fxprefab = nil        -----------------------------------    return instendreturn Prefab( "common/jinlighter", fn, assets, prefabs)  

 

I tried a guide for custom hand equips to create the lighter from scratch but I still had the same problem. I'm lost here xP

@Corrosive Here ya go. My friend is still working on her character art so I haven't changed it from the template assets. Sorry if that makes it kind of tricky to see things in-game.

 

https://www.mediafire.com/?tttukotaffx8bge

Edited by Toko

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...