Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 |
//============================================================================= // CoopGame. //============================================================================= class CoopGame extends UnrealGameInfo; var() config bool bNoFriendlyFire; var bool bSpecialFallDamage; function PostBeginPlay() { Super.PostBeginPlay(); bClassicDeathMessages = True; } function bool IsRelevant(actor Other) { // hide all playerpawns if ( Other.IsA('PlayerPawn') && !Other.IsA('Spectator') ) { Other.SetCollision(false,false,false); Other.bHidden = true; } return Super.IsRelevant(Other); } function float PlaySpawnEffect(inventory Inv) { Playsound(sound'RespawnSound'); if ( !bCoopWeaponMode || !Inv.IsA('Weapon') ) { spawn( class 'ReSpawn',,, Inv.Location ); return 0.3; } return 0.0; } event playerpawn Login ( string Portal, string Options, out string Error, class<playerpawn> SpawnClass ) { local PlayerPawn NewPlayer; local string InName, InPassword; local pawn aPawn; NewPlayer = Super.Login(Portal, Options, Error, SpawnClass); if ( NewPlayer != None ) { if ( !NewPlayer.IsA('Spectator') ) { NewPlayer.bHidden = false; NewPlayer.SetCollision(true,true,true); } log("Logging in to "$Level.Title); if ( Level.Title ~= "The Source Antechamber" ) { bSpecialFallDamage = true; log("reduce fall damage"); } } return NewPlayer; } function NavigationPoint FindPlayerStart( byte Team, optional string incomingName ) { local PlayerStart Dest, Candidate[8], Best; local float Score[8], BestScore, NextDist; local pawn OtherPlayer; local int i, num; local Teleporter Tel; num = 0; //choose candidates foreach AllActors( class 'PlayerStart', Dest ) { if ( (Dest.bSinglePlayerStart || Dest.bCoopStart) && !Dest.Region.Zone.bWaterZone ) { if (num<4) Candidate[num] = Dest; else if (Rand(num) < 4) Candidate[Rand(4)] = Dest; num++; } } if (num>4) num = 4; else if (num == 0) return None; //assess candidates for (i=0;i<num;i++) Score[i] = 4000 * FRand(); //randomize foreach AllActors( class 'Pawn', OtherPlayer ) { if (OtherPlayer.bIsPlayer) { for (i=0;i<num;i++) { NextDist = VSize(OtherPlayer.Location - Candidate[i].Location); Score[i] += NextDist; if (NextDist < OtherPlayer.CollisionRadius + OtherPlayer.CollisionHeight) Score[i] -= 1000000.0; } } } BestScore = Score[0]; Best = Candidate[0]; for (i=1;i<num;i++) { if (Score[i] > BestScore) { BestScore = Score[i]; Best = Candidate[i]; } } return Best; } function int ReduceDamage(int Damage, name DamageType, pawn injured, pawn instigatedBy) { if ( bNoFriendlyFire && (instigatedBy != None) && instigatedBy.bIsPlayer && injured.bIsPlayer && (instigatedBy != injured) ) return 0; if ( (DamageType == 'Fell') && bSpecialFallDamage ) return Min(Damage, 5); return Super.ReduceDamage(Damage, DamageType, injured, instigatedBy); } function bool ShouldRespawn(Actor Other) { if ( Other.IsA('Weapon') && !Weapon(Other).bHeldItem && (Weapon(Other).ReSpawnTime != 0) ) { Inventory(Other).ReSpawnTime = 1.0; return true; } return false; } function SendPlayer( PlayerPawn aPlayer, string URL ) { // hack to skip end game in coop play if ( left(URL,6) ~= "endgame") { Level.ServerTravel( "Vortex2", false); return; } Level.ServerTravel( URL, true ); } function PlayTeleportEffect( actor Incoming, bool bOut, bool bSound) { } function Killed(pawn killer, pawn Other, name damageType) { super.Killed(killer, Other, damageType); if ( (Killer != None) && (Other.bIsPlayer || Other.IsA('Nali')) ) killer.PlayerReplicationInfo.Score -= 2; } function AddDefaultInventory( pawn PlayerPawn ) { local Translator newTranslator; if ( Level.DefaultGameType != class'VRikersGame' ) Super.AddDefaultInventory(PlayerPawn); // Spawn translator. if( PlayerPawn.IsA('Spectator') || PlayerPawn.FindInventoryType(class'Translator') != None ) return; newTranslator = Spawn(class'Translator',,, Location); if( newTranslator != None ) { newTranslator.bHeldItem = true; newTranslator.GiveTo( PlayerPawn ); PlayerPawn.SelectedItem = newTranslator; newTranslator.PickupFunction(PlayerPawn); } } defaultproperties { bNoFriendlyFire=True bHumansOnly=True bRestartLevel=False bPauseable=False bCoopWeaponMode=True ScoreBoardType=Class'UnrealShare.UnrealScoreBoard' GameMenuType=Class'UnrealShare.UnrealCoopGameOptions' RulesMenuType="UMenu.UMenuCoopGameRulesSClient" SettingsMenuType="UMenu.UMenuCoopGameRulesSClient" BeaconName="Coop" GameName="Coop Game" } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |