Jump to content

Laegel

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by Laegel

  1. Yup, I've been to Discord and got some help directly. 

    But you're right: when extracting the prefabs, all important tags got replaced by "UnknownXX", which caused the game not to recognize the entities.

    Note that it's not just the "Origin" GameObject: gore parts also have a tag.

     

    I've made this Python script to replace the tags in prefabs ( but don't execute it, since it seems to have created issues with the transform matrices of many prefabs, so I ended up fixing them manually. 🫠😞

    import glob
    
    from unityparser import UnityDocument
    
    
    def set_tag(entry, value):
        entry.m_TagString = value
    
    
    def modify_prefab(file):
        doc = UnityDocument.load_yaml(file)
        mapping = {
            "HeadGore": "L_HeadGore",
            "Hips": "E_BP_Body",
            "LeftUpperLegGore": "L_LeftUpperLegGore",
            "RightUpperLegGore": "L_RightUpperLegGore",
            "LeftLeg": "E_BP_LLowerLeg",
            "RightLeg": "E_BP_RLowerLeg",
            "LeftUpLeg": "E_BP_LLeg",
            "RightUpLeg": "E_BP_RLeg",
            "Head": "E_BP_Head",
            "LeftLowerLegGore": "L_LeftLowerLegGore",
            "RightLowerLegGore": "L_RightLowerLegGore",
            "RightUpperArmGore": "L_RightUpperArmGore",
            "LeftUpperArmGore": "L_LeftUpperArmGore",
            "LeftLowerArmGore": "L_LeftLowerArmGore",
            "RightLowerArmGore": "L_RightLowerArmGore",
            "Origin": "E_BP_BipedRoot",
            "Collider": "LargeEntityBlocker",
        }
    
        entries = doc.filter(class_names=("GameObject",))
        for entry in entries:
            if entry.m_Name in mapping.keys():
                set_tag(entry, mapping[entry.m_Name])
    
        doc.dump_yaml()

     

    Also, the meshes appeared white because the ripped shader wasn't doing anything (it's been generated so the project doesn't break). To fix this, I used one shared in Discord.

    What are your issues?

  2. I've been able to extract everything I needed thanks to https://github.com/AssetRipper/AssetRipper

    After loading the bundle content in Unity, I've changed the texture, re-created the entities bundle and changed the entityclasses.xml:

    <Test>
    
    	<set
    		xpath="//entity_class[@name='zombieArlene' or @name='zombieArleneFeral']/property[@name='Mesh']/@value">
    		#@modfolder:Resources/bcb3fda78435ca5a58d6d9a80f1622dd.bundle?ZArlene.prefab</set>
     </Test>

     

    From what I see in-game, the modification is applied but unsuccessful: https://ibb.co/CtzgNMn

    While the mesh is loaded and the entity acts normally, the texture is missing, it has no HP bar showing up and I keep getting this error in the logs:

    NullReferenceException: Object reference not set to an instance of an object
      at BlockDamage.OnEntityCollidedWithBlock (WorldBase _world, System.Int32 _clrIdx, Vector3i _blockPos, BlockValue _blockValue, Entity _targetEntity) [0x0005b] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at ChunkCluster.CheckCollisionWithBlocks (Entity _entity) [0x00239] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at World.CheckEntityCollisionWithBlocks (Entity _entity) [0x0002b] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at Entity.ccEntityCollisionResults () [0x001ce] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at Entity.ccEntityCollision (UnityEngine.Vector3 _vel) [0x00016] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at Entity.entityCollision (UnityEngine.Vector3 _motion) [0x000e8] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at EntityAlive.DefaultMoveEntity (UnityEngine.Vector3 _direction, System.Boolean _isDirAbsolute) [0x0026f] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at EntityAlive.MoveEntityHeaded (UnityEngine.Vector3 _direction, System.Boolean _isDirAbsolute) [0x00216] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at EntityHuman.MoveEntityHeaded (UnityEngine.Vector3 _direction, System.Boolean _isDirAbsolute) [0x00125] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at EntityAlive.OnUpdateLive () [0x001a8] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at EntityEnemy.OnUpdateLive () [0x00000] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at EntityHuman.OnUpdateLive () [0x00000] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at EntityAlive.OnUpdateEntity () [0x00035] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at World.TickEntity (Entity e, System.Single _partialTicks) [0x0011e] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at World.TickEntitiesSlice (System.Int32 count) [0x00037] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at World.TickEntitiesSlice () [0x00000] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at GameManager.UpdateTick () [0x00026] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at GameManager.gmUpdate () [0x00336] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at GameManager.Update () [0x00000] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 

    Any clues here?

  3. Looks like I've tried to replace a mesh with a texture, which makes no sense. 🤦‍♂️

    After digging a bit more in the XML files (especially entityclasses.xml), I don't think it's possible to change a texture without overriding the mesh, is it?

    So I've tried to extract the mesh with UABEA in order to apply modifications to it directly but I can't find any "export" action when selecting a mesh; how can I extract meshes?

  4. Hey there! I've been enjoying 7DTD for years and recently decided to explore the modding section to make the game slightly customized.

     

    I'm working on a first simple mod which goal is to replace current zombies textures.

    I have extracted the textures via UABEA (thanks a lot to 4sheetzngeegles!). First, I've tried to just replace the zombies.bundle with the updated textures but it caused errors, saying that the bundle was corrupted. Instead, I decided to create my own Unity bundle and embed it inside a mod.

    Here is the bundle manifest:

    ManifestFileVersion: 0
    CRC: 1339901114
    Hashes:
      AssetFileHash:
        serializedVersion: 2
        Hash: e1a876901da95e3cf3a34cf66d7a063e
      TypeTreeHash:
        serializedVersion: 2
        Hash: b0363f7088f9761414f730641bf9a24b
    HashAppended: 0
    ClassTypes:
    - Class: 28
      Script: {instanceID: 0}
    SerializeReferenceClassIdentifiers: []
    Assets:
    - Assets/zombies/HD_YoGrey.png
    - Assets/zombies/HD_TomClarkGrey.png
    - Assets/zombies/HD_ArleneGrey.png
    Dependencies: []

     

    For now, the bundle only contains 3 textures: HD_ArleneGrey, HD_TomClarkGrey and HD_YoGrey. I've created the entityclasses.xml file with the following content:

    <Test>
    	<!-- CHANGE TEXTURES -->
    	<set
    		xpath="//entity_class[@name='zombieArlene' or @name='zombieArleneFeral']/property[@name='Mesh']/@value">
    		#@modfolder:Resources/entities.bundle?HD_ArleneGrey</set>
    	<set
    		xpath="//entity_class[@name='zombieTomClark' or @name='zombieTomClarkFeral']/property[@name='Mesh']/@value">
    		#@modfolder:Resources/entities.bundle?HD_TomClarkGrey</set>
    	<set
    		xpath="//entity_class[@name='zombieYo' or @name='zombieYoFeral']/property[@name='Mesh']/@value">
    		#@modfolder:Resources/entities.bundle?HD_YoGrey</set>
    </Test>

    I took a look at https://7daystodiemods.com/adredens-christmas-a20/ in order to understand how to replace a texture via XML. Maybe this way is outdated.    

     

    When I start the game and reach a location with zombies, I get this kind of error:

    2024-01-12T11:53:48 346.878 INF 134.2995 SleeperVolume -1619, 58, 474: Still alive 'GameObject'
    2024-01-12T11:53:48 346.971 INF 134.3931 SleeperVolume -1619, 58, 474: Restoring -1615, 60, 490 (-101, 30) 'zombieYo', count 2
    2024-01-12T11:53:48 346.971 ERR Could not load file '#@modfolder(Test):Resources/entities.bundle?HD_YoGrey' for entity_class 'zombieYo'
    ArgumentNullException: Value cannot be null.
    Parameter name: Name cannot be null
      at UnityEngine.Transform.Find (System.String n) [0x00009] in <799d47ea3fd1460380efad1aacedaf7c>:0 
      at AvatarZombieController.SwitchModelAndView (System.String _modelName, System.Boolean _bFPV, System.Boolean _bMale) [0x00000] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at EModelBase.SwitchModelAndView (System.Boolean _bFPV, System.Boolean _bMale) [0x000e8] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at EModelBase.InitCommon () [0x0002a] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at EModelBase.Init (World _world, Entity _entity) [0x000d9] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at Entity.InitEModel () [0x00061] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at Entity.Init (System.Int32 _entityClass) [0x0000d] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at EntityAlive.Init (System.Int32 _entityClass) [0x00000] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at EntityEnemy.Init (System.Int32 _entityClass) [0x00000] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at EntityFactory.CreateEntity (EntityCreationData _ecd) [0x004c2] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at EntityFactory.CreateEntity (System.Int32 _et, System.Int32 _id, ItemValue _itemValue, System.Int32 _count, UnityEngine.Vector3 _transformPos, UnityEngine.Vector3 _transformRot, System.Single _lifetime, System.Int32 _playerId, System.String _skinName, System.Int32 _spawnById, System.String _spawnByName) [0x0001b] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at EntityFactory.CreateEntity (System.Int32 _et, System.Int32 _id, UnityEngine.Vector3 _transformPos, UnityEngine.Vector3 _rotation) [0x0000c] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at EntityFactory.CreateEntity (System.Int32 _et, UnityEngine.Vector3 _transformPos, UnityEngine.Vector3 _rotation) [0x00000] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at SleeperVolume.Spawn (World _world, System.Int32 entityClass, System.Int32 spawnIndex, GameStageGroup group, BlockSleeper block) [0x000cb] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at SleeperVolume.UpdateSpawn (World _world) [0x001e7] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at SleeperVolume.Tick (World _world) [0x00010] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at World.TickSleeperVolumes () [0x00027] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at World.OnUpdateTick (System.Single _partialTicks, System.ArraySegment`1[T] _activeChunks) [0x0024b] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at GameManager.UpdateTick () [0x00073] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at GameManager.gmUpdate () [0x00336] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 
      at GameManager.Update () [0x00000] in <4fda5fdf844d4aa1ab3483d85a7c21c0>:0 

     

    It happens for every kind of retextured zombie. The error sounds rather clear: "Could not load file". However, I have no idea how to fix that; are there invalid paths?

     

    Thanks for reading!

×
×
  • Create New...