In my map DM-1on1-TheVeryEndOfYou , there's a trap:
When we shoot the target, a mover goes down and squishs the players who are under it.
I want bots to be able to shoot the target to activate the squisher.
I create a squisher volume (placed under the mover which squish players). When a pawn enter the volume, i search for bots who would like to activate the sqhisher.
Then I ask him to shoot with shootSpecial(targetSquisher) (in class Pawn).
Here's the code
but it doesn't function ! The function is called at the right moment but the bot doesn't shoot !
Could anyone help me.
Thanks
When we shoot the target, a mover goes down and squishs the players who are under it.
I want bots to be able to shoot the target to activate the squisher.
I create a squisher volume (placed under the mover which squish players). When a pawn enter the volume, i search for bots who would like to activate the sqhisher.
Then I ask him to shoot with shootSpecial(targetSquisher) (in class Pawn).
Here's the code
Code:
//============================================================================= // SquisherVolume. //============================================================================= class SquisherVolume extends PhysicsVolume; var Pawn PawnInVolume[8]; var Actor targetSquisher; //Find the target function PostBeginPlay() { local mover M; ForEach AllActors(class'Mover', M, 'TargetSquisher') targetSquisher = M; } event Touch(Actor Other) { local Controller P, Killer; local Actor A; Super.Touch(Other); //Search for bot who would activate the squisher if(Pawn(Other)!=None) { for ( P=Level.ControllerList; P!=None; P=P.NextController ) if( P.Pawn.PlayerReplicationInfo.bBot && shouldSquish(P.Pawn) && P.Pawn.CanAttack(targetSquisher)) { log("BOT WILL SHOOT "$targetSquisher$" !!!!!!!!!!!!!!!"); A = P.Pawn.ShootSpecial(targetSquisher); } } } //Ask if the Bot should activate the squisher function bool shouldSquish(Pawn Bot) { local int i; updatePawnInVolume(); for(i=0;i<8;i++) { //don't kill the bot itself if(Bot == PawnInVolume[i]) return false; //don't kill teamate if(Level.Game.bTeamGame && (Bot.PlayerReplicationInfo.Team == PawnInVolume[i].PlayerReplicationInfo.Team)) return false; } // Pawn should squish return true; } //Put in an array, all the pawns which are in the volume function updatePawnInVolume() { local Pawn P; local int i; for(i=0;i<8;i++) PawnInVolume[i] = None; i = 0; forEach TouchingActors(class'Pawn', P) { if( (P.Health > 0) && !P.IsA('Spectator') ) { PawnInVolume[i] = P; i++; } } }
Could anyone help me.
Thanks
Comment