Jump to content

Custom actions?


Recommended Posts

I need to customize SuperShotgun to use my custom SSGPuff subclass of BulletPuff. The problem is that SSG uses https://zdoom.org/wiki/A_FireShotgun2 in its Fire state, which doesn't accept puff as parameter, so I need to define my own A_FireShotgun2_CustomPuff action duplicating existing one, but with minor modifications. So, how do I do that? I tried placing such action in decorate file, but it didn't work, I also tried putting in zscript file in multiple ways, which seemed to compile once, but then, this action is not visible from decorate file where I declare my CustomSSG and override its states.

Share this post


Link to post

To use ZScript stuff in DECORATE, your DECORATE actor needs to inherit from your ZScript actor.

Share this post


Link to post
5 minutes ago, Gez said:

To use ZScript stuff in DECORATE, your DECORATE actor needs to inherit from your ZScript actor.

 

Thank you!

 

In case anyone wonders, the working structure is:

zscript:

class SuperShotgunWithActions : SuperShotgun {
    action void A_FireShotgun2_CustomPuff() {
        // ...
    }
}

decorate:

actor CustomSSG : SuperShotgunWithActions replaces SuperShotgun { ... }

 

Share this post


Link to post
1 hour ago, ramon.dexter said:

You actually dont need decorate here. You can completely define the whole weapon directly in zscript.

 

Is it possible to define states in zscript?

Here is what I do in decorate:

 

actor CustomSSG : SuperShotgunWithActions replaces SuperShotgun {
	States {
		Fire:
			SHT2 A 3
			SHT2 A 7 A_FireShotgun2_CustomPuff
			SHT2 B 7
			SHT2 C 7 A_CheckReload
			SHT2 D 7 A_OpenShotgun2
			SHT2 E 7
			SHT2 F 7 A_LoadShotgun2
			SHT2 G 6
			SHT2 H 6 A_CloseShotgun2
			SHT2 A 5 A_ReFire
			Goto Ready
			// unused states
			SHT2 B 7
			SHT2 A 3
			Goto Deselect
	}
}

 

Share this post


Link to post
class CustomSSG : SuperShotgunWithActions replaces SuperShotgun {
	States {
		Fire:
			SHT2 A 3;
			SHT2 A 7 A_FireShotgun2_CustomPuff();
			SHT2 B 7;
			SHT2 C 7 A_CheckReload();
			SHT2 D 7 A_OpenShotgun2();
			SHT2 E 7();
			SHT2 F 7 A_LoadShotgun2();
			SHT2 G 6();
			SHT2 H 6 A_CloseShotgun2();
			SHT2 A 5 A_ReFire();
			Goto Ready;
			// unused states
			SHT2 B 7;
			SHT2 A 3;
			Goto Deselect;
	}
}

No problem. 

Edited by ramon.dexter

Share this post


Link to post
1 hour ago, ramon.dexter said:

...

 

No problem. 

 

Thanks, this way it's less messy.

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...