Jump to content

tommysticks

Recommended Posts

Haven't posted in a while, have a question.

 

Just gettin into zomboid again, as the addiction goes.

 

I have written a script that will change skin texture of the player but the effect won't happen until the game is reloaded. I would post it, but it's not on this computer.

 

Anyone see anywhere in the lua files anything about the reanimation scripts? I assume there is something in there that reloads textures due to the textures being different upon reanimation. I could be wrong, it could be an entirely new model loaded after death occurs.

 

Any insight would be appreciated.

Link to comment
Share on other sites

The game most likely calls a model refreshing function.

 

After dissecting the games code and accidentally finding under-the-wraps things like usual (this time, it was a profanity filter test that was filled with a bunch of swear words), I found getPlayer():resetModel()

 

I don't have a code sample to work with so I can't do any testing, but hopefully that will work.

Link to comment
Share on other sites

Seems that all of the clothing changing textures use resetModelNextFrame(), not resetModel()

 

The problem is that it is a private function, so you can't use it. I guess that adds another function to the "useful functions that cannot be used" list.

 

EDIT: I've found something interesting, which is getPlayer():update(). It seems that it's the function that checks (and, y'know, updates) things like your characters model, whether or not you're falling, etc.

Link to comment
Share on other sites

Seems that all of the clothing changing textures use resetModelNextFrame(), not resetModel()

 

The problem is that it is a private function, so you can't use it. I guess that adds another function to the "useful functions that cannot be used" list.

 

EDIT: I've found something interesting, which is getPlayer():update(). It seems that it's the function that checks (and, y'know, updates) things like your characters model, whether or not you're falling, etc.

Excellent, I will definitely check this out.

Link to comment
Share on other sites

Sooo.. I've been fuckin around with some shit and got some weird results.

 

getPlayer():update(); doesn't do anything for me. Isn't the player updated a bunch of times every second? Like in the event OnPlayerUpdate or whatever it is?

 

This is the code I used to change skins: 

getPlayer():getDescriptor():setTorso("Kate");

 

The only textures under media that work are Kate, Kate_2, and Male thru Male_8. Anything else will break the game.

Funny thing is that in order to get the change to take place you either have to exit out and reload, or take off and replace a piece of clothing.

Reloading changes the model of the character whereas changing clothes only changes the texture until you reload. This leads me to believe it has something to do with the clothing reloading you mentioned earlier.

 

I seem to remember being able to get it to load no skin texture showing the grey model, but I've forgotten how.

 

The following code...

getPlayer():getDescriptor():setHair("F_Hair_Bob_White"); --Quote can be changed with models under media folder... even weapon models

getPlayer():resetModel();

...will cycle through hair styles with resetModel() without having to reload or change clothes. If you try to load male hairs on female or vice versa the hair goes out of wack, I'm assuming due to weights on the skeleton.

 

Just thought I would share this.

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
×
×
  • Create New...