ppg-snippets icon indicating copy to clipboard operation
ppg-snippets copied to clipboard

Issue

Open Apevus opened this issue 3 years ago • 6 comments

The human from my mod is invisible, please help error thing code: using UnityEngine;

namespace Mod { public class Mod { public static void Main() { ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Human"), //item to derive from NameOverride = "[PAF] Soldier", //new item name with a suffix to assure it is globally unique DescriptionOverride = "PAF Soldier.", //new item description CategoryOverride = ModAPI.FindCategory("Entities"), //new item category ThumbnailOverride = ModAPI.LoadSprite("soldier.png"), //new item thumbnail (relative path) AfterSpawn = (Instance) => //all code in the AfterSpawn delegate will be executed when the item is spawned {

                var skin = ModAPI.LoadTexture("soldier.png");
                var flesh = ModAPI.LoadTexture("flesh.png");
                var bone = ModAPI.LoadTexture("bone.png");
                var person = Instance.GetComponent<PersonBehaviour>();
                person.SetBodyTextures(skin, flesh, bone, 1);
                person.SetBruiseColor(86, 62, 130); //main bruise colour. purple-ish by default
                person.SetSecondBruiseColor(154, 0, 7); //second bruise colour. red by default
                person.SetThirdBruiseColor(207, 206, 120); // third bruise colour. light yellow by default
                person.SetRottenColour(202, 199, 104); // rotten/zombie colour. light yellow/green by default
                person.SetBloodColour(108, 0, 4); // blood colour. dark red by default. note that this does not change decal nor particle effect colours. it only affects the procedural blood color which may or may not be rendered
            }
        }
    );
    ModAPI.Register(
        new Modification()
        {
            OriginalItem = ModAPI.FindSpawnable("Human"), //item to derive from
            NameOverride = "[PAF] Elite Unit", //new item name with a suffix to assure it is globally unique
            DescriptionOverride = "Pretty cool.", //new item description
            CategoryOverride = ModAPI.FindCategory("Entities"), //new item category
            ThumbnailOverride = ModAPI.LoadSprite("elite soldier.png"), //new item thumbnail (relative path)
            AfterSpawn = (Instance) => //all code in the AfterSpawn delegate will be executed when the item is spawned
            {
         
                var skin = ModAPI.LoadTexture("elite soldier.png");
                var flesh = ModAPI.LoadTexture("flesh.png");
                var bone = ModAPI.LoadTexture("bone.png");
                var person = Instance.GetComponent<PersonBehaviour>();
                person.SetBodyTextures(skin, flesh, bone, 1);
                person.SetBruiseColor(86, 62, 130); //main bruise colour. purple-ish by default
                person.SetSecondBruiseColor(154, 0, 7); //second bruise colour. red by default
                person.SetThirdBruiseColor(207, 206, 120); // third bruise colour. light yellow by default
                person.SetRottenColour(202, 199, 104); // rotten/zombie colour. light yellow/green by default
                person.SetBloodColour(108, 0, 4); // blood colour. dark red by default. note that this does not change decal nor particle effect colours. it only affects the procedural blood color which may or may not be rendered
            }
        }
    );
    ModAPI.Register(
        new Modification()
        {
            OriginalItem = ModAPI.FindSpawnable("Human"), //item to derive from
            NameOverride = "[PAF] Pilot", //new item name with a suffix to assure it is globally unique
            DescriptionOverride = "PAF Pilot.", //new item description
            CategoryOverride = ModAPI.FindCategory("Entities"), //new item category
            ThumbnailOverride = ModAPI.LoadSprite("pilotman.png"), //new item thumbnail (relative path)
            AfterSpawn = (Instance) => 
            //all code in the AfterSpawn delegate will be executed when the item is spawned
            {
         
                var skin = ModAPI.LoadTexture("pilotman.png");
                var flesh = ModAPI.LoadTexture("flesh.png");
                var bone = ModAPI.LoadTexture("bone.png");
                var person = Instance.GetComponent<PersonBehaviour>();
                person.SetBodyTextures(skin, flesh, bone, 1);
                person.SetBruiseColor(86, 62, 130); //main bruise colour. purple-ish by default
                person.SetSecondBruiseColor(154, 0, 7); //second bruise colour. red by default
                person.SetThirdBruiseColor(207, 206, 120); // third bruise colour. light yellow by default
                person.SetRottenColour(202, 199, 104); // rotten/zombie colour. light yellow/green by default
                person.SetBloodColour(108, 0, 4); // blood colour. dark red by default. note that this does not change decal nor particle effect colours. it only affects the procedural blood color which may or may not be rendered
            }
        }
    );
    ModAPI.Register(
        new Modification()
        {
            OriginalItem = ModAPI.FindSpawnable("Human"), //item to derive from
            NameOverride = "[PAF] Officer", //new item name with a suffix to assure it is globally unique
            DescriptionOverride = "PAF Officer.", //new item description
            CategoryOverride = ModAPI.FindCategory("Entities"), //new item category
            ThumbnailOverride = ModAPI.LoadSprite("officer.png"), //new item thumbnail (relative path)
            AfterSpawn = (Instance) => //all code in the AfterSpawn delegate will be executed when the item is spawned
            {
         
                var skin = ModAPI.LoadTexture("officer.png");
                var flesh = ModAPI.LoadTexture("flesh.png");
                var bone = ModAPI.LoadTexture("bone.png");
                var person = Instance.GetComponent<PersonBehaviour>();
                person.SetBodyTextures(skin, flesh, bone, 1);
                person.SetBruiseColor(86, 62, 130); //main bruise colour. purple-ish by default
                person.SetSecondBruiseColor(154, 0, 7); //second bruise colour. red by default
                person.SetThirdBruiseColor(207, 206, 120); // third bruise colour. light yellow by default
                person.SetRottenColour(202, 199, 104); // rotten/zombie colour. light yellow/green by default
                person.SetBloodColour(108, 0, 4); // blood colour. dark red by default. note that this does not change decal nor particle effect colours. it only affects the procedural blood color which may or may not be rendered
            }
        }
    );
        ModAPI.Register(
            new Modification()
            {
                OriginalItem = ModAPI.FindSpawnable("Stick"),
                NameOverride = "Officer cap",
                NameToOrderByOverride = "A5",
                DescriptionOverride = " ",
                CategoryOverride = ModAPI.FindCategory("Entities"),
                ThumbnailOverride = ModAPI.LoadSprite("Officer cap.png"),
                AfterSpawn = (Instance) =>
                {
                    Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("Officer cap.png");
					Instance.FixColliders();
                    ArmorBehaviour armor = Instance.AddComponent<ArmorBehaviour>();

                    armor.stabResistance = 1f;
                    armor.armorPiece = "Head";
                    armor.armorTier = 1;
                }
            }
        );
        ModAPI.Register(
            new Modification()
            {
                OriginalItem = ModAPI.FindSpawnable("Stick"),
                NameOverride = "Pilot hood",
                NameToOrderByOverride = "A5",
                DescriptionOverride = " ",
                CategoryOverride = ModAPI.FindCategory("Entities"),
                ThumbnailOverride = ModAPI.LoadSprite("pilot.png"),
                AfterSpawn = (Instance) =>
                {
                    Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("pilot.png");
					Instance.FixColliders();
                    ArmorBehaviour armor = Instance.AddComponent<ArmorBehaviour>();

                    armor.stabResistance = 1f;
                    armor.armorPiece = "Head";
                    armor.armorTier = 1;
                }
            }
        );
        ModAPI.Register(
            new Modification()
            {
                OriginalItem = ModAPI.FindSpawnable("Stick"),
                NameOverride = "Elite Beret",
                NameToOrderByOverride = "A5",
                DescriptionOverride = " ",
                CategoryOverride = ModAPI.FindCategory("Entities"),
                ThumbnailOverride = ModAPI.LoadSprite("elite beret.png"),
                AfterSpawn = (Instance) =>
                {
                    Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("elite beret.png");
					Instance.FixColliders();
                    ArmorBehaviour armor = Instance.AddComponent<ArmorBehaviour>();

                    armor.stabResistance = 1f;
                    armor.armorPiece = "Head";
                    armor.armorTier = 1;
                }
            }
        );
    ModAPI.Register(
            new Modification()
            {
                OriginalItem = ModAPI.FindSpawnable("Rod"),
                NameOverride = "[PAF] Helmet",
                NameToOrderByOverride = "A5",
                DescriptionOverride = " ",
                CategoryOverride = ModAPI.FindCategory("Entities"),
                ThumbnailOverride = ModAPI.LoadSprite("helmet.png"),
                AfterSpawn = (Instance) =>
                {
                    Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("helmet.png");
					Instance.FixColliders();
                    ArmorBehaviour armor = Instance.AddComponent<ArmorBehaviour>();

                    armor.stabResistance = 3f;
                    armor.armorPiece = "Head";
                    armor.armorTier = 3;
                }
            }
        );
    }
}

}

THERE ARE NO ERRORS HERE.

Apevus avatar Dec 27 '21 05:12 Apevus

listen this is extremely unclear. you should attach the entire mod, resources and all, instead. perferrably as an archive

mestiez avatar Dec 27 '21 11:12 mestiez

ill send it now

Apevus avatar Dec 27 '21 18:12 Apevus

download the whole mod https://gofile.io/d/Xjbe08

Apevus avatar Dec 27 '21 19:12 Apevus

Its because your skin textures dimensions are far larger then the flesh and bone textures is my guess. For example "elite soldier.png" is 70 x 237 and "flesh layer.png" is 18 x 79.

Leve1 avatar Dec 28 '21 21:12 Leve1

makes sense

Apevus avatar Dec 28 '21 22:12 Apevus

But, I am using MilitaryMod NPCs, I downloaded the mod, and just recolored some sprites so maybe it is a glitch.

Apevus avatar Dec 28 '21 22:12 Apevus