I'm currently creating deployable turrets, and a strange thing happens. When deployed, the turrets are assigned to the Instigator's team. The colour of the deployable also changes due to this. The strange thing is that after deploying, even though the deployed turret's colour matches the team colour of the instigator, all bots in the game try to kill the turret, including the Instigator himself. Here's what happens when you fire the deploy weapon:
Here's what happens when it tries to set the team, in a subclass of Pawn:Code:function bool Deploy( vector DeployLocation, rotator DeployRotation, bool bAltActivate ) { local Actor A; // make sure owner won't be gibbed by item (e.g. if near wall & this causes item to move into player) Instigator.SetCollision( false, false, false ); if( bIgnoreOwnerYaw ) DeployRotation.Yaw = 0; A = Spawn( DeployClass, , , DeployLocation, DeployRotation ); //GE: No owner, because it's set later (KillerController). Instigator.SetCollision( Instigator.default.bCollideActors, Instigator.default.bBlockActors, Instigator.default.bBlockPlayers ); if( A == None ) return false; // if the spawn succeeds, complete the deployment // common initialization UseSkill( DeploySkillCost ); A.SetPhysics( PHYS_Falling ); A.Instigator = Instigator; if( Instigator!=none ) { if ( U2DeployedUnit(A)!=none ) U2DeployedUnit(A).SetKillerController( Instigator.Controller ); else if ( U2MineBase(A) != none ) U2MineBase(A).SetKillerController( Instigator.Controller ); } if( bTossProjectiles ) TossDeployed( A, Instigator ); // custom initialization PostDeploy( A, bAltActivate ); return true; } //----------------------------------------------------------------------------- function PostDeploy( Actor DeployedActor, bool bAltActivate ) { local U2DeployedUnit DU; assert( Instigator != None ); DU = U2DeployedUnit(DeployedActor); if( DU!=none ) { DU.SetActive( false ); DU.SetTeam( Instigator.GetTeamNum() ); DU.Initialize( bAltActivate ); } }
I've tried changing else ifs in the last function to just ifs, but it's the same.Code:simulated function SetTeam(int NewTeam) { if( U2StationaryPawnController(Controller)!=none ) U2StationaryPawnController(Controller).SetTeam( NewTeam ); else if ( (PlayerReplicationInfo != None) && (PlayerReplicationInfo.Team != None) ) PlayerReplicationInfo.Team.TeamIndex = NewTeam; else TeamIndex = NewTeam; ClientTeamIndex = NewTeam; SetTeamSkin(Self, NewTeam); // hack }
Anyone knows what's wrong?



Reply With Quote



Bookmarks