A_JumpIfChildrenAmount

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: A_JumpIfChildrenAmount

Re: A_JumpIfChildrenAmount

by Henderick » Wed Dec 25, 2013 9:47 am

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

Re: A_JumpIfChildrenAmount

by Major Cooke » Wed Dec 25, 2013 8:18 am

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.

Re: A_JumpIfChildrenAmount

by Gez » Tue Dec 24, 2013 5:11 pm

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.

Re: A_JumpIfChildrenAmount

by Graf Zahl » Tue Dec 24, 2013 4:06 pm

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

Re: A_JumpIfChildrenAmount

by Major Cooke » Tue Dec 24, 2013 3:06 pm

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.

A_JumpIfChildrenAmount

by Henderick » Tue Dec 24, 2013 10:59 am

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)

Top