Jump to content
tommysticks

Player Update

Recommended Posts

I don't like bothering people here, I'd rather figure it out myself, but I'm still learning and appreciate the help.

 

I am working on a mod that changes character hair in-game. I've got it so it works, but the hair won't change until the player is updated, by changing either what he has equipped or what he is wearing.

 

Does anyone have any suggestions as to how I could make the player update with the press of a button? Currently, the code looks like this:

  local function checkKey(_key)	  local key = _key;	  if key == 26 then -- [		  getPlayer():getDescriptor():setHair("F_Hair_Bob_White");		  print("key pressed!");	  end  end 

Ideally the player would update after '[' is pressed as if he had just equipped a weapon or changed his shirt.

 

Share this post


Link to post
Share on other sites

I suppose having the script quickly un-equip and re-equip (or equip and delete) a clothing item to force update would work. I don't think there's any externalized methods to force the renderer to update on its own.

Share this post


Link to post
Share on other sites

Check the javadocs for the IsoGameCharacter class and see if there is something like "setDirty". There should be some kind of function which allows you to update the colors without using a hack.

After all the colors are updated in the Character Creation Menu as well.

(Or directly check the character creation menu and see how TIS updates the hair colors there ;))

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...