Archvile "See" script stops working after attack

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
woofdg79
Posts: 21
Joined: Wed Jan 28, 2015 10:02 am
Graphics Processor: nVidia (Modern GZDoom)

Archvile "See" script stops working after attack

Post by woofdg79 »

I have a basic zscript for a "Weeping Archvile" where it stops moving when its in view. It works perfectly... until the archvile starts his attack. After he casts his flames he starts acting like a regular ol' archvile and ignores the code I have. Either that, or the code I have is returning different values after an attack? Any thoughts?

Code: Select all

class WeepingVile : Archvile
{
	Default
	{
		Obituary "Weepers be weepin'";
		Tag "WeepingVile";
	}
	
	States
	{
		See:
			VILE AABBCCDDEEFF 2 
			{
				if(target.IsVisible(invoker, FALSE))
				{
					return;
				}
				else
				{
					A_VileChase();
				}
			}
			Loop;
	}
}
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: Archvile "See" script stops working after attack

Post by Blue Shadow »

You need to include all the other state sequences from the Archvile class that end with Goto See, as state jumps with Goto aren't virtual, like they are with A_Jump and sister functions, for example.
User avatar
woofdg79
Posts: 21
Joined: Wed Jan 28, 2015 10:02 am
Graphics Processor: nVidia (Modern GZDoom)

Re: Archvile "See" script stops working after attack

Post by woofdg79 »

Thanks! I understand the solution though I'm not fully following the explanation. Could you expand on that a little, please?
User avatar
Jekyll Grim Payne
 
 
Posts: 1076
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Re: Archvile "See" script stops working after attack

Post by Jekyll Grim Payne »

woofdg79 wrote:Thanks! I understand the solution though I'm not fully following the explanation. Could you expand on that a little, please?
Goto is a static jump, meaning it'll always jump to state labels within this specific actor. All other types of jumps and state changes in zscript are dynamic, so they're not subjected to it. You can read more about it in my ZScript guide here.
User avatar
woofdg79
Posts: 21
Joined: Wed Jan 28, 2015 10:02 am
Graphics Processor: nVidia (Modern GZDoom)

Re: Archvile "See" script stops working after attack

Post by woofdg79 »

Thank you this helps a lot!
Post Reply

Return to “Scripting”