1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. 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.

UE2 - UT2kX "Remote" control vehicle

Discussion in 'Programming' started by ROSoldier, Oct 21, 2015.

  1. ROSoldier

    ROSoldier New Member

    Joined:
    Feb 1, 2015
    Messages:
    28
    Likes Received:
    0
    Hello guys. I would like to try to do something that may sound strange but actually must be possible in U Script.
    What I am trying to do is a vehicle (lets say a ground vehicle) that can be remotely controlled by a specific player (players).
    The idea is: A special weapon is given to the Player (a "remote") and he can use this remote to control the vehicle from distance without being inside. The control should work the same way as if the player was sitting inside as a driver.

    The vehicle is of course a type of "Pawn", but what I actually don't understand is how player input is handled. So I googled around and it looks like what I need to do is to possess the pawn(vehicle) somehow.
    As for the "weapon" itself I guess that it will just be used to "possess" or "unpossess" (I think these are the correct terms) the vehicle on demand by pressing the fire/Alt fire or something like that. Of course if the weapon is dropped and picked by another player, that same player must now be able to control the vehicle I guess)

    I already looked at the RedeemerWarhead class, but I don't think how this can help me. Since the Redeemer is just a rocket that is flying straight, and the only think that a player can control is the rockets rotation", while in a vehicle you must control the throttle, breaks, steer and etc.

    What I already know how to do is how to possess a pawn by looking at the RedeemerGuidedFire
    Code:
    function Projectile SpawnProjectile(Vector Start, Rotator Dir)
    {
        local RedeemerWarhead Warhead;
        local PlayerController Possessor;
    
        Warhead = Weapon.Spawn(class'RedeemerWarhead', Instigator,, Start, Dir);
        // End:0x62
        if(Warhead == none)
        {
            Warhead = Weapon.Spawn(class'RedeemerWarhead', Instigator,, Instigator.Location, Dir);
        }
        // End:0x1B3
        if(Warhead != none)
        {
            Warhead.OldPawn = Instigator;
            Warhead.PlaySound(FireSound);
            Possessor = PlayerController(Instigator.Controller);
            Possessor.bAltFire = 0;
            // End:0x13E
            if(Possessor != none)
            {
                // End:0xED
                if(Instigator.InCurrentCombo())
                {
                    Possessor.Adrenaline = 0.0;
                }
                Possessor.UnPossess();
                Instigator.SetOwner(Possessor);
                Instigator.PlayerReplicationInfo = Possessor.PlayerReplicationInfo;
                Possessor.Possess(Warhead);
            }
            Warhead.Velocity = Warhead.AirSpeed * vector(Warhead.Rotation);
            Warhead.Acceleration = Warhead.Velocity;
            Warhead.MyTeam = Possessor.PlayerReplicationInfo.Team;
        }
        // End:0x1F5
        else
        {
            Weapon.Spawn(class'SmallRedeemerExplosion');
            Weapon.HurtRadius(500.0, 400.0, class'DamTypeRedeemer', 100000.0, Instigator.Location);
        }
        bIsFiring = false;
        StopFiring();
        return none;
        //return;   
    }
    ,

    but I don't know how I can posess the player's pawn from within the "remote" (weapon) itself. The redeemer Warhead has a dedicated function to do this called RelinquishController
    I am thinking of using the same function in my vehicle, but I must somehow call it manually from within the "remote control" (the weapon) itself, lets say when I press the Alt fire button.

    If you are familiar of a some mod that already does this, or you have any suggestion please don't be afraid to share your ideas. even the simplest ideas can be helpful.
     
  2. ROSoldier

    ROSoldier New Member

    Joined:
    Feb 1, 2015
    Messages:
    28
    Likes Received:
    0
    Its Sunday and I finally got some free time. Here is what I have at the moment: With a custom weapon, the Player aims at a Vehicle, and when he presses Fire, he Possesses the vehicle (he gets "inside" vehicle) , as expected, but the problems start here: Player is sitting in the vehicle, but cannot control it. I can "Exit" the vehicle, but the moment I exit I die, and when I respawn I can see the old "Pawn" standing where it was located the moment I fired the possession weapon. (which is kinda correct, because I want to control the vehicle without actually getting in the drivers position)
    I am using the Redeemer "possession" code.
     

Share This Page