This one is from TheSheep and is a pawn you can control via an aug. I have not tried it to see if it works, but if anyone does, would be interesting to see how far you can get to controlling a pawn with this:simulated function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
{
local float mult, randomiser;
local name damageType;
local DeusExPlayer dxPlayer;
if (Other != None)
{
// AugCombat increases our damage if hand to hand
mult = 1.0;
if (bHandToHand && (DeusExPlayer(Owner) != None))
{
mult = DeusExPlayer(Owner).AugmentationSystem.GetAugLevelValue(class'AugCombat');
if (mult == -1.0)
mult = 1.0;
}
// skill also affects our damage
// GetWeaponSkill returns 0.0 to -0.7 (max skill/aug)
mult += -2.0 * GetWeaponSkill();
//phaser damage is randomised, which for no good reason, we shall do
//after all the bonuses for skills etc
randomiser = frand();
randomiser = fclamp(randomiser, 0.2, 0.7); //gets a random value between 0.2 and 0.7
mult *= randomiser;
// Determine damage type
damageType = WeaponDamageType();
if (Other != None)
{
if (Other.bOwned)
{
dxPlayer = DeusExPlayer(Owner);
if (dxPlayer != None)
dxPlayer.AISendEvent('Futz', EAITYPE_Visual);
}
}
if ((Other == Level) || (Other.IsA('Mover')))
{
if ( Role == ROLE_Authority )
Other.TakeDamage(HitDamage * mult, Pawn(Owner), HitLocation, 1000.0*X, damageType);
SelectiveSpawnEffects( HitLocation, HitNormal, Other, HitDamage * mult);
}
else if ((Other != self) && (Other != Owner))
{
if ( Role == ROLE_Authority )
Other.TakeDamage(HitDamage * mult, Pawn(Owner), HitLocation, 1000.0*X, damageType);
if (bHandToHand)
SelectiveSpawnEffects( HitLocation, HitNormal, Other, HitDamage * mult);
if (bPenetrating && Other.IsA('Pawn') && !Other.IsA('Robot'))
SpawnBlood(HitLocation, HitNormal);
}
}
if (DeusExMPGame(Level.Game) != None)
{
if (DeusExPlayer(Other) != None)
DeusExMPGame(Level.Game).TrackWeapon(self,HitDamage * mult);
else
DeusExMPGame(Level.Game).TrackWeapon(self,0);
}
}
ControllablePawn.uc
I extended it from MJ12Troop, but it should work just as well from anything else, including Robots or Animals.
Code:
ControllerPlayerclass ControllablePawn extends MJ12Troop;
var bool bControlled;
var name DefOrders;
function PostBeginPlay()
{
Super.PostBeginPlay();
DefOrders=Orders;
}
function Controlled(bool b)
{
b=bControlled;
if(b)
SetOrders('Idle',,True);
else
SetOrders(DefOrders,,True);
}
AugController
Code:
class AugController extends Augmentation;
var Name OrigOrders;
state Active
{
function BeginState()
{
local Actor a;
local Vector HitLoc,HitNorm;
a=Trace(HitLoc,HitNorm,Player.Location+Vector(Player.ViewRotation)*2048,Player.Location+Vector(Player.ViewRotation),True);
if(ControllablePawn(a)==None)
{
Player.ClientMessage("No target acquired.");
Deactivate();
return;
}
if(ControllerPlayer(Player)!=None)
{
ControllerPlayer(Player).Controlee=ControllablePawn(a);
ControllerPlayer(Player).Controlee.Controlled(True);
}
}
}
function Deactivate()
{
Super.Deactivate();
if(ControllerPlayer(Player)!=None)
{
if(ControllerPlayer(Player).Controlee!=None)
ControllerPlayer(Player).Controlee.Controlled(False);
ControllerPlayer(Player).Controlee=None;
}
}
defaultproperties
{
EnergyRate=40.000000
Icon=Texture'DeusExUI.UserInterface.AugIconDrone'
smallIcon=Texture'DeusExUI.UserInterface.AugIconDrone_Small'
AugmentationName="Controller"
Description="The controller augmentation can instantaneously and remotely take control of motor functions."
LevelValues(0)=1.000000
}
Not 100% complete. Pawn will walk but can't jump, shoot, or frob things. This is a lot more complex and I may or may not do it. Don't hold your breath
Code:
You also need to create a new augmentation manager to allow the new aug. IIRC Tack has a tut on this. If it doesn't and you don't know how, I'll give you a copy of the relevant code which I have lying around.class ControllerPlayer extends DeusExPlayer;
var ControllablePawn Controlee;
state PlayerWalking
{
function ProcessMove ( float DeltaTime, vector newAccel, eDodgeDir DodgeMove, rotator DeltaRot)
{
local Vector loc,acc;
if(Controlee!=None)
{
if(DodgeMove!=DODGE_Left && DodgeMove!=DODGE_Right)
{
acc=newAccel;
if(bool(bDuck) && acc.Z==0.0)
{
bDuck=0;
acc.Z=-256;
}
Controlee.Velocity=Normal((aUp*vect(0,0,1)+aForward*vect(1,0 ,0)+aStrafe*vect(0,1,0))>>ViewRotation)*1024;
Controlee.ViewRotation=viewRotation;
Controlee.SetRotation(Rotation);
}
Velocity=vect(0,0,0);
}
else
Super.ProcessMove(DeltaTime,newAccel,DodgeMove,DeltaRot) ;
}
function PlayerTick(float deltaTime)
{
if(Controlee!=None)
Controlee.ViewRotation=ViewRotation;
Super.PlayerTick(deltatime);
}
}
exec function ParseLeftClick()
{
if(Controlee!=None)
{
//make the pawn shoot - CODE ME!!!!!!!!!!!!!!!!!
}
else
Super.ParseLeftClick();
}
exec function Fire(optional float F)
{
if(Controlee==None)
Super.Fire(F);
}
Another from TheSheep, a thermal scope. You just put this in the weapon class you want to use the scope on. I think it needs slight modification to work or it won't compile right.
var byte ScopeMode;
const SM_NONE=0;
const SM_OPTICAL=1;
const SM_THERMAL=2;
replication
{
reliable if(Role==ROLE_Authority)
ThermalScopeOn,ThermalScopeOff;
reliable if(Role<ROLE_Authority)
FullScopeOff,OpticalScopeOn,ScopeMode,OpticalScop eOff;
}
simulated function ScopeOn() { } //does nothing!
simulated function OpticalScopeOn()
{
local DeusExPlayer p;
p=DeusExPlayer(owner);
if(p==None) return;
/* Removed this. It requires the separate class, BleaterScope view, and allows a full-screen scope in singleplayer.
if(Level.NetMode==NM_Standalone && DeusExRootWindow(p.rootWindow)!=None && DeusExRootWindow(p.rootWindow).scopeview.class!=class'BleaterScopeView')
{
DeusExRootWindow(p.rootWindow).scopeview.Destroy();
DeusExRootWindow(p.rootWindow).scopeView = BleaterScopeView(DeusExRootWindow(p.rootWindow).NewChild(Class'BleaterScopeView', False));
DeusExRootWindow(p.rootWindow).scopeView.SetWindowAlignments(HALIGN_Full, VALIGN_Full, 0, 0);
DeusExRootWindow(p.rootWindow).scopeView.Lower();
}*/
VisionOff();
RefreshScopeDisplay(DeusExPlayer(Owner), False, True);
}
simulated function ThermalScopeOn()
{
/* if(ScopeMode!=SM_THERMAL) //not replicated for ThermalScope, so removed
{
BroadcastMessage("Wrong scope mode - "$ScopeMode);
FullScopeOff();
return;
}*/
VisionOff();
RefreshScopeDisplay(DeusExPlayer(Owner), False, True);
DeusExRootWindow(DeusExPlayer(owner).rootWindow).hud.augDisplay.bVisionActive = True;
if(Level.NetMode==NM_Standalone)
{
DeusExRootWindow(DeusExPlayer(owner).rootWindow).hud.augDisplay.visionLevel = 4;
DeusExRootWindow(DeusExPlayer(owner).rootWindow).hud.augDisplay.visionLevelValue = 800.0;
}
else
{
DeusExRootWindow(DeusExPlayer(owner).rootWindow).hud.augDisplay.visionLevel = 3;
DeusExRootWindow(DeusExPlayer(owner).rootWindow).hud.augDisplay.visionLevelValue = 800.0;
}
}
simulated function ScopeOff()
{
FullScopeOff();
}
simulated function FullScopeOff()
{
OpticalScopeOff();
ThermalScopeOff();
}
simulated function OpticalScopeOff()
{
ScopeMode=SM_NONE; //if it's called from something other than ScopeToggle
RefreshScopeDisplay(DeusExPlayer(Owner), False, False);
}
simulated function ThermalScopeOff()
{
VisionOff();
DeusExRootWindow(DeusExPlayer(owner).rootWindow).hud.augDisplay.bVisionActive = False;
}
simulated function ScopeToggle()
{
if(!IsInState('Idle') || owner==None || !owner.IsA('DeusExPlayer') || !bHasScope) return;
//removed: HAW-specific
//if(DeusExPlayer(owner)!=None && ProjRocketTOW(DeusExPlayer(owner).ViewTarget)!=None) return;
ScopeMode++;
if(ScopeMode>SM_THERMAL) ScopeMode=SM_NONE;
switch(ScopeMode)
{
case SM_NONE:
FullScopeOff();
break;
case SM_OPTICAL:
OpticalScopeOn();
break;
case SM_THERMAL:
ThermalScopeOn();
break;
default:
Log("Error: bad scope mode "$ScopeMode$".");
}
}
simulated function VisionOff() //disabled vision aug
{
local DeusExPlayer player;
local AugmentationManager augSys;
local Augmentation anAug;
player=DeusExPlayer(owner);
if(player==None) return;
augSys=player.AugmentationSystem;
if(augSys==None) return;
anAug = augSys.FirstAug;
while(anAug != None)
{
if(anAug.IsA('AugVision'))
break;
anAug = anAug.next;
}
if (anAug == None)
return;
if (anAug.bIsActive)
anAug.Deactivate();
}