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