From Gustavo6046, 4 Months ago, written in UnrealScript.
This paste is a reply to CoopMatch gametype from Gustavo6046 - view diff
Embed
  1. //=============================================================================
  2. // CoopMatch.
  3. //=============================================================================
  4. class CoopMatch expands TeamGamePlus;
  5.  
  6. simulated function ScoreKill(Pawn Killer, Pawn Other)
  7. {
  8.     if ( ScriptedPawn(Killer) != None && Other.bIsPlayer )
  9.         return;
  10.  
  11.     if ( ScriptedPawn(Other) != None && Killer.bIsPlayer )
  12.         Super(DeathMatchPlus).ScoreKill(Killer, Other);
  13.        
  14.     else
  15.         Super.ScoreKill(Killer, Other);
  16. }
  17.  
  18. function byte AssessBotAttitude(Bot aBot, Pawn Other)
  19. {
  20.     if ( (Other.bIsPlayer && (aBot.PlayerReplicationInfo.Team == Other.PlayerReplicationInfo.Team))
  21.         || (Other.IsA('TeamCannon')
  22.             && (StationaryPawn(Other).SameTeamAs(aBot.PlayerReplicationInfo.Team))) )
  23.         return 5;
  24.        
  25.     else if ( ScriptedPawn(Other) != None && ScriptedPawn(Other).AttitudeTo(aBot) == 1 )
  26.         return 1;
  27.    
  28.     else
  29.         return Super.AssessBotAttitude(aBot, Other);
  30. }
  31.  
  32. function bool SendBotToGoal(Bot aBot)
  33. {
  34.     local Teleporter Dest, T;
  35.     local int i;
  36.     local bool b;
  37.    
  38.     foreach AllActors(class'Teleporter', T)
  39.     {
  40.         for ( i = 0; i < Len(T.URL); i++ )
  41.             if ( mid(T.URL, i, 1) == "#" )
  42.                 b = True;
  43.                
  44.         if ( !b )
  45.             continue;
  46.    
  47.         if ( ( Dest == None || VSize(aBot.Location - T.Location) < VSize(Dest.Location - aBot.Location) ) )
  48.             Dest = T;
  49.     }
  50.        
  51.     if ( Dest != None )
  52.         aBot.MoveTarget = aBot.FindPathToward(Dest);
  53.    
  54.     if ( aBot.MoveTarget == None )
  55.     {
  56.         aBot.bStayFreelance = true;
  57.         aBot.Orders = 'FreeLance';
  58.         if ( aBot.bVerbose && Dest != None )
  59.             log(aBot.PlayerReplicationInfo.PlayerName$" freelance because no path to exit "$Dest$" from "$aBot.Location);
  60.            
  61.         return false;
  62.     }
  63.    
  64.     else
  65.     {
  66.         SetAttractionStateFor(aBot);
  67.         return true;
  68.     }
  69. }
  70.  
  71. defaultproperties
  72. {
  73.     bNoMonsters=false
  74.     MapPrefix=""
  75.     bCoopWeaponMode=true
  76.     BeaconName="CPMT"
  77.     GameName="Campaign Botmatch"
  78.     MaxCommanders=2
  79.     StartUpMessage="Work with your teammates against the monsters towards the exit."
  80.     MaxTeams=1
  81.     MaxAllowedTeams=4
  82. }
  83.