Jump to content

[Modded Skins API Tutorial] Creating Custom Skins for Mods


Hornete
 Share

Recommended Posts

7 minutes ago, Hornete said:

You need to include the 'condition' table, even if you have no conditions set the table needs to exist.


table.insert(prefabs, CreatePrefabSkin("ms_characternamehere_shadow",
{
	base_prefab = "characternamehere",
	build_name_override = "ms_characternamehere_shadow",
	type = "base",
	rarity = "ModLocked",
	condition = { --Here!

	},
	skin_tags = {"BASE", "CHARACTERNAMEHERE", "SHADOW"},
	skins = {
		normal_skin = "ms_characternamehere_shadow",
		ghost_skin = "ghost_characternamehere_build",
		powerup = "ms_characternamehere_shadow_powerup",
	},
	assets = {
		Asset("ANIM", "anim/ms_characternamehere_shadow.zip"),
		Asset("ANIM", "anim/ms_characternamehere_shadow_powerup.zip"),
		Asset("ANIM", "anim/ghost_characternamehere_build.zip"),
	},
}))

 

Alright, that worked. Thanks.

  • Big Ups 1
Link to comment
Share on other sites

On 5/27/2022 at 3:26 PM, Hornete said:

When some of you get to making your character mods/item mods compatible with Modded Skins, it'd be great if you could use the image below in the description of your mod to show it's compatible with the API and let users know that, :D

Could even slap it on some screenshots showing usage of the API in the gallery of your mod's workshop page too!

  Reveal hidden contents

ms-compatible.png

 

How do you include images in Workshop descriptions?

Link to comment
Share on other sites

I wasn't sure how much of a hassle it would be to add custom skins. There were some hiccups on my end since I'm sort of a klutz with basic coding abilities, but overall this turned out to be a pretty straightforward process! I commend you for your work.

  • Health 1
Link to comment
Share on other sites

1 hour ago, Garamonde said:

Heya, me again. This time it's a very minor issue, luckily.

image.thumb.png.c9e1e2b0ad8294f4a3b9a951207ca165.png

Good news is that everything still works, except the Inspect Self icon; it's just a black square. Any idea what could've caused this?

I don't have any idea how that may have happened. May I see the image for your self inspect icon?

  • Like 1
Link to comment
Share on other sites

34 minutes ago, Garamonde said:

It's the images/avatars/self_inspect_[character], right? This is the one, if so.

self_inspect_kk.png.2950db3d79752bdb6ad548ae35d6f83b.png

Funny thing is, my other character, Cap'n's, works perfectly fine.

Have you tried recompiling the icon?

  • Like 1
Link to comment
Share on other sites

33 minutes ago, Hornete said:

Have you tried recompiling the icon?

Yup, just did, and that didn't fix it, sadly... I also have the filename correct under modmain.lua. (At least, assuming it's supposed to be like "self_inspect_kk.tex/xml" and that same name goes for the Element Name within its XML, as well)

  • Sad Dupe 1
Link to comment
Share on other sites

12 hours ago, Garamonde said:

Yup, just did, and that didn't fix it, sadly... I also have the filename correct under modmain.lua. (At least, assuming it's supposed to be like "self_inspect_kk.tex/xml" and that same name goes for the Element Name within its XML, as well)

I've no further ideas for what the issue may be then, my apologies.

  • Like 1
Link to comment
Share on other sites

Update (and sorry for double-posting): My friend helped me fix it. It wasn't a problem with the API, but rather it seemed to be the .TEX file itself, oddly enough. After creating it manually with TEX Creator it seemed to work fine. Just thought I'd let you know!

  • Big Ups 1
Link to comment
Share on other sites

Triple post time... my K_K mod is causing issues for me (yes, again, lol), but this time it's straight up crashing the game it seems... Well, according to my client log here, there are two apparent causes? I have no idea what's going on, but the most prominent in the log appears to be K_K's Modded Skins API code:

client_log.txt

The other mod that looks to be causing issues is Too Many Items Plus, but it wasn't causing me issues yesterday so I don't know what the deal is...

Link to comment
Share on other sites

11 minutes ago, Garamonde said:

Triple post time... my K_K mod is causing issues for me (yes, again, lol), but this time it's straight up crashing the game it seems... Well, according to my client log here, there are two apparent causes? I have no idea what's going on, but the most prominent in the log appears to be K_K's Modded Skins API code:

client_log.txt 83.55 kB · 0 downloads

The other mod that looks to be causing issues is Too Many Items Plus, but it wasn't causing me issues yesterday so I don't know what the deal is...

The issue is being caused by Too Many Items Plus. 

Looking at the page, it was just updated today, I would guess this update is causing a crash.

  • Like 1
Link to comment
Share on other sites

Hey. Out of curiosity, do you think there would be a way to change the character's voice and gender with a specific skin selected? I do remember the original Modded Skins having that ability, but I just want to know if it is possible. Thanks. 

Link to comment
Share on other sites

1 hour ago, Cagealicous said:

Hey. Out of curiosity, do you think there would be a way to change the character's voice and gender with a specific skin selected? I do remember the original Modded Skins having that ability, but I just want to know if it is possible. Thanks. 

For voice, I imagine you can check for the currently equipped skin(inst.components.skinner.skin_name will have this information) and then set your 'inst.soundsname' accordingly.

For gender, I haven't looked too far into it but you could possibly take a look at the 'GetNewDeathAnnouncementString' function defined in widgets/eventannouncer.lua and hook into that. Gender is mainly referenced in the death/revive strings and so I imagine this is where you'd want to change that and check for a specific skin.

Link to comment
Share on other sites

1 hour ago, Hornete said:

For voice, I imagine you can check for the currently equipped skin(inst.components.skinner.skin_name will have this information) and then set your 'inst.soundsname' accordingly.

For gender, I haven't looked too far into it but you could possibly take a look at the 'GetNewDeathAnnouncementString' function defined in widgets/eventannouncer.lua and hook into that. Gender is mainly referenced in the death/revive strings and so I imagine this is where you'd want to change that and check for a specific skin.

Alright. I'll take a look into it. Thanks.

Link to comment
Share on other sites

8 hours ago, Hornete said:

For voice, I imagine you can check for the currently equipped skin(inst.components.skinner.skin_name will have this information) and then set your 'inst.soundsname' accordingly.

For gender, I haven't looked too far into it but you could possibly take a look at the 'GetNewDeathAnnouncementString' function defined in widgets/eventannouncer.lua and hook into that. Gender is mainly referenced in the death/revive strings and so I imagine this is where you'd want to change that and check for a specific skin.

Alright so I tried to change the voice, but it did not work out.
image.thumb.png.1f2d2e4f28e1c47314bf50ed11892d09.png

The following a segment of the code:
 

local master_postinit = function(inst)
	-- Set starting inventory
    inst.starting_inventory = start_inv[TheNet:GetServerGameMode()] or start_inv.default
	
	if inst.components.skinner and inst.components.skinner.skin_name == inst.prefab.."_hypno" then
		inst.soundsname = "hypno"
	else
		inst.soundsname = "ethan"
	end
	

I'm not sure what to do here, but my assumption is that I cannot use 'prefab' there.

Any ideas what I should do?

Link to comment
Share on other sites

On 8/2/2022 at 12:26 AM, Cagealicous said:

Alright so I tried to change the voice, but it did not work out.
image.thumb.png.1f2d2e4f28e1c47314bf50ed11892d09.png

The following a segment of the code:
 


local master_postinit = function(inst)
	-- Set starting inventory
    inst.starting_inventory = start_inv[TheNet:GetServerGameMode()] or start_inv.default
	
	if inst.components.skinner and inst.components.skinner.skin_name == inst.prefab.."_hypno" then
		inst.soundsname = "hypno"
	else
		inst.soundsname = "ethan"
	end
	

I'm not sure what to do here, but my assumption is that I cannot use 'prefab' there.

Any ideas what I should do?

Is it necessary that you use 'prefab' to concatenate your string? I would just do 'ethan_hypno' (I am assuming ethan is your prefab name) rather than try to reference the inst.prefab.

(For future reference, prefab is only set after the constructor function for your entity is run)

Link to comment
Share on other sites

5 hours ago, Hornete said:

Is it necessary that you use 'prefab' to concatenate your string? I would just do 'ethan_hypno' (I am assuming ethan is your prefab name) rather than try to reference the inst.prefab.

(For future reference, prefab is only set after the constructor function for your entity is run)

Well, it didn't crash this time, but it isn't working. It continues to be the regular voice. 

Link to comment
Share on other sites

21 hours ago, Cagealicous said:

Well, it didn't crash this time, but it isn't working. It continues to be the regular voice. 

Hmm If I had to guess, you need to hook into the 'SetSkinName' function defined in the skinner component for your character and then execute your code, as to make sure the code is actually run when your skin is set.

Link to comment
Share on other sites

On 8/4/2022 at 6:53 PM, Hornete said:

Hmm If I had to guess, you need to hook into the 'SetSkinName' function defined in the skinner component for your character and then execute your code, as to make sure the code is actually run when your skin is set.

Yeah so sorry for the late response, but I got it working at last. I reached out to @Stormish and showed me how to do it correctly. Thanks for the help, though!

  • Big Ups 1
Link to comment
Share on other sites

Do you know about the recent change in skin_id?

I used to generate fake skin id and it works with TheSim:ReskinEntity. But in  some recent update it just crashes game for access violation (accessing address 0) if you reskin another entity given a faked skin_id.

Link to comment
Share on other sites

On 8/22/2022 at 11:18 PM, Mr.Rickzzs said:

Do you know about the recent change in skin_id?

I used to generate fake skin id and it works with TheSim:ReskinEntity. But in  some recent update it just crashes game for access violation (accessing address 0) if you reskin another entity given a faked skin_id.

I can't reproduce the issue you are talking about. Using a 'fake' skin id just resets the entity in question to its original build/visual.

Link to comment
Share on other sites

On 8/26/2022 at 4:18 AM, Hornete said:

I can't reproduce the issue you are talking about. Using a 'fake' skin id just resets the entity in question to its original build/visual.

TheSim:ReskinEntity(c_spawn("abigail").GUID,nil,"abigail_handmedown",c_spawn("abigail_flower").GUID)

This crash the game, but it shouldn't, is it?

params:

1. Abigail's GUID

2. Abigail's skin name. It is acceptable to pass param nil as "abigail_none"

3. New skin name

4. one possible fake skin id, it should have been Abigail's Flower's skin_id.

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
 Share

×
×
  • Create New...