Error in code (I know what it is, but need help)

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

music monkey

New Member
Feb 26, 2006
11
0
0
This is what I have:

This is in my projectile class and notice the line that checks to see if the object hit is a vehicle and if so it spawns a EMPTime who's owner is the hit actor.
Code:
function SuperExplosion()
{
	local actor HitActor;
	local vector HitLocation, HitNormal;
	local int Time;

	HurtRadius(ComboDamage, ComboRadius, class'DamTypeShockTankShockBall', ComboMomentumTransfer, Location );

	Spawn(class'EMPExplosion');
	Time=(Level.TimeSeconds - 1);
	//Time=/*(class'EMPTime'.default.StopTime)-*/(class'EMPTime'.default.StartTime);
	//VehicleMessage
	//VehicleMessage=VehicleMessage$(StopTime-TimeStopped)$" Sec Left.";
	VehicleMessage=VehicleMessage$(Time)$" Sec Left.";
	//endVehicleMessage
	//Spawn(class'ONSShockTankShockExplosion');
	if ( (Level.NetMode != NM_DedicatedServer) && EffectIsRelevant(Location,false) )
	{
		HitActor = Trace(HitLocation, HitNormal,Location - Vect(0,0,120), Location,false);
		if(HitActor.IsA('Vehicle'))
                {
                 Pawn(HitActor).spawn(class'EMPTime',HitActor);
                }
                class'EMPMessage'.default.string0 = VehicleMessage;
		BroadcastLocalizedMessage(class'EMPMessage',0,,,HitActor);
		if ( HitActor != None )
			Spawn(class'ComboDecal',self,,HitLocation, rotator(vect(0,0,-1)));
	}
	PlaySound(ComboSound, SLOT_None,1.0,,800);
        DestroyTrails();
        Destroy();
}

Then in my EMPTime class there is an error:
Code:
simulated event Trigger( Actor Other, Pawn EventInstagator )
{
  SetTimer(StopTime , false);
  Owner.bStalled = true; //Error
  log("Got Trigger");
}

It doesn't know that Owner is a vehicle and does have the variable bStalled, so it says Unrecognized member 'bStalled' in class 'Actor.

How would I get around this?
 

_Lynx

Strategic Military Services
Staff member
Dec 5, 2003
1,965
8
38
41
Moscow, Russia
beyondunreal.com
To do that you make a construction like that:
Code:
Vehicle(Owner).bStalled
That will tell the engine that the owner in this case is object of class Vehicle. Note that there are of course certain rules: The class before brackets must be a child class of the one inside brackets.

If you need to address a class defined as a variable in some other calls the construction will look like that:
Code:
TeamPlayerReplicationInfo(Controller.PlayerReplicationInfo).bFirstBlood

P.S. I was typing for too long, Wormbo did it before me. =)