- Code: Select all
state Activated
{
function Activate()
{
// can't turn it off
}
function BeginState()
{
local Vector StartTrace, EndTrace, HitLocation, HitNormal;
local Actor HitActor;
local DeusExPlayer P;
local CozDecoration CD;
local Vector placeLocation;
local Vector placeNormal;
P = DeusExPlayer(Owner);
Super.BeginState();
// trace out ten foot in front of the pawn
StartTrace = Owner.Location;
EndTrace = StartTrace + Vector(Pawn(Owner).ViewRotation) * 320;
StartTrace.Z += Pawn(Owner).BaseEyeHeight;
EndTrace.Z += Pawn(Owner).BaseEyeHeight;
HitActor = Trace(HitLocation, HitNormal, EndTrace, StartTrace);
if (HitActor == Level)
{
placeLocation = HitLocation;
placeNormal = HitNormal;
}
CD = spawn(DecoClass, Owner,, placeLocation, Rotator(placeNormal));
CD.MyOwner = P;
UseOnce();
}
Begin:
}
That's all there is in this class; no variables outside of locals and no other functions or w/e. Basically, it's just a decoration the player can use, so I could do it differently but I really wanna get it sticking to walls etc. It uses a modified version of the DeusExWeapon.uc code to find a point on a surface and spawn the TV there.
It should work, but it doesn't. Atm it just spawns the class slightly left of wherever the player is, and never on a wall. It's late here so maybe I'm missing something but can't see it. Help appreciated.