(ZScript) is it possible to jump to a state with an offset?

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
User avatar
MyNameIs
Posts: 26
Joined: Sun May 26, 2013 3:28 am

(ZScript) is it possible to jump to a state with an offset?

Post by MyNameIs »

i'm trying to make a weapon that lets you skip frames depending on the variable
basically, it's for keeping the kicking animation on screen (i'm using a_overlays) if weapon is switched, as it can just cut out if weapon is picked up/dropped at the wrong time.
i can't just lock the ability to drop a weapon while kicking, that would not feel nice

Code: Select all

TNT1 A 0	{
				let m = ThePlayer(self);
				if (m.FindInventory("WannaKick")||m.KickingFrame>0)
				{
					return ResolveState("KickLeft");//+ m.KickingFrame
				}
				else 
				return ResolveState(null);
		}

is there a way to ResolveState to a state + offset? like "Goto Spawn+10" does?

it's kinda messy to define each target frame as a new state or check and skip them with A_SetTics (0), especially when it's, like, around 20 frames to skip * 2 kicking types
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: (ZScript) is it possible to jump to a state with an offs

Post by Apeirogon »

IIRC

Code: Select all

ResolveState("KickLeft")  + integer;
User avatar
MyNameIs
Posts: 26
Joined: Sun May 26, 2013 3:28 am

Re: (ZScript) is it possible to jump to a state with an offs

Post by MyNameIs »

oh.

i thought.. i tried that..
it works, thanks!
Post Reply

Return to “Scripting”