Bleksmits Posted September 6, 2014 Share Posted September 6, 2014 In my deerclops horn mood i can't add to play animation with my creation its always play with different item default horn or pan flute depends what is in [inst:AddTag("flute")] or [inst:AddTag("horn")]not mine. When i wrote [inst:AddTag("rags")] nothing hapen's. rags mean horn in my language:) local Assets ={ Asset("ANIM", "anim/rags_build.zip"), Asset("ATLAS", "images/inventoryimages/rags.xml"),local function onfinished(inst) inst:Remove()endlocal function TryAddFollower(leader, follower) -- no erors if leader.components.leader and follower.components.follower and follower:HasTag("beefalo") and not follower:HasTag("baby") and leader.components.leader:CountFollowers("beefalo") < TUNING.HORN_MAX_FOLLOWERS then leader.components.leader:AddFollower(follower) follower.components.follower:AddLoyaltyTime(TUNING.HORN_EFFECTIVE_TIME+math.random()) if follower.components.combat and follower.components.combat.target and follower.components.combat.target == leader then follower.components.combat:SetTarget(nil) end follower:DoTaskInTime(math.random(), function() follower.sg:PushEvent("heardhorn", {musician = leader} )end) endend -- !!local function HearRags(inst, musician, instrument) -- OK no errors if musician.components.leader then local herd = nil if inst:HasTag("beefalo") and not inst:HasTag("baby") and inst.components.herdmember then if inst.components.combat and inst.components.combat.target then inst.components.combat:GiveUp() end TryAddFollower(musician, inst) herd = inst.components.herdmember:GetHerd() end if herd and herd.components.herd then for k,v in pairs(herd.components.herd.members) do TryAddFollower(musician, k) end end endend -- OKlocal function fn(Sim) local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst:AddTag("flute") -- !!!??? MakeInventoryPhysics(inst) inst.AnimState:SetBank("horn") inst.AnimState:SetBuild("rags_build") inst.AnimState:PlayAnimation("idle") MakeInventoryPhysics(inst) inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/rags.xml" inst:AddComponent("inspectable") inst:AddComponent("instrument") inst.components.instrument.range = TUNING.HORN_RANGE inst.components.instrument:SetOnHeardFn(HearRags) inst:AddComponent("tool") inst.components.tool:SetAction(ACTIONS.PLAY) inst:AddComponent("fuel") -- ok inst.components.fuel.fuelvalue = TUNING.MED_FUEL -- ok can burn return instendSTRINGS.NAMES.RAGS = "Litle hornelio"STRINGS.CHARACTERS.GENERIC.DESCRIBE.RAGS = "Should something do but don't!"return Prefab( "common/inventory/rags", fn, Assets) Link to comment Share on other sites More sharing options...
Mobbstar Posted September 6, 2014 Share Posted September 6, 2014 Tags don't change how the thing works, they only let other things know what it is. Turns out the WilsonStateGraph handles the "Play"-action by checking for the horn/flute tag to determine the animations to be played.Two ways to get your animation working is by overriding WilsonSG or changing the characters stategraph to one of your own. In both scenarios, another mod that does these ways will not work, keep yours from working or crash the game. Sorry, I can't help more. Link to comment Share on other sites More sharing options...
Bleksmits Posted September 6, 2014 Author Share Posted September 6, 2014 Tags don't change how the thing works, they only let other things know what it is. Turns out the WilsonStateGraph handles the "Play"-action by checking for the horn/flute tag to determine the animations to be played.Two ways to get your animation working is by overriding WilsonSG or changing the characters stategraph to one of your own. In both scenarios, another mod that does these ways will not work, keep yours from working or crash the game. Sorry, I can't help more. Thanks! I'll see what I can do. Link to comment Share on other sites More sharing options...
lynn Posted September 6, 2014 Share Posted September 6, 2014 Take a look at Puppy PrincessThere's a custom flute there, the musha_play.lua file seems to do what you are missing. Link to comment Share on other sites More sharing options...
Bleksmits Posted September 6, 2014 Author Share Posted September 6, 2014 Take a look at Puppy PrincessThere's a custom flute there, the musha_play.lua file seems to do what you are missing. Thanks! i very appreciate it! Link to comment Share on other sites More sharing options...
Bleksmits Posted September 6, 2014 Author Share Posted September 6, 2014 Success! Oh thanks very much both of you! we made it! musha_play.lua helped me out. 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.