ZScript error "Unexpected '='"

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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!)
User avatar
Ivory_2505
Posts: 12
Joined: Thu Apr 16, 2026 1:01 pm
Preferred Pronouns: He/Him

ZScript error "Unexpected '='"

Post by Ivory_2505 »

Alright I have no idea why this is happening and I've been breaking my head open trying to figure it out. For some reason when i just set the doubles here in my ZScript player replacement code it keeps giving me this dang error "unexpected '='" even tho there is literally 0 issue in the code. It is a zscript file being included by a separate zscript file outside any folders. plz help

Code: Select all

class MonterPlayer : PlayerPawn {
	double MinSpeed = 8;
    double MaxSpeed = 24;
    double CurrentSpeed = 8;
//------------------------------------------------------------------------------
    double AccelTime = 2.0;
    double AccelRate;
//------------------------------------------------------------------------------
	Default {
		Speed 1;
		Health 100;
		Radius 16;
		Height 56;
		Mass 100;
		PainChance 255;
		Player.DisplayName "MonterPlayer";
		Player.CrouchSprite "PLYC";
		Player.ColorRange 144, 189;
		Player.Colorset 0, "$TXT_COLOR_GREEN", 144, 191, 144;
		Player.Colorset 1, "$TXT_COLOR_RED", 96, 143, 96;
		Player.Colorset 2, "$TXT_COLOR_BLUE", 192, 239, 192;
	}
You do not have the required permissions to view the files attached to this post.
User avatar
phantombeta
Posts: 2225
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: ZScript error "Unexpected '='"

Post by phantombeta »

Code: Select all

	double MinSpeed = 8;
    double MaxSpeed = 24;
    double CurrentSpeed = 8;
    double AccelTime = 2.0;
You can't assign values to member variables like that. You have to either assign them in a BeginPlay or PostBeginPlay override, or make them properties and set their values in the default block.

Return to “Scripting”