Azarael wrote:Having looked into this further, you can just use the Owner variable, as the child monster is owned by the parent monster. So the code would be like so:
function getbackup()
{
local vector X, Y, Z, SpawnOffSet;
local Monster M;
if(Controller != None)
{
GetAxes(Rotation,X,Y,Z);
SpawnOffSet = X;
M=Spawn(class'DreamsCombineBackup1A',self,,location + 200 * SpawnOffSet + (Y) + (3 * Z),Rotation);
if (M != None)
{
if(Invasion(Level.Game) != None)
Invasion(Level.Game).NumMonsters++;
}
else Destroy();
}
}
Then, in your child class:
function TakeDamage (lots of params here)
{
if (Owner != None)
Owner.TakeDamage(lots of params here);
else <insert here your method of choice for terminating this monster, be it takedamage, destroy, died, whatever>
}
as usual thanks alot for ur replies, there are 2 problems right now,
lets call secondaryclass by its name: DreamsCombineBackup1A
and the primaryclass aswell: DreamsBossHunter1A
i have tried this in the DreamsCombineBackup1A:
Code: Select all
function TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, class<DamageType> damageType)
{
if (Owner != None)
{
Owner.TakeDamage(Damage,instigatedBy,hitlocation,momentum,damageType); //doesnt work because i dont know what are the right parameters to put in here
return; //you have said theres no need for return, but if i dont use return the monster will get damaged to its own hp
}
super.TakeDamage(Damage,instigatedBy,hitlocation,momentum,damageType);
}
If i use this 2 problem happen:
1) the dreamsbosscombine1A doesnt register taking any damage
2) even if i kill the dreamsbosscombine1A directly the "if (Owner != None)" still returns double negative (as if it still detects its owner).
Im sorry to bother you like this, but my experience with this type of syntax and right parameters used in uscript is rly small, could u help me on this once more? i usually learn from examples like these and in future i learn how to apply them as i already have examples on how to xD
Thanks as usual in advance!