OOP problem?

  • 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.

Sett

New Member
Jan 14, 2002
55
0
0
Visit site
I'm changing the dust emitter that is used for the KVehicle. The spawning of the emitters is hardcoded in ONSWheeledCraft's(my KV's parent) event DrivingStatusChanged()

Code:
simulated event DrivingStatusChanged()
{
	local int i;
	local Coords WheelCoords;

	Super.DrivingStatusChanged();

    if (bDriving && Level.NetMode != NM_DedicatedServer && !bDropDetail)
	{
        Dust.length = Wheels.length;
        for(i=0; i<Wheels.Length; i++)
            if (Dust[i] == None)
            {
        		// Create wheel dust emitters.
        		WheelCoords = GetBoneCoords(Wheels[i].BoneName);
The spawning->    Dust[i] = spawn(class'ONSDirtSlipEffect', self,, WheelCoords.Origin + ((vect(0,0,-1) * Wheels[i].WheelRadius) >> Rotation));
        		Dust[i].SetBase(self);
			    Dust[i].SetDirtColor( Level.DustColor );
        	}


        if (Level.NetMode != NM_DedicatedServer)
    	{
            for(i=0; i<Dust.Length; i++)
                Dust[i].Destroy();

            Dust.Length = 0;

....omited code
 
}

So I overrid that event so I could spawn my own emitter - a copy+paste job the only diff is that I deleted the Super call.
Because I omitted the Super call I added what would have been missed in Vehicle's event DiverStatuschanged()
Code:
   local PlayerController PC;

	PC = Level.GetLocalPlayerController();

	if (bDriving && PC != None && (PC.ViewTarget == None || !(PC.ViewTarget.IsJoinedTo(self))))
        bDropDetail = (Level.bDropDetail || (Level.DetailMode == DM_Low));
    else
        bDropDetail = False;

    if (bDriving)
        Enable('Tick');
    else
        Disable('Tick');

So I combined them in my own event-
Code:
simulated event DrivingStatusChanged()
{
	local int i;
	local Coords WheelCoords;
    local PlayerController PC;

	PC = Level.GetLocalPlayerController();

	if (bDriving && PC != None && (PC.ViewTarget == None || !(PC.ViewTarget.IsJoinedTo(self))))
        bDropDetail = (Level.bDropDetail || (Level.DetailMode == DM_Low));
    else
        bDropDetail = False;

    if (bDriving)
        Enable('Tick');
    else
        Disable('Tick');


    if (bDriving && Level.NetMode != NM_DedicatedServer && !bDropDetail)
	{
        Dust.length = Wheels.length;
        for(i=0; i<Wheels.Length; i++)
            if (Dust[i] == None)
            {
        		// Create wheel dust emitters.
        		WheelCoords = GetBoneCoords(Wheels[i].BoneName);
        		Dust[i] = spawn(class'ONSDirtSlipEffect', self,, WheelCoords.Origin + ((vect(0,0,-1) * Wheels[i].WheelRadius) >> Rotation));
        		Dust[i].SetBase(self);
			    Dust[i].SetDirtColor( Level.DustColor );
                log("ddddssssssss"$i);//check spawn
        	}

		if(bMakeBrakeLights)
		{
			for(i=0; i<2; i++)
    			if (BrakeLight[i] == None)
    			{
    				BrakeLight[i] = spawn(class'ONSBrakelightCorona', self,, Location + (BrakeLightOffset[i] >> Rotation) );
    				BrakeLight[i].SetBase(self);
    				BrakeLight[i].SetRelativeRotation( rot(0,32768,0) ); // Point lights backwards.
    				BrakeLight[i].Skins[0] = BrakeLightMaterial;
    			}
		}
	}
    else
    {
        if (Level.NetMode != NM_DedicatedServer)
    	{
            for(i=0; i<Dust.Length; i++)
            {
                Dust[i].Destroy();
                log("ssssssss"$i);//
            }

            Dust.Length = 0;

            if(bMakeBrakeLights)
            {
            	for(i=0; i<2; i++)
                    if (BrakeLight[i] != None)
                        BrakeLight[i].Destroy();
            }
        }

        TurnDamping = 0.0;
    }
}

The problem is that my KV no longer emits dust.

Any thoughts?
 

Sett

New Member
Jan 14, 2002
55
0
0
Visit site
Mychaeel said:
Instead of removing the Super call and duplicating the code it would have executed, just make your Super call skip ONSWheeledCraft:
Code:
Super(ONSVehicle).DrivingStatusChanged();

Cool:tup: didn't know you could do that.

Thank you very much.