function not called in subclass

Discussions about Coding and Scripting
Post Reply
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

function not called in subclass

Post by Rakiayn »

I have 2 classes:

class PRN_Projectile expands projectile
class PRN_Chunk expands PRN_projectile;

for some reason the function hitwall() is not called in the 'prn_chunk'
instead the function is called in its parent class
why is this?
there is no super.hitwall() in prn_chunk
Helen
Novice
Posts: 28
Joined: Sat Dec 25, 2010 6:03 pm

Re: function not called in subclass

Post by Helen »

- What is your code?
- How have you proved it is not getting called?
- Are you testing in a standalone game, or in a client/server setting?
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: function not called in subclass

Post by JackGriffin »

Do you understand the difference between a simulated function and a non-simulated one? It makes all the difference in the world when it comes to child classes:
//=============================================================================
// Projectile.
//
// A delayed-hit projectile moves around for some time after it is created.
// An instant-hit projectile acts immediately.
//=============================================================================
class Projectile extends Actor
abstract
native;

<SNIP>

simulated function HitWall (vector HitNormal, actor Wall)
{
if ( Role == ROLE_Authority )
{
if ( (Mover(Wall) != None) && Mover(Wall).bDamageTriggered )
Wall.TakeDamage( Damage, instigator, Location, MomentumTransfer * Normal(Velocity), '');

MakeNoise(1.0);
}
Explode(Location + ExploWallOut * HitNormal, HitNormal);
if ( (ExplosionDecal != None) && (Level.NetMode != NM_DedicatedServer) )
Spawn(ExplosionDecal,self,,Location, rotator(HitNormal));
}
So long, and thanks for all the fish
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

Re: function not called in subclass

Post by Rakiayn »

as far as I know , simulated function is called client side aswell as server side.
I didnt know that child classes are called different in simulated functions.
Post Reply