Code not working (vector stuff)

The best and quickest support by a group of top-notch editing specialists, guaranteed!

Moderator: Forum Guards

Code not working (vector stuff)

Postby Cozmo » Tue Nov 23, 10 1:51 am

So close to finally finishing this mod, but silly little things like this keep getting in the way. Argh.

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. :)
Cozmo
Master
 
Posts: 1266
Joined: Tue Jun 28, 05 10:53 am
Location: UK

Return to Editing issues

Who is online

Users browsing this forum: No registered users and 15 guests
cron