View Full Version : using "Super"

24th Sep 2001, 11:56 PM
hi, trying to track down an infinite recursion error ... i've subclassed the Teleporter actor and called it OffsetTeleporter ... It removes code in the Touch function dealing with sending a player across the 'net, and picking a random teleporter, and also adds some additional vector stuff in the Accept function.

Works fine in botmatch and on the server machine (nondedicated) but crashes on the client machine with a recursion error, says it cancelled it after 250 calls.

I've combed through and nowhere have i removed anything with replication or role code in it that would be called in the normal Teleporter in my circumstances. Grasping at straws the only part of things i never understood anyway was how to control using Super ....

For example, if in say Teleporter there's a function BLAH() that calls Super.BLAH(), then in my subclass i have a BLAH() function and i put Super.BLAH(), it will execute the BLAH() in Teleporter when in hits that line, right?

But how can i instead have it execute the BLAH() in NavigationPoint (Teleporter's parent)? I tried Super.Super.BLAH() but got recursion errors right off the bat ... I tried NavigationPoint.BLAH() i think and got some sort of error ... I think i also tried global.BLAH() and got errors too ...

25th Sep 2001, 03:51 AM
I think you have to use Super(NavigationPoint).BLAH()

Also look at this (I found it somewhere on the web some time ago):

Function Calling Specifiers
In complex programming situations, you will often need to call a specific version of a function, rather than the one thatís in the current scope. To deal with these cases, UnrealScript provides the following keywords:
∑ Global: Calls the most-derived global (non-state) version of the function.
∑ Super: Calls the corresponding version of the function in the parent class. The function called may either be a state or non-state function depending on context.
∑ Super(classname): Calls the corresponding version of the function residing in (or above) the specified class. The function called may either be a state or non-state function depending on context.

It is not valid to combine multiple calling specifiers (i.e. Super(Actor).Global.Touch).
Here are some examples of calling specifiers:
class MyClass expands Pawn;

function MyExample( actor Other )
Super(Pawn).Touch( Other );
Global.Touch( Other );
Super.Touch( Other );

As an additional example, the BeginPlay() function is called when an actor is about to enter into gameplay. The BeginPlay() function is implemented in the Actor class and it contains some important functionality that needs to be executed. Now, say you want to override BeginPlay() in your new class MyClass, to add some new functionality. To do that safely, you need to call the version of BeginPlay() in the parent class:
class MyClass expands Pawn;

function BeginPlay()
// Call the version of BeginPlay in the parent class (important).

// Now do custom BeginPlay stuff.

26th Sep 2001, 12:50 PM
thanks! that's exactly what i was looking for.

don't suppose you have any idea if somehow simulated functions/events have any additional considerations as far as calls using super? Something is recursing infinitely on client machine but not on server or botmatch... Hard as hell to troubleshoot without a network at my disposal, argh.

26th Sep 2001, 01:53 PM
okay i think i know what might be happening, but i'm not sure how to deal with it:

"if( !Other.bJustTeleported )" in a WarpZoneInfo is what keeps the recursion from happening in botmatch and on the server; the pawn is teleported into a warpzone from a custom Teleporter, and bJustTeleported keeps the zone from warping the pawn.

I'm thinking that since the ActorEntered function in the warpzone is simulated, that maybe it's local copy of bJustTeleported hasn't been updated? If indeed it works that way, it would explain why the warpzone on a client machine warps the player back, which touches them to the teleporter, and it starts all over again.

How can i have the client's simulated ActorEntered get the "real" value of bJustTeleported (what's on the server's copy)???

Or is there a more efficient way to do this?

Thanks for any insights.