FurryEskimo Posted August 13, 2020 Share Posted August 13, 2020 I've been trying to get this structure's breaking animation to play, but all it wants to do is a big puff of smoke, what looks like a flash, a wooden crashing sound, the end. What's weird though is that no matter what in this code I change, the breaking effects never seem to change. The Destroy animation is very difficult to get to play, and is almost always obstructed by another effect. Removing the Prefab collapse effect causes the mod to break,and changing the SetMaterial code never seems to do anything at all. The most I've discovered is that inst.Remove() controls when the ten's flap-animation stops, when the physical obstruction is removed, and when the tent is no longer functional as a tent. I'm hoping this might explain my other issue with the tent, where it's build animation places the flaps early, then puts the actual tent's png in the wrong place. inst:Remove() --Test code. --inst.AnimState:PushAnimation("destroy", true) --Test code. Doesn't seem to have enough time to play animation before the instance is removed. -- inst.AnimState:PlayAnimation("destroy") --Test code. Not sure this is working. inst.components.lootdropper:DropLoot() local fx = SpawnPrefab("collapse_big") --Removal animation effect. Note: Mod breaks if this is removed. -- inst.SoundEmitter:PlaySound("dontstarve/common/tent_dis_pre") --Test code. Note: Not sure this is working. -- inst.SoundEmitter:PlaySound("dontstarve/common/tent_dis_pre") --local fx = SpawnPrefab("collapse_small") inst.AnimState:PlayAnimation("destroy") --Test code. fx.Transform:SetPosition(inst.Transform:GetWorldPosition()) --Unsure what this does, but removing or moving it causes mod to break. fx:SetMaterial("wood") --No idea what this does. Does not seem to be necessary. --fx:SetMaterial("metal") -- inst:Remove() --inst.persists = false --Unsure what this does. --inst.SoundEmitter:PlaySound("dontstarve/common/tent_dis_twirl") --Note: Does not appear to work. inst:DoTaskInTime(160 * FRAMES, onfinishedsound) Link to comment https://forums.kleientertainment.com/forums/topic/120921-basic-breaking-animation/ Share on other sites More sharing options...
Mobbstar Posted August 14, 2020 Share Posted August 14, 2020 After you call inst:Remove(), the thing is gone. Entirely What you want is to play the "destroy" animation and install an Event Listener that runs inst.Remove when the animation finished playing. Refer to a range of vanilla prefabs for details. Link to comment https://forums.kleientertainment.com/forums/topic/120921-basic-breaking-animation/#findComment-1362781 Share on other sites More sharing options...
FurryEskimo Posted August 21, 2020 Author Share Posted August 21, 2020 I'll give that a try, thanks. I fiddled with it a bit more over the last week, and I got most of the broken animations working, and when I did, noticed that by default, the 'destroy' animation only plays when the tent is used up. When a tent is hammered, they do this special, poof of smoke animation instead. Link to comment https://forums.kleientertainment.com/forums/topic/120921-basic-breaking-animation/#findComment-1364975 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