Wrong, I said that IT IS already BEING called twice so they spawn 2 weapons and attempting a twice touch - and both of them are crapped up because are spawned Too EARLY. Yeah, that "coder" was pretty much clueless how does trooper work, but addicted to more brain-farts - let's do the error TWICE if once is not enough. If I will rewrite a fixed version of those pawns, I will remove that crapped duplicated code, they are Troopers and they already do spawn weapon, they don't even need that repeated "auto state" because it do happens already - and NOTHING is changed from original so my question is: For which purpose was duplicated ?
and the cake...
Code: Select all
class Humangrant expands SkaarjTrooper; //So we are doing again the stupid thing
LIKE I said, Drop them in "GameEnded" until game is being started - End of story.
As a note those pawns Could be direct child of ScriptedPawn and writing properly weaponry code rather that calling the default sh!t again. By example my NsMonster (troopers there) doesn't use any bIsPlayer as a master option - just as a backup and only if a weapon is in range to be touched else they will never spam crap with bIsPlayer stupidity.
Edit: Piece of stuff used by me for safety...
Code: Select all
function bool CheckReplacement( Actor Other, out byte bSuperRelevant)
{
local Inventory Inv;
local int i;
local Pawn P;
bSuperRelevant = 1;
if ( Weapon(Other) != None && Weapon(Other).Instigator != None && Weapon(Other).Instigator.IsA('Pawn') ) //Make sure about when timer is sucky
{
P = Weapon(Other).Instigator;
if ( P.Health > 0 && P.PlayerReplicationInfo == None )
spawn (class'PawnControl',P,,P.Location); //Wait a bit to see what's the deal
}
if ( MH.bMegaSpeed && Other.bIsPawn && Pawn(Other).bIsPlayer )
{
Pawn(Other).GroundSpeed *= 1.4;
Pawn(Other).WaterSpeed *= 1.4;
Pawn(Other).AirSpeed *= 1.4;
Pawn(Other).AccelRate *= 1.4;
}
....
This is part of "MonsterBase" or such...
And the toy:
Code: Select all
class PawnControl expands Info;
var Pawn P;
var float Patience;
event PrebeginPlay()
{
}
event PostBeginPlay()
{
Patience=0.15; //wait a bit to see what's the deal
}
function FinishWaiting()
{
local Weapon W;
if ( Pawn(Owner) != None && Pawn(Owner).Health > 0 )
P = Pawn(Owner);
if ( P == None || P.bDeleteMe || P.Health <= 0 )
{
Destroy();
GoTo JL48;
}
if ( P != None && P.Weapon == None )
{
Foreach RadiusActors (class'Weapon',W,100,P.Location)
{
if ( W != None && W.Instigator == P )
{
W.BecomeItem(); // Do not mess anims
P.AddInventory(W);
W.GiveAmmo(P);
}
}
P.SwitchToBestWeapon();
P.bIsPlayer = False;
}
JL48:
}
Auto State CheckAndGo
{
Begin:
Sleep(Patience);
DoneWaiting:
FinishWaiting();
LifeSpan=0.1;
}
Yehaw!
The bug: Recommend breaking iterator at first weapon loaded ? Or allow all load ? Some "weapon holders" uses More than one weapon... so we might have multiple copies of such "helpers".