Jump to content

Recommended Posts

I've added previous equip-able items using the hat template, and those worked out fine when I set the 'SetBank' command to the source animation. However when I tried to do this with the extracted log suit files, the item would still drop invisible. Have I scripted anything wrong here?

local assets=
{
	Asset("ANIM", "anim/wakes_armor.zip"),
	
	    
	Asset("ATLAS", "images/inventoryimages/wakes_armor.xml"),
    Asset("IMAGE", "images/inventoryimages/wakes_armor.tex"),
}

local function OnBlocked(owner) 
    owner.SoundEmitter:PlaySound("dontstarve/wilson/hit_armour") 
end

local function onequip(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_body", "wakes_armor", "swap_body")
    inst:ListenForEvent("blocked", OnBlocked, owner)
end

local function onunequip(inst, owner) 
    owner.AnimState:ClearOverrideSymbol("swap_body")
    inst:RemoveEventCallback("blocked", OnBlocked, owner)
end

local function fn(Sim)
	local inst = CreateEntity()
	local trans = inst.entity:AddTransform()
	local anim = inst.entity:AddAnimState()
	MakeInventoryPhysics(inst)
	
    
    
    anim:SetBank("armor_wood")
    anim:SetBuild("wakes_armor")
    anim:PlayAnimation("anim")
    inst:AddTag("wood")
    inst:AddComponent("inspectable")
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.foleysound = "dontstarve/movement/foley/logarmour"
	inst.components.inventoryitem.imagename = "wakes_armor"
    inst.components.inventoryitem.atlasname = "images/inventoryimages/wakes_armor.xml"
    
	inst:AddComponent("fuel")
    inst.components.fuel.fuelvalue = TUNING.LARGE_FUEL
    
    inst:AddComponent("armor")
    inst.components.armor:InitCondition(TUNING.ARMORWOOD*2, TUNING.ARMORWOOD_ABSORPTION)
	
	inst:AddComponent("waterproofer")
    inst.components.waterproofer.effectiveness = 0
    
    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.BODY
    
    inst.components.equippable:SetOnEquip( onequip )
    inst.components.equippable:SetOnUnequip( onunequip )
    
    return inst
end

return Prefab( "common/inventory/wakes_armor", fn, assets) 

 

image.thumb.png.1a63c74da83e30a3400b54ec5de7a53c.pngimage.thumb.png.95e9cf622c17a80d0b4835a4c7410c9e.png

And here's the sprite code:

<?xml version="1.0" encoding="UTF-8"?>
<spriter_data scml_version="1.0" generator="BrashMonkey Spriter" generator_version="b5">
	<folder id="0" name="logsuit_float">
		<file id="0" name="logsuit_float/logsuit_float-0.png" width="144" height="136" pivot_x="0.397392" pivot_y="0.15368" />
	</folder>
	<folder id="1" name="swap_body">
		<file id="0" name="swap_body/swap_body-0.png" width="92" height="128" pivot_x="0.480429" pivot_y="0.173441" />
		<file id="1" name="swap_body/swap_body-1.png" width="92" height="128" pivot_x="0.530973" pivot_y="0.171879" />
		<file id="2" name="swap_body/swap_body-2.png" width="92" height="128" pivot_x="0.478255" pivot_y="0.183793" />
		<file id="3" name="swap_body/swap_body-3.png" width="92" height="128" pivot_x="0.475538" pivot_y="0.173441" />
		<file id="4" name="swap_body/swap_body-4.png" width="88" height="128" pivot_x="0.479824" pivot_y="0.17559" />
		<file id="5" name="swap_body/swap_body-5.png" width="92" height="128" pivot_x="0.47119" pivot_y="0.168754" />
		<file id="6" name="swap_body/swap_body-6.png" width="100" height="116" pivot_x="0.526245" pivot_y="0.184918" />
		<file id="7" name="swap_body/swap_body-7.png" width="100" height="120" pivot_x="0.627745" pivot_y="0.184588" />
		<file id="8" name="swap_body/swap_body-8.png" width="100" height="116" pivot_x="0.482245" pivot_y="0.183194" />
		<file id="9" name="swap_body/swap_body-9.png" width="96" height="100" pivot_x="0.542182" pivot_y="0.04476" />
		<file id="10" name="swap_body/swap_body-10.png" width="72" height="104" pivot_x="1.0545" pivot_y="0.0101058" />
		<file id="11" name="swap_body/swap_body-13.png" width="172" height="156" pivot_x="0.468311" pivot_y="0.203689" />
	</folder>
	<entity id="0" name="armor_wood">
		<animation id="0" name="anim" length="34">
			<mainline>
				<key id="0" time="0">
					<object_ref id="0" name="swap_body" abs_x="0" abs_y="0" abs_pivot_x="0.468311" abs_pivot_y="0.203689" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="0" z_index="1" />
				</key>
				<key id="1" time="34">
					<object_ref id="0" name="swap_body" abs_x="0" abs_y="0" abs_pivot_x="0.468311" abs_pivot_y="0.203689" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="1" z_index="1" />
				</key>
			</mainline>
			<timeline id="0" name="swap_body">
				<key id="0" time="0" spin="1">
					<object folder="1" file="11" x="-0.449" y="0.299" scale_x="1" scale_y="1" angle="0" />
				</key>
				<key id="1" time="34" spin="1">
					<object folder="1" file="11" x="-0.449" y="0.299" scale_x="1" scale_y="1" angle="0" />
				</key>
			</timeline>
		</animation>
		<animation id="1" name="idle_water" length="1200">
			<mainline>
				<key id="0" time="0">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="0" z_index="5" />
				</key>
				<key id="1" time="34">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="1" z_index="5" />
				</key>
				<key id="2" time="67">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="2" z_index="5" />
				</key>
				<key id="3" time="100">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="3" z_index="5" />
				</key>
				<key id="4" time="134">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="4" z_index="5" />
				</key>
				<key id="5" time="167">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="5" z_index="5" />
				</key>
				<key id="6" time="200">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="6" z_index="5" />
				</key>
				<key id="7" time="234">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="7" z_index="5" />
				</key>
				<key id="8" time="267">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="8" z_index="5" />
				</key>
				<key id="9" time="300">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="9" z_index="5" />
				</key>
				<key id="10" time="334">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="10" z_index="5" />
				</key>
				<key id="11" time="367">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="11" z_index="5" />
				</key>
				<key id="12" time="400">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="12" z_index="5" />
				</key>
				<key id="13" time="434">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="13" z_index="5" />
				</key>
				<key id="14" time="467">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="14" z_index="5" />
				</key>
				<key id="15" time="500">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="15" z_index="5" />
				</key>
				<key id="16" time="534">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="16" z_index="5" />
				</key>
				<key id="17" time="567">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="17" z_index="5" />
				</key>
				<key id="18" time="600">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="18" z_index="5" />
				</key>
				<key id="19" time="634">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="19" z_index="5" />
				</key>
				<key id="20" time="667">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="20" z_index="5" />
				</key>
				<key id="21" time="700">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="21" z_index="5" />
				</key>
				<key id="22" time="734">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="22" z_index="5" />
				</key>
				<key id="23" time="767">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="23" z_index="5" />
				</key>
				<key id="24" time="800">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="24" z_index="5" />
				</key>
				<key id="25" time="834">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="25" z_index="5" />
				</key>
				<key id="26" time="867">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="26" z_index="5" />
				</key>
				<key id="27" time="900">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="27" z_index="5" />
				</key>
				<key id="28" time="934">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="28" z_index="5" />
				</key>
				<key id="29" time="967">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="29" z_index="5" />
				</key>
				<key id="30" time="1000">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="30" z_index="5" />
				</key>
				<key id="31" time="1034">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="31" z_index="5" />
				</key>
				<key id="32" time="1067">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="32" z_index="5" />
				</key>
				<key id="33" time="1100">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="33" z_index="5" />
				</key>
				<key id="34" time="1134">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="34" z_index="5" />
				</key>
				<key id="35" time="1167">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="35" z_index="5" />
				</key>
				<key id="36" time="1201">
					<object_ref id="0" name="logsuit_float" abs_x="0" abs_y="0" abs_pivot_x="0.397392" abs_pivot_y="0.15368" abs_angle="0" abs_scale_x="1" abs_scale_y="1" abs_a="1" timeline="0" key="36" z_index="5" />
				</key>
			</mainline>
			<timeline id="0" name="logsuit_float">
				<key id="0" time="0" spin="1">
					<object folder="0" file="0" x="-6.799" y="-3.85" scale_x="1" scale_y="1" angle="0" />
				</key>
				<key id="1" time="34" spin="1">
					<object folder="0" file="0" x="-6.799" y="-4" scale_x="1.00067" scale_y="0.99881" angle="0" />
				</key>
				<key id="2" time="67" spin="1">
					<object folder="0" file="0" x="-6.799" y="-4.1" scale_x="1.00133" scale_y="0.997604" angle="0" />
				</key>
				<key id="3" time="100" spin="1">
					<object folder="0" file="0" x="-6.799" y="-4.25" scale_x="1.002" scale_y="0.996414" angle="0" />
				</key>
				<key id="4" time="134" spin="1">
					<object folder="0" file="0" x="-6.799" y="-4.35" scale_x="1.00266" scale_y="0.995209" angle="0" />
				</key>
				<key id="5" time="167" spin="1">
					<object folder="0" file="0" x="-6.799" y="-4.5" scale_x="1.00333" scale_y="0.994019" angle="0" />
				</key>
				<key id="6" time="200" spin="1">
					<object folder="0" file="0" x="-6.849" y="-4.55" scale_x="1.00398" scale_y="0.992813" angle="0" />
				</key>
				<key id="7" time="234" spin="1">
					<object folder="0" file="0" x="-6.849" y="-4.7" scale_x="1.00465" scale_y="0.991623" angle="0" />
				</key>
				<key id="8" time="267" spin="1">
					<object folder="0" file="0" x="-6.849" y="-4.8" scale_x="1.00531" scale_y="0.990417" angle="0" />
				</key>
				<key id="9" time="300" spin="1">
					<object folder="0" file="0" x="-6.849" y="-4.95" scale_x="1.00598" scale_y="0.989227" angle="0" />
				</key>
				<key id="10" time="334" spin="1">
					<object folder="0" file="0" x="-6.849" y="-5.05" scale_x="1.00665" scale_y="0.988037" angle="0" />
				</key>
				<key id="11" time="367" spin="1">
					<object folder="0" file="0" x="-6.849" y="-5.2" scale_x="1.00731" scale_y="0.986832" angle="0" />
				</key>
				<key id="12" time="400" spin="1">
					<object folder="0" file="0" x="-6.849" y="-5.3" scale_x="1.00798" scale_y="0.985641" angle="0" />
				</key>
				<key id="13" time="434" spin="1">
					<object folder="0" file="0" x="-6.849" y="-5.45" scale_x="1.00864" scale_y="0.984436" angle="0" />
				</key>
				<key id="14" time="467" spin="1">
					<object folder="0" file="0" x="-6.849" y="-5.55" scale_x="1.00931" scale_y="0.983246" angle="0" />
				</key>
				<key id="15" time="500" spin="1">
					<object folder="0" file="0" x="-6.849" y="-5.7" scale_x="1.00996" scale_y="0.98204" angle="0" />
				</key>
				<key id="16" time="534" spin="1">
					<object folder="0" file="0" x="-6.849" y="-5.8" scale_x="1.01064" scale_y="0.98085" angle="0" />
				</key>
				<key id="17" time="567" spin="1">
					<object folder="0" file="0" x="-6.899" y="-5.9" scale_x="1.01129" scale_y="0.979645" angle="0" />
				</key>
				<key id="18" time="600" spin="1">
					<object folder="0" file="0" x="-6.849" y="-6" scale_x="1.01196" scale_y="0.978455" angle="0" />
				</key>
				<key id="19" time="634" spin="1">
					<object folder="0" file="0" x="-6.849" y="-5.85" scale_x="1.01125" scale_y="0.979721" angle="0" />
				</key>
				<key id="20" time="667" spin="1">
					<object folder="0" file="0" x="-6.849" y="-5.75" scale_x="1.01056" scale_y="0.980988" angle="0" />
				</key>
				<key id="21" time="700" spin="1">
					<object folder="0" file="0" x="-6.849" y="-5.6" scale_x="1.00984" scale_y="0.982254" angle="0" />
				</key>
				<key id="22" time="734" spin="1">
					<object folder="0" file="0" x="-6.849" y="-5.5" scale_x="1.00916" scale_y="0.983521" angle="0" />
				</key>
				<key id="23" time="767" spin="1">
					<object folder="0" file="0" x="-6.849" y="-5.35" scale_x="1.00842" scale_y="0.984787" angle="0" />
				</key>
				<key id="24" time="800" spin="1">
					<object folder="0" file="0" x="-6.799" y="-5.25" scale_x="1.00774" scale_y="0.986053" angle="0" />
				</key>
				<key id="25" time="834" spin="1">
					<object folder="0" file="0" x="-6.799" y="-5.1" scale_x="1.00703" scale_y="0.98732" angle="0" />
				</key>
				<key id="26" time="867" spin="1">
					<object folder="0" file="0" x="-6.799" y="-4.95" scale_x="1.00633" scale_y="0.988586" angle="0" />
				</key>
				<key id="27" time="900" spin="1">
					<object folder="0" file="0" x="-6.799" y="-4.85" scale_x="1.00563" scale_y="0.989868" angle="0" />
				</key>
				<key id="28" time="934" spin="1">
					<object folder="0" file="0" x="-6.799" y="-4.75" scale_x="1.00493" scale_y="0.991135" angle="0" />
				</key>
				<key id="29" time="967" spin="1">
					<object folder="0" file="0" x="-6.799" y="-4.6" scale_x="1.00423" scale_y="0.992401" angle="0" />
				</key>
				<key id="30" time="1000" spin="1">
					<object folder="0" file="0" x="-6.799" y="-4.5" scale_x="1.00351" scale_y="0.993668" angle="0" />
				</key>
				<key id="31" time="1034" spin="1">
					<object folder="0" file="0" x="-6.799" y="-4.35" scale_x="1.00281" scale_y="0.994934" angle="0" />
				</key>
				<key id="32" time="1067" spin="1">
					<object folder="0" file="0" x="-6.799" y="-4.2" scale_x="1.00209" scale_y="0.996201" angle="0" />
				</key>
				<key id="33" time="1100" spin="1">
					<object folder="0" file="0" x="-6.799" y="-4.05" scale_x="1.0014" scale_y="0.997467" angle="0" />
				</key>
				<key id="34" time="1134" spin="1">
					<object folder="0" file="0" x="-6.749" y="-3.95" scale_x="1.00069" scale_y="0.998734" angle="0" />
				</key>
				<key id="35" time="1167" spin="1">
					<object folder="0" file="0" x="-6.799" y="-3.85" scale_x="1" scale_y="1" angle="0" />
				</key>
				<key id="36" time="1201" spin="1">
					<object folder="0" file="0" x="-6.799" y="-3.85" scale_x="1" scale_y="1" angle="0" />
				</key>
			</timeline>
		</animation>
	</entity>
</spriter_data>

Any help?

What I'd do is go back to the latest backup where it was actually working, then change things one at a time to resolve bugs one at a time as they happen.  

If you don't have a backup, start over and just see if you can make a re-named logsuit, and go from there slowly.

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...