Jump to content

[Decorate/ZScript] Question regarding A_ReFire Priorities.


Recommended Posts

Sorry if this is a strange or silly question, but I’m curious to know if there are any priorities or preferences regarding a State to jump to for when A_ReFire is called? I am aware that one can add a State to A_ReFire but I have encountered difficulties with using this to jump to a specified State, and I haven’t been able to find much via searching online (likely due to my poor searching skills). From some experimenting, A_ReFire seems to prefer jumping to a Hold State (in my case AltHold as I’m using AltFire) rather than going to a predefined State. I have quickly mocked-up a rough example to try to illustrate the issue I'm facing:

Class Gun : Weapon {

int counter;

override void BeginPlay () {
	Super.BeginPlay();
	self.counter = 0;
	return;

States {
AltFire:
	//do some things
	A_ReFire;
	Goto Ready;

AltHold:
	//do some other things
	invoker.counter ++;
	if (invoker.counter >= 10) {
		return ResolveState (“AltHold0”);
	} else {
		return ResolveState (null);
	}
	A_ReFire;
	Goto Ready;

AltHold0:
	//do something else
	A_ReFire (“AltHold1”);
	Goto Ready;

AltHold1:
	//this code doesn’t get executed...
}
}

If the alternative fire button is held down one would progress from AltFire to AltHold, loop until counter is equal to 10, before moving to AltHold0. The issue I face here however is that the A_ReFire check in AltHold0 does not go to AltHold1 but back to AltHold, resulting in some code not being reached.

 

I’ve probably messed something up; I’m no programmer and I don’t exactly have a good understanding on what I’m doing.

 

Any help and advice is very much appreciated, thank you.

Share this post


Link to post

I cannot find any problem in the mock-up example (should work imo). A_Refire should always use the parameter-given state (unless that state does not exist).

 

Maybe there could be a typo in your actual code or something?

Share this post


Link to post

I'm embarrassed to admit that I have had a dyslexic moment lasting for around a week; it was indeed a typo at the source of the issue.

 

Thank you so very much for this, and I'm really sorry for wasting your time.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...