Jump to content

Help with flipped animation on StaticModel


Makakikus

Recommended Posts

I am making a mod which adds a big beer in project zomboid. I am currently using the Red Wine mesh with a new custom texture.

 

Please see the following code:

 

Model file:

 

module Base
{
    model NewBeer_Ground
    {
        mesh = WorldItems/Wine,
        texture = WorldItems/NewBeer_ground,
        scale = 0.4,
    }

 

    model NewBeerEmpty_Ground
    {
        mesh = WorldItems/Wine,
        texture = WorldItems/NewBeer_ground,
        scale = 0.4,
    }

}


 

Item file:

 

module Base
{

item NewBeer
        {
            DisplayName = New Beer Test,
            DisplayCategory = Food,
            Type = Food,
            Weight = 1.0,
            Icon = NewBeerIcon,
            FoodType = Beer,
            Alcoholic = TRUE,
            CantBeFrozen = TRUE,
            EatType = Bourbon,
            Packaged = TRUE,
            ReplaceOnUse = NewBeerEmpty,
            HungerChange = -30,
            ThirstChange = -60,
            UnhappyChange = -35,
            Calories = 500,
            Carbohydrates = 120,
            Lipids = 0,
            Proteins = 0,
            CustomContextMenu = Drink,
            CustomEatSound = DrinkingFromBottleGlass,
            StaticModel = NewBeer_Ground,
            WorldStaticModel = NewBeer_Ground,
        }

    item NewBeerWaterFull
        {
            DisplayName = New Beer with Water,
            DisplayCategory = Water,
            Type = Drainable,
            Weight = 0.9,
            Icon = NewBeerIcon,
            CanStoreWater = TRUE,
            EatType = Bourbon,
            FillFromDispenserSound = GetWaterFromDispenserGlass,
            FillFromTapSound = GetWaterFromTapGlass,
            IsCookable = TRUE,
            IsWaterSource = TRUE,
            ReplaceOnDeplete = NewBeerEmpty,
            ReplaceOnUseOn = WaterSource-NewBeerWaterFull,
            UseDelta = 0.08,
            UseWhileEquipped = FALSE,
            CustomEatSound = DrinkingFromBottleGlass,
            StaticModel = NewBeer_Ground,
            WorldStaticModel = NewBeer_Ground,
        }
        
        item NewBeerEmpty
        {
            DisplayCategory = WaterContainer,
            Weight    =    0.35,
            CanStoreWater = TRUE,
            Type    =    Normal,
            DisplayName    =    New Beer Empty Bottle,
            ReplaceOnUseOn    =    WaterSource-NewBeerWaterFull,
            Icon    =    NewBeerEmptyIcon,
            StaticModel = NewBeerEmpty_Ground,
            WorldStaticModel = NewBeerEmpty_Ground,
        }

}

 

I tested this code and it works fine. I can see the new textures when the beer is on the floor and the icons are showed correctly in the inventory menu. HOWEVER, when the character is drinking from the bottle or refilling the bottle with water, the bottle is upside down (please see the attached image). Any ideas of why does this happens and how to resolve it?

 

Thanks in advance!

bug.png

Link to comment
Share on other sites

Self-Reply. For anyone having this issue in the future, I solved this by changing the StaticModel and  WorldStaticModel. The main problem is that both parameters cannot have the same WorldItem texture (the one that is on the ModName/media/textures/WorldItems folder). In order to work, you must have two different models, one for the StaticModel (that should be in the ModName/media/textures, and it doesn't matter that it is the same that is inside the WorldItems folder) and other for the WorldStaticFolder (that should be inside the WorldItems folder). 

 

In the model file, you need to have two different models (one for the StaticModel and other for the WorldStaticModel). And should look like the following:

 

For the StaticModel:

    model NewBeerStaticModel
    {
        mesh = RedWineBottle,
        texture = NewBeerStaticModelFileName,
    }

 

And the other one for the WorldStaticModel:

 

    model NewBeer_Ground
    {
        mesh = WorldItems/Wine,
        texture = WorldItems/NewBeerStaticModelFileName,
        scale = 0.4,
    }

 

In this case, I used the RedWineBottle mesh to my New Beer Mod Item.

 

I hope this helps someone in the future. I spent 5 hours of my life investigating and testing to resolve this haha.

Link to comment
Share on other sites

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