A random sentence for a random mind.

ScriptedPawn weaponholder problem

For questions and discussion about UnrealEd, UnrealScript, and other aspects of Unreal Engine design.

Moderators: Semfry, ividyon

xortion
Skaarj Scout Skaarj Scout
Posts: 15
Joined: 26 Oct 2012, 07:11

Subject: ScriptedPawn weaponholder problem

Post Posted: 22 Feb 2013, 04:10

Basically what I'm doing is making a pawn that switches weapons when the function is called.

Code: Select all

function SwitchWeapon()
{
local int wrand, numweapons;
local weapon NextWeapon;

SetTimer( 60, True);   //don't want to constantly switch weapons
NumWeapons = GetLoadoutValues();
wrand = Rand(numWeapons);

   if ( (switchTimeover)&&(!WeaponGrabbed) )
   {
        TossWeapon();
   bIsPlayer = True;
   WeaponGrabbed = True;
   NextWeapon = Spawn(Myloadout[wrand]);
   NextWeapon.GiveTo(self);
   }

}


function TossWeapon()
{
   local vector X,Y,Z;
   if ( Weapon == None )
      return;
   GetAxes(Rotation,X,Y,Z);
   Weapon.Destroy();
}



First off, the pawn works as far as HOLDING the weapon and firing it, etc. That's not the problem. All the functions here work.

The problem is that when the weapon actually spawns, he does not pick it up. He has to walk away from it, then back to it to pick it up.

I've already tried the SkaarjTrooper pickup method of Weapon.Touch(self); it was a no go :S

Any ideas?

StudioF
Skaarj Scout Skaarj Scout
Posts: 19
Joined: 30 Jan 2008, 06:38
Contact:

Subject: Re: ScriptedPawn weaponholder problem

Post Posted: 22 Feb 2013, 13:06

try the playerscript. ( just an idea, im not a coder but i guess the code must be in there somewhere)

User avatar Buff Skeleton
>:E >:E
Posts: 4173
Joined: 15 Dec 2007, 00:46

Subject: Re: ScriptedPawn weaponholder problem

Post Posted: 22 Feb 2013, 16:37

There was a hacky fix for this in Oldskool, but I can't remember what it was (and it was kind of bad anyway). I think 227 also fixed this, but it may have been more engine-based.

I have a shitty hack idea you can try: Set the pawn's or weapon's location to somewhere just outside the weapon's collision cylinder (do a trace check with the pawn's collision cylinder first to ensure the location is valid and reachable), then have it slide back into position. You can minimize the distance by setting the weapon's collision to something very small, like setcollisionsize(1,1); until it's picked up again, then set it back to default. There's probably a way to ACTUALLY fix this, though, but I'm not sure without spending some significant time on it.
Image


Who is online

Users browsing this forum: No registered users and 34 guests

Copyright © 2001-2024 UnrealSP.org

Powered by phpBB® Forum Software © phpBB Limited