Page 1 of 1
Change Player skin mid-game
Posted: Sat Jan 30, 2016 6:34 pm
by RobbyPants
Is there a way to change a player's skin upon picking up a custom inventory item?
RE: Change Player skin mid-game
Posted: Sat Jan 30, 2016 7:04 pm
by Ænima
RobbyPants wrote:
Is there a way to change a player's skin upon picking up a custom inventory item?
You could put a bunch of custom states in the player actor's DECORATE and then use A_JumpIfInventory.
RE: Change Player skin mid-game
Posted: Sat Jan 30, 2016 7:51 pm
by RobbyPants
Ænima wrote:
You could put a bunch of custom states in the player actor's DECORATE and then use A_JumpIfInventory.
Can that change the skin?
I want to do this because the player's skin is what's used in GLDEFS for giving the player a light source. I wanted to have a flashlight item, that if possessed, would make the player "glow". It's easy enough for me to set this to always be on, but I'd like it if it would start off and only work once the player picks the flashlight up.
RE: Change Player skin mid-game
Posted: Sat Jan 30, 2016 7:59 pm
by Ænima
I told you how to do it in the other thread ...
Do you want the player's skin to be changed? In other words do you want this to work with custom skins or are you forcing a certain set of sprites on every player?
RE: Change Player skin mid-game
Posted: Sat Jan 30, 2016 8:20 pm
by RobbyPants
Ænima wrote:
I told you how to do it in the other thread ...
Do you want the player's skin to be changed? In other words do you want this to work with custom skins or are you forcing a certain set of sprites on every player?
I'll take a look at that one, again.
The map is made for just a single player, so I don't particularly care what the skin
looks like. I just need a way to differentiate two different sprites in GLDEFS based on the presence or absence of an inventory item.
RE: Change Player skin mid-game
Posted: Sat Jan 30, 2016 8:35 pm
by Ænima
So then make an identical copy of all your PLAY* sprites but rename them PLA2 or something. Then make a seperate set of See, Pain, Spawn, Melee, and Missile states that are exactly the same as the normal player states, just with PLA2 instead of PLAY. Make sure you put a A_JumpIfInventory at the beginning of all your "normal" states and make it jump to the PLA2 version of that state if the flashlight is equipped. Then go into GLDEFS and attach the light to PLA2 on your player actor.
It might even be easier to just have an ACS script that spawns an invisible actor (TNT1A0) from the player every single tic, and spawn it using the player's x,y,z velocity so that it stays MOSTLY sync'd with the player's movement. Then just attach the GL light to that actor. It won't look 100% as smooth as using the player themself as the light origin but if it's singleplayer I don't think anyone will notice.
RE: Change Player skin mid-game
Posted: Sat Jan 30, 2016 8:42 pm
by RobbyPants
That separate object thing is actually a really good idea. Thanks.
The separate object thing had too many odd side effects. The light would disappear when I got next to a wall or went up stairs, but would come back if I moved or went down. I might have been able to tweak the spawn height, but I ultimately made the extra player sprites and states, and it worked great! Thanks for the advice!