Replacing doomplayer doesnt work?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
PartiallyInvisible
Posts: 12
Joined: Thu Sep 28, 2023 9:15 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support

Replacing doomplayer doesnt work?

Post by PartiallyInvisible »

I have no idea what im doing wrong, im using zscript, this is my code:

Code: Select all

class newplayer : Doomplayer Replaces DoomPlayer
{
	Default
	{
	Player.StartItem "Clip", 100;
	}
    States
	{
	Death:
	PLAY H 10 A_SkullPop("PlayerHead");
	PLAY I 10 A_PlayerScream;
	PLAY J 10 A_NoBlocking;
	PLAY KLM 10;
	PLAY N -1;
		Stop;
    }		
		
class PlayerHead : PlayerChunk
{
	Default
	{
		Radius 4;
		Height 4;
		Gravity 0.125;
		+NOBLOCKMAP
		+DROPOFF
		+CANNOTPUSH
		+SKYEXPLODE
		+NOBLOCKMONST
		+NOSKIN
	}
	States
	{
	Spawn:
		PHED A 0;
		PHED ABCDEFGHI 5 A_CheckFloor("Hit");
		Goto Spawn+1;
	Hit:
		PHED J 16 A_CheckPlayerDone;
		Wait;
	}
}
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: Replacing doomplayer doesnt work?

Post by Blue Shadow »

Player pawns cannot be replaced with the replaces keyword like any other actor. To replace them, use MAPINFO:

Code: Select all

gameinfo
{
	PlayerClasses = "newplayer"
}
PartiallyInvisible
Posts: 12
Joined: Thu Sep 28, 2023 9:15 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support

Re: Replacing doomplayer doesnt work?

Post by PartiallyInvisible »

Blue Shadow wrote: Sat Nov 02, 2024 2:22 am Player pawns cannot be replaced with the replaces keyword like any other actor. To replace them, use MAPINFO:

Code: Select all

gameinfo
{
	PlayerClasses = "newplayer"
}
Wow, I cant believe that i didnt know that beforehand. Thanks!
Post Reply

Return to “Scripting”