nirasa Posted April 24, 2015 Share Posted April 24, 2015 Sorry for my english - google translation. (Thank you for your help)Creating your own character - a snowman. Does snowflakes, works like a boomerang. It works perfectly in the slot is visible. In the hands of a snowman is not visible, but it works.I followed the instructions:http://forums.kleientertainment.com/topic/27341-tutorial-the-artists-guide-to-characteritem-modding/title: But what about items?File ...scripts/prefabs/vlockalocal assets={ Asset("ANIM", "anim/vlocka.zip"), Asset("ANIM", "anim/swap_vlocka.zip"), Asset("ATLAS", "images/inventoryimages/vlocka.xml"), Asset("IMAGE", "images/inventoryimages/vlocka.tex"),}local prefabs = {}local function OnFinished(inst) inst.AnimState:PlayAnimation("used") inst:ListenForEvent("animover", function() inst:Remove() end)endlocal function OnEquip(inst, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_vlocka", "swap_vlocka") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") endlocal function OnDropped(inst) inst.AnimState:PlayAnimation("idle")endlocal function OnUnequip(inst, owner) owner.AnimState:Hide("ARM_carry") owner.AnimState:Show("ARM_normal") endlocal function OnThrown(inst, owner, target) if target ~= owner then owner.SoundEmitter:PlaySound("dontstarve/wilson/boomerang_throw") end inst.AnimState:PlayAnimation("spin_loop", true)endlocal function OnCaught(inst, catcher) if catcher then if catcher.components.inventory then if inst.components.equippable and not catcher.components.inventory:GetEquippedItem(inst.components.equippable.equipslot) then catcher.components.inventory:Equip(inst) else catcher.components.inventory:GiveItem(inst) end catcher:PushEvent("catch") end endendlocal function ReturnToOwner(inst, owner) if owner and not (inst.components.finiteuses and inst.components.finiteuses:GetUses() < 1) then owner.SoundEmitter:PlaySound("dontstarve/wilson/boomerang_return") inst.components.projectile:Throw(owner, owner) endendlocal function OnHit(inst, owner, target) if owner == target then OnDropped(inst) else ReturnToOwner(inst, owner) end local impactfx = SpawnPrefab("impact") if impactfx then local follower = impactfx.entity:AddFollower() follower:FollowSymbol(target.GUID, target.components.combat.hiteffectsymbol, 0, 0, 0 ) impactfx:FacePoint(inst.Transform:GetWorldPosition()) endendlocal function fn(Sim) local inst = CreateEntity() local trans = inst .entity:AddTransform() local anim = inst.entity:AddAnimState() MakeInventoryPhysics(inst) RemovePhysicsColliders(inst) anim:SetBank("vlocka") anim:SetBuild("vlocka") anim:PlayAnimation("idle") anim:SetRayTestOnBB(true); inst:AddTag("projectile") inst:AddTag("thrown") inst:AddComponent("weapon") inst.components.weapon:SetDamage(TUNING.BOOMERANG_DAMAGE) inst.components.weapon:SetRange(TUNING.BOOMERANG_DISTANCE, TUNING.BOOMERANG_DISTANCE+2) ------- inst:AddComponent("inspectable") inst:AddComponent("projectile") inst.components.projectile:SetSpeed(10) inst.components.projectile:SetCanCatch(true) inst.components.projectile:SetOnThrownFn(OnThrown) inst.components.projectile:SetOnHitFn(OnHit) inst.components.projectile:SetOnMissFn(ReturnToOwner) inst.components.projectile:SetOnCaughtFn(OnCaught) inst:AddComponent("inventoryitem") inst.components.inventoryitem:SetOnDroppedFn(OnDropped) inst.components.inventoryitem.imagename = "vlocka" inst.components.inventoryitem.atlasname = "images/inventoryimages/vlocka.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip(OnEquip) inst.components.equippable:SetOnUnequip(OnUnequip) return instendreturn Prefab( "common/inventory/vlocka", fn, assets, prefabs) Picture of the game: Link to comment Share on other sites More sharing options...
Seiai Posted April 24, 2015 Share Posted April 24, 2015 @nirasaits probably a problem withanim:SetBank("vlocka")anim:SetBuild("vlocka")andowner.AnimState:OverrideSymbol("swap_object", "swap_vlocka", "swap_vlocka")which is supposed to containowner.AnimState:OverrideSymbol("swap_object", "swap_vlocka"--[[build]],"swap_vlocka" --[[bank]])and the actual names of the Bank(name of the animationfolder in anim.bin) and the Build(name in build.bin) in your anim/vlocka.zip and anim/swap_vlocka.zip.If u dont mind to upload anim/vlocka.zip and anim/swap_vlocka.zip here, we can have a look at the actual data. Link to comment Share on other sites More sharing options...
Corrosive Posted April 24, 2015 Share Posted April 24, 2015 @Seiai, --[[ ... ]] is Lua's syntax for block comments, they don't have any effect on those lines. I would like to take a peek at swap_vlocka.zip though Link to comment Share on other sites More sharing options...
Seiai Posted April 24, 2015 Share Posted April 24, 2015 @Seiai, --[[ ... ]] is Lua's syntax for block comments, they don't have any effect on those lines. I would like to take a peek at swap_vlocka.zip thoughi know, i just wanted to mark those two parameters with whats supposed to be in there. i guess the bank in the override is wrong, and i asume u guess the same. Link to comment Share on other sites More sharing options...
nirasa Posted April 25, 2015 Author Share Posted April 25, 2015 @Seiai, --[[ ... ]] is Lua's syntax for block comments, they don't have any effect on those lines. I would like to take a peek at swap_vlocka.zip though I send the whole file with character Wilan. It is not finished.I can not lua, but still I am learning. File vlocka.lua I copied from the file boomerang.lua and adjusted it.Thank you both for your response.wilan_snehulak.zip Link to comment Share on other sites More sharing options...
Seiai Posted April 25, 2015 Share Posted April 25, 2015 i noticed that there is the end of both build.bin missing. you somehow deleted a bit when editing them.and you named the atlas-0.tex in vlocka.zip altas-0.tex.use the attached swap_vlocka.zip and vlocka.zip.then changeanim:SetBank("vlocka")anim:SetBuild("vlocka")toanim:SetBank("boomerang")anim:SetBuild("vlocka")this should make it, so it is visible on the ground.then changeowner.AnimState:OverrideSymbol("swap_object", "swap_vlocka", "swap_vlocka")toowner.AnimState:OverrideSymbol("swap_object", "swap_vlocka", "swap_boomerang")this should make it visible in your hand and when flying.then i noticed that you used more space on the template than the boomerang, thats why there is a part missing. You will have to make the vlocka smaller:swap_vlocka.zipvlocka.zip Link to comment Share on other sites More sharing options...
Seiai Posted April 25, 2015 Share Posted April 25, 2015 Edit: redundant post, i edited the above one. Edit to make it a bit less redundant: vlocka is czech i presume? Greetings from just across the border, iam from austria near the CZ border^^ Link to comment Share on other sites More sharing options...
nirasa Posted April 26, 2015 Author Share Posted April 26, 2015 Yeees! It works! Nice. Thank you very much for your help. Edit: redundant post, i edited the above one.Edit to make it a bit less redundant: vlocka is czech i presume? Greetings from just across the border, iam from austria near the CZ border^^ Yes, I'm from Czech republic I greet you, too. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.