Turning Animated models into static models - How do I avoid the 'Dead' state?

Soul_RiderSoul_Rider Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue
Ok, so I've finally realised that the problem with models in GorgeCraft is that they are 'Dead'. The Crag was confusing, but when it happened to the Shade as well, the pose was unmistakable:

2014-01-22_00002_zpsc3757451.jpg

The question is, how can I set the animation/model state to be 'built'. I have tried setting the animation manually, but this does not work.

I am sure this has been solved previously, but my powers of search have failed me. I remeber a mapper somehow solving the problem in their ready room. Any tips would be great.

In case you are wondering why they are showing the 'dead' animation, it is because they are just being used as static models in my mod.

Comments

  • SamusDroidSamusDroid Colorado Join Date: 2013-05-13 Member: 185219Members, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Gold, Subnautica Playtester, NS2 Community Developer, Pistachionauts
    edited January 2014
    But did you find in files? Must not have :D
    Search "built" with quotes.
  • Soul_RiderSoul_Rider Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue
    edited January 2014
    I found a way :D

    I was just about to post my method. Thanks for the advice :D

    It turns out that if you want to set an animations model state, you have to set multiple animation states at once. There is livemixin, which sets the animation to alive. Then the constructmixin sets states to built and active.

    Here is the working code for the shade:
    // =================================================================
    //
    // lua\GCShade.lua
    //
    //    Created by:   Andy 'Soul Rider' Wilson for GorgeCraft
    //
    // =================================================================
    
    Script.Load("lua/Mixins/ClientModelMixin.lua")
    Script.Load("lua/ScriptActor.lua")
    Script.Load("lua/DigestMixin.lua")
    Script.Load("lua/IdleMixin.lua")
    
    class 'GCShade' (ScriptActor)
    
    GCShade.kMapName = "gcshade"
    
    GCShade.kModelName = PrecacheAsset("models/alien/shade/shade.model")
    GCShade.kAnimationGraph = PrecacheAsset("models/alien/shade/shade.animation_graph")
    
    
    local networkVars = { }
    
    AddMixinNetworkVars(BaseModelMixin, networkVars)
    AddMixinNetworkVars(ClientModelMixin, networkVars)
    AddMixinNetworkVars(IdleMixin, networkVars)
            
    function GCShade:OnCreate()
    
        ScriptActor.OnCreate(self)
        
        InitMixin(self, BaseModelMixin)
        InitMixin(self, ClientModelMixin)
        
        if Server then
            InitMixin(self, DigestMixin)  
        end
        
        self:SetLagCompensated(false)
        self:SetPhysicsType(PhysicsType.Kinematic)
        self:SetPhysicsGroup(PhysicsGroup.MediumStructuresGroup)
        
    end
    
    function GCShade:OnInitialized()
    
        ScriptActor.OnInitialized(self)
        
        self:SetModel(GCShade.kModelName, GCShade.kAnimationGraph)    
        InitMixin(self, IdleMixin)
    
    end
    
    function GCShade:OnUpdateAnimationInput(modelMixin)
    
        PROFILE("GCShade:OnUpdateAnimationInput")
        modelMixin:SetAnimationInput("alive", true)
        modelMixin:SetAnimationInput("built", true)
        modelMixin:SetAnimationInput("active", true)
        
    end
    
    Shared.LinkClassToMap("GCShade", GCShade.kMapName, networkVars)
    
  • SamusDroidSamusDroid Colorado Join Date: 2013-05-13 Member: 185219Members, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Gold, Subnautica Playtester, NS2 Community Developer, Pistachionauts
    Yes that is correct.
  • Soul_RiderSoul_Rider Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue
    In response to your first message, I had already searched in file for 'Built', as I noted in my first post, when I tried setting the animation manually. The problem was that I needed all three animation states, and I was only using one. :D

    I don't understand why you need to set 3 animation states, that to me seems very confusing. An animation state should include everything relevant, at least, in my head :D

    Can you explain why multiple animation states are needed?
  • SamusDroidSamusDroid Colorado Join Date: 2013-05-13 Member: 185219Members, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Gold, Subnautica Playtester, NS2 Community Developer, Pistachionauts
    Because in the animation graph you have to have certain states in order for certain things to play or else things would happen when they shouldn't.
Sign In or Register to comment.