What I'm attempting to do is: I have a custom player class that uses inventory items to spawn friendly monsters. When the inventory item is used, it invokes the owner to spawn a custom projectile which functions much like the 'ArtiDarkServant's summoning doll projectile. I'd like to have a cap on the number of summons active at once, so I gave the custom class a 'NumChildren' user variable.
Trouble I'm having is accessing the user variable from the projectile. I've referenced the wiki article on member variables, but I'm not knowledgeable enough in coding to understand what I'm maent to do to access the variables.
This is what I have so far.
Code: Select all
// Custom Mage Class -----------------------------------------------------------
class MagePlayerCustom : MagePlayer
{
int NumChildren;
Default
{
Player.StartItem "MWeapDagg";
Player.WeaponSlot 1, "MWeapDagg";
}
}
// Summoning crystal Projectile-------------------------------------------------
Class SummoningCrystal : SummoningDoll
{
Default
{
Scale .15;
}
States
{
Spawn:
CRYS A 4;
Loop;
Hound:
TNT1 A 0
{
Spawn("MinotaurSmoke", Pos, ALLOW_REPLACE);
A_StartSound("hound/act", CHAN_VOICE);
}
CRYS AA 4;
CRYS A 4
{
if(!A_SpawnItemEX("HoundFamiliar", 0, 0, 0, 0, 0, 0, 0, SXF_SETMASTER))
{
A_SpawnItemEx("ArtiSummoningCrystal");
}
else
{
master.NumChildren += 1; //<-- the problem area. I've tried master.x, invoker.player.x, owner.blah.blah.blah, with the same result, GZDoom throws an error complaining that the identifier 'NumChildren' doesn't exsist.
}
}
Stop;
Dragon:
TNT1 A 0
{
Spawn("MinotaurSmoke", Pos, ALLOW_REPLACE);
A_StartSound("dragon/act", CHAN_VOICE);
}
CRYS AA 4;
CRYS A 4
{
if(!A_SpawnItemEX("DragonFamiliar", 0, 0, 40, 0, 0, 0, 0, SXF_SETMASTER))
{
A_SpawnItemEx("ArtiSummoningCrystal");
}
else
{
master.NumChildren += 1;// <-- Same as above.
}
}
Stop;
Death:
TNT1 A 0 A_Jump(256, "Hound", "Dragon");
Stop;
}
}