Jump to content

Modded Skins (API)


Fidooop
 Share

Recommended Posts

On 1/5/2017 at 6:17 PM, Fidooop said:
Spoiler

SKINNING CHARACTERS: 

The first thing you'll want is the 'MakeModCharacterSkinnable' function. (Which is a GLOBAL function) It must be called in the modmain and has to be called after 'AddModCharacter' is run. 
MakeModCharacterSkinnable only has one argument which is the mod character's prefab name. 

Now that the mod character is skinnable you can now add skins. 'AddModCharacterSkin' will create a skin prefab for the character and return it. It must be called within a prefab file. 
AddModCharacterSkin's arguments are as follows: prefab, skin, skins, assets, tags, options 
prefab = Mod character's prefab name. 
skin = The skin being added. ("formal", "survivor", "shadow", etc.) 
skins = A table of skinstates and the corrisponding builds. Example: {normal_skin = "charactername", ghost_skin = "ghost_charactername_build"} 
assets = A table provided with names of builds used for this skin. Example: {"charactername", "ghost_charactername_build"} 
tags = Tags for this skin. Example: {"CHARACTERNAME", "FORMAL"} 
options = A table filled with various options that are all optional extras for the skin. 
    options.starting_inv_skins = If a mod character's starting inventory items have skins that match this skin then this table can be used to swap out the inventory on spawn. (ONLY WORKS ON MODDED ITEMS.) 
    options.avatarset = The name of a custom avatar set for this skin. (Changes out "avatar_charactername", "self_inspect_charactername", etc. with "avatar_avatarset", etc.) 
    options.uiname = The name of a custom uiname image. (The dark gray one found in character select and when a character is examined.) When this skin is equipped it will switch the uiname image out for this one. 
    options.gender = A gender change for this skin specifically. If one were to make a robotic skin or genderswap skin then this option will help out in doing so. 
    Example of how to use the options argument: 
    { 
        starting_inv_skins = {customitem = "robotic"}, 
        avatarset = "roboticcharactername", 
        uiname = "names_roboticcharactername", 
        gender = "ROBOT" 
    } 


SKINNING ITEMS: 

To add a skin for an item the function needed is 'AddModItemSkin'. It must be called in a prefab since it creates a prefab for the item. 
AddModItemSkin's arguments are as follows: item, skin, fn, assets, atlas, image, placer 
item = The item's prefab name. 
skin = The skin being added. 
fn = The item/skin's prefab function. ('AddModItemSkin' creates an entirely new prefab and will need a function. Best way to do this is use the same function from the original item and have various values change based on what skin is being made) 
assets = The skin's assets. 
atlas = The skin's inventory image atlas. (Used in the crafting menu) 
image = The skin's inventory image. (Used in the crafting menu) 
placer = If this item comes with a placer then the placer argument can either be set to true or be a table and will build a placer prefab. 
    If set to true the function will build a placer with the build and bank both being item.."_"..skin and the anim being "placer" 
    If set to a table (the table keys/values must be {bank = "", build = "", anim = ""}) the function will create a placer with the bank, build, and anim being what is set in the table. 
If 'AddModItemSkin' is called without the placer argument it will return just the skin prefab. 
If 'AddModItemSkin' is called with the placer argument it will return both the skin prefab and the skin's placer. 


Extra Functionality: 

If some changes need to be applied to the character there are two functions that get run whenever skins get changed. 
inst.OnChangeModdedSkin gets run on the server. Arguments are as follows: inst, skin, newspawn 
inst = prefab variable, skin = skin name ("formal", "survivor", etc.) newspawn = true if it is a brand new spawn on the server. 
inst.OnChangeModdedSkinClient gets run on the client side. It gets the same arguments as 'OnChangeModdedSkin' but without 'newspawn' 
The event "onchangemoddedskin" also gets pushed on both the client and the server with data providing the name of the skin that has just been equipped. 

To spawn a skinned item there are two ways: 
SpawnPrefab("item", "skin") 
SpawnPrefab("item_skin")

 

@Lumina are you following these instructions?

Link to comment
Share on other sites

3 minutes ago, Chris1488 said:

@Lumina are you following these instructions?

No, i tried to use the erik mod as an example as suggested before, but it's managed in another way that is maybe harder for me to replicate (but for what i understand, a lot better to add multiple skin for one item and manage them easily).

I'm just a little confused to what put where and what else i need.

  • Like 1
Link to comment
Share on other sites

OK then, making character skins is alot harder than I thought... I don't exactly know what I should be doing. I have the code MakeModCharacterSkinable at the bottom of the code (Along with an enter after it.) At that point, i don't know what I'm doing. Also, this is my first mod, so I'm not good at ANY of this stuff. lol atleast I know about using some strings, like - STRINGS.CHARACTER.(moddedcharactername).DESCRIBE.(moddedcharactername) = { -, but however, this one is more difficult... Good mod tho :p I did follow the instructions, but alas idk where to go... nor actually know how todo this.

Edited by kirbyKLEI3000
Link to comment
Share on other sites

On 1/13/2017 at 6:12 PM, kirbyKLEI3000 said:

OK then, making character skins is alot harder than I thought... I don't exactly know what I should be doing. I have the code MakeModCharacterSkinable at the bottom of the code (Along with an enter after it.) At that point, i don't know what I'm doing. Also, this is my first mod, so I'm not good at ANY of this stuff. lol atleast I know about using some strings, like - STRINGS.CHARACTER.(moddedcharactername).DESCRIBE.(moddedcharactername) = { -, but however, this one is more difficult... Good mod tho :p I did follow the instructions, but alas idk where to go... nor actually know how todo this.

This mod is for more advanced modders! I wouldn't recommend this for a first-time modder sadly.. :C

But with time I'm sure if you keep making mods you'll get to the point where a lot of this makes sense! ^-^

  • Like 3
Link to comment
Share on other sites

On 17-1-2017 at 0:07 AM, Fidooop said:

This mod is for more advanced modders! I wouldn't recommend this for a first-time modder sadly.. :C

But with time I'm sure if you keep making mods you'll get to the point where a lot of this makes sense! ^-^

Hi,  thanks for this awesome tool. I'm sure that it just looks more complicated than it is. Are you sure you can't make a tutorial? The instructions are kind of difficult to get by and Erik being such a complicated character it's hard to know what you have to look for. I mean, it seems a bit odd to give us this and then not helping us use it. With all due respect, of course.

Link to comment
Share on other sites

I am fairly sure there is a reason why Fidooop didn't do a full tutorial and left Erik as an example. 
 See, for you to do that you need to at least know a bit of the basics to how to break a mod down and work your way to use it as an example, as he said, he doesn't recommends it for a first time modder, and as he said, keep making mods, he would rather have the person have some experience before tampering with it.

Otherwise just making an open tutorial is like giving someone the fish and the rod but not teaching them how to fish at all. Sure I understand tutorials might help, but sometimes it is better to try to break down an example to use it for your own knowledge, it might be hard but, well, this is an API, not a template.

  • Like 1
Link to comment
Share on other sites

I have some basics, but i guess it's not the rights basics, and i'm not sure the mods i'm trying to make will lead me to understand how make this one work. I mean, i learned things, but this is so huge, you have so much to learn in all directions. Can't be sure i'll see things bringing me closer to this part.

As the informations Kzisor gave about symbols, i'm grateful for everyone sharing knowledge, so even if i'm unable to use this, i'm still grateful Fidooop shared this, and no one is entitled to do more.

 

Still, i hope for a tutorial because i tried and failed, and i feel that if i want to learn more, a tutorial could be a good step. So... Anyway, as i said, no one is entitled to do more.

Link to comment
Share on other sites

1 hour ago, halfrose said:

I am fairly sure there is a reason why Fidooop didn't do a full tutorial and left Erik as an example. 
 See, for you to do that you need to at least know a bit of the basics to how to break a mod down and work your way to use it as an example, as he said, he doesn't recommends it for a first time modder, and as he said, keep making mods, he would rather have the person have some experience before tampering with it.

Otherwise just making an open tutorial is like giving someone the fish and the rod but not teaching them how to fish at all. Sure I understand tutorials might help, but sometimes it is better to try to break down an example to use it for your own knowledge, it might be hard but, well, this is an API, not a template.

So what, this is supposed to be training? I have been doing mods for a while now, It's just a pain to look at Erik as an example because of all the irrelevant things you need to sort out. It's not like we are poor people that need to learn by our own to earn a living, we just want to make different skins for our character, so sorry, I can't agree with you on the fish and rod argument.

 

Not saying that Fidoop had an obligation to do this though, he can do whatever he wants. Just requesting.

  • Like 1
Link to comment
Share on other sites

2 minutes ago, Thibooms said:

So what, this is supposed to be training? I have been doing mods for a while now, It's just a pain to look at Erik as an example because of all the irrelevant things you need to sort out. It's not like we are poor people that need to learn by our own to earn a living, we just want to make different skins for our character, so sorry, I can't agree with you on the fish and rod argument.

 

Not saying that Fidoop had an obligation to do this though, he can do whatever he wants. Just requesting.

so basically you are saying it is a pain to look at Erik because you don't want to have to fish out the information because there is 'irrelevant' things? by that you mean you can technically do it, you are just not willing to dissect it. That really is not Fidooop's problem in this case.

  • Like 1
Link to comment
Share on other sites

Just now, halfrose said:

so basically you are saying it is a pain to look at Erik because you don't want to have to fish out the information because there is 'irrelevant' things? by that you mean you can technically do it, you are just not willing to dissect it. That really is not Fidooop's problem in this case.

Of course it is not his problem. I'm just requesting this because this is not a clear way of doing things. There have been other people requesting a full tutorial for this reason.

Link to comment
Share on other sites

1 minute ago, Thibooms said:

Of course it is not his problem. I'm just requesting this because this is not a clear way of doing things. There have been other people requesting a full tutorial for this reason.

and if Fidooop didn't do one, it is for a reason too. If you really want a tutorial you might as well ask for someone else that managed to do it for it, because as you said, others asked, and if he didn't do it now he won't do it anytime soon. After all, it is an API not a template.

  • Like 1
Link to comment
Share on other sites

As i said, for me, Fidoop shared a thing and it's great, and if he don't want to spend time doing tutorial, it's fine, because it's not a due. And if no one else want to do it because it's tedious or whatever or they just don't want, it's fine too. After all, they are sharing their mod, they already did something.

 

But for me, i just want to let people know there are people that would like a tutorial, and after that, it's like every topic asking for something in this forum : people could answer, they don't have too.

And i'll probably download any new mod using skin in the hope i'll find a clue or a pattern i am missing for now.


So i hope i made my point of view a little more clear. I respect your, and i will try to not post here anymore about this subject because i don't want to spam or seem to require a tutorial, my point was to say it will be welcome but i feel like speaking about it too much could give the wrong feeling.

I appreciate all the work put in skins, anyway. And i could understand that it's better to not ask for people that already did an hard work to do more work.

Link to comment
Share on other sites

5 hours ago, Thibooms said:

So what, this is supposed to be training? I have been doing mods for a while now, It's just a pain to look at Erik as an example because of all the irrelevant things you need to sort out. It's not like we are poor people that need to learn by our own to earn a living, we just want to make different skins for our character, so sorry, I can't agree with you on the fish and rod argument.

 

Not saying that Fidoop had an obligation to do this though, he can do whatever he wants. Just requesting.

 

5 hours ago, Lumina said:

As i said, for me, Fidoop shared a thing and it's great, and if he don't want to spend time doing tutorial, it's fine, because it's not a due. And if no one else want to do it because it's tedious or whatever or they just don't want, it's fine too. After all, they are sharing their mod, they already did something.

 

But for me, i just want to let people know there are people that would like a tutorial, and after that, it's like every topic asking for something in this forum : people could answer, they don't have too.

And i'll probably download any new mod using skin in the hope i'll find a clue or a pattern i am missing for now.


So i hope i made my point of view a little more clear. I respect your, and i will try to not post here anymore about this subject because i don't want to spam or seem to require a tutorial, my point was to say it will be welcome but i feel like speaking about it too much could give the wrong feeling.

I appreciate all the work put in skins, anyway. And i could understand that it's better to not ask for people that already did an hard work to do more work.

I understand the desire for a tutorial, however, at this time I do not have time. I've supplied the general information you need in order to use this API to it's full effectiveness. At this time if you're looking for a step-by-step guide you will either need to create it yourself or wait for someone with more time to create it. Once again, as it has been stated several times now this is an API not a tutorial. There is a clear difference between them and the faster you understand that the faster you will be able to create skins. There are many examples aside from Erik on the steam workshop for you to use, @Chris1488 has even created a forum topic linking the different skins from other mods.
 

Edited by Fidooop
  • Like 3
Link to comment
Share on other sites

40 minutes ago, icantevenname said:

A thought occurred to me, any highly skilled modders out there, think it's possible to change stats and perks based on the skin being used?

Yes, use inst.CurrentModdedSkin to do this, just be noted its set to "none" on initilization (I think?) so you might have to do DoTaskInTime stuff calling a new function in masterpostinit.

so like this:

if inst.CurrentModdedSkin == "formal" then

--stuff

end

  • Like 1
Link to comment
Share on other sites

13 hours ago, DarkKingBoo said:

Yes, use inst.CurrentModdedSkin to do this, just be noted its set to "none" on initilization (I think?) so you might have to do DoTaskInTime stuff calling a new function in masterpostinit.

so like this:

if inst.CurrentModdedSkin == "formal" then

--stuff

end

Would this also work with speech scripts? I'm taking a shot in the dark as I say all this, could one be able to make a speech script along side the original (Say that the original is "speech_disguy" and the skin speech is "speech_disguy_formal") and under that CurrentModdedSkin thing, you specify to use "speech_disguy_formal" instead of "speech_disguy"?

Link to comment
Share on other sites

  • Developer
2 hours ago, icantevenname said:

Would this also work with speech scripts? I'm taking a shot in the dark as I say all this, could one be able to make a speech script along side the original (Say that the original is "speech_disguy" and the skin speech is "speech_disguy_formal") and under that CurrentModdedSkin thing, you specify to use "speech_disguy_formal" instead of "speech_disguy"?

I know it's possible since @Fidooop set that up for me so I could write more quotes for our mods. Maybe he could help you with that once he's back from his trip!

Edited by ImDaMisterL
Link to comment
Share on other sites

  • Developer
26 minutes ago, Zephyr41k said:

Is there will be a Video Guide? Or, maybe, Template Character?

@Fidooop is very busy with his other mods to stop and make another, more in-depth tutorial for this. Unless someone else has the time to make it, I don't think it'll happen.

  • Like 2
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...