kirb code stuff

few things i did in Acid Rainbows' code for kirby stuff i tweaked to fix some issues

in init.gml

kirbyability = 16; enemykirby = noone; // by doing this it will stop _my side_ from spamming error messages to the log swallowed = 0; // changed swallowed implementation to fix error message as well

author's simple tutorial just tells you to put kirbyability variable with 16 in it.
however, this is not enough for a specific reason -
without further tweaking, your character will start flooding the ctrl+8 error-log with a lot of errors
until the said character has been swallowed by kirby.

explanations -
first of all, "noone" seems to be a gamemaker shortcut-variable of sorts,
and it will automatically be translated to "-4", which will refer to nothing when used as an ID.
by declaring it here, it will stop the errors caused by the variable not being found.

second, by declaring the swallowed variable here already, i fix another flood of error.
since we're going out of our way to put kirbyability variable in here,
why shouldn't we make the other variables here as well?

in update.gml

this is the part where kirby's custom attacks are handled.
there's actually no real flaw in the code for this part, where it's defining kirby's AT_EXTRA_3 values.
i'll put it here nonetheless for reference or if you hadn't seen it before

if swallowed { //Kirby ability script starts here swallowed = 0 //Define any assets kirby might need to grab from YOUR CHARACTER var ability_spr = sprite_get("YOUR KIRBY SPRITE HERE"); var ability_hurt = sprite_get("YOUR KIRBY HURTBOX HERE") with enemykirby { //Define AT_EXTRA_3 for Kirby, using your asset variables where necessary in place of sprite_get or sound_get ... } //Kirby ability script ends here }

now, here's the part i did tweak a bit, where it is the equivalent of attack_update but in update.gml...

//edited var ekid = enemykirby; if enemykirby != noone { //if kirby is in a match & has swallowed the character with oPlayer { //Run through all players if (id == ekid){ //makes sure it's the kirby that has swallowed you if ((state == PS_ATTACK_AIR || state == PS_ATTACK_GROUND) && attack == AT_EXTRA_3) { //your code here } } } }

and compare that with what it was before tweaking;

//original if enemykirby != undefined { //if kirby is in a match & swallowed with oPlayer { //Run through all players if ((state == PS_ATTACK_AIR || state == PS_ATTACK_GROUND) && attack == AT_EXTRA_3) { //your code here } } }

the changes here are that i have changed "undefined" to "noone", which again is a shortcut for -4.
that means it no longer relies on the enemykirby variable not existing (which will constantly push errors).

i have also changed - or rather added - an extra if condition
to make sure it's the kirby that has swallowed you.
This is actually a big flaw and it may be affecting everyone that has used this code as-is;
without this little check, few other characters that use the attack value assigned to AT_EXTRA_3 to be
affected by the code that would be written here.
what's worse is that there's a few character in the vanilla rivals that this applies to!
such as Shovel Knight (ghost gloves), and Etalus (one of the phases of forward air).
either way, the said check will prevent this from happening.