Custom/batch action functions

Moderator: GZDoom Developers

User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Custom/batch action functions

Post by Matt »

Yes, this is another "not a huge functional difference but makes DECORATE vastly easier to read and write" suggestion...

Wouldn't it be great if we can define a set of zero-frame frames and then call them again and again as a single function?


For instance, suppose I had five different monsters with a standard, slightly complex baron-like attack looking something like this:

Code: Select all

Missile:
 MNST E 6 A_FaceTarget
 MNST F 4

 MNST G 0 A_JumpIfCloser (48, 11)
 MNST G 0 A_Jump (256, 1, 4, 7)

 MNST G 0 A_CustomMissile ("BaronBall", 32, -5, 0)
 MNST G 0 A_CustomMissile ("BaronBall", 32, 5, 0)
 MNST G 0 A_Jump (256, 8)

 MNST G 0 A_CustomMissile ("BaronBall", 32, -10, 0)
 MNST G 0 A_CustomMissile ("BaronBall", 32, 0, 0)
 MNST G 0 A_Jump (256, 5)

 MNST G 0 A_CustomMissile ("BaronBall", 32, 0, 0)
 MNST G 0 A_CustomMissile ("BaronBall", 32, 10, 0)
 MNST G 0 A_Jump (256, 2)

 MNST G 0 A_FireBullets (4, 4, 1, 4, "ClawPuff", 4, 32) //temp until A_CustomMeleeAttack is available

 MNST G 8
 goto See
Now every time I have to change this attack I'd have to go through all five actors to make the change. This isn't much by itself, but if you've got sequences like this repeated for various different things (dodging, standardized weapons, characters that behave similarly but act differently, etc.) it really starts to add up.

So I thought it would be great if the following were possible:

Code: Select all

action A_MonstAttack
{
 MNST G 0 A_JumpIfCloser (48, 8)
 MNST G 0 A_Jump (256, 1, 3, 5)

 MNST G 0 A_CustomMissile ("BaronBall", 32, -5, 0)
 MNST G 0 A_CustomMissile ("BaronBall", 32, 5, 0)
 return

 MNST G 0 A_CustomMissile ("BaronBall", 32, -10, 0)
 MNST G 0 A_CustomMissile ("BaronBall", 32, 0, 0)
 return

 MNST G 0 A_CustomMissile ("BaronBall", 32, 0, 0)
 MNST G 0 A_CustomMissile ("BaronBall", 32, 10, 0)
 return

 MNST G 0 A_FireBullets (4, 4, 1, 4, "ClawPuff", 4, 32) //temp until A_CustomMeleeAttack is available
 return
}
Leaving us with the following in the monster's actual missile state:

Code: Select all

Missile:
 MNST E 6 A_FaceTarget
 MNST F 4
 MNST G 8 A_MonstAttack
 goto See
I'd ask for custom parameters to be possible too, but I suspect that would be pushing my luck a bit. ^^;
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49096
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

That's a classic 'Wait for Doomscript' thing.
User avatar
Enjay
 
 
Posts: 26536
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Post by Enjay »

I was a young man when I started waiting for doomscript Image



;)
User avatar
Nash
 
 
Posts: 17450
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Post by Nash »

LOL!
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49096
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Enjay wrote:I was a young man when I started waiting for doomscript Image



;)

Maybe Randy can say something?
User avatar
Kirby
Posts: 2697
Joined: Thu Aug 26, 2004 1:23 pm

Post by Kirby »

ROFL! :laff: He has a point too :)
User avatar
MasterOFDeath
... in rememberance ...
Posts: 2024
Joined: Sat Apr 03, 2004 10:58 am

Post by MasterOFDeath »

Speaking of Doomscript and old stuff... WHERE IS POLYMOST?
User avatar
Kirby
Posts: 2697
Joined: Thu Aug 26, 2004 1:23 pm

Post by Kirby »

Waiting for Mordeth to be released, of course
skadoomer
Posts: 1026
Joined: Fri Sep 05, 2003 12:49 pm

Post by skadoomer »

MasterOFDeath wrote:WHERE IS POLYMOST?
Hopefully gone for good.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Post by Matt »

For the record, I've found that the effect I wanted could be approximated by CustomInventory pickup states. Pretty useful thing to have...
User avatar
TheDarkArchon
Posts: 7656
Joined: Sat Aug 07, 2004 5:14 am
Location: Some cold place

Post by TheDarkArchon »

Uh, look at the last post date...
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Post by Matt »

For the record
Being the person who made this suggestion I'm quite aware of this thread's age. :P

I'm really just adding this here in case someone searches for something similar and isn't aware of this trick, which had never occurred to me until I saw this.

That, and to make sure there's an objection at hand in case some overconscientious person decides to suggest that an item's pickup state should be changed so that it only works if the actual on-the-map actor is picked up. I seriously doubt any such change would be done, but after I had to edit every single DECORATE lump in Hideous Destructor because the SVN suddenly stopped taking non-quotemarked custom state names in A_Jump(If), I've learned not to take these things for granted.


Anyway, since I'm here here's the OP for anyone else trying to create a set of repeatable batch actions effectively acting as a combo action function:

Code: Select all

actor A_MonstAttack : CustomInventory
{
states:
{
pickup:
 MNST G 0 A_JumpIfCloser (48, 8)
 MNST G 0 A_Jump (256, 1, 3, 5)

 MNST G 0 A_CustomMissile ("BaronBall", 32, -5, 0)
 MNST G 0 A_CustomMissile ("BaronBall", 32, 5, 0)
 stop

 MNST G 0 A_CustomMissile ("BaronBall", 32, -10, 0)
 MNST G 0 A_CustomMissile ("BaronBall", 32, 0, 0)
 stop

 MNST G 0 A_CustomMissile ("BaronBall", 32, 0, 0)
 MNST G 0 A_CustomMissile ("BaronBall", 32, 10, 0)
 stop

 MNST G 0 A_FireBullets (4, 4, 1, 4, "ClawPuff", 4, 32) //temp until A_CustomMeleeAttack is available
 stop
}
}
And putting it in the monster's actual missile state:

Code: Select all

Missile:
 MNST E 6 A_FaceTarget
 MNST F 4
 MNST G 8 A_GiveInventory("A_MonstAttack", 1)
 goto See

I should note as well that this method effectively lets you call any DECORATE function in ACS.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49096
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

No, no, no!

This is an awful hack and I won't even think about it.

As I said in the other thread, I won't add any new DECORATE features and I most certainly won't add any hacks anymore. This is as dirty as they come.
Gez
 
 
Posts: 17840
Joined: Fri Jul 06, 2007 3:22 pm

Post by Gez »

Awful but nifty. Vaecrius is not asking for it to be added, since it already works!

Simple question, are the projectiles considered fired by the pickup or by the monster? That is to say, do they hurt monsters of the same species or not?
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Post by Matt »

@Gez: They're considered fired by the monster. Heck, I'd wish there were any way to access the properties of the pickup actor in the pickup state, but I can't find anything.

@Graf: I'm not asking this to be added, this method works already - I only posted the hack in case someone else comes across this thread later on and nothing better is available by then. I certainly wouldn't ask for a hack like this after the near-identical but clean version was no'd...

Return to “Closed Feature Suggestions [GZDoom]”