mirror of
https://github.com/Ragora/TribesReplay.git
synced 2026-01-21 02:24:43 +00:00
Map Editor =================================== Several editor crashes have been resolved and this tool should be more stable for the MOD community now. VCR Mode =================================== The VCR Mode has been implemented. F3 starts recording. F4 stops the current recording. Multiple recordings can be made from the same mission. Other controls can be used while playing back a recording. They include: -- ESCAPE will stop the playback -- TAB will pop up the playback controls window in the upper part of the screen -- SPACEBAR will pause/unpause the playback -- Numpad + will increase the time step so that the playback accelerates (maximum of 16X speed) -- Numpad - will decrease the time step so that the playback slows down (minimum of 1/16X speed) ***If you Alt-Tab to windows to rename a demo file and then return to Tribes instead of using the rename file feature of the demo recorder you will crash after you exit the recorder. It is a windows issue and so we can't fix it. Satchel Charge Icon Glow =================================== When the satchel charge is deployed and ready to explode, the icon now glows. The icon disappears completely when the satchel is destroyed (either through activation or destruction). This allows players to more readily keep track of satchel charge status. "Visibility" option for Server Admins ===================================== Allows an Advanced Server option to indicate whether the server will use the "Speed" or "Distance" versions of the maps when hosting games. The "Distance" setting will use world versions with much less fog and more visible distance. The "Speed" setting will use the current foggier map settings. These settings will be displayed as a new column on the Master Server List titled "VISIBILITY" and the settings will be "Speed" or "Distance". NOTE: This visibility change won't be apparent on all maps. A map you can use as a test to show the differences is "Dessicator". World Skins Default to Main Tribes ========================================== The missions are now set up so they have default skins other than "Storm" vs. "Inferno". This occurs whenever a player has "Show Individual Skins" toggled OFF. In otherwords, some maps will have "Diamond Skin" vs. "StarWolf", while others will have different combinations. (NOTE: If a player has "Show Individual Skins" toggled ON, then he will see the regular individual skins for players.) New voice samples have been added to allow Victory messages indicate these new team skins. Also note: Bioderms are bioderms, regardless of the team they are on...we're not changing models or voice packages. Teams now use skins for CTF games relative to the planet - as follows: Terrain Team 1 Team 2 Ice Starwolf Blood Eagle Lush Blood Eagle Diamond Sword Badlands Starwolf Diamond Sword Desert Phoenix Blood Eagle Lava Diamond Sword Phoenix If the server admin wishes to specify team skins, set the variable $host:: useCustomSkins = true; in serverPrefs.cs if this variable is set true the skins and names used are $Host::TeamName1 and $Host::TeamName2 and $Host::TeamSkin1 and $Host::TeamSkin2 also set in serverPrefs.cs. These team and skin names are always used for non-CTF games. NOTE: In "Tournament" mode games, the skins will always default to Storm and Inferno rather than world-specific skins. This is to make it easier for League and Ladder players to assign teams to sides. Cheat Fixes =================================== Significant cheat prevention code has been implemented to eliminate known cheats, as well as to make it much more difficult for future cheating of a similar nature to occur. NOTE: If you have any troubles running a server now, you may have altered or removed something from the build on your server. The code is checking almost everything now (shapes, textures, etc.), so you should ensure that you have all files present from a normal build on your server. (Additional files, like MODs and extra art files won't be a problem...but all original files must be there as well.) Siege Halftime Improved =================================== The Siege halftime now gets a screen listing the winning team instead of simply "Switching Sides". CTF Individual Scoring =================================== No change was made whatsoever to the team CTF scoring. But the individual scoring now takes into account vehicle kills, more repair/destroy stuff, and makes it nice and robust for statistical tracking later. NOTE: The scores are dramatically inflated compared to previous individual scores so that we had more "granularity" in the system and didn't have to use decimal points. Thus, you will appear to be racking up a huge amount of points, but it's all relative when compared to other players in the game. Scoring Details ---------------------- Kill: 10 pts Flag Capture: 30 pts Flag Grab (if subsequently captured): 20 [A one player grab-and-cap you get both for a total of 50] Carrier Escort: 3 Sniper Headshot: 1 Turret kill: manned: 10 automated: 3 Flag Defend: 5 Flag Carrier Kill: 5 Flag Return: 0 - 10 pts [Points are scaled by distance: no points for a short return. 10 pts if the flag carrier gets all the way to the flag. 1 point per 10% (Halfway is 5 pts.)] 15 points if the return breaks a stalemate (both teams have had each others flags for 60 seconds or longer.) Generator Defend: 5 pts Object Destroy Repair Generator 10 8 Sensor 4 1 Base Turret 5 4 Inv Station 2 2 Vehicle Station 5 4 Solar Panel 5 4 Sentry Turret 4 2 Deployed sensor 1 0 Deployed inv station 2 0 Deployed turret 3 3 Shrike 5 Bomber 8 Havoc 5 Wildcat 5 Tank 8 MPB 12 *vehicles destroyed by mines are double points, vehicles destroyed by the Shrike are triple points **vehicles destroyed also score 2 points per passenger (after any multiplier) ***points accumulated in a vehicle are earned by everyone in the vehicle Heat Lock vs. Target Laser Lock =================================== Heat Locking now supercedes Targeting Laser Locking so that heat locks can be attained on objects that are being lazed by friends. Keep in mind that when the target is out of range for the ML, it will still lock onto the targeting laser giving the appearance that its locking onto the laser first. If the target is in range the ML will always look for heated targets first. Objective HUD Visible on Vehicles =================================== The objective HUD is now visible while flying/driving vehicles. Client-Side Toggle on Vehicle Tport =================================== The player now has the ability to toggle Vehicle Tport ability on/off (defaults to ON) as a client-side option in SETTINGS/GAME. EAX Sound Improvements =================================== EAX environmental sound reverbs have been included for underwater and interiors. Those sounds will only be heard when using EAX or EAX2 drivers. (We recommend EAX for best results.) IFeel Force Feedback Mouse =================================== The IFeel force feedback mouse vibrations should now work correctly again. They have also been enhanced beyond what was previously available. Vehicles Parking on Flags =================================== "Anti-Parking" code has been added to flags similar to the "anti-camping" code around a Nexus in Hunters. This results in vehicles taking damage over time when they are parked near a flag, eventually resulting in their destruction if left there too long. Aiming Up and Down =================================== The restrictions on aiming up and down have been virtually removed for all armors. NOTE: This will result in situations where your weapon can clip through the leg of your armor when looking straight down. If this bothers you, then change your graphics setting to "Items Only" so that your body is not drawn when in first-person perspective. Jetpower for Suits =================================== Scout jetpower (power of thrust) was reduced to previous levels, but their maximum speed velocity was increased somewhat. This removes the "butterfly" effect, but allows slightly faster skiing than previously allowed. Additionally, air resistance was reduced by 33% on all armors to further reduce the "floaty" feel. This also allows slightly faster speeds across the board. Splash Damage =================================== Splash damage on shots was reduced slightly. It is still much more powerful than when the game was released, but this change makes mortars and grenades more playable. Shrike Speed =================================== The Shrike thrust was returned to normal, making the Shrike very responsive again. A new maximum speed cap has been added to prevent it from going too fast, but the performance improvement on this vehicle is significant. Mine Damage =================================== Mine damage was reduced slightly to prevent Lights from being one-shotted by stepping on a mine. They will still be severely harmed, but won't go from 100% health to dead in one shot. Missile Launcher =================================== The Missile Launcher range had been inadvertently reduced during the reticule improvements a few patches back. It has now been increased back to its original design. Range is now 400m. Heat Signature Fall Off =================================== Heat reduces *very slightly* slower than it did previously. Players can still easily manage their heat signatures, but must be a bit more paranoid of missile launchers now (thus making it a bit easier for high-ping players to use this weapon). Suit Mortars vs. Tanks =================================== The strength of hand-held mortars versus Tanks was incorrectly weak. It has now been increased so that it is much more useful. Shrike Gun Changes =================================== The Shrike blasters have been moved out to the wing joints to allow easier strafing of objects. Additionally, there is some (very minor...one degree of spread) projectile spread on the blasters now to make strafing easier. (For comparison purposes, the chaingun has eight degrees of spread.)The range of the blasters was incorrectly enormous and has been reduced to a balanced distance (slightly outside the range of hand-held missile launchers). Water Movement =================================== Speeds in water have been greatly increased so as to make water a more viable playing environment. Whiteout Grenades =================================== A maximum saturation has been defined for the Whiteout grenades to keep your "whiteout" time to no more than two seconds. OOB Grid =================================== The mission boundary is now visually defined. As you approach a mission boundary, and "out of bounds grid" will fade into existence. If you go past the boundary, the grid will not fade out until you return inside the mission area. This is done to make it easier to avoid getting a flag stripped or getting damaged due to OOB damage. This visual option can be toggled OFF in your Game Settings area (option button is called "Show Out of Bounds Grid"). Wildcat Grav Bike =================================== "Suspension" has been added to the Wildcat making it easier to control over rough terrain. Air Drag =================================== Air Drag has been reduced making the game feel "faster". Panther XL Support Added =================================== Players will now be able to satisfactorily map the roller ball of the Panther XL. The Z axis or throttle is not configurable with T2 because of a Panther XL driver issue. Flight Ceiling limited for Shrike =================================== If you fly past the flight ceiling then you will lose your jetting and thrusting ability. Angle your nose down (when you are above the flight ceiling) and thrust will function normally. "Unassigned" Team =================================== This bug allowed a person to join as "unassigned" and view all friend/foe triangles as grey. It has been fixed. <Null> and random string issues =================================== There is a finite number of network strings available, the single quote strings. This problem occurs when all strings have been allocated. This is particularly common with mod servers, which appear to be allocating too many net strings. Mod and script developers need to be cautious when creating new strings. Don't create dynamic net strings unless you have a firm understanding of the implications. If a string is added using "AddTaggedString" make sure that there is a corresponding "RemoveTaggedSting" call when the string is no longer needed. Also be sure to limit the number of imbedded strings in your scripts.
1311 lines
36 KiB
C#
1311 lines
36 KiB
C#
// Training Script
|
|
//echo("Running Training Script");
|
|
|
|
datablock EffectProfile(TrainingHudUpdateEffect)
|
|
{
|
|
effectname = "gui/objective_notification";
|
|
minDistance = 10;
|
|
};
|
|
|
|
datablock AudioProfile(TrainingHudUpdateSound)
|
|
{
|
|
filename = "gui/objective_notification.wav";
|
|
description = AudioDefault3d;
|
|
effect = TrainingHudUpdateEffect;
|
|
preload = true;
|
|
};
|
|
|
|
datablock AudioProfile(MessageRecieveSound)
|
|
{
|
|
filename = "gui/objective_notification.wav";
|
|
description = AudioDefault3d;
|
|
preload = true;
|
|
};
|
|
|
|
// for training5
|
|
datablock ForceFieldBareData(defaultNoTeamLavaLightField)
|
|
{
|
|
fadeMS = 1000;
|
|
baseTranslucency = 1;
|
|
powerOffTranslucency = 0;
|
|
teamPermiable = false;
|
|
otherPermiable = false;
|
|
color = "1.0 0.4 0.0";
|
|
targetTypeTag = 'ForceField';
|
|
|
|
texture[0] = "skins/forcef1";
|
|
texture[1] = "skins/forcef2";
|
|
texture[2] = "skins/forcef3";
|
|
texture[3] = "skins/forcef4";
|
|
texture[4] = "skins/forcef5";
|
|
|
|
framesPerSec = 10;
|
|
numFrames = 5;
|
|
scrollSpeed = 15;
|
|
umapping = 1.0;
|
|
vmapping = 0.15;
|
|
};
|
|
|
|
// load the voice text and wav file
|
|
exec("scripts/spDialog.cs");
|
|
|
|
|
|
function setSinglePlayerGlobals()
|
|
{
|
|
// server settings
|
|
//$MPRestoreBotCount = $Host::BotCount; this one is done automatically in server.cs
|
|
$MPRestoreBotMatchBotCount = $Host::BotMatchBotCount;
|
|
$MPRestoreBotsEnabled = $Host::BotsEnabled;
|
|
$MPRestoreMaxBotDifficulty = $Host::MaxBotDifficulty;
|
|
$MPRestoreMaxPlayers = $Host::MaxPlayers;
|
|
$MPRestoreMinBotDifficulty = $Host::MinBotDifficulty;
|
|
$MPRestoreTimeLimit = $Host::TimeLimit;
|
|
$MPRestoreTournamentMode = $Host::TournamentMode;
|
|
$MPRestorewarmupTime = $Host::warmupTime;
|
|
$MPRestoreTeamDamage = $teamDamage;
|
|
|
|
//$Host::BotCount = "0";
|
|
$Host::BotMatchBotCount = "0";
|
|
$Host::BotsEnabled = "0";
|
|
$Host::MaxBotDifficulty = "1";
|
|
$Host::MaxPlayers = "64";
|
|
$Host::MinBotDifficulty = "0";
|
|
$Host::TimeLimit = "9999999";
|
|
$Host::TournamentMode = "false";
|
|
$Host::warmupTime = "0";
|
|
|
|
if($pref::trainingDifficulty < 1 || $pref::trainingDifficulty > 3)
|
|
$pref::trainingDifficulty = 1;
|
|
|
|
if($pref::trainingDifficulty == 1)
|
|
$teamDamage = false;
|
|
else
|
|
$teamDamage = true;
|
|
|
|
|
|
// game settings
|
|
$MPRestoreteamSkin[1] = $teamSkin[1];
|
|
$MPRestoreteamName[1] = $teamName[1];
|
|
$MPRestoreholoName[1] = $holoName[1];
|
|
$MPRestoreswitchSkin[1] = $switchSkin[1];
|
|
|
|
$MPRestoreteamSkin[2] = $teamSkin[2];
|
|
$MPRestoreteamName[2] = $teamName[2];
|
|
$MPRestoreholoName[2] = $holoName[2];
|
|
$MPRestoreswitchSkin[2] = $switchSkin[2];
|
|
|
|
$playerTeam = 1;
|
|
$teamSkin[$playerTeam] = 'swolf';
|
|
$teamName[$playerTeam] = 'StarWolf';
|
|
$holoName[$playerTeam] = "StarWolf";
|
|
$switchSkin[$playerTeam] = 'swolf';
|
|
$playerLivesAtEasy = 3;
|
|
|
|
$EnemyTeam = 2;
|
|
$teamSkin[$EnemyTeam] = 'Horde';
|
|
$teamName[$EnemyTeam] = 'Bioderm Horde';
|
|
// $holoName[$enemyTeam] = "Bioderm";
|
|
// $switchSkin[$enemyTeam] = 'Bioderm';
|
|
|
|
if($enemyName $= "")
|
|
$EnemyName = "Enemy";
|
|
|
|
$trainingDefenseTauntList = "bas.enemy slf.att.attack slf.def.defend wrn.enemy tgt.acquired gbl.brag slf.def.base vqk.help";
|
|
$trainingOffenseTauntList = "slf.att.attack gbl.brag vqk.help att.distract att.attack ene.disarray glb.awesome need.cover";
|
|
}
|
|
|
|
function resetSinglePlayerGlobals()
|
|
{
|
|
|
|
//error("================ single player global vars reset!");
|
|
// server settings
|
|
//$Host::BotCount = $MPRestoreBotCount;
|
|
$Host::BotMatchBotCount = $MPRestoreBotMatchBotCount;
|
|
$Host::BotsEnabled = $MPRestoreBotsEnabled;
|
|
$Host::MaxBotDifficulty = $MPRestoreMaxBotDifficulty;
|
|
$Host::MaxPlayers = $MPRestoreMaxPlayers;
|
|
$Host::MinBotDifficulty = $MPRestoreMinBotDifficulty;
|
|
$Host::TimeLimit = $MPRestoreTimeLimit;
|
|
$Host::TournamentMode = $MPRestoreTournamentMode;
|
|
$Host::warmupTime = $MPRestorewarmupTime;
|
|
$teamDamage = $MPRestoreTeamDamage;
|
|
|
|
// game settings
|
|
$teamSkin[1] = $MPRestoreteamSkin[1];
|
|
$teamName[1] = $MPRestoreteamName[1];
|
|
$holoName[1] = $MPRestoreholoName[1];
|
|
$switchSkin[1] = $MPRestoreswitchSkin[1];
|
|
|
|
$teamSkin[2] = $MPRestoreteamSkin[2];
|
|
$teamName[2] = $MPRestoreteamName[2];
|
|
$holoName[2] = $MPRestoreholoName[2];
|
|
$switchSkin[2] = $MPRestoreswitchSkin[2];
|
|
}
|
|
|
|
// Actors
|
|
//=======================================================================================
|
|
|
|
function addEnemies()
|
|
{
|
|
%num = $numberOfEnemies[$pref::TrainingDifficulty];
|
|
error("Adding " @ %num @" enemies!");
|
|
|
|
%group = nameToId("MissionGroup/Teams/Team2/DropPoints");
|
|
|
|
for(%i = 0; %i < %num; %i++){
|
|
%name = getUniqueEnemyName();
|
|
%voice = "Derm"@getRandom(1,3);
|
|
%voicePitch = 1 - ((getRandom(20) - 10)/100);
|
|
|
|
//%client = AIConnect($EnemyName@%i, $EnemyTeam, $missionBotSkill[$pref::TrainingDifficulty], true);
|
|
%client = AIConnect(%name, $EnemyTeam, $missionBotSkill[$pref::TrainingDifficulty], true, %voice, %voicePitch);
|
|
$Enemy[%i] = %client;
|
|
%client.race = "Bioderm";
|
|
|
|
setTargetSkin(%client.target, $teamSkin[$enemyTeam]);
|
|
//setTargetVoice(%client.target, addTaggedString(%client.voice));
|
|
|
|
//error("Setting race of "@$Enemy[%i]@" to "@$Enemy[%i].race);
|
|
if(%group.getObject(%i).Equipment || %group.getObject(%i).specialObjectives) {
|
|
%client.equipment = %group.getObject(%i).Equipment;
|
|
//error("Client: "@%client@ " has equipment "@%client.equipment);
|
|
%client.SpecialObjectives = %group.getObject(%i).SpecialObjectives;
|
|
//error("Client: "@%client@ " has specialEd "@%client.SpecialObjectives);
|
|
game.equip(%client.player);
|
|
}
|
|
|
|
// this seems redundant after equip
|
|
%client.player.setArmor(%client.armor);
|
|
}
|
|
}
|
|
|
|
// there are times (missions 2 and 4) where bots are not added with
|
|
// addEnemies(). there are x waves of bots with y number in each wave
|
|
// i do it a couple of times so im going to localize it here rather than
|
|
// do it twice or cut and paste it
|
|
function spawnWave(%wave)
|
|
{
|
|
for(%i=1; %i<=$numberInWave[$pref::TrainingDifficulty]; %i++) {
|
|
%name = getUniqueEnemyName();
|
|
%voice = "Derm"@getRandom(1,3);
|
|
%voicePitch = 1 - ((getRandom(20) - 10)/100);
|
|
%thisAi = aiConnect(%name, $enemyTeam, $missionBotSkill[$pref::TrainingDifficulty], false, %voice, %voicePitch);
|
|
//%thisAi = aiConnect("Wave"@%wave@"num"@%i, $enemyTeam, $missionBotSkill[$pref::TrainingDifficulty], false);
|
|
// here we differentiate the different drop points for wave spawned bots (these spawned bots are "!offense")
|
|
//error("added enemy "@%thisAi);
|
|
%thisAi.race = "Bioderm";
|
|
%thisAi.voice = "Derm"@getRandom(3);
|
|
setTargetSkin(%thisAI.target, $teamSkin[$enemyTeam]);
|
|
setTargetVoice(%thisAI.target, addTaggedString(%thisAI.voice));
|
|
%equipment = pickEquipment();
|
|
game.equip(%thisAi.player, %equipment);
|
|
//%client.player.setArmor(%thisAi.armor);
|
|
|
|
//create a little group
|
|
game.NumberInWave[%wave]++;
|
|
%thisAI.MemberOfWave = %wave;
|
|
|
|
//anything mission specific that has to be done with this client
|
|
missionSpawnedAI(%thisAi);
|
|
}
|
|
game.spawnWaveTimer = spawnWaveTimer(%wave, false);
|
|
}
|
|
|
|
|
|
function addPlayersTeam(%num)
|
|
{
|
|
//echo($player.team@"<---------players team on addPlayerTeam");
|
|
|
|
getTeammateGlobals();
|
|
|
|
for(%i=0; %i< %num; %i++){
|
|
$Teammate[%i] = %client = AIConnect($TeammateWarnom[%i], $playerTeam, $teammateSkill[%i], true, $teammateVoice[%i]);
|
|
|
|
%client.sex = $teammateGender[%i];
|
|
%client.equipment = $teammateEquipment[%i];
|
|
setTargetSkin(%client.target, $teamSkin[$playerTeam]);
|
|
game.equip(%client.player);
|
|
%client.player.setArmor(%client.armor);
|
|
|
|
if (! %client.defaultTasksAdded)
|
|
{
|
|
%client.defaultTasksAdded = true;
|
|
%client.addTask(AIEngageTask);
|
|
%client.addTask(AIPickupItemTask);
|
|
%client.addTask(AIUseInventoryTask);
|
|
%client.addTask(AIEngageTurretTask);
|
|
%client.addtask(AIDetectMineTask);
|
|
}
|
|
|
|
}
|
|
|
|
//add Player===============================================================
|
|
$player.lives = $playerLivesAtEasy - $pref::TrainingDifficulty;
|
|
|
|
game.spawnPlayer($player, false);
|
|
setTargetSkin($player.target, $teamSkin[$playerTeam]);
|
|
|
|
}
|
|
|
|
function getUniqueEnemyName()
|
|
{
|
|
if(!$enemyNameCount)
|
|
return;
|
|
|
|
%used = false;
|
|
%name = pickUniqueEnemyName();
|
|
%used = enemyNameIsUsed(%name);
|
|
while(%used)
|
|
{
|
|
if(%emergency++ > 1000)
|
|
{
|
|
//error("Too many times in the name while loop...using DEFAULT");
|
|
return $enemyName;
|
|
}
|
|
%name = pickUniqueEnemyName();
|
|
%used = enemyNameIsUsed(%name);
|
|
}
|
|
return %name;
|
|
}
|
|
|
|
function pickUniqueEnemyName()
|
|
{
|
|
%random = getRandom(1, $enemyNameCount);
|
|
%name = $EnemyNameList[%random];
|
|
//error("returning" SPC %name SPC "from pick");
|
|
return %name;
|
|
}
|
|
|
|
function enemyNameIsUsed(%name)
|
|
{
|
|
%number = game.usedNameCount;
|
|
for(%i = 0; %i <= %number; %i++)
|
|
{
|
|
if(game.usedName[%i] $= %name)
|
|
return true;
|
|
}
|
|
// the name is unused
|
|
game.usedName[game.usedNameCount++] = %name;
|
|
return false;
|
|
}
|
|
|
|
function spawnWaveTimer(%wave, %reset)
|
|
{
|
|
//error("SpawnTimer ACTIVATED");
|
|
|
|
if(%reset)
|
|
{
|
|
cancel(game.spawnWaveTimer);
|
|
%timeForAction = 60000 * 2; //2 min
|
|
}
|
|
else %timeForAction = 60000 * 4; //4 min
|
|
|
|
game.spawnWaveTimer = schedule(%timeForAction, game, destroyWave, %wave);
|
|
}
|
|
|
|
function DestroyWave(%wave)
|
|
{
|
|
// this group has enemies in it that are dawdling and
|
|
// need to be killed to keep the game progressing
|
|
%num = clientGroup.getCount();
|
|
for(%i = 0; %i < %num; %i++)
|
|
{
|
|
%client = clientGroup.getObject(%i);
|
|
if(%client.player && %client.MemberOfWave == %wave)
|
|
{
|
|
%client.player.applyDamage(%client.player.getDataBlock().maxDamage);
|
|
enemyWaveMemberKilled(%client);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
function SinglePlayerGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement)
|
|
{
|
|
if(game.missionOver)
|
|
return;
|
|
%clVictim.dead = true;
|
|
if(%clvictim.team == $enemyTeam && getRandom(1,1000) == 69)
|
|
doText(Any_jingo02);
|
|
missionClientKilled(%clVictim, %clKiller);
|
|
if(%clVictim.MemberOfWave)
|
|
enemyWaveMemberKilled(%clVictim );
|
|
|
|
Parent::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement);
|
|
cancel(%clVictim.respawnTimer);
|
|
|
|
if(%clVictim == $player) {
|
|
// dead players are not out of bounds
|
|
cancel($player.OOB);
|
|
|
|
$player.deaths++;
|
|
%num = $player.lives;
|
|
if( %num >= 1) {
|
|
if(%num == 1)
|
|
%textNum = "one life";
|
|
else %textNum = %num SPC "lives";
|
|
messageBoxOk("Restart", "You have" SPC %textNum SPC "remaining.", "spawnSinglePlayer();");
|
|
}
|
|
else schedule(3000, $player.player, singlePlayerDead);
|
|
}
|
|
}
|
|
|
|
function enemyWaveMemberKilled(%client)
|
|
{
|
|
%wave = %client.MemberOfWave;
|
|
%remaining = game.numberInWave[%wave]--;
|
|
//error("Debug: Script reports that client " @ %client @ " was a member of wave " @ %wave @ " that now has " @ %remaining @ " members remaining.");
|
|
if(%remaining == 0) {
|
|
missionWaveDestroyed(%wave);
|
|
|
|
if (%wave+1 <= $numberOfWaves[$pref::TrainingDifficulty])
|
|
spawnWave(%wave+1);
|
|
//else error("Debug: " @ %wave @ " was the last wave.");
|
|
}
|
|
}
|
|
|
|
function SinglePlayerGame::assignClientTeam(%game, %client)
|
|
{
|
|
// The players team is set in singlePlayer::clientMissionDropReady
|
|
// and the bots are added to a team with aiConnect
|
|
// so this is unnecessary
|
|
}
|
|
|
|
function singlePlayerGame::AIHasJoined()
|
|
{
|
|
// Big deal...my missions are crawling with AI
|
|
// lets get rid of this mundane console spam
|
|
}
|
|
|
|
function SinglePlayerGame::updateKillScores()
|
|
{
|
|
// Do nothing other than get rid of the console warning...
|
|
}
|
|
|
|
function singlePlayerGame::biodermAssume(%game, %client)
|
|
{
|
|
//error(%client SPC "might talk.");
|
|
// dont do anything if we have just done this
|
|
if(%client.spgSpeaking)
|
|
return;
|
|
|
|
%probability = 2;
|
|
%time = 30; // secs
|
|
|
|
// we are going to POSSIBLY talk. flag it for %time secs
|
|
%client.spgSpeaking = true;
|
|
schedule(%time * 1000, %client, resetSpeakingFlag, %client);
|
|
|
|
if(getRandom(%probability) == 1)
|
|
trainingBiodermSpeaks(%client);
|
|
|
|
}
|
|
|
|
function resetSpeakingFlag(%client)
|
|
{
|
|
//error(%client SPC "can now speak again.");
|
|
%client.spgSpeaking = false;
|
|
}
|
|
|
|
function trainingBiodermSpeaks(%client)
|
|
{
|
|
if(%client.offense) // offense = defense?
|
|
%tauntlist = $trainingDefenseTauntList; //yes this seem wrong but its not
|
|
else
|
|
%tauntlist = $trainingOffenseTauntList;
|
|
%num = getWordCount(%tauntList);
|
|
%random = getRandom(%num - 1);
|
|
%use = getWord(%tauntList, %random);
|
|
//echo("Derm taunting:" SPC %use);
|
|
|
|
playTargetAudio( %client.target, addTaggedString(%use), AudioClose3d, false );
|
|
}
|
|
|
|
function singlePlayerDead()
|
|
{
|
|
missionFailed($player.miscMsg[trainingDeathLoss]);
|
|
AIMissionEnd();
|
|
$objectiveQ[$enemyTeam].clear();
|
|
cancel($player.distanceCheckSchedule);
|
|
}
|
|
|
|
function SinglePlayerGame::missionLoadDone(%game)
|
|
{
|
|
DefaultGame::missionLoadDone(%game);
|
|
|
|
setSinglePlayerGlobals();
|
|
$matchStarted = true;
|
|
//this has to happen sometime because game.startMatch never gets called
|
|
%game.clearDeployableMaxes();
|
|
}
|
|
|
|
|
|
function SinglePlayerGame::notifyMatchStart(%game, %time)
|
|
{
|
|
//do nothing
|
|
}
|
|
|
|
|
|
function SinglePlayerGame::clientMissionDropReady(%game, %client)
|
|
{
|
|
DefaultGame::clientMissionDropReady(%game, %client);
|
|
|
|
//echo(%client @ " is single player Ready!!!");
|
|
messageClient(%client, 'MsgClientReady', "", %game.class);
|
|
|
|
$Player = %client;
|
|
$player.race = "Human";
|
|
$player.team = $playerTeam;
|
|
$player.setTeam($playerTeam);
|
|
setTargetSkin($teammate[%i].target, $teamSkin[$playerTeam]);
|
|
$player.clearBackpackIcon();
|
|
|
|
createText($player);
|
|
HUDMessageVector.clear();
|
|
messageClient(%client, 'MsgMissionDropInfo', "", $MissionDisplayName, $MissionTypeDisplayName, $ServerName );
|
|
|
|
// We don't start in observer mode, so disable:
|
|
commandToClient(%client, 'setHudMode', 'Standard');
|
|
|
|
//custom training keymap
|
|
%game.createCustomKeyMap();
|
|
|
|
|
|
addEnemies();
|
|
//echo($player.team@"<---------players team on mission drop ready");
|
|
addPlayersTeam($numberOfTeammates);
|
|
|
|
//everybody's in, enable the AI system
|
|
AISystemEnabled(true);
|
|
|
|
$player.setControlObject( $player.player );
|
|
$player.camera = new Camera()
|
|
{
|
|
dataBlock = Observer;
|
|
};
|
|
|
|
startCurrentMission(%game);
|
|
}
|
|
|
|
function SinglePlayerGame::AIInit(%game)
|
|
{
|
|
//error("initializing Bot Q's for SinglePlayerGame...");
|
|
for (%i = 0; %i <= %game.numTeams; %i++)
|
|
{
|
|
if (!isObject($ObjectiveQ[%i]))
|
|
{
|
|
$ObjectiveQ[%i] = new AIObjectiveQ();
|
|
MissionCleanup.add($ObjectiveQ[%i]);
|
|
}
|
|
|
|
//error("team " @ %i @ " objectives load...");
|
|
$ObjectiveQ[%i].clear();
|
|
AIInitObjectives(%i, %game);
|
|
}
|
|
|
|
AIInit();
|
|
|
|
// Bots never throw grenades on Easy skills
|
|
if($pref::TrainingDifficulty == 1)
|
|
$AIDisableGrenades = true;
|
|
}
|
|
|
|
// unlike the MP game, sometimes we start with switches (flipFlops)
|
|
// already on one team or the other and they are unskinned
|
|
function setFlipFlopSkins(%group)
|
|
{
|
|
if(!%group)
|
|
%group = nameToID("Teams");
|
|
|
|
for(%i = 0; %i < %group.getCount(); %i++) {
|
|
%this = %group.getObject(%i);
|
|
if(%this.getClassName() $= "SimGroup")
|
|
setFlipFlopSkins(%this);
|
|
else if(%this.getDataBlock().getName() $= "FlipFlop")
|
|
setTargetSkin(%this.getTarget(), $teamSkin[%this.team]);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function singlePlayerGame::gameOver(%game)
|
|
{
|
|
moveMap.push();
|
|
|
|
ServerConnection.setBlackOut(false, 0);
|
|
|
|
$timeScale = 1;
|
|
|
|
game.missionOver = true;
|
|
|
|
// clear the inventory and weapons hud
|
|
// BH: This doesn't actually DO anything...
|
|
//error("clearing Inv HUD for client " @ $player);
|
|
//$player.SetInventoryHudClearAll();
|
|
|
|
// im gonna try dropping all the clients
|
|
%count = clientGroup.getCount();
|
|
echo("count=" SPC %count);
|
|
for(%i = 0; %i < %count; %i++) {
|
|
%client = clientGroup.getObject(%i);
|
|
game.client[%i] = %client;
|
|
freeClientTarget(%client);
|
|
}
|
|
for(%i = 0; %i < %count; %i++) {
|
|
%client = game.client[%i];
|
|
echo("client=" SPC %client);
|
|
if(%client.isAIControlled())
|
|
%client.drop();
|
|
}
|
|
|
|
//disable the AI system
|
|
AISystemEnabled(false);
|
|
$AIDisableChatResponse = "";
|
|
|
|
game.deactivatePackages();
|
|
|
|
if(isObject( $player.currentWaypoint ))
|
|
$player.currentWaypoint.delete();
|
|
|
|
if($player.OOB)
|
|
cancel($player.OOB);
|
|
|
|
// clear the objective HUD
|
|
messageClient($player, 'MsgClearObjHud', "");
|
|
|
|
resetSinglePlayerGlobals();
|
|
|
|
$currentMissionType = "";
|
|
DefaultGame::GameOver(%game);
|
|
}
|
|
|
|
function singlePlayerGame::deactivatePackages(%game)
|
|
{
|
|
error("singlePlayerGame packages deactivated");
|
|
//Deactivate packages...gotta catch'm all
|
|
//deactivatepackage(SinglePlayer);
|
|
deactivatepackage(Training1);
|
|
deactivatepackage(Training2);
|
|
deactivatepackage(Training3);
|
|
deactivatepackage(Training4);
|
|
deactivatepackage(Training5);
|
|
deactivatepackage(Training6);
|
|
deactivatePackage(singlePlayerMissionAreaEnforce);
|
|
}
|
|
//------------------------------------------------------------------------------------
|
|
|
|
|
|
// Voice line, text, function and audio parsing
|
|
//=================================================================================
|
|
// this is how we handle ALL the voice distribition and playing
|
|
// its NOT pretty
|
|
function doText(%name, %extraTime, %priority)
|
|
{
|
|
if($player.text[%name, priority] || %priority)
|
|
addToQueueNext(%name);
|
|
else addToQueueEnd(%name);
|
|
|
|
$player.text[%name, extraTime] = %extraTime;
|
|
processText(false);
|
|
}
|
|
|
|
function processText(%cont)
|
|
{
|
|
//we may need to fudge everysound to get it timed right
|
|
%universalSoundFudgingConstant = 400;
|
|
|
|
if(isEventPending($currentlyPlaying) && !%cont)
|
|
return;
|
|
|
|
%name = $player.Textque0;
|
|
if(%name $= "")
|
|
return;
|
|
|
|
//echo("processing: "@%name);
|
|
if($player.Text[%name, eval] !$= "")
|
|
{
|
|
if (!isPureServer())
|
|
eval($player.text[%name, eval]);
|
|
else
|
|
processTextEval($player.text[%name, eval]);
|
|
}
|
|
if($player.Text[%name, text] !$= "") {
|
|
// the old way: messageClient($player, 0, '\c2%1: %2',$trainerName, $player.Text[%name, line]);
|
|
messageClient($player, 0, "\c5"@$player.Text[%name, text]);
|
|
serverPlay2d(MessageRecieveSound);
|
|
}
|
|
if($player.Text[%name, wav] !$= "") {
|
|
//messageClient($player, 0, "~w"@$player.Text[%name, wav]);
|
|
%audio = alxCreateSource( AudioChat, $player.Text[%name, wav] );
|
|
alxPlay( %audio );
|
|
}
|
|
|
|
removeFromQueue();
|
|
|
|
%wavLen = alxGetWaveLen($player.text[%name, wav]);
|
|
//if(%wavLen < 400)
|
|
// %wavLen = 400; // you cant go back in time, vge
|
|
|
|
%time = %wavLen + $player.text[%name, extraTime] + %universalSoundFudgingConstant;
|
|
//echo("total delay time of"@%time);
|
|
|
|
$currentlyPlaying = schedule(%time, $player.player, processText, true);
|
|
//if (!isPureServer())
|
|
// schedule(%time, 0, eval, "$currentlyPlaying = false;");
|
|
//else
|
|
// schedule(%time, 0, SPUnsetCurrentlyPlaying);
|
|
}
|
|
|
|
function SPUnsetCurrentlyPlaying()
|
|
{
|
|
$currentlyPlaying = "";
|
|
error(getSimTime() SPC "DEBUG setting currentlyPlaying null");
|
|
}
|
|
|
|
function processTextEval(%evalStmt)
|
|
{
|
|
switch$ (%evalStmt)
|
|
{
|
|
case "singlePlayerPlayGuiCheck();":
|
|
singlePlayerPlayGuiCheck();
|
|
|
|
case "schedule(3000, 0, disconnect);":
|
|
schedule(3000, 0, disconnect);
|
|
|
|
case "lockArmorHack();autoToggleHelpHud(true);":
|
|
lockArmorHack();autoToggleHelpHud(true);
|
|
|
|
case "flashMessage();":
|
|
flashMessage();
|
|
|
|
case "flashObjective();":
|
|
flashObjective();
|
|
|
|
case "flashCompass();":
|
|
flashCompass();
|
|
|
|
case "flashHealth();":
|
|
flashHealth();
|
|
|
|
case "flashEnergy();":
|
|
flashEnergy();
|
|
|
|
case "flashInventory();":
|
|
flashInventory();
|
|
|
|
case "flashSensor();":
|
|
flashSensor();
|
|
|
|
case "autoToggleHelpHud(false);":
|
|
autoToggleHelpHud(false);
|
|
|
|
case "setWaypointAt(\"-287.5 393.1 76.2\", \"Health Patches\");movemap.push();$player.player.setMoveState(false);":
|
|
setWaypointAt("-287.5 393.1 76.2", "Health Patches");movemap.push();$player.player.setMoveState(false);
|
|
|
|
case "$player.hurryUp = schedule(40000, 0, hurryPlayerUp); endOpeningSpiel(); updateTrainingObjectiveHud(obj8);":
|
|
$player.hurryUp = schedule(40000, 0, hurryPlayerUp); endOpeningSpiel(); updateTrainingObjectiveHud(obj8);
|
|
|
|
case "updateTrainingObjectiveHud(obj7);":
|
|
updateTrainingObjectiveHud(obj7);
|
|
|
|
case "flashWeapon(0);":
|
|
flashWeapon(0);
|
|
|
|
case "flashWeapon(2);":
|
|
flashWeapon(2);
|
|
|
|
case "flashWeapon(3); ":
|
|
flashWeapon(3);
|
|
|
|
case "flashWeaponsHud();":
|
|
flashWeaponsHud();
|
|
|
|
case "use(Blaster);":
|
|
use(Blaster);
|
|
|
|
case "queEnemySet(0); activatePackage(singlePlayerMissionAreaEnforce);":
|
|
queEnemySet(0); activatePackage(singlePlayerMissionAreaEnforce);
|
|
|
|
case "setWaypointat(nameToId(Tower).position, \"BE Tower\"); updateTrainingObjectiveHud(obj4);":
|
|
setWaypointat(nameToId(Tower).position, "BE Tower"); updateTrainingObjectiveHud(obj4);
|
|
|
|
case "flashPack();":
|
|
flashPack();
|
|
|
|
case "updateTrainingObjectiveHud(obj3);":
|
|
updateTrainingObjectiveHud(obj3);
|
|
|
|
case "setWaypointAt(\"-8.82616 -131.779 119.756\", \"Control Switch\");":
|
|
setWaypointAt("-8.82616 -131.779 119.756", "Control Switch");
|
|
|
|
case "setWaypointAt(nameToId(InitialPulseSensor).position, \"Sensor\");":
|
|
setWaypointAt(nameToId(InitialPulseSensor).position, "Sensor");
|
|
|
|
case "setWaypointAt(\"-8.82616 -131.779 119.756\", \"Tower\");":
|
|
setWaypointAt("-8.82616 -131.779 119.756", "Tower");
|
|
|
|
case "setWaypointAt(\"380.262 -298.625 98.9719\", \"Tower\");":
|
|
setWaypointAt("380.262 -298.625 98.9719", "Tower");
|
|
|
|
case "firstPersonQuickPan();":
|
|
firstPersonQuickPan();
|
|
|
|
case "ThreeAEval();":
|
|
ThreeAEval();
|
|
|
|
case "game.ExpectiongSupportButton = true;":
|
|
game.ExpectiongSupportButton = true;
|
|
|
|
case "game.expectingRepairOrder = true;":
|
|
game.expectingRepairOrder = true;
|
|
|
|
case "$random = getRandom(20,40);schedule($random, 0, doText, T4_TipDefense06);":
|
|
$random = getRandom(20,40);schedule($random, 0, doText, T4_TipDefense06);
|
|
|
|
case "training5addSafeDistance();":
|
|
training5addSafeDistance();
|
|
}
|
|
}
|
|
|
|
|
|
function removeFromQueue()
|
|
{
|
|
%i = 1;
|
|
while($player.textque[%i] !$= "") {
|
|
$player.textque[%i-1] = $player.textque[%i];
|
|
%i++;
|
|
}
|
|
$player.textque[%i-1] = "";
|
|
}
|
|
|
|
|
|
function addToQueueEnd(%name)
|
|
{
|
|
%q = 0;
|
|
while($player.Textque[%q] !$= ""){
|
|
%q++;
|
|
}
|
|
$player.Textque[%q] = %name;
|
|
}
|
|
|
|
function addToQueueNext(%name)
|
|
{
|
|
%q = 0;
|
|
while($player.Textque[%q] !$= ""){
|
|
%q++;
|
|
}
|
|
for(%i=%q; %i>0; %i--)
|
|
$player.textque[%i] = $player.textque[%i-1];
|
|
$player.textque0 = %name;
|
|
}
|
|
|
|
function echoQueue()
|
|
{
|
|
echo("Textque -------------------------------");
|
|
%i = 0;
|
|
while($player.Textque[%i] !$= "") {
|
|
echo(%i@": "@$player.Textque[%i]);
|
|
%i++;
|
|
}
|
|
}
|
|
|
|
function clearQueue()
|
|
{
|
|
for(%i=0;%i<100; %i++)
|
|
$player.textQue[%i] = "";
|
|
}
|
|
|
|
//handy waypoint setting tool
|
|
//=========================================================================
|
|
function setWaypointAt(%location, %name, %team)
|
|
{
|
|
%team = (!%team ? $playerTeam : %team);
|
|
// if(!%name)
|
|
// %name = "";
|
|
if ( isObject( $player.currentWaypoint ) )
|
|
$player.currentWaypoint.delete();
|
|
|
|
$player.currentWaypoint = new WayPoint(TurretTower) {
|
|
position = %location;
|
|
rotation = "1 0 0 0";
|
|
scale = "1 1 1";
|
|
dataBlock = "WayPointMarker";
|
|
team = %team;
|
|
name = %name;
|
|
};
|
|
MissionCleanup.add($player.currentWaypoint);
|
|
}
|
|
|
|
//this is just a little consolidation of functions
|
|
//its a little gregarious but allows text to live in spdialg.cs
|
|
//intent is to make hud updating easier and localization easier too ;)
|
|
function updateTrainingObjectiveHud( %objectiveNum )
|
|
{
|
|
|
|
//sound
|
|
objectiveHud.setVisible(false);
|
|
if (!isPureServer())
|
|
schedule(400, game, eval, "objectiveHud.setVisible(true);");
|
|
else
|
|
schedule(400, game, setObjHudVisible);
|
|
|
|
serverPlay2d(TrainingHudUpdateSound);
|
|
|
|
//clear old text
|
|
messageClient($player, 'MsgSPCurrentObjective1', "", ' ');
|
|
messageClient($player, 'MsgSPCurrentObjective2', "", ' ');
|
|
|
|
// find the lines from the spdialog file that are now attached to the sp client
|
|
%who = $player;
|
|
%mission = $currentMission;
|
|
for(%x = 1; %x <= 2; %x++)
|
|
%newObjectiveLine[%x] = $player.objHud[%mission, %objectiveNum, %x];
|
|
|
|
//add new text
|
|
messageClient($player, 'MsgSPCurrentObjective1', "", %newObjectiveLine1);
|
|
if(%newObjectiveLine2 !$= "")
|
|
messageClient($player, 'MsgSPCurrentObjective2', "", %newObjectiveLine2);
|
|
}
|
|
|
|
function setObjHudVisible()
|
|
{
|
|
objectiveHud.setVisible(true);
|
|
}
|
|
|
|
|
|
// Misc/Overwrites
|
|
//=======================================================================================
|
|
|
|
function isSafe(%object, %radius)
|
|
{
|
|
%team = %object.team;
|
|
%position = %object.player.getTransform();
|
|
|
|
//check for enemy players
|
|
%num = clientGroup.getCount();
|
|
for(%client = 0; %client <= %num; %client++)
|
|
{
|
|
if(%team != %client.team && %client.player) {
|
|
%enemyPos = %client.player.getTransform();
|
|
//okay, just in case we dont have a player for that client
|
|
//AND are close to "0 0 0" vge
|
|
if(!%enemyPos)
|
|
%dist = 100000;
|
|
else %dist = vectorDist(%position, %enemyPos);
|
|
//error("Debug: Client "@%client@" is "@%dist@" away");
|
|
if ( %dist < %radius){
|
|
//error("Unsafe because of client "@%client@" at a distance of "@%dist@"!!!!");
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
//error("Safe for a radius of "@%radius@"!");
|
|
return true;
|
|
}
|
|
|
|
function singlePlayerGame::onAIRespawn(%game, %client)
|
|
{
|
|
// add the default tasks
|
|
|
|
if (! %client.defaultTasksAdded)
|
|
{
|
|
%client.defaultTasksAdded = true;
|
|
%client.addTask(AIEngageTask);
|
|
%client.addTask(AIPickupItemTask);
|
|
%client.addTask(AIUseInventoryTask);
|
|
%client.addTask(AIEngageTurretTask);
|
|
%client.addtask(AIDetectMineTask);
|
|
if(%client.team == $playerTeam || $pref::trainingDifficulty == 3)
|
|
%client.addTask(AITauntCorpseTask);
|
|
}
|
|
}
|
|
|
|
|
|
function singlePlayerGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement)
|
|
{
|
|
// dont respawn AI (this is overwritten in some of the mission packages)
|
|
}
|
|
|
|
|
|
function singleplayerGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement)
|
|
{
|
|
//the DefaultGame will set some vars
|
|
DefaultGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %implement);
|
|
|
|
//now see if both were on the same team
|
|
if(%clAttacker && %clAttacker != %clVictim && %clVictim.team == %clAttacker.team)
|
|
{
|
|
%game.friendlyFireMessage(%clVictim, %clAttacker);
|
|
}
|
|
}
|
|
|
|
function singleplayerGame::onAIDamaged(%game, %clVictim, %clAttacker, %damageType, %implement)
|
|
{
|
|
if(%clVictim.team != %clAttacker.team && %clVictim.MemberOfWave)
|
|
{
|
|
spawnWaveTimer(%clVictim.MemberOfWave, true);
|
|
}
|
|
|
|
if (%clAttacker && %clAttacker != %clVictim && %clAttacker.team == %clVictim.team)
|
|
{
|
|
schedule(250, %clVictim, "AIPlayAnimSound", %clVictim, %clAttacker.player.getWorldBoxCenter(), "wrn.watchit", -1, -1, 0);
|
|
|
|
//clear the "lastDamageClient" tag so we don't turn on teammates... unless it's uberbob!
|
|
%clVictim.lastDamageClient = -1;
|
|
}
|
|
}
|
|
|
|
// find number of players on a team
|
|
// why isnt this in a std lib
|
|
function getPlayersOnTeam(%team)
|
|
{
|
|
%num = clientGroup.getCount();
|
|
for(%i=0; %i<%num; %i++){
|
|
%client = clientGroup.getObject(%i);
|
|
if(%client.team == %team && %client.player)
|
|
%count++;
|
|
}
|
|
|
|
return %count;
|
|
}
|
|
|
|
|
|
//mission completion/falure stuff============================================
|
|
function missionComplete(%text)
|
|
{
|
|
$player.endMission = schedule(15000, game, forceFinish);
|
|
|
|
messageBoxOk("Victory", %text, "forceFinish();");
|
|
|
|
//AI stop
|
|
clearQueue();
|
|
AIMissionEnd();
|
|
$objectiveQ[$enemyTeam].clear();
|
|
}
|
|
|
|
function forceFinish()
|
|
{
|
|
$timeScale = 1;
|
|
//kill the thread if we pressed a button to get here...
|
|
cancel($player.endMission);
|
|
|
|
//make sure we end the game neatly
|
|
Game.gameOver();
|
|
|
|
//immediately disconnect - bringing us back to the main menu...
|
|
Disconnect();
|
|
}
|
|
|
|
function missionFailed(%text)
|
|
{
|
|
|
|
$player.endMission = schedule(30000, game, forceFinish);
|
|
|
|
MessageBoxYesNo("Failure", %text, "reloadMission();", "forceFinish();");
|
|
|
|
//AI stop
|
|
cancel($Player.T1OpeningSpielSchedule);
|
|
cancel($Player.distanceCheckSchedule);
|
|
clearQueue();
|
|
AIMissionEnd();
|
|
$objectiveQ[$enemyTeam].clear();
|
|
}
|
|
|
|
function reloadMission()
|
|
{
|
|
cancel($player.endMission);
|
|
Game.gameOver();
|
|
Canvas.setContent( LoadingGui );
|
|
loadMission($currentMission, singlePlayer);
|
|
debriefContinue();
|
|
}
|
|
|
|
|
|
// silly...we fed it a movemap binding it retuns the capitalized key in (almost) english
|
|
function findTrainingControlButtons( %name )
|
|
{
|
|
%controlName = moveMap.getBinding(%name);
|
|
if (%controlName $= "")
|
|
return "[no key binding]";
|
|
%prettyName = strupr(getMapDisplayName(getWord(%controlName, 0), getWord(%controlName, 1)));
|
|
%next = 2;
|
|
while( getWord( %controlName, %next ) !$= "" ) {
|
|
%extra = "-"@strupr(getWord( %controlName, 2 ));
|
|
%prettyName = %prettyName @ %extra;
|
|
%next++;
|
|
}
|
|
return %prettyName;
|
|
}
|
|
|
|
// just a kinda cool little effect
|
|
function firstPersonQuickPan()
|
|
{
|
|
if($firstperson) {
|
|
toggleFirstPerson($player);
|
|
schedule(4000, $player.player, toggleFirstPerson, $player);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
// Player spawning/respawning====================================================
|
|
//since we are going through pickTeamSpawn rather than pickPlayerSpawn
|
|
// and for a couple other reasons, we are going to need to manually determine
|
|
// if this is a respawn or not.
|
|
function spawnSinglePlayer()
|
|
{
|
|
$player.lives--;
|
|
|
|
game.spawnPlayer($player, true);
|
|
$player.setControlObject($player.player);
|
|
//messageClient($player, 0, "Respawns Remaining: "@$player.lives);
|
|
}
|
|
|
|
|
|
function singleplayerGame::observerOnTrigger()
|
|
{
|
|
//we dont want the player respawning (yet)
|
|
return false;
|
|
}
|
|
|
|
function SinglePlayerGame::spawnPlayer( %game, %client, %respawn )
|
|
{
|
|
//error("Spawn Player: %client = " @%client@" %respawn = "@%respawn);
|
|
%spawnPoint = %game.pickPlayerSpawn( %client, %respawn );
|
|
%game.createPlayer( %client, %spawnPoint, %respawn );
|
|
}
|
|
|
|
function singlePlayerGame::playerSpawned(%game, %player)
|
|
{
|
|
defaultGame::playerSpawned(%game, %player);
|
|
}
|
|
|
|
function singleplayerGame::pickPlayerSpawn(%game, %client, %respawn)
|
|
{
|
|
// the bots, for some reason, always pass in %respawn as true
|
|
// well that's horse pucky, since the bots never respawn in SPG
|
|
// so I do this stupid thing
|
|
if(%client.isAIcontrolled())
|
|
%respawn = false;
|
|
|
|
if(!%client.offense) // this is a wave spawned attack bot
|
|
%respawn = true;
|
|
|
|
|
|
%game.pickTeamSpawn( %client, %respawn);
|
|
}
|
|
|
|
function singleplayerGame::pickTeamSpawn(%game, %client, %respawn)
|
|
{
|
|
%team = %client.team;
|
|
|
|
if(%respawn) {
|
|
%group = nameToID("MissionGroup/Teams/team"@%team@"/DropPoints/Respawns");
|
|
if(! isObject(%group)) {
|
|
//error("Client" SPC %client SPC "is attempting a respawn with no drop point");
|
|
return "0 0 300";
|
|
}
|
|
else %spawnLoc = %group.getObject(game.respawnPoint);
|
|
//error("REspawn loc is: " @ %spawnLoc);
|
|
}
|
|
|
|
else {
|
|
%group = nameToID("MissionGroup/Teams/team" @ %team @ "/DropPoints");
|
|
%spawnLoc = %group.getObject(game.spawnLoc[%team]);
|
|
//error("spawn loc is: "@game.spawnLoc[%team]);
|
|
game.spawnLoc[%team]++;
|
|
}
|
|
return %spawnLoc.getTransform();
|
|
}
|
|
|
|
|
|
function SinglePlayerGame::createCustomKeymap(%game)
|
|
{
|
|
// new ActionMap(TrainingMap);
|
|
// TrainingMap.bindCmd( keyboard, "escape", "escapeFromGame();", "" );
|
|
}
|
|
|
|
//=======================================================================================
|
|
// Escape dialog functions:
|
|
//=======================================================================================
|
|
function SinglePlayerEscapeDlg::onWake( %this )
|
|
{
|
|
$timeScale = 0;
|
|
|
|
if( OptionsDlg.isAwake())
|
|
{
|
|
Canvas.popDialog( OptionsDlg );
|
|
}
|
|
}
|
|
|
|
function SinglePlayerEscapeDlg::onSleep( %this )
|
|
{
|
|
// spMap.pop();
|
|
// spMap.delete();
|
|
}
|
|
|
|
|
|
function SinglePlayerEscapeDlg::leaveGame( %this )
|
|
{
|
|
Canvas.popDialog( SinglePlayerEscapeDlg );
|
|
MessageBoxYesNo( "LEAVE GAME", $player.miscMsg[LeaveGame], "forceFinish();", "$timeScale = 1;" );
|
|
}
|
|
|
|
function SinglePlayerEscapeDlg::gotoSettings( %this )
|
|
{
|
|
Canvas.popDialog( SinglePlayerEscapeDlg );
|
|
Canvas.pushDialog( OptionsDlg );
|
|
}
|
|
|
|
function SinglePlayerEscapeDlg::returnToGame( %this )
|
|
{
|
|
//error( "** CALLING SinglePlayerEscapeDlg::returnToGame **" );
|
|
$timeScale = 1;
|
|
Canvas.popDialog( SinglePlayerEscapeDlg );
|
|
|
|
movemap.push();
|
|
//trainingmap.push();
|
|
}
|
|
|
|
|
|
function singlePlayerGame::OptionsDlgSleep(%game)
|
|
{
|
|
$enableDirectInput = 1;
|
|
activateDirectInput();
|
|
|
|
Canvas.pushDialog( SinglePlayerEscapeDlg );
|
|
// the player may have changed his keys
|
|
// we need to reload the big spdialog string table that
|
|
// holds all the text related to the players keymappings
|
|
createText($player);
|
|
}
|
|
|
|
// mission Area package
|
|
package singlePlayerMissionAreaEnforce {
|
|
// -begin mission area package-------------------------------------------------
|
|
|
|
// OOB
|
|
function SinglePlayerGame::leaveMissionArea(%game, %playerData, %player)
|
|
{
|
|
parent::leaveMissionArea(%game, %playerData, %player);
|
|
if(%player == $player.player) {
|
|
$player.leftMissionArea++;
|
|
%timeAllowed = 30;
|
|
$player.OOB = schedule(%timeAllowed *1000, 0, wussOut, %player);
|
|
clearQueue();
|
|
doText(Any_offcourse);
|
|
MessageClient($player, 0, $player.miscMsg[OOB]);
|
|
%player.playerLeftMissionArea = true;
|
|
}
|
|
}
|
|
function SinglePlayerGame::enterMissionArea(%game, %playerData, %player)
|
|
{
|
|
parent::enterMissionArea(%game, %playerData, %player);
|
|
if(%player == $player.player && %player.playerLeftMissionArea) {
|
|
//echo("player back in bounds");
|
|
cancel($player.OOB);
|
|
clearQueue();
|
|
doText(Any_alright);
|
|
MessageClient($player, 0, $player.miscMsg[InBounds]);
|
|
}
|
|
}
|
|
function wussOut(%player)
|
|
{
|
|
clearQueue();
|
|
doText(Any_abort);
|
|
missionFailed($player.miscMsg[OOBLoss]);
|
|
}
|
|
|
|
// -end mission area package-------------------------------------------------
|
|
};
|
|
|
|
// Custom Particle effects for training5
|
|
|
|
datablock ParticleData(BeforeT5particle)
|
|
{
|
|
dragCoefficient = 0;
|
|
gravityCoefficient = -0.017094;
|
|
inheritedVelFactor = 0.0176125;
|
|
constantAcceleration = -0.8;
|
|
lifetimeMS = 1248;
|
|
lifetimeVarianceMS = 0;
|
|
useInvAlpha = 1;
|
|
spinRandomMin = -200;
|
|
spinRandomMax = 200;
|
|
textureName = "particleTest";
|
|
colors[0] = "1.000000 0.677165 0.000000 1.000000";
|
|
colors[1] = "0.708661 0.507812 0.000000 1.000000";
|
|
colors[2] = "0.000000 0.000000 0.000000 0.000000";
|
|
colors[3] = "1.000000 1.000000 1.000000 1.000000";
|
|
sizes[0] = 0.991882;
|
|
sizes[1] = 2.99091;
|
|
sizes[2] = 4.98993;
|
|
sizes[3] = 1;
|
|
times[0] = 0;
|
|
times[1] = 0.2;
|
|
times[2] = 1;
|
|
times[3] = 2;
|
|
};
|
|
|
|
datablock ParticleData(AfterT5particle)
|
|
{
|
|
dragCoefficient = 0;
|
|
gravityCoefficient = -0.017094;
|
|
inheritedVelFactor = 0.0176125;
|
|
constantAcceleration = -1.1129;
|
|
lifetimeMS = 2258;
|
|
lifetimeVarianceMS = 604;
|
|
useInvAlpha = 1;
|
|
spinRandomMin = -200;
|
|
spinRandomMax = 200;
|
|
textureName = "special/Smoke/smoke_001";
|
|
colors[0] = "1.000000 0.677165 0.000000 1.000000";
|
|
colors[1] = "0.181102 0.181102 0.181102 1.000000";
|
|
colors[2] = "0.000000 0.000000 0.000000 0.000000";
|
|
colors[3] = "1.000000 1.000000 1.000000 1.000000";
|
|
sizes[0] = 0.991882;
|
|
sizes[1] = 2.99091;
|
|
sizes[2] = 4.98993;
|
|
sizes[3] = 1;
|
|
times[0] = 0;
|
|
times[1] = 0.2;
|
|
times[2] = 1;
|
|
times[3] = 2;
|
|
};
|
|
|
|
datablock ParticleEmitterData(BeforeT5)
|
|
{
|
|
ejectionPeriodMS = 16;
|
|
periodVarianceMS = 10;
|
|
ejectionVelocity = 7.45968;
|
|
velocityVariance = 0.25;
|
|
ejectionOffset = 0;
|
|
thetaMin = 0;
|
|
thetaMax = 180;
|
|
phiReferenceVel = 0;
|
|
phiVariance = 360;
|
|
overrideAdvances = 0;
|
|
orientParticles= 0;
|
|
orientToNormal = 0;
|
|
orientOnVelocity = 1;
|
|
particles = "BeforeT5particle";
|
|
};
|
|
|
|
datablock ParticleEmitterData(AfterT5)
|
|
{
|
|
ejectionPeriodMS = 10;
|
|
periodVarianceMS = 0;
|
|
ejectionVelocity = 10.25;
|
|
velocityVariance = 0.25;
|
|
ejectionOffset = 0;
|
|
thetaMin = 0;
|
|
thetaMax = 180;
|
|
phiReferenceVel = 0;
|
|
phiVariance = 360;
|
|
overrideAdvances = 0;
|
|
orientParticles= 0;
|
|
orientToNormal = 0;
|
|
orientOnVelocity = 1;
|
|
particles = "AfterT5particle";
|
|
};
|