• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code looking for a coder to help me with a vehicle replacement mut

Moz

Grizzled Veteran
Nov 21, 2005
1,773
1
http://www.youtube.com/watch?v=FOqF74TmEWY

I was thinking a pawn replacement

Also, no matter what I do the vehicle always defaults to team 0, making it unuseable to the allied team whenever I summon it. I don't think this is fixed by vehicle factories because the team setting in them do nothing, leading me to believe it is set in code.

I do have the default properties set to team one.

Yes I am aware how sloppy it is. I am not a coder. And most of it is copy and pasta.
Code:
//-----------------------------------------------------------
// Code Shamelessly stolen from the ut2004 codebase ;)
//-----------------------------------------------------------
class Moz_FlyingClownCar extends ROPlaneCraft;

#exec OBJ LOAD FILE=..\Animations\allies_ba64_anm.ukx

var()   float   MaxPitchSpeed;

var        int                    PendingPositionIndex;    // Position index the client is trying to switch to

/* =================================================================================== *
* NextViewPoint()
* Handles switching to the next view point in the list of available viewpoints
* for the driver.
*
* created by: Ramm 10/08/04
* =================================================================================== */
simulated function NextViewPoint()
{
     GotoState('ViewTransition');
}

function ServerChangeViewPoint(bool bForward)
{
    if (bForward)
    {
        if ( DriverPositionIndex < (DriverPositions.Length - 1) )
        {
            PreviousPositionIndex = DriverPositionIndex;
            DriverPositionIndex++;

            if(  Level.Netmode == NM_Standalone  || Level.NetMode == NM_ListenServer )
            {
                NextViewPoint();
            }
        }
    }
    else
    {
        if ( DriverPositionIndex > 0 )
        {
            PreviousPositionIndex = DriverPositionIndex;
            DriverPositionIndex--;

            if(  Level.Netmode == NM_Standalone  || Level.NetMode == NM_ListenServer )
            {
                NextViewPoint();
            }
        }
    }
}

simulated function PostNetReceive()
{
    super.PostNetReceive();

    if ( DriverPositionIndex != SavedPositionIndex )
    {
        PreviousPositionIndex = SavedPositionIndex;
        SavedPositionIndex = DriverPositionIndex;
        NextViewPoint();
    }

    // Kill the engine sounds if the engine is dead
    if( EngineHealth <= 0 )
    {
        if( IdleSound != none )
            IdleSound=none;

        if( StartUpSound != none )
            StartUpSound=none;

        if( ShutDownSound != none )
            ShutDownSound=none;

        if( AmbientSound != none )
            AmbientSound=none;
    }
}

simulated function NextWeapon()
{
    if( !bMultiPosition || IsInState('ViewTransition') || DriverPositionIndex != PendingPositionIndex)
        return;

    // Make sure the client doesn't switch positions while the server is changing position indexes
    if ( DriverPositionIndex < (DriverPositions.Length - 1) )
    {
        PendingPositionIndex = DriverPositionIndex + 1;
    }

    ServerChangeViewPoint(true);
}

// Overriden to switch viewpoints while driving
simulated function PrevWeapon()
{
    if( !bMultiPosition || IsInState('ViewTransition') || DriverPositionIndex != PendingPositionIndex)
        return;

    // Make sure the client doesn't switch positions while the server is changing position indexes
    if ( DriverPositionIndex > 0 )
    {
        PendingPositionIndex = DriverPositionIndex - 1;
    }

    ServerChangeViewPoint(false);
}

// Subclassed to remove onslaught functionality we don't need. This actually never happens in our game yet.
simulated event TeamChanged()
{
/*    local int i;

    // MergeTODO: Don't think we need any of this
    for (i = 0; i < Weapons.Length; i++)
        Weapons[i].SetTeam(Team); */
}

// Allow behindview for debugging
exec function ToggleViewLimit()
{
    if( !class'ROEngine.ROLevelInfo'.static.RODebugMode() || Level.NetMode != NM_Standalone  )
        return;

    if( bAllowViewChange )
    {
        bAllowViewChange=false;
        bDontUsePositionMesh = false;
        bLimitYaw = true;
        bLimitPitch = true;
    }
    else
    {
        bAllowViewChange=true;
        bDontUsePositionMesh = true;
        bLimitYaw = false;
        bLimitPitch = false;
    }
}


simulated event DrivingStatusChanged()
{
    if (bDriving)
        Enable('Tick');
    else
        Disable('Tick');
}

simulated function Tick(float DeltaTime)
{
    local float EnginePitch;

    if(Level.NetMode != NM_DedicatedServer)
    {
        EnginePitch = 96.0 + VSize(Velocity)/MaxPitchSpeed * 32.0;
        SoundPitch = FClamp(EnginePitch, 96, 128);
    }

    Super.Tick(DeltaTime);
}

defaultproperties
{

    // Position Info
    DriverAttachmentBone=driver_attachment
    bMultiPosition=true
    DriverPositions(0)=(PositionMesh=Mesh'allies_ba64_anm.BA64_body_int',DriverTransitionAnim=none,TransitionUpAnim=Overlay_Out,ViewPitchUpLimit=65535,ViewPitchDownLimit=65535,ViewPositiveYawLimit=0,ViewNegativeYawLimit=0,bExposed=false,bDrawOverlays=true)
    DriverPositions(1)=(PositionMesh=Mesh'allies_ba64_anm.BA64_body_int',DriverTransitionAnim=VBA64_driver_close,TransitionUpAnim=driver_hatch_open,TransitionDownAnim=Overlay_in,ViewPitchUpLimit=2730,ViewPitchDownLimit=60065,ViewPositiveYawLimit=5500,ViewNegativeYawLimit=-5500,bExposed=false)
    DriverPositions(2)=(PositionMesh=Mesh'allies_ba64_anm.BA64_body_int',DriverTransitionAnim=VBA64_driver_open,TransitionDownAnim=driver_hatch_close,ViewPitchUpLimit=9500,ViewPitchDownLimit=62835,ViewPositiveYawLimit=9500,ViewNegativeYawLimit=-9500,bExposed=true,ViewFOV=85)
    FPCamPos=(X=42.000000,Y=-18.000000,Z=33.000000)
    TPCamLookat=(X=0.000000,Z=0.000000)
    TPCamWorldOffset=(Z=100.000000)
    TPCamDistance=150.000000
    DrivePos=(X=0,Y=0,Z=0)
    ExitPositions(0)=(Y=-200.000000,Z=100.000000)
    ExitPositions(1)=(Y=200.000000,Z=100.000000)
    ExitPositions(2)=(Y=-200.000000,Z=100.000000)
    ExitPositions(3)=(Y=200.000000,Z=100.000000)
    EntryRadius=160.000000

    // Driver overlay
    HUDOverlayClass=class'ROVehicles.BA64DriverOverlay'
    HUDOverlayOffset=(X=2,Y=0,Z=0)
    HUDOverlayFOV=85

    VehiclePositionString="in a FLYING CLOWNCAR"
    VehicleNameString="FLYING CLOWNCAR"

    // Destruction
    DestroyedVehicleMesh=StaticMesh'allies_vehicles_stc.Ba64_destoyed'
    DestructionEffectClass=class'ROEffects.ROVehicleDestroyedEmitter'
    DisintegrationEffectClass=class'ROEffects.ROVehicleDestroyedEmitter'
    DestructionLinearMomentum=(Min=100.000000,Max=350.000000)
    DestructionAngularMomentum=(Min=50.000000,Max=150.000000)
    DamagedEffectOffset=(X=-40.000000,Y=10.000000,Z=10.000000)
    DamagedEffectScale=0.75

    // Display
    Mesh=SkeletalMesh'allies_ba64_anm.BA64_body_ext'

    Skins(0)=Texture'allies_vehicles_tex.ext_vehicles.BA64_ext'
    Skins(1)=Texture'allies_vehicles_tex.int_vehicles.BA64_int'

    HighDetailOverlay=Material'allies_vehicles_tex.int_vehicles.BA64_int_s'
    bUseHighDetailOverlayIndex=true
    HighDetailOverlayIndex=1

    DriveAnim=VBA64_driver_idle_close
    BeginningIdleAnim=driver_hatch_idle_close

    // Hud stuff
    VehicleHudImage=Texture'InterfaceArt_tex.Tank_Hud.BA64_body'
    VehicleHudEngineX=0.5
    VehicleHudEngineY=0.3
    VehicleHudOccupantsX(0)=0.5
    VehicleHudOccupantsX(1)=0.5
    VehicleHudOccupantsX(2)=none
    VehicleHudOccupantsY(0)=0.5
    VehicleHudOccupantsY(1)=0.665
    VehicleHudOccupantsY(2)=none

    // Vehicle Params
    VehicleMass=3.0
    VehicleTeam=1
    Health=250
    HealthMax=250.000000
    DisintegrationHealth=-10000//-25.000000
    CollisionHeight=40.000000
    CollisionRadius=175.0
    DriverDamageMult=1.0
    MaxDesireability=0.100000



    // sound
    IdleSound=sound'Vehicle_Engines.BA64.ba64_engine_loop'
    StartUpSound=sound'Vehicle_Engines.BA64.ba64_engine_start'
    ShutDownSound=sound'Vehicle_Engines.BA64.ba64_engine_stop'

     MaxPitchSpeed=3200.000000
     LiftCoefficientCurve=(Points=((InVal=-180.000000),(InVal=-10.000000),(OutVal=0.400000),(InVal=6.000000,OutVal=0.800000),(InVal=10.000000,OutVal=1.200000),(InVal=12.000000,OutVal=1.400000),(InVal=20.000000,OutVal=0.800000),(InVal=60.000000,OutVal=0.600000),(InVal=90.000000),(InVal=180.000000)))
     DragCoefficientCurve=(Points=((InVal=-180.000000),(InVal=-90.000000,OutVal=1.200000),(InVal=-10.000000,OutVal=0.100000),(InVal=-5.000000,OutVal=0.350000),(OutVal=0.010000),(InVal=5.000000,OutVal=0.350000),(InVal=10.000000,OutVal=0.100000),(InVal=15.000000,OutVal=0.300000),(InVal=60.000000,OutVal=1.000000),(InVal=90.000000,OutVal=1.200000),(InVal=180.000000)))
     AirFactor=0.000050
     MaxThrust=70.000000
     ThrustAcceleration=40.000000
     bHoverOnGround=True
     COMHeight=20.000000
     HoverForceCurve=(Points=((OutVal=500.000000),(InVal=30.000000,OutVal=700.000000),(InVal=250.000000)))
     ThrusterOffsets(0)=(X=200.000000,Z=10.000000)
     ThrusterOffsets(1)=(X=-50.000000,Y=300.000000,Z=10.000000)
     ThrusterOffsets(2)=(X=-50.000000,Y=-300.000000,Z=10.000000)
     HoverSoftness=0.900000
     HoverPenScale=1.500000
     HoverCheckDist=100.00000
     PitchTorque=700.000000
     BankTorque=300.000000

     Begin Object Class=KarmaParamsRBFull Name=KParams0
         KInertiaTensor(0)=3.500000
         KInertiaTensor(3)=10.000000
         KInertiaTensor(5)=13.000000
         KCOMOffset=(X=0.650000)
         KLinearDamping=0.000000
         KAngularDamping=1.500000
         KStartEnabled=True
         bKNonSphericalInertia=True
         KActorGravScale=2.000000
         KMaxSpeed=4000.000000
         bHighDetailOnly=False
         bClientOnly=False
         bKDoubleTickRate=True
         bDestroyOnWorldPenetrate=True
         bDoSafetime=True
         KFriction=0.600000
         KImpactThreshold=300.000000
     End Object
     KParams=KarmaParamsRBFull'KParams0'



    // Wheels

     Begin Object Class=SVehicleWheel Name=LFWheel
         bPoweredWheel=False
         SteerType=VST_Steered
         BoneName="steer_wheel_RF"
         BoneRollAxis=AXIS_Y
          BoneOffset=(Y=-9.000000,Z=2.0)
         WheelRadius=26.000000
         SupportBoneName="Axle_RF"
         SupportBoneAxis=AXIS_X
     End Object
     Wheels(0)=SVehicleWheel'Moz_AirWar.Moz_FlyingClownCar.LFWheel'

     Begin Object Class=SVehicleWheel Name=RFWheel
         bPoweredWheel=False
         SteerType=VST_Steered
         BoneName="steer_wheel_LF"
         BoneRollAxis=AXIS_Y
         BoneOffset=(Y=9.000000,Z=2.0)
         WheelRadius=26.000000
         SupportBoneName="Axle_LF"
         SupportBoneAxis=AXIS_X
     End Object
     Wheels(1)=SVehicleWheel'Moz_AirWar.Moz_FlyingClownCar.RFWheel'

     Begin Object Class=SVehicleWheel Name=LRWheel
         bPoweredWheel=True
         bHandbrakeWheel=True
         BoneName="steer_wheel_LR"
         BoneRollAxis=AXIS_Y
         BoneOffset=(X=0.0,Y=-9.000000,Z=2.0)
         WheelRadius=26.000000
         SupportBoneName="Axle_LR"
         SupportBoneAxis=AXIS_X
     End Object
     Wheels(2)=SVehicleWheel'Moz_AirWar.Moz_FlyingClownCar.LRWheel'

     Begin Object Class=SVehicleWheel Name=RRWheel
         bPoweredWheel=True
         bHandbrakeWheel=True
         BoneName="steer_wheel_RR"
         BoneRollAxis=AXIS_Y
         BoneOffset=(X=0.0,Y=9.000000,Z=2.0)
         WheelRadius=26.000000
         SupportBoneName="Axle_RR"
         SupportBoneAxis=AXIS_X
     End Object
     Wheels(3)=SVehicleWheel'Moz_AirWar.Moz_FlyingClownCar.RRWheel'

     // Special hit points
    VehHitpoints(0)=(PointRadius=7.0,PointHeight=0.0,PointScale=1.0,PointBone=driver_player,PointOffset=(X=-10.0,Y=0.0,Z=-7.0),bPenetrationPoint=false,DamageMultiplier=0.0,HitPointType=HP_Driver)
    VehHitpoints(1)=(PointRadius=22.0,PointHeight=0.0,PointScale=1.0,PointBone=engine,PointOffset=(X=60.0,Y=0.0,Z=-10.0),bPenetrationPoint=false,DamageMultiplier=5.0,HitPointType=HP_Engine)


    // misc
    ObjectiveGetOutDist=1500.000000
    bHasHandbrake=True
    bIsApc=true

    // Passengers
    PassengerWeapons(0)=(WeaponPawnClass=Class'ROVehicles.T60CannonPawn',WeaponBone="Turret_placement")
    // PassengerWeapons(1)=(WeaponPawnClass=Class'ROVehicles.Sdkfz251PassengerOne',WeaponBone=Track_L)
    // PassengerWeapons(2)=(WeaponPawnClass=Class'ROVehicles.Sdkfz251PassengerFour',WeaponBone=Track_R)
}
 
something like this doesnt work?

Code:
class MyMut extends Mutator;
[LEFT] 
function bool CheckReplacement( Actor Other, out byte bSuperRelevant )
{
      if(Other.IsA('BA64Vehicle')) //i dont know the exact name of the BA pawn, so you would have to check for the correct name
      {
            ReplaceWith(Other,"Moz_FlyingClownCar ");
            return false;
      }
      return true;
}[/LEFT]


As for your code: A t60 turret? :p

btw. why did you subclass the wheels?
For the team problem i would have to have a look when im home.​
 
Upvote 0
I don't believe I subclassed the wheel, wotreal just decided to add the whole Moz_airwar.moz_flyingclowncar in front, and me not being a coder took it's word for it.

Thank you very much for the check replacement, I tried to do something afew days ago but it refused to compile so I put it on the back burner, I though there was more to it than that so I asked for help :p

The whole point of this project was to see if I could stir some interesting in RO modding, and not the total conversion kind that seems to be the only popular one. To prove a lowly mapper armed with the ability to read (not write :S) unreal script can hack and slap stuff together.

Everyone learns from making garbage like this flying ba64 right? But after I did the videos I owe it to my fans to release this buggy mess.


Worluk you are my guardian angel <3
 
Upvote 0
i would know a truckload of things that would be suitable to learn UScript and would probably lead to a usable (by mappers in "serious" maps ;) ) result
If you need inspiration, just tell me :p

for the wheels, i see it now, the wheels are defined in the defaultproperties of your class. Thats why it is referenced this way.
 
Upvote 0
That's pretty cool. looks like fun.

Back in the Mod days I created a ZisTruck with a turbo boost and it had a
german and russian version. I had to create a special Factory class for it and
I fixed the Team setting. I'll post the code later if you want.

Oh, also, If you cant get the CheckReplace to work you can do it the way TeamSwap does it.
In postbeingplay it finds all the ROVehicleFactory objects and changes their VehicleClass when appropriate.
 
Last edited:
Upvote 0