RAINBOW Posted April 10, 2014 Share Posted April 10, 2014 I've successfully modded a custom trait "Vegetarian" which I intend to make the effects for later (Eating meat causes Nausea) The problem I have is simply displaying the custom Icon for a custom profession (i.e) when you create a new game, and choose the trait. I believe the problem lies in the dimensions or file format (I went with .png) of the icon. I wasn't able to find any hints in the javadoc or overview section. Thanks. Rainbow. Oh, here's the code I used, incidental really, because I just need the size/dimension of the image. -- CheaterProfession.luarequire'NPCs/MainCreationMethods';require'NPCs/ProfessionClothing'; local function initProfessions()-- Java: Create a new profession.local cheater = ProfessionFactory.addProfession("vegetarian", "Vegetarian", "Prof_rm_Vegetarian"); -- Java: Add a custom trait called Undesireable (no one likes cheaters ).cheater:addFreeTrait("rm_vegetarian");-- Java: Add the vanilla trait Nightowl. cheater:addFreeTrait("Vegetarian");end local function initTraits()TraitFactory.addTrait("rm_vegetarian", "Vegetarian", -2, "Meat is Murder.\nEating meat causes Nausea!", false);end ----- Set custom spawn points for this profession.-- Modelled after spawn code by RegularX. Thanks to-- The_Real_Ai for his explanation on how to calculate-- them.--local function initSpawnPoints()local spawn; -- Create a Spawnpoint in the large Warehouse.spawn = {{worldX = 10,worldY = 6,posX = 110,posY = 8,},} -- Add our profession to the list of spawnpoints for Muldraugh.BaseGameCharacterDetails.spawnPoint.MuldraughKY.vegetarian = spawn; spawn = {{worldX = 39,worldY = 23,posX = 138,posY = 100,},} -- Add our profession to the list of spawnpoints for West Point.BaseGameCharacterDetails.spawnPoint.WestPointKY.vegetarian = spawn;end ----- Set custom clothing and clothing colors for this-- profession.--local function initClothing()local clothes = {male = {topPal = "Shirt_White",top = "Shirt",bottomPal = "Trousers_White",bottom = "Trousers",topCol = {r = 0.1,g = 0.1,b = 0.1,},bottomCol = {r = 0.1,g = 0.1,b = 0.1,},},female = {topPal = "Shirt_White",top = "Shirt",bottomPal = "Trousers_White",bottom = "Trousers",topCol = {r = 0.1,g = 0.1,b = 0.1,},bottomCol = {r = 0.1,g = 0.1,b = 0.1,},},}ProfessionClothing.vegetarian = clothes;end Events.OnGameBoot.Add(initTraits);Events.OnGameBoot.Add(initProfessions);Events.OnGameBoot.Add(initSpawnPoints);Events.OnGameBoot.Add(initClothing); Link to comment Share on other sites More sharing options...
Japer Posted April 10, 2014 Share Posted April 10, 2014 Make sure in your mod folder the icon is located as follows;media\ui\Traits\trait_yourtraitname.pngThe image size for trait is 18x18 pixelsAndmedia\icons\Prof_yourprofname.pngThe image size for Profession icons I used was 64x59 pixels Link to comment Share on other sites More sharing options...
RAINBOW Posted April 10, 2014 Author Share Posted April 10, 2014 Thanks a tonne Japer. I owe you a coke Link to comment Share on other sites More sharing options...
Japer Posted April 10, 2014 Share Posted April 10, 2014 Anytime! Good luck! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now