[WFDS] Custom/batch action functions

Moderator: GZDoom Developers

Custom/batch action functions

Postby Matt » Sun Jan 21, 2007 3:52 am

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 allExpand view
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 allExpand view
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 allExpand view
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
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Postby Graf Zahl » Sun Jan 21, 2007 5:07 am

That's a classic 'Wait for Doomscript' thing.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Postby Enjay » Sun Jan 21, 2007 8:19 am

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



;)
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Postby Nash » Sun Jan 21, 2007 9:03 am

LOL!
User avatar
Nash
AKA Nash Muhandes! Twitter/Facebook/Youtube: nashmuhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Twitch ID: nashmuhandes
Github ID: nashmuhandes

Postby Graf Zahl » Sun Jan 21, 2007 9:07 am

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



;)



Maybe Randy can say something?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Postby Kirby » Sun Jan 21, 2007 5:59 pm

ROFL! :laff: He has a point too :)
User avatar
Kirby
Soon to be chastized
 
Joined: 26 Aug 2004

Postby MasterOFDeath » Sun Jan 21, 2007 6:19 pm

Speaking of Doomscript and old stuff... WHERE IS POLYMOST?
User avatar
MasterOFDeath
professional lurking witch
... in loving memory ...
 
Joined: 03 Apr 2004

Postby Kirby » Mon Jan 22, 2007 12:52 am

Waiting for Mordeth to be released, of course
User avatar
Kirby
Soon to be chastized
 
Joined: 26 Aug 2004

Postby skadoomer » Sat Jan 27, 2007 12:03 am

MasterOFDeath wrote:WHERE IS POLYMOST?


Hopefully gone for good.
skadoomer
 
Joined: 05 Sep 2003

Postby Matt » Tue Oct 23, 2007 10:47 am

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
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Postby TheDarkArchon » Wed Oct 24, 2007 3:57 am

Uh, look at the last post date...
User avatar
TheDarkArchon
OUT!
 
Joined: 07 Aug 2004
Location: Some cold place

Postby Matt » Fri Oct 26, 2007 1:27 am

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 allExpand view
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 allExpand view
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
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Postby Graf Zahl » Fri Oct 26, 2007 2:06 am

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Postby Gez » Fri Oct 26, 2007 2:15 am

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?
Gez
 
 
 
Joined: 06 Jul 2007

Postby Matt » Fri Oct 26, 2007 5:47 pm

@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...
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest