ppg-snippets
ppg-snippets copied to clipboard
Issue
The human from my mod is invisible, please help
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.
listen this is extremely unclear. you should attach the entire mod, resources and all, instead. perferrably as an archive
ill send it now
download the whole mod https://gofile.io/d/Xjbe08
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.
makes sense
But, I am using MilitaryMod NPCs, I downloaded the mod, and just recolored some sprites so maybe it is a glitch.