A_JumpIfChildrenAmount

Moderator: GZDoom Developers

Post Reply
Henderick
Posts: 50
Joined: Sun Mar 08, 2009 9:11 am
Location: Germany

A_JumpIfChildrenAmount

Post by Henderick »

I really need an action which does a check on how many children a master has.
I thought about A_JumpIfChildrenAmount("amount") because I know that there are some complications about master/children checks and I want to keep it simple, so I hope it is. :?
It should perform a state jump if "amount" is true.
If "amount" is 2 it should perform a jump when the calling actor has 2 alive minions/children/slaves.
If "amount" is 0 it should perform a jump when the calling actor has none alive left.
And so on.

(Maybe it could also be combined with =< => and == to have "more", "less" and "equal" than checks, but the general check is enough for me, just an idea here)
User avatar
Major Cooke
Posts: 8212
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: A_JumpIfChildrenAmount

Post by Major Cooke »

No need for comparison logic for something like this. That only works with expression and user variables anyway. It's like A_JumpIfInventory's logic essentially, in which it checks to see if an actor has a certain amount of an item OR MORE, then jumps if it's true.
Perhaps something more like this:

A_JumpIfNumberOfChildren(<int number>,<str state/int offset>)

However, a few things I foresee may need to be taken into accountability... FLAG TIME!

A_JumpIfNumberOfChildren(<int number>,<str state/int offset>,<int flags>)
  • CHM_ALIVE - Only count those that are alive as children. Assumed by default.
  • CHM_NOALIENS - Don't count any children that were not spawned by the master, who have been converted to it.
  • CHM_NOSUBVERTS - Don't count any children spawned by the master who no longer considers the original master to be their current master.
  • CHM_DEAD - Counts the actors that still exist as corpses. Naturally doesn't count those that don't exist (reached a Stop statement).
Good for being more selective too, with those flags.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49238
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_JumpIfChildrenAmount

Post by Graf Zahl »

Major Cooke wrote: A_JumpIfNumberOfChildren(<int number>,<str state/int offset>,<int flags>)
  • CHM_ALIVE - Only count those that are alive as children. Assumed by default.
  • CHM_NOALIENS - Don't count any children that were not spawned by the master, who have been converted to it.
  • CHM_NOSUBVERTS - Don't count any children spawned by the master who no longer considers the original master to be their current master.
  • CHM_DEAD - Counts the actors that still exist as corpses. Naturally doesn't count those that don't exist (reached a Stop statement).

... especially if there's no way to detect those states... ;)
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: A_JumpIfChildrenAmount

Post by Gez »

Major Cooke wrote:
  • CHM_NOALIENS - Don't count any children that were not spawned by the master, who have been converted to it.
  • CHM_NOSUBVERTS - Don't count any children spawned by the master who no longer considers the original master to be their current master.
:?: :?: :?:
How exactly would that happen? You'd need to add a new pointer field to actors, for "spawner", in addition to the master/target/tracer mess. As it is, there is no way for the engine to tell you whether something's master is the actor's original spawner or not.

On the plus side, I suppose it'd allow to have at least one pointer with a consistent and straightforward behavior... Still, though, it'd be a big overhaul just for one single tiny optional behavior of some obscure new function.
User avatar
Major Cooke
Posts: 8212
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: A_JumpIfChildrenAmount

Post by Major Cooke »

I see what you mean Gez. Sorry, was thinking in terms of it being a possibility in DECORATE, which it is, though comparable pointers would make it even easier.

But hell, an original target/master/tracer set of pointers would be nice!

@Graf: Well, check for corpse flag on the dead one (okay, I know there could be +DONTCORPSE taking into account which would be a problem).

-----

But for the most vanilla of the vanilla necessities, Henderick, what you could do is have each minion spawned give the master a token, the first thing they do when they spawn called MinionCount or something. Just have the master perform inventory checks for that in the mean time. Then when the child dies, have them take one away from the master.
Henderick
Posts: 50
Joined: Sun Mar 08, 2009 9:11 am
Location: Germany

Re: A_JumpIfChildrenAmount

Post by Henderick »

Major Cooke wrote:But for the most vanilla of the vanilla necessities, Henderick, what you could do is have each minion spawned give the master a token, the first thing they do when they spawn called MinionCount or something. Just have the master perform inventory checks for that in the mean time. Then when the child dies, have them take one away from the master.
But the reason I made the suggestion in the first place is because I really do not want to do that because of 3 reasons:
1. It takes very long and is complicated if your master can have around 100 different children actors
2. It just fills up the decorate file if I have to do copies of every actor only because they need an extra state
3. If the children have diferent death states like Burn Ice XDeath and so on it takes even longer and for some reasons it does not work on rare occasions like getting crushed in their very first tic or if they get removed by different reasons like morph into pigs/chicken/something else and then get killed.

It would be so much easier if I could just use a simple check/action on the master itself and there wouldn't be any problems regarding the children fail to do their action and would be much much MUCH less work.
And like I said I would be happy with the simplest check possible, to start with...
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”