mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-03-02 12:03:56 +00:00
Initial commit
This commit is contained in:
parent
2211ed7650
commit
ebb3dc9cdd
10121 changed files with 801 additions and 4 deletions
899
docs/base/@vl2/scripts.vl2/scripts/BountyGame.cs
Normal file
899
docs/base/@vl2/scripts.vl2/scripts/BountyGame.cs
Normal file
|
|
@ -0,0 +1,899 @@
|
|||
//--- GAME RULES BEGIN ---
|
||||
//Eliminate Targets in order assigned; eliminate Pursuer(s) without penalty
|
||||
//Killing a Bystander who was a former Target returns him to your Target pool
|
||||
//Killing 3 or more Targets in a row without dying earns a bonus
|
||||
//Killing all Targets first earns a bonus
|
||||
//Red = Target, Green = Bystander
|
||||
//--- GAME RULES END ---
|
||||
|
||||
//Spec Note: Upon entry to game -
|
||||
// All opponents have green triangles.
|
||||
// Once you select your target, that player's triangle appears red (for you).
|
||||
// If someone who has you as a target (a Pursuer) damages you, his triangle disappears altogether (for you).
|
||||
// Once your target is eliminated, he respawns with a green triangle.
|
||||
// If your Pursuer kills you, he has a green triangle again when you respawn (unless he becomes your target).
|
||||
|
||||
exec("scripts/aiBountyGame.cs");
|
||||
|
||||
$InvBanList[Bounty, "TurretOutdoorDeployable"] = 1;
|
||||
$InvBanList[Bounty, "TurretIndoorDeployable"] = 1;
|
||||
$InvBanList[Bounty, "ElfBarrelPack"] = 1;
|
||||
$InvBanList[Bounty, "MortarBarrelPack"] = 1;
|
||||
$InvBanList[Bounty, "PlasmaBarrelPack"] = 1;
|
||||
$InvBanList[Bounty, "AABarrelPack"] = 1;
|
||||
$InvBanList[Bounty, "MissileBarrelPack"] = 1;
|
||||
$InvBanList[Bounty, "Mine"] = 1;
|
||||
|
||||
//-----------------Bounty Game score inits --------------
|
||||
// .objectiveTargetKills .bystanderKills .predatorKills .suicides .deaths
|
||||
function BountyGame::initGameVars(%game)
|
||||
{
|
||||
%game.SCORE_PER_TARGETKILL = 1;
|
||||
%game.SCORE_PER_BYSTANDERKILL = -1;
|
||||
%game.SCORE_PER_SUICIDE = -1;
|
||||
%game.SCORE_PER_DEATH = 0;
|
||||
%game.SCORE_PER_COMPLETION_BONUS = 5;
|
||||
%game.SIZE_STREAK_TO_AWARD = 3; //award bonus for a winning streak this big or better
|
||||
%game.WARN_AT_NUM_OBJREM = 2; //display warning when player has only this many or less objectives left
|
||||
%game.MAX_CHEATDEATHS_ALLOWED = 1; //number of times a player can die by cntrl-k or die by leaving mission area before being labeled a cheater
|
||||
|
||||
%game.waypointFrequency = 24000;
|
||||
%game.waypointDuration = 6000;
|
||||
}
|
||||
|
||||
function BountyGame::startMatch(%game)
|
||||
{
|
||||
//call the default
|
||||
DefaultGame::startMatch(%game);
|
||||
|
||||
//now give everyone who's already playing a target
|
||||
%count = ClientGroup.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
%game.nextObjective(%cl);
|
||||
}
|
||||
}
|
||||
|
||||
function BountyGame::allowsProtectedStatics(%game)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
function BountyGame::setUpTeams(%game)
|
||||
{
|
||||
if ((%group = nameToID("MissionGroup/Teams")) == -1)
|
||||
return;
|
||||
|
||||
%dropSet = new SimSet("TeamDrops0");
|
||||
MissionCleanup.add(%dropSet);
|
||||
|
||||
%group.setTeam(0);
|
||||
|
||||
game.numTeams = 1;
|
||||
setSensorGroupCount(32);
|
||||
|
||||
//now set up the sensor group colors - specific for bounty - everyone starts out green to everone else...
|
||||
for(%i = 0; %i < 32; %i++)
|
||||
setSensorGroupColor(%i, 0xfffffffe, "0 255 0 255");
|
||||
}
|
||||
|
||||
function BountyGame::pickTeamSpawn(%game, %team)
|
||||
{
|
||||
DefaultGame::pickTeamSpawn(%game, 0);
|
||||
}
|
||||
|
||||
function BountyGame::claimSpawn(%game, %obj, %newTeam, %oldTeam)
|
||||
{
|
||||
%newSpawnGroup = nameToId("MissionCleanup/TeamDrops0");
|
||||
%newSpawnGroup.add(%obj);
|
||||
}
|
||||
|
||||
function BountyGame::clientJoinTeam( %game, %client, %team, %respawn )
|
||||
{
|
||||
%game.assignClientTeam( %client );
|
||||
|
||||
// Spawn the player:
|
||||
%game.spawnPlayer( %client, %respawn );
|
||||
}
|
||||
|
||||
function BountyGame::assignClientTeam(%game, %client)
|
||||
{
|
||||
%client.team = 0;
|
||||
|
||||
//initialize the team array
|
||||
for (%i = 1; %i < 32; %i++)
|
||||
%game.teamArray[%i] = false;
|
||||
|
||||
%count = ClientGroup.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl.team != 0)
|
||||
%game.teamArray[%cl.team] = true;
|
||||
}
|
||||
|
||||
//now loop through the team array, looking for an empty team
|
||||
for (%i = 1; %i < 32; %i++)
|
||||
{
|
||||
if (! %game.teamArray[%i])
|
||||
{
|
||||
%client.team = %i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// set player's skin pref here
|
||||
setTargetSkin(%client.target, %client.skin);
|
||||
%client.justEntered = true;
|
||||
|
||||
// Let everybody know you are no longer an observer:
|
||||
messageAll( 'MsgClientJoinTeam', '\c1%1 has joined the fray.', %client.name, "", %client, 1 );
|
||||
|
||||
updateCanListenState( %client );
|
||||
|
||||
logEcho(%client.nameBase@" (cl "@%client@") entered game");
|
||||
}
|
||||
|
||||
function BountyGame::playerSpawned(%game, %player, %armor)
|
||||
{
|
||||
DefaultGame::playerSpawned(%game, %player, %armor);
|
||||
|
||||
%client = %player.client;
|
||||
if (%client.justEntered)
|
||||
{
|
||||
%client.justEntered = "";
|
||||
%game.updateHitLists();
|
||||
}
|
||||
%client.isPlaying = true;
|
||||
// if client spawned and has no target (e.g. when first enters game), give him one
|
||||
// if client came from observer mode, should still have a target
|
||||
if (!%client.objectiveTarget && $MatchStarted)
|
||||
%game.nextObjective(%client);
|
||||
|
||||
//make sure the colors for this client are correct
|
||||
%game.updateColorMask(%client);
|
||||
|
||||
//show the waypoint for this player...
|
||||
%client.damagedTargetTime = 0;
|
||||
cancel(%client.waypointSchedule);
|
||||
%game.showTargetWaypoint(%client);
|
||||
|
||||
//also, anyone who has this client as an objective target, update their waypoint as well...
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl.objectiveTarget == %client)
|
||||
{
|
||||
%cl.damagedTargetTime = 0;
|
||||
cancel(%cl.waypointSchedule);
|
||||
%game.showTargetWaypoint(%cl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function BountyGame::equip(%game, %player)
|
||||
{
|
||||
for(%i =0; %i<$InventoryHudCount; %i++)
|
||||
%player.client.setInventoryHudItem($InventoryHudData[%i, itemDataName], 0, 1);
|
||||
%player.client.clearBackpackIcon();
|
||||
|
||||
//%player.setArmor("Light");
|
||||
%player.setInventory(EnergyPack, 1);
|
||||
%player.setInventory(RepairKit,1);
|
||||
%player.setInventory(Grenade,6);
|
||||
%player.setInventory(Blaster,1);
|
||||
%player.setInventory(Disc,1);
|
||||
%player.setInventory(Chaingun, 1);
|
||||
%player.setInventory(ChaingunAmmo, 100);
|
||||
%player.setInventory(DiscAmmo, 20);
|
||||
%player.setInventory(Beacon, 3);
|
||||
%player.setInventory(TargetingLaser, 1);
|
||||
%player.weaponCount = 3;
|
||||
|
||||
%player.use("Blaster");
|
||||
}
|
||||
|
||||
function BountyGame::updateColorMask(%game, %client)
|
||||
{
|
||||
//set yourself to red, so your objectives will be red
|
||||
%redMask = 0;
|
||||
%blueMask = 0;
|
||||
|
||||
%count = ClientGroup.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
|
||||
//first, see if the client is your target
|
||||
if (%cl == %client.objectiveTarget)
|
||||
%redMask |= (1 << %cl.team);
|
||||
|
||||
//else see if the have you as a target, and have damaged you...
|
||||
else if (%cl.objectiveTarget == %client && %cl.damagedObjectiveTarget)
|
||||
%blueMask |= (1 << %cl.team);
|
||||
}
|
||||
|
||||
//first everyone to green
|
||||
setSensorGroupColor(%client.team, 0xfffffffe, "0 255 0 255");
|
||||
|
||||
//now set the red mask (your target)
|
||||
setSensorGroupColor(%client.team, %redMask, "255 0 0 255");
|
||||
|
||||
//finally, set the blue mask (by setting alpha to 0 the damage/triangle will not appear, though
|
||||
// names still can).. if none were desired then making this group never visible would be
|
||||
// the better solution
|
||||
setSensorGroupColor(%client.team, %blueMask, "0 0 255 0");
|
||||
}
|
||||
|
||||
function BountyGame::showTargetWaypoint(%game, %client)
|
||||
{
|
||||
//AI's simply detect their target
|
||||
if (%client.isAIControlled())
|
||||
{
|
||||
if (AIClientIsAlive(%client.objectiveTarget))
|
||||
%client.clientDetected(%client.objectiveTarget);
|
||||
return;
|
||||
}
|
||||
|
||||
//only show the target waypoint if the target hasn't been damaged within the frequency period
|
||||
if (getSimTime() - %client.damagedTargetTime < %game.waypointFrequency)
|
||||
{
|
||||
%client.waypointSchedule = %game.schedule(%game.waypointFrequency, "showTargetWaypoint", %client);
|
||||
return;
|
||||
}
|
||||
|
||||
//flash a waypoint on the %client's current objective
|
||||
%clTarget = %client.objectiveTarget;
|
||||
if (!AIClientIsAlive(%clTarget) || !AIClientIsAlive(%client))
|
||||
return;
|
||||
|
||||
//set the vis mask
|
||||
%visMask = getSensorGroupAlwaysVisMask(%clTarget.getSensorGroup());
|
||||
%visMask |= (1 << %client.getSensorGroup());
|
||||
setSensorGroupAlwaysVisMask(%clTarget.getSensorGroup(), %visMask);
|
||||
|
||||
//scope the client, then set the always vis mask...
|
||||
if (isObject(%clTarget.player))
|
||||
{
|
||||
//always keep the target in scope...
|
||||
%clTarget.player.scopeToClient(%client);
|
||||
|
||||
//now issue a command to kill the target
|
||||
%client.setTargetId(%clTarget.target);
|
||||
commandToClient(%client, 'TaskInfo', %client, -1, false, "Attack Target");
|
||||
%client.sendTargetTo(%client, true);
|
||||
|
||||
//send the "waypoint is here sound" - QIX, need a sound!
|
||||
messageClient(%client, 'MsgBountyWaypoint', '~wfx/misc/target_waypoint.wav');
|
||||
}
|
||||
|
||||
//schedule the time to hide the waypoint
|
||||
%client.waypointSchedule = %game.schedule(%game.waypointDuration, "hideTargetWaypoint", %client);
|
||||
}
|
||||
|
||||
function BountyGame::hideTargetWaypoint(%game, %client)
|
||||
{
|
||||
//AI's simply detect their target
|
||||
if (%client.isAIControlled())
|
||||
{
|
||||
if (AIClientIsAlive(%client.objectiveTarget))
|
||||
%client.clientDetected(%client.objectiveTarget);
|
||||
return;
|
||||
}
|
||||
|
||||
//flash a waypoint on the %client's current objective
|
||||
%clTarget = %client.objectiveTarget;
|
||||
if (!isObject(%clTarget))
|
||||
return;
|
||||
|
||||
//clear scope the client, then unset the always vis mask...
|
||||
%visMask = getSensorGroupAlwaysVisMask(%clTarget.getSensorGroup());
|
||||
%visMask &= ~(1 << %client.getSensorGroup());
|
||||
setSensorGroupAlwaysVisMask(%clTarget.getSensorGroup(), %visMask);
|
||||
|
||||
//kill the actually task...
|
||||
removeClientTargetType(%client, "AssignedTask");
|
||||
|
||||
//schedule the next time the waypoint should flash
|
||||
%client.waypointSchedule = %game.schedule(%game.waypointFrequency, "showTargetWaypoint", %client);
|
||||
}
|
||||
|
||||
function BountyGame::nextObjective(%game, %client)
|
||||
{
|
||||
%numValidTargets = %game.buildListValidTargets(%client);
|
||||
|
||||
if (%numValidTargets > 0)
|
||||
{
|
||||
// if there are valid targets (other players that client hasn't killed)
|
||||
%client.objectiveTarget = %game.selectNewTarget(%client, %numValidTargets);
|
||||
%client.objectiveTargetName = detag((%client.objectiveTarget).name);
|
||||
%client.damagedObjectiveTarget = false;
|
||||
|
||||
// this client has now been assigned a target
|
||||
%client.hasHadTarget = true;
|
||||
messageClient(%client, 'msgBountyTargetIs', '\c2Your target is %1.', %client.objectiveTarget.name);
|
||||
|
||||
//for the client, set his mask to see his target as red, anyone who as him as a target and has damaged him is blue
|
||||
//and everyone else is green...
|
||||
%game.updateColorMask(%client);
|
||||
|
||||
//set a temporary waypoint so you can find your new target
|
||||
if (%client.isAIControlled())
|
||||
%game.aiBountyAssignTarget(%client, %client.objectiveTarget);
|
||||
|
||||
//show the waypoint...
|
||||
%client.damagedTargetTime = 0;
|
||||
cancel(%client.waypointSchedule);
|
||||
%game.showTargetWaypoint(%client);
|
||||
logEcho(%client.nameBase@" (pl "@%client.player@"/cl "@%client@") assigned objective");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (%client.hasHadTarget)
|
||||
{
|
||||
// if there aren't any more valid targets and you've been assigned one,
|
||||
// that means you've killed everyone -- game over!
|
||||
%game.awardScoreCompletionBonus(%client);
|
||||
%game.gameOver();
|
||||
cycleMissions();
|
||||
}
|
||||
else
|
||||
{
|
||||
cancel(%client.awaitingTargetThread);
|
||||
%client.awaitingTargetThread = %game.schedule(500, "nextObjective", %client); //waiting for an opponent to join, keep checking 2x per second.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function BountyGame::buildListValidTargets(%game, %cl)
|
||||
{
|
||||
%availTargets = 0;
|
||||
%numClients = ClientGroup.getCount();
|
||||
for (%cIndex = 0; %cIndex < %numClients; %cIndex++)
|
||||
{
|
||||
%opponent = ClientGroup.getObject(%cIndex);
|
||||
//make sure the target isn't yourself, or an observer
|
||||
if (%opponent != %cl && %opponent.team > 0 && !%opponent.isNotInGame)
|
||||
{
|
||||
//make sure candidate for list has not already been killed by client
|
||||
if (!%cl.eliminated[%opponent])
|
||||
{
|
||||
%cl.validList[%availTargets] = %opponent;
|
||||
%availTargets++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//returns length of list (number of players eligible as targets to this client)
|
||||
%game.hudUpdateObjRem(%cl, %availTargets);
|
||||
if ((%availTargets <= %game.WARN_AT_NUM_OBJREM) && (%cl.hasHadTarget))
|
||||
%game.announceEminentWin(%cl, %availTargets);
|
||||
return %availTargets;
|
||||
}
|
||||
|
||||
function BountyGame::selectNewTarget(%game, %cl, %numValidTargets)
|
||||
{
|
||||
// pick a player at random from eligible target list
|
||||
%targetIndex = mFloor(getRandom() * (%numValidTargets - 0.01));
|
||||
//echo("picking index " @ %targetIndex @ " from ValidList");
|
||||
return %cl.validList[%targetIndex];
|
||||
}
|
||||
|
||||
function BountyGame::updateHitLists(%game)
|
||||
{
|
||||
%numClients = ClientGroup.getCount();
|
||||
for (%cIndex = 0; %cIndex < %numClients; %cIndex++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%cIndex);
|
||||
%game.buildListValidTargets(%cl);
|
||||
}
|
||||
}
|
||||
|
||||
function BountyGame::timeLimitReached(%game)
|
||||
{
|
||||
%game.gameOver();
|
||||
cycleMissions();
|
||||
}
|
||||
|
||||
function BountyGame::gameOver(%game)
|
||||
{
|
||||
//call the default
|
||||
DefaultGame::gameOver(%game);
|
||||
|
||||
//send the message
|
||||
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.gameover.wav" );
|
||||
|
||||
messageAll('MsgClearObjHud', "");
|
||||
for(%i = 0; %i < ClientGroup.getCount(); %i++) {
|
||||
%client = ClientGroup.getObject(%i);
|
||||
%game.resetScore(%client);
|
||||
cancel(%client.waypointSchedule);
|
||||
cancel(%client.forceRespawnThread);
|
||||
}
|
||||
}
|
||||
|
||||
function BountyGame::clientMissionDropReady(%game, %client)
|
||||
{
|
||||
%game.resetScore(%client);
|
||||
messageClient(%client, 'MsgClientReady', "", %game.class);
|
||||
messageClient(%client, 'MsgBountyTargetIs', "", "");
|
||||
messageClient(%client, 'MsgYourScoreIs', "", 0);
|
||||
//%objRem = %game.buildListValidTargets(%client);
|
||||
//messageClient(%client, 'MsgBountyObjRem', "", %objRem);
|
||||
//messageClient(%client, 'MsgYourRankIs', "", -1);
|
||||
|
||||
messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName );
|
||||
|
||||
DefaultGame::clientMissionDropReady(%game, %client);
|
||||
}
|
||||
|
||||
function BountyGame::AIHasJoined(%game, %client)
|
||||
{
|
||||
//let everyone know the player has joined the game
|
||||
//messageAllExcept(%client, -1, 'MsgClientJoinTeam', '%1 has joined the fray.', %client.name, "", %client, 1);
|
||||
}
|
||||
|
||||
function BountyGame::forceRespawn(%game, %client)
|
||||
{
|
||||
//make sure the player hasn't already respawned
|
||||
if (isObject(%client.player))
|
||||
return;
|
||||
|
||||
commandToClient(%client, 'setHudMode', 'Standard');
|
||||
Game.spawnPlayer( %client, true );
|
||||
%client.camera.setFlyMode();
|
||||
%client.setControlObject(%client.player);
|
||||
}
|
||||
|
||||
function BountyGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc)
|
||||
{
|
||||
DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc);
|
||||
|
||||
// you had your shot
|
||||
%clVictim.isPlaying = false;
|
||||
cancel(%clVictim.awaitingTargetThread);
|
||||
|
||||
// any time a person dies, the kill streak is reset
|
||||
%clVictim.killStreak = 0;
|
||||
|
||||
//force the player to respawn
|
||||
if (!%clVictim.isAIControlled())
|
||||
%clVictim.forceRespawnThread = %game.schedule(5000, forceRespawn, %clVictim);
|
||||
}
|
||||
|
||||
function BountyGame::onClientLeaveGame(%game, %clientId)
|
||||
{
|
||||
DefaultGame::onClientLeaveGame(%game, %clientId);
|
||||
%clientId.isNotInGame = true;
|
||||
|
||||
%numClients = ClientGroup.getCount();
|
||||
for (%index = 0; %index < %numClients; %index++)
|
||||
{
|
||||
%possPredator = ClientGroup.getObject(%index);
|
||||
// make sure this guy gets erased from everyone's eliminated list
|
||||
%possPredator.eliminated[%clientId] = "";
|
||||
|
||||
//no need for this - anyone who has him as a target will have their colors reset in game.nextObjective()
|
||||
//reset everyones triangles to friendly and visible so the next guy that joins, doesn't get the old settings
|
||||
//setTargetFriendlyMask(%possPredator.target, getTargetFriendlyMask(%possPredator.target) | (1<<getTargetSensorGroup(%clientID.target)));
|
||||
//setTargetNeverVisMask(%possPredator.target, getTargetNeverVisMask(%possPredator.target) & ~(1<<getTargetSensorGroup(%clientID.target)));
|
||||
|
||||
// if anyone had this client as a target, get them a new target
|
||||
if (%possPredator.objectiveTarget == %clientID)
|
||||
{
|
||||
messageClient(%possPredator, 'msgBountyTargetDropped', '\c2%1 has left the game and is no longer a target', %clientId.name);
|
||||
%game.nextObjective(%possPredator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function BountyGame::onClientEnterObserverMode(%game, %clientId)
|
||||
{
|
||||
//cancel the respawn schedule
|
||||
cancel(%clientId.forceRespawnThread);
|
||||
|
||||
//notify everyone else, and choose a new objective if required...
|
||||
%numClients = ClientGroup.getCount();
|
||||
for (%index = 0; %index < %numClients; %index++)
|
||||
{
|
||||
// if anyone had this guy as a target, pick new target
|
||||
%possPredator = ClientGroup.getObject(%index);
|
||||
if (%possPredator.objectiveTarget == %clientId)
|
||||
{
|
||||
messageClient(%possPredator, 'msgBountyTargetEntObs', '\c2%1 has left the playfield and is no longer a target', %clientId.name);
|
||||
%game.nextObjective(%possPredator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function BountyGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %sourceObject)
|
||||
{
|
||||
DefaultGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %sourceObject);
|
||||
|
||||
//the updateColorMask function chooses red over blue, so no need to check if each is the other's target
|
||||
if (%clAttacker.objectiveTarget == %clVictim && !%clAttacker.damagedObjectiveTarget)
|
||||
{
|
||||
%clAttacker.damagedObjectiveTarget = true;
|
||||
%game.updateColorMask(%clVictim);
|
||||
}
|
||||
|
||||
//update the time at which the attacker damaged his target
|
||||
if (%clAttacker.objectiveTarget == %clVictim)
|
||||
%clAttacker.damagedTargetTime = getSimTime();
|
||||
}
|
||||
|
||||
function BountyGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %implement)
|
||||
{
|
||||
|
||||
if (%game.testSuicide(%clVictim, %clKiller, %damageType))
|
||||
%game.awardScoreSuicide(%clVictim, %damageType);
|
||||
else if (%game.testTargetKill(%clVictim, %clKiller))
|
||||
%game.awardScoreTargetKill(%clVictim, %clKiller);
|
||||
else if (%game.testPredatorKill(%clVictim, %clKiller))
|
||||
%game.awardScorePredatorKill(%clVictim, %clKiller);
|
||||
else
|
||||
%game.awardScoreBystanderKill(%clVictim, %clKiller);
|
||||
|
||||
if (%game.testCheating(%clVictim))
|
||||
%game.announceCheater(%clVictim);
|
||||
|
||||
%game.recalcScore(%clKiller);
|
||||
%game.recalcScore(%clVictim);
|
||||
}
|
||||
|
||||
function BountyGame::testCheating(%game, %client)
|
||||
{
|
||||
return (%client.cheated > %game.MAX_CHEATDEATHS_ALLOWED);
|
||||
}
|
||||
|
||||
function BountyGame::testSuicide(%game, %victimID, %killerID, %damageType)
|
||||
{
|
||||
return ((%victimID == %killerID) || (%damageType == $DamageType::Ground) || (%damageType == $DamageType::Suicide) || (%damageType == $DamageType::OutOfBounds));
|
||||
}
|
||||
|
||||
function BountyGame::testTargetKill(%game, %clVictim, %clKiller)
|
||||
{
|
||||
// was the person you just killed your target?
|
||||
return (%clKiller.objectiveTarget == %clVictim);
|
||||
}
|
||||
|
||||
function BountyGame::testPredatorKill(%game, %clVictim, %clKiller)
|
||||
{
|
||||
// were you the target of the person you just killed?
|
||||
return (%clVictim.objectiveTarget == %clKiller);
|
||||
}
|
||||
|
||||
function BountyGame::awardScoreSuicide(%game, %clVictim, %damageType)
|
||||
{
|
||||
//now loop through the client, and award the kill to any attacker who damaged the client within 20 secs...
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl.objectiveTarget == %clVictim)
|
||||
{
|
||||
%game.awardScoreTargetKill(%clVictim, %cl, true);
|
||||
messageClient(%clVictim, 'msgBountyTarKil', '\c2You eliminated yourself. %1 has been awarded the bounty!', %cl.name);
|
||||
}
|
||||
}
|
||||
|
||||
//update the "cheated" count
|
||||
if (%damageType == $DamageType::Suicide)
|
||||
{
|
||||
%clVictim.cheated++;
|
||||
DefaultGame::awardScoreSuicide(%game, %clVictim);
|
||||
}
|
||||
|
||||
%game.recalcScore(%clVictim);
|
||||
%clVictim.killStreak = 0;
|
||||
}
|
||||
|
||||
function BountyGame::awardScoreTargetKill(%game,%clVictim, %clKiller, %victimSuicided)
|
||||
{
|
||||
// congratulations, you killed your target
|
||||
%clKiller.objectiveTargetKills++;
|
||||
%clKiller.kills = %clKiller.objectiveTargetKills;
|
||||
%clKiller.eliminated[%clVictim] = true;
|
||||
|
||||
if (%victimSuicided)
|
||||
{
|
||||
if (%clVictim.gender $= "Female")
|
||||
messageClient(%clKiller, 'msgBountyTarKil', '\c2Target %1 helped you out by eliminating herself!', %clVictim.name);
|
||||
else
|
||||
messageClient(%clKiller, 'msgBountyTarKil', '\c2Target %1 helped you out by eliminating himself!', %clVictim.name);
|
||||
}
|
||||
else
|
||||
messageClient(%clKiller, 'msgBountyTarKil', '\c2You eliminated target %1!', %clVictim.name);
|
||||
|
||||
if (%game.SCORE_PER_TARGETKILL != 0)
|
||||
%game.recalcScore(%clKiller);
|
||||
|
||||
%clKiller.killStreak++;
|
||||
%clVictim.killStreak = 0;
|
||||
if (%clKiller.killStreak >= %game.SIZE_STREAK_TO_AWARD) //award points for a kill streak
|
||||
%game.awardScoreKillStreak(%clKiller);
|
||||
|
||||
//the victim is no longer the objective of the killer, reset his colors.
|
||||
//The colors for the killer will be reset in game.nextObjective()
|
||||
%clKiller.objectiveTarget = "";
|
||||
%game.updateColorMask(%clVictim);
|
||||
|
||||
%game.nextObjective(%clKiller);
|
||||
|
||||
//since the killer scored, update everyone who's got him as a target...
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl.objectiveTarget == %clKiller)
|
||||
{
|
||||
%cl.damagedTargetTime = 0;
|
||||
cancel(%cl.waypointSchedule);
|
||||
%game.showTargetWaypoint(%cl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function BountyGame::awardScoreBystanderKill(%game, %clVictim, %clKiller)
|
||||
{
|
||||
// uh oh, you killed someone other than your target or the person targeting you
|
||||
%clKiller.bystanderKills++;
|
||||
//%clVictim.killStreak = 0; //don't penalize the bystander right now, maybe change this later
|
||||
// if you'd already killed him legally, he's back on your prospective target list
|
||||
|
||||
if (mAbs(%game.SCORE_PER_BYSTANDERKILL) > 1)
|
||||
%plural = (%game.SCORE_PER_BYSTANDERKILL > 1 ? "s" : "");
|
||||
|
||||
if (%game.SCORE_PER_BYSTANDERKILL != 0)
|
||||
{
|
||||
messageClient(%clKiller, 'msgBountyBysKil', '\c0You have been penalized %1 point%2 for killing bystander %3.', mAbs(%game.SCORE_PER_BYSTANDERKILL), %plural, %clVictim.name);
|
||||
messageClient(%clVictim, 'msgBountyBystander', '\c2You were the victim of %1\'s lousy aim! He was penalized.', %clKiller.name);
|
||||
%game.recalcScore(%clKiller);
|
||||
}
|
||||
|
||||
//add a target back to your list (any target)
|
||||
%targetCount = 0;
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%clKiller.eliminated[%cl])
|
||||
{
|
||||
%addTargetsArray[%targetCount] = %cl;
|
||||
%targetCount++;
|
||||
}
|
||||
}
|
||||
|
||||
//see if we found any targets we can add back on...
|
||||
if (%targetCount > 0)
|
||||
{
|
||||
%clKiller.eliminated[%addTargetsArray[mFloor(getRandom() * (%targetCount - 0.01))]] = false;
|
||||
messageClient(%clKiller, 'msgBountyBysRedo', '\c2One target has been added back onto your Bounty list.');
|
||||
}
|
||||
|
||||
%clKiller.killStreak = 0;
|
||||
}
|
||||
|
||||
function BountyGame::awardScorePredatorKill(%game, %clVictim, %clKiller)
|
||||
{
|
||||
%clVictim.killStreak = 0;
|
||||
messageClient(%clKiller, 'msgBountyPredKill', '\c0You have temporarily fended off %1.', %clVictim.name);
|
||||
|
||||
//now, try to assign a new objective target for clVictim...
|
||||
%game.nextObjective(%clVictim);
|
||||
|
||||
//also update the color mask for the killer...
|
||||
%game.updateColorMask(%clKiller);
|
||||
}
|
||||
|
||||
function BountyGame::awardScoreKillStreak(%game, %cl)
|
||||
{
|
||||
%bonus = (%cl.killStreak - %game.SIZE_STREAK_TO_AWARD) + 1;
|
||||
%cl.streakPoints += %bonus;
|
||||
|
||||
messageClient(%cl,'msgBountyPlrStrkBonus', '\c0You received a %1 point bonus for a %2 kill streak!', %bonus, %cl.killStreak);
|
||||
messageAll('msgBountyStreakBonus', '\c0%1 has eliminated %2 targets in a row!', %cl.name, %cl.killStreak, %bonus); //send bonus for sound parsing
|
||||
//callback exists in client.cs for 'msgBountyStreakBonus', to play repeating bell sound length dependent on streak
|
||||
}
|
||||
|
||||
function BountyGame::awardScoreCompletionBonus(%game, %cl)
|
||||
{
|
||||
// you killed everybody who was on your list
|
||||
%cl.compBonus = 1;
|
||||
if (%game.SCORE_PER_COMPLETION_BONUS != 0)
|
||||
messageAll('msgBountyCompBonus', '\c2%1 receives a %2 point bonus for completing all objectives.', %cl.name, %game.SCORE_PER_COMPLETION_BONUS);
|
||||
|
||||
%game.recalcScore(%cl);
|
||||
}
|
||||
|
||||
|
||||
function BountyGame::announceEminentWin(%game, %cl, %objRem)
|
||||
{
|
||||
%wav = "~wfx/misc/bounty_objRem" @ %objRem @ ".wav";
|
||||
%plural = (%objRem > 1 ? "s" : "");
|
||||
if (%objRem > 0)
|
||||
messageAll('msgBountyEminent', '\c2%1 has only %2 target%3 left!%4', %cl.name, %objRem, %plural, %wav);
|
||||
else
|
||||
messageAll('msgBountyOver', '\c2%1 has eliminated all targets!~wfx/misc/bounty_completed.wav', %cl.name);
|
||||
}
|
||||
|
||||
function BountyGame::announceCheater(%game, %client)
|
||||
{
|
||||
if (%client.cheated > 1)
|
||||
%plural = "s";
|
||||
else
|
||||
%plural = "";
|
||||
messageAll('msgCheater', '%1 has suicided \c2%2 \c0time%3!', %client.name, %client.cheated, %plural);
|
||||
}
|
||||
|
||||
function BountyGame::recalcScore(%game, %cl)
|
||||
{
|
||||
%cl.score = %cl.objectiveTargetKills * %game.SCORE_PER_TARGETKILL;
|
||||
%cl.score += %cl.bystanderKills * %game.SCORE_PER_BYSTANDERKILL;
|
||||
%cl.score += %cl.suicides * %game.SCORE_PER_SUICIDE;
|
||||
%cl.score += %cl.compBonus * %game.SCORE_PER_COMPLETION_BONUS;
|
||||
%cl.score += %cl.streakPoints; //this awarded in awardScoreKillStreak
|
||||
|
||||
messageClient(%cl, 'MsgYourScoreIs', "", %cl.score);
|
||||
|
||||
%game.recalcTeamRanks(%cl);
|
||||
}
|
||||
|
||||
function BountyGame::resetScore(%game, %cl)
|
||||
{
|
||||
%cl.score = 0;
|
||||
%cl.kills = 0;
|
||||
%cl.objectiveTargetKills = 0;
|
||||
%cl.bystanderKills = 0;
|
||||
%cl.suicides = 0;
|
||||
%cl.compBonus = 0;
|
||||
%cl.streakPoints = 0;
|
||||
|
||||
cancel(%cl.awaitingTargetThread);
|
||||
|
||||
%cl.killstreak = "";
|
||||
%cl.cheated = "";
|
||||
%cl.hasHadTarget = false;
|
||||
|
||||
//reset %cl's hit list
|
||||
//note that although this only clears clients (enemies) currently in the game,
|
||||
//clients (enemies) who left early should have been cleared at that time.
|
||||
%numClients = ClientGroup.getCount();
|
||||
for (%count = 0; %count < %numClients; %count++)
|
||||
{
|
||||
%enemy = ClientGroup.getObject(%count);
|
||||
%cl.eliminated[%enemy] = "";
|
||||
}
|
||||
}
|
||||
|
||||
function BountyGame::hudUpdateObjRem(%game, %client, %availTargets)
|
||||
{
|
||||
// how many people do you have left to kill?
|
||||
messageClient(%client, 'msgBountyObjRem', "", %availTargets);
|
||||
}
|
||||
|
||||
function BountyGame::enterMissionArea(%game, %playerData, %player)
|
||||
{
|
||||
%player.client.outOfBounds = false;
|
||||
messageClient(%player.client, 'EnterMissionArea', '\c1You are back in the mission area.');
|
||||
cancel(%player.alertThread);
|
||||
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") entered mission area");
|
||||
}
|
||||
|
||||
function BountyGame::leaveMissionArea(%game, %playerData, %player)
|
||||
{
|
||||
if(%player.getState() $= "Dead")
|
||||
return;
|
||||
|
||||
%player.client.outOfBounds = true;
|
||||
messageClient(%player.client, 'LeaveMissionArea', '\c1You have left the mission area. Return or take damage.~wfx/misc/warning_beep.wav');
|
||||
%player.alertThread = %game.schedule(1000, "AlertPlayer", 3, %player);
|
||||
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") left mission area");
|
||||
}
|
||||
|
||||
function BountyGame::AlertPlayer(%game, %count, %player)
|
||||
{
|
||||
if(%count > 1)
|
||||
%player.alertThread = %game.schedule(1000, "AlertPlayer", %count - 1, %player);
|
||||
else
|
||||
%player.alertThread = %game.schedule(1000, "MissionAreaDamage", %player);
|
||||
}
|
||||
|
||||
function BountyGame::MissionAreaDamage(%game, %player)
|
||||
{
|
||||
if(%player.getState() !$= "Dead") {
|
||||
%player.setDamageFlash(0.1);
|
||||
%prevHurt = %player.getDamageLevel();
|
||||
%player.setDamageLevel(%prevHurt + 0.05);
|
||||
// a little redundancy to see if the lastest damage killed the player
|
||||
if(%player.getState() $= "Dead")
|
||||
%game.onClientKilled(%player.client, 0, $DamageType::OutOfBounds);
|
||||
else
|
||||
%player.alertThread = %game.schedule(1000, "MissionAreaDamage", %player);
|
||||
}
|
||||
else
|
||||
{
|
||||
%game.onClientKilled(%player.client, 0, $DamageType::OutOfBounds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function BountyGame::updateScoreHud(%game, %client, %tag)
|
||||
{
|
||||
// clear the header:
|
||||
messageClient( %client, 'SetScoreHudHeader', "", "" );
|
||||
|
||||
// send the subheader:
|
||||
messageClient( %client, 'SetScoreHudSubheader', "", '<tab:15,235,335>\tPLAYER\tSCORE\tTARGETS LEFT' );
|
||||
|
||||
for ( %index = 0; %index < $TeamRank[0, count]; %index++ )
|
||||
{
|
||||
//get the client info
|
||||
%cl = $TeamRank[0, %index];
|
||||
%clScore = %cl.score $= "" ? 0 : %cl.score;
|
||||
|
||||
//find out how many targets this client has left
|
||||
%clTargets = 0;
|
||||
for (%cIndex = 0; %cIndex < ClientGroup.getCount(); %cIndex++)
|
||||
{
|
||||
%opponent = ClientGroup.getObject(%cIndex);
|
||||
if (!%opponent.isNotInGame && %opponent.team > 0 && %opponent != %cl && !%cl.eliminated[%opponent])
|
||||
%clTargets++;
|
||||
}
|
||||
|
||||
//find out if we've killed this target
|
||||
%clKilled = "";
|
||||
if ( %client.eliminated[%cl] )
|
||||
%clKilled = "<font:univers condensed:18>ELIMINATED";
|
||||
|
||||
%clStyle = %cl == %client ? "<color:dcdcdc>" : "";
|
||||
|
||||
//if the client is not an observer, send the message
|
||||
if (%client.team != 0)
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '%5<tab:20,430>\t<clip:200>%1</clip><rmargin:280><just:right>%2<rmargin:400><just:right>%3<rmargin:610><just:left>\t<color:FF0000>%4',
|
||||
%cl.name, %clScore, %clTargets, %clKilled, %clStyle );
|
||||
}
|
||||
//else for observers, create an anchor around the player name so they can be observed
|
||||
else
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '%5<tab:20,430>\t<clip:200><a:gamelink\t%6>%1</a></clip><rmargin:280><just:right>%2<rmargin:400><just:right>%3<rmargin:610><just:left>\t<color:FF0000>%4',
|
||||
%cl.name, %clScore, %clTargets, %clKilled, %clStyle, %cl );
|
||||
}
|
||||
}
|
||||
|
||||
// Tack on the list of observers:
|
||||
%observerCount = 0;
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl.team == 0)
|
||||
%observerCount++;
|
||||
}
|
||||
|
||||
if (%observerCount > 0)
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, "");
|
||||
%index++;
|
||||
messageClient(%client, 'SetLineHud', "", %tag, %index, '<tab:10, 310><spush><font:Univers Condensed:22>\tOBSERVERS (%1)<rmargin:260><just:right>TIME<spop>', %observerCount);
|
||||
%index++;
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
//if this is an observer
|
||||
if (%cl.team == 0)
|
||||
{
|
||||
%obsTime = getSimTime() - %cl.observerStartTime;
|
||||
%obsTimeStr = %game.formatTime(%obsTime, false);
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:20, 310>\t<clip:150>%1</clip><rmargin:260><just:right>%2',
|
||||
%cl.name, %obsTimeStr );
|
||||
%index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//clear the rest of Hud so we don't get old lines hanging around...
|
||||
messageClient(%client, 'ClearHud', "", %tag, %index);
|
||||
}
|
||||
|
||||
function BountyGame::applyConcussion(%game, %player)
|
||||
{
|
||||
}
|
||||
2014
docs/base/@vl2/scripts.vl2/scripts/CTFGame.cs
Normal file
2014
docs/base/@vl2/scripts.vl2/scripts/CTFGame.cs
Normal file
File diff suppressed because it is too large
Load diff
180
docs/base/@vl2/scripts.vl2/scripts/CenterPrint.cs
Normal file
180
docs/base/@vl2/scripts.vl2/scripts/CenterPrint.cs
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
// CenterPrint Methods
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
|
||||
$centerPrintActive = 0;
|
||||
$bottomPrintActive = 0;
|
||||
|
||||
$CenterPrintSizes[1] = 20;
|
||||
$CenterPrintSizes[2] = 36;
|
||||
$CenterPrintSizes[3] = 56;
|
||||
|
||||
function centerPrintAll( %message, %time, %lines )
|
||||
{
|
||||
if( %lines $= "" || ((%lines > 3) || (%lines < 1)) )
|
||||
%lines = 1;
|
||||
|
||||
%count = ClientGroup.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if( !%cl.isAIControlled() )
|
||||
commandToClient( %cl, 'centerPrint', %message, %time, %lines );
|
||||
}
|
||||
}
|
||||
|
||||
function bottomPrintAll( %message, %time, %lines )
|
||||
{
|
||||
if( %lines $= "" || ((%lines > 3) || (%lines < 1)) )
|
||||
%lines = 1;
|
||||
|
||||
%count = ClientGroup.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if( !%cl.isAIControlled() )
|
||||
commandToClient( %cl, 'bottomPrint', %message, %time, %lines );
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
|
||||
function centerPrint( %client, %message, %time, %lines )
|
||||
{
|
||||
if( %lines $= "" || ((%lines > 3) || (%lines < 1)) )
|
||||
%lines = 1;
|
||||
|
||||
|
||||
commandToClient( %client, 'CenterPrint', %message, %time, %lines );
|
||||
}
|
||||
|
||||
function bottomPrint( %client, %message, %time, %lines )
|
||||
{
|
||||
if( %lines $= "" || ((%lines > 3) || (%lines < 1)) )
|
||||
%lines = 1;
|
||||
|
||||
commandToClient( %client, 'BottomPrint', %message, %time, %lines );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
|
||||
function clearCenterPrint( %client )
|
||||
{
|
||||
commandToClient( %client, 'ClearCenterPrint');
|
||||
}
|
||||
|
||||
function clearBottomPrint( %client )
|
||||
{
|
||||
commandToClient( %client, 'ClearBottomPrint');
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
|
||||
function clearCenterPrintAll()
|
||||
{
|
||||
%count = ClientGroup.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if( !%cl.isAIControlled() )
|
||||
commandToClient( %cl, 'ClearCenterPrint');
|
||||
}
|
||||
}
|
||||
|
||||
function clearBottomPrintAll()
|
||||
{
|
||||
%count = ClientGroup.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if( !%cl.isAIControlled() )
|
||||
commandToClient( %cl, 'ClearBottomPrint');
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
|
||||
function clientCmdCenterPrint( %message, %time, %lines ) // time is specified in seconds
|
||||
{
|
||||
// if centerprint already visible, reset text and time.
|
||||
if($centerPrintActive)
|
||||
{
|
||||
CenterPrintText.setText( "<just:center>" @ %message );
|
||||
if( centerPrintDlg.removePrint !$= "")
|
||||
{
|
||||
cancel(centerPrintDlg.removePrint);
|
||||
}
|
||||
if(%time > 0)
|
||||
centerPrintDlg.removePrint = schedule( ( %time * 1000 ), 0, "clientCmdClearCenterPrint" );
|
||||
|
||||
// were done.
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CenterPrintDlg.visible = 1;
|
||||
$centerPrintActive = 1;
|
||||
CenterPrintText.setText( "<just:center>" @ %message );
|
||||
CenterPrintDlg.extent = firstWord(CenterPrintDlg.extent) @ " " @ $CenterPrintSizes[%lines];
|
||||
|
||||
if(%time > 0)
|
||||
centerPrintDlg.removePrint = schedule( ( %time * 1000 ), 0, "clientCmdClearCenterPrint" );
|
||||
}
|
||||
|
||||
function clientCmdBottomPrint( %message, %time, %lines ) // time is specified in seconds
|
||||
{
|
||||
// if bottomprint already visible, reset text and time.
|
||||
if($bottomPrintActive)
|
||||
{
|
||||
if( bottomPrintDlg.removePrint !$= "")
|
||||
{
|
||||
cancel(bottomPrintDlg.removePrint);
|
||||
}
|
||||
|
||||
bottomPrintText.setText( "<just:center>" @ %message );
|
||||
bottomPrintDlg.extent = firstWord(bottomPrintDlg.extent) @ " " @ $CenterPrintSizes[%lines];
|
||||
|
||||
if(%time > 0)
|
||||
bottomPrintDlg.removePrint = schedule( ( %time * 1000 ), 0, "clientCmdClearbottomPrint" );
|
||||
|
||||
// were done.
|
||||
return;
|
||||
}
|
||||
|
||||
bottomPrintDlg.setVisible(true);
|
||||
$bottomPrintActive = 1;
|
||||
bottomPrintText.setText( "<just:center>" @ %message );
|
||||
bottomPrintDlg.extent = firstWord(bottomPrintDlg.extent) @ " " @ $CenterPrintSizes[%lines];
|
||||
|
||||
if(%time > 0)
|
||||
{
|
||||
bottomPrintDlg.removePrint = schedule( ( %time * 1000 ), 0, "clientCmdClearbottomPrint" );
|
||||
}
|
||||
}
|
||||
|
||||
function BottomPrintText::onResize(%this, %width, %height)
|
||||
{
|
||||
%this.position = "0 0";
|
||||
}
|
||||
|
||||
function CenterPrintText::onResize(%this, %width, %height)
|
||||
{
|
||||
%this.position = "0 0";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
|
||||
function clientCmdClearCenterPrint()
|
||||
{
|
||||
$centerPrintActive = 0;
|
||||
CenterPrintDlg.visible = 0;
|
||||
|
||||
CenterPrintDlg.removePrint = "";
|
||||
}
|
||||
|
||||
function clientCmdClearBottomPrint()
|
||||
{
|
||||
$bottomPrintActive = 0;
|
||||
BottomPrintDlg.visible = 0;
|
||||
|
||||
BottomPrintDlg.removePrint = "";
|
||||
}
|
||||
3425
docs/base/@vl2/scripts.vl2/scripts/ChatGui.cs
Normal file
3425
docs/base/@vl2/scripts.vl2/scripts/ChatGui.cs
Normal file
File diff suppressed because it is too large
Load diff
433
docs/base/@vl2/scripts.vl2/scripts/ChooseFilterDlg.cs
Normal file
433
docs/base/@vl2/scripts.vl2/scripts/ChooseFilterDlg.cs
Normal file
|
|
@ -0,0 +1,433 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// ChooseFilterDlg.cs
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function ChooseFilterDlg::onWake( %this )
|
||||
{
|
||||
CF_FilterList.clear();
|
||||
CF_FilterList.addRow( 0, "All servers" );
|
||||
CF_FilterList.addRow( 1, "Servers with buddies" );
|
||||
CF_FilterList.addRow( 2, "Favorites only" );
|
||||
for ( %i = 0; $pref::ServerBrowser::Filter[%i] !$= ""; %i++ )
|
||||
CF_FilterList.addRow( %i + 3, $pref::ServerBrowser::Filter[%i] );
|
||||
|
||||
if ( $pref::ServerBrowser::activeFilter >= %i + 3 )
|
||||
$pref::ServerBrowser::activeFilter = 0;
|
||||
|
||||
CF_FilterList.setSelectedById( $pref::ServerBrowser::activeFilter );
|
||||
|
||||
CF_GoBtn.makeFirstResponder( 1 );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function ChooseFilterDlg::onSleep( %this )
|
||||
{
|
||||
// export out all the filters...
|
||||
%count = CF_FilterList.rowCount();
|
||||
for ( %row = 3; %row < %count; %row++ )
|
||||
$pref::ServerBrowser::Filter[%row - 3] = CF_FilterList.getRowText( %row );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function ChooseFilterDlg::newFilter( %this )
|
||||
{
|
||||
// get an updated list of game types:
|
||||
queryMasterGameTypes();
|
||||
%this.editFilterIndex = CF_FilterList.rowCount();
|
||||
|
||||
FilterEditName.setValue( "New Filter" );
|
||||
FilterEditGameType.setText( "Any" );
|
||||
FilterEditMissionType.setText( "Any" );
|
||||
FilterEditMinPlayers.setValue( 0 );
|
||||
FilterEditMaxPlayers.setValue( 255 );
|
||||
FilterEditMaxBots.setValue( 16 );
|
||||
FilterEditMinCPU.setValue( 0 );
|
||||
FilterEditUsePingTgl.setValue( false );
|
||||
FilterEditMaxPing.setValue( 50 );
|
||||
FilterEditMaxPing.setVisible( false );
|
||||
FilterEditTDOnTgl.setValue( false );
|
||||
FilterEditTDOffTgl.setValue( false );
|
||||
FilterEditWindowsTgl.setValue( false );
|
||||
FilterEditLinuxTgl.setValue( false );
|
||||
FilterEditDedicatedTgl.setValue( false );
|
||||
FilterEditNoPwdTgl.setValue( false );
|
||||
FilterEditCurVersionTgl.setValue( false );
|
||||
for ( %i = 0; isObject( "FilterEditLocMask" @ %i ); %i++ )
|
||||
( "FilterEditLocMask" @ %i ).setValue( true );
|
||||
|
||||
Canvas.pushDialog( FilterEditDlg );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function ChooseFilterDlg::editFilter( %this )
|
||||
{
|
||||
%rowId = CF_FilterList.getSelectedId();
|
||||
if ( %rowId < 3 ) // can't edit default filters
|
||||
return;
|
||||
|
||||
// get an updated list of game types:
|
||||
queryMasterGameTypes();
|
||||
%rowText = CF_FilterList.getRowTextById( %rowId );
|
||||
%filterName = getField( %rowText, 0 );
|
||||
%gameType = getField( %rowText, 1 );
|
||||
if ( %gameType $= "" )
|
||||
%gameType = "Any";
|
||||
%misType = getField( %rowText, 2 );
|
||||
if ( %misType $= "" )
|
||||
%misType = "Any";
|
||||
%minPlayers = getField( %rowText, 3 );
|
||||
if ( %minPlayers $= "" )
|
||||
%minPlayers = 0;
|
||||
%maxPlayers = getField( %rowText, 4 );
|
||||
if ( %maxPlayers $= "" )
|
||||
%maxPlayers = 255;
|
||||
%regionCode = getField( %rowText, 5 );
|
||||
if ( %regionCode $= "" )
|
||||
%regionCode = 4294967295;
|
||||
%maxPing = getField( %rowText, 6 );
|
||||
%maxBots = getField( %rowText, 7 );
|
||||
if ( %maxBots $= "" )
|
||||
%maxBots = 16;
|
||||
%minCPU = getField( %rowText, 8 );
|
||||
if ( %minCPU $= "" )
|
||||
%minCPU = 0;
|
||||
%flags = getField( %rowText, 9 );
|
||||
|
||||
FilterEditName.setValue( %filterName );
|
||||
FilterEditMinPlayers.setValue( %minPlayers );
|
||||
FilterEditMaxPlayers.setValue( %maxPlayers );
|
||||
FilterEditGameType.setText( %gameType );
|
||||
FilterEditMissionType.setText( %misType );
|
||||
%index = 0;
|
||||
while ( isObject( "FilterEditLocMask" @ %index ) )
|
||||
{
|
||||
( "FilterEditLocMask" @ %index ).setValue( %regionCode & 1 );
|
||||
%index++;
|
||||
%regionCode >>= 1;
|
||||
}
|
||||
|
||||
if ( %maxPing == 0 )
|
||||
{
|
||||
FilterEditUsePingTgl.setValue( false );
|
||||
FilterEditMaxPing.setValue( 50 );
|
||||
FilterEditMaxPing.setVisible( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
FilterEditUsePingTgl.setValue( true );
|
||||
FilterEditMaxPing.setValue( %maxPing );
|
||||
FilterEditMaxPing.setVisible( true );
|
||||
}
|
||||
|
||||
FilterEditMaxBots.setValue( %maxBots );
|
||||
FilterEditMinCPU.setValue( %minCPU );
|
||||
if ( %flags & 8 )
|
||||
{
|
||||
FilterEditWindowsTgl.setValue( true );
|
||||
FilterEditLinuxTgl.setValue( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
FilterEditWindowsTgl.setValue( false );
|
||||
FilterEditLinuxTgl.setValue( %flags & 4 );
|
||||
}
|
||||
|
||||
if ( %flags & 16 )
|
||||
{
|
||||
FilterEditTDOnTgl.setValue( true );
|
||||
FilterEditTDOffTgl.setValue( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
FilterEditTDOnTgl.setValue( false );
|
||||
FilterEditTDOffTgl.setValue( %flags & 32 );
|
||||
}
|
||||
|
||||
FilterEditDedicatedTgl.setValue( %flags & 1 );
|
||||
FilterEditNoPwdTgl.setValue( %flags & 2 );
|
||||
FilterEditCurVersionTgl.setValue( %flags & 128 );
|
||||
|
||||
%this.editFilterIndex = %rowId;
|
||||
Canvas.pushDialog( FilterEditDlg );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function ChooseFilterDlg::saveFilter( %this )
|
||||
{
|
||||
%filterName = FilterEditName.getValue();
|
||||
%gameType = FilterEditGameType.getText();
|
||||
%misType = FilterEditMissionType.getText();
|
||||
%minPlayers = FilterEditMinPlayers.getValue();
|
||||
%maxPlayers = FilterEditMaxPlayers.getValue();
|
||||
%regionCode = 0;
|
||||
for ( %i = 0; isObject( "FilterEditLocMask" @ %i ); %i++ )
|
||||
{
|
||||
if ( ( "FilterEditLocMask" @ %i ).getValue() )
|
||||
%regionCode |= ( 1 << %i );
|
||||
}
|
||||
%maxPing = FilterEditUsePingTgl.getValue() ? FilterEditMaxPing.getValue() : 0;
|
||||
%maxBots = FilterEditMaxBots.getValue();
|
||||
%minCPU = FilterEditMinCPU.getValue();
|
||||
%flags = FilterEditDedicatedTgl.getValue()
|
||||
| ( FilterEditNoPwdTgl.getValue() << 1 )
|
||||
| ( FilterEditLinuxTgl.getValue() << 2 )
|
||||
| ( FilterEditWindowsTgl.getValue() << 3 )
|
||||
| ( FilterEditTDOnTgl.getValue() << 4 )
|
||||
| ( FilterEditTDOffTgl.getValue() << 5 )
|
||||
| ( FilterEditCurVersionTgl.getValue() << 7 );
|
||||
%row = %filterName TAB %gameType TAB %misType
|
||||
TAB %minPlayers TAB %maxPlayers TAB %regionCode
|
||||
TAB %maxPing TAB %maxBots TAB %minCPU TAB %flags;
|
||||
|
||||
CF_FilterList.setRowById( %this.editFilterIndex, %row );
|
||||
CF_FilterList.setSelectedById( %this.editFilterIndex );
|
||||
%this.editFilterIndex = "";
|
||||
Canvas.popDialog( FilterEditDlg );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function ChooseFilterDlg::deleteFilter( %this )
|
||||
{
|
||||
%rowId = CF_FilterList.getSelectedId();
|
||||
if ( %rowId < 3 ) // can't delete default filters
|
||||
return;
|
||||
|
||||
%row = CF_FilterList.getRowNumById( %rowId );
|
||||
%lastFilter = CF_FilterList.rowCount() - 4;
|
||||
|
||||
while ( ( %nextRow = CF_FilterList.getRowTextById( %rowId + 1 ) ) !$= "" )
|
||||
{
|
||||
CF_FilterList.setRowById( %rowId, %nextRow );
|
||||
%rowId++;
|
||||
}
|
||||
CF_FilterList.removeRowById( %rowId );
|
||||
|
||||
// Get rid of the last filter (now extra):
|
||||
$pref::ServerBrowser::Filter[%lastFilter] = "";
|
||||
|
||||
// Select next (or failing that, previous) filter:
|
||||
if ( CF_FilterList.getRowTextById( %row ) $= "" )
|
||||
%selId = CF_FilterList.getRowId( %row - 1 );
|
||||
else
|
||||
%selId = CF_FilterList.getRowId( %row );
|
||||
|
||||
CF_FilterList.setSelectedById( %selId );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function ChooseFilterDlg::go( %this )
|
||||
{
|
||||
Canvas.popDialog( ChooseFilterDlg );
|
||||
GMJ_Browser.runQuery();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function CF_FilterList::onSelect( %this, %id, %text )
|
||||
{
|
||||
// Let the user know they can't edit or delete the default filters:
|
||||
if ( %id < 3 )
|
||||
{
|
||||
CF_EditFilterBtn.setActive( false );
|
||||
CF_DeleteFilterBtn.setActive( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
CF_EditFilterBtn.setActive( true );
|
||||
CF_DeleteFilterBtn.setActive( true );
|
||||
}
|
||||
$pref::ServerBrowser::activeFilter = %id;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function FilterEditDlg::setMinPlayers( %this )
|
||||
{
|
||||
%newMin = FilterEditMinPlayers.getValue();
|
||||
if ( %newMin < 0 )
|
||||
{
|
||||
%newMin = 0;
|
||||
FilterEditMinPlayers.setValue( %newMin );
|
||||
}
|
||||
else if ( %newMin > 254 )
|
||||
{
|
||||
%newMin = 254;
|
||||
FilterEditMinPlayers.setValue( %newMin );
|
||||
}
|
||||
|
||||
%newMax = FilterEditMaxPlayers.getValue();
|
||||
if ( %newMax <= %newMin )
|
||||
{
|
||||
%newMax = %newMin + 1;
|
||||
FilterEditMaxPlayers.setValue( %newMax );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function FilterEditDlg::setMaxPlayers( %this )
|
||||
{
|
||||
%newMax = FilterEditMaxPlayers.getValue();
|
||||
if ( %newMax < 1 )
|
||||
{
|
||||
%newMax = 1;
|
||||
FilterEditMaxPlayers.setValue( %newMax );
|
||||
}
|
||||
else if ( %newMax > 255 )
|
||||
{
|
||||
%newMax = 255;
|
||||
FilterEditMaxPlayers.setValue( %newMax );
|
||||
}
|
||||
|
||||
%newMin = FilterEditMinPlayers.getValue();
|
||||
if ( %newMin >= %newMax )
|
||||
{
|
||||
%newMin = %newMax - 1;
|
||||
FilterEditMinPlayers.setValue( %newMin );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function FilterEditDlg::setMaxBots( %this )
|
||||
{
|
||||
%newMax = FilterEditMaxBots.getValue();
|
||||
if ( %newMax < 0 )
|
||||
{
|
||||
%newMax = 0;
|
||||
FilterEditMaxBots.setValue( %newMax );
|
||||
}
|
||||
else if ( %newMax > 16 )
|
||||
{
|
||||
%newMax = 16;
|
||||
FilterEditMaxBots.setValue( %newMax );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function FilterEditUsePingTgl::onAction( %this )
|
||||
{
|
||||
FilterEditMaxPing.setVisible( %this.getValue() );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function FilterEditDlg::setMaxPing( %this )
|
||||
{
|
||||
%newMax = FilterEditMaxPing.getValue();
|
||||
if ( %newMax < 10 )
|
||||
{
|
||||
%newMax = 10;
|
||||
FilterEditMaxPing.setValue( %newMax );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function FilterEditDlg::setMinCPU( %this )
|
||||
{
|
||||
%newMin = FilterEditMinCPU.getValue();
|
||||
if ( %newMin < 0 )
|
||||
{
|
||||
%newMin = 0;
|
||||
FilterEditMinCPU.setValue( %newMin );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function clearGameTypes()
|
||||
{
|
||||
%text = FilterEditGameType.getText();
|
||||
FilterEditGameType.clear();
|
||||
FilterEditGameType.add( "Any", 0 );
|
||||
FilterEditGameType.add( "base", 1 );
|
||||
FilterEditGameType.add( "variant", 2 );
|
||||
FilterEditGameType.setText( %text );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function addGameType( %type )
|
||||
{
|
||||
if ( FilterEditGameType.findText( %type ) == -1 )
|
||||
{
|
||||
%id = FilterEditGameType.size();
|
||||
FilterEditGameType.add( %type, %id );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function clearMissionTypes()
|
||||
{
|
||||
%text = FilterEditMissionType.getText();
|
||||
FilterEditMissionType.clear();
|
||||
FilterEditMissionType.add( "Any", 0 );
|
||||
FilterEditMissionType.setText( %text );
|
||||
|
||||
// Add all the mission types found on this machine:
|
||||
for ( %i = 0; %i < $HostTypeCount; %i++ )
|
||||
FilterEditMissionType.add( $HostTypeDisplayName[%i], %i + 1 );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function addMissionType(%type)
|
||||
{
|
||||
if ( %type !$= "" && FilterEditMissionType.findText( %type ) == -1 )
|
||||
{
|
||||
%id = FilterEditMissionType.size();
|
||||
FilterEditMissionType.add( %type, %id );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function sortGameAndMissionTypeLists()
|
||||
{
|
||||
FilterEditGameType.sort( true, 3 );
|
||||
%idx = FilterEditGameType.findText( FilterEditGameType.getText() );
|
||||
if ( %idx > -1 )
|
||||
FilterEditGameType.setSelected( %idx );
|
||||
FilterEditMissionType.sort( true, 1 );
|
||||
%idx = FilterEditMissionType.findText( FilterEditMissionType.getText() );
|
||||
if ( %idx > -1 )
|
||||
FilterEditMissionType.setSelected( %idx );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function FilterEditTDOnTgl::onAction( %this )
|
||||
{
|
||||
if ( %this.getValue() && FilterEditTDOffTgl.getValue() )
|
||||
FilterEditTDOffTgl.setValue( false );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function FilterEditTDOffTgl::onAction( %this )
|
||||
{
|
||||
if ( %this.getValue() && FilterEditTDOnTgl.getValue() )
|
||||
FilterEditTDOnTgl.setValue( false );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function FilterEditWindowsTgl::onAction( %this )
|
||||
{
|
||||
if ( %this.getValue() && FilterEditLinuxTgl.getValue() )
|
||||
FilterEditLinuxTgl.setValue( false );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function FilterEditLinuxTgl::onAction( %this )
|
||||
{
|
||||
if ( %this.getValue() && FilterEditWindowsTgl.getValue() )
|
||||
FilterEditWindowsTgl.setValue( false );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Make sure we still have at least one region selected:
|
||||
function FilterEditDlg::checkRegionMasks( %this, %lastIndex )
|
||||
{
|
||||
%index = 0;
|
||||
while ( isObject( "FilterEditLocMask" @ %index ) )
|
||||
{
|
||||
if ( ( "FilterEditLocMask" @ %index ).getValue() )
|
||||
return;
|
||||
%index++;
|
||||
}
|
||||
|
||||
// None are selected, so reselect the last control:
|
||||
( "FilterEditLocMask" @ %lastIndex ).setValue( true );
|
||||
}
|
||||
466
docs/base/@vl2/scripts.vl2/scripts/CnHGame.cs
Normal file
466
docs/base/@vl2/scripts.vl2/scripts/CnHGame.cs
Normal file
|
|
@ -0,0 +1,466 @@
|
|||
// DisplayName = Capture and Hold
|
||||
|
||||
//--- GAME RULES BEGIN ---
|
||||
//Teams try to capture marked objectives
|
||||
//Capturing player gets a point 12 seconds after a capture
|
||||
//Hold objectives in order to score
|
||||
//A team scores 2 points per second it holds an objective
|
||||
//Turrets and inventory stations convert when their switch is taken
|
||||
//--- GAME RULES END ---
|
||||
|
||||
//exec the AI scripts
|
||||
exec("scripts/aiCnH.cs");
|
||||
|
||||
package CnHGame {
|
||||
|
||||
function FlipFlop::playerTouch(%data, %flipflop, %player)
|
||||
{
|
||||
if(%flipflop.team != %player.client.team)
|
||||
{
|
||||
Parent::playerTouch(%data, %flipflop, %player);
|
||||
Game.startTimerPlayerFFCap(%player.client, %flipflop);
|
||||
}
|
||||
}
|
||||
|
||||
function Flipflop::objectiveInit(%data, %flipflop)
|
||||
{
|
||||
%flipflop.tCapThread = "";
|
||||
%flipflop.tHoldThread = "";
|
||||
%flipflop.pCapThread = "";
|
||||
Parent::objectiveInit(%data, %flipflop);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//--------- CnH SCORING INIT ------------------
|
||||
function CnHGame::initGameVars(%game)
|
||||
{
|
||||
%game.SCORE_PER_SUICIDE = -1;
|
||||
%game.SCORE_PER_TEAMKILL = -1;
|
||||
%game.SCORE_PER_DEATH = -1;
|
||||
|
||||
%game.SCORE_PER_KILL = 1;
|
||||
%game.SCORE_PER_PLYR_FLIPFLOP_CAP = 1;
|
||||
%game.SCORE_PER_TEAM_FLIPFLOP_CAP = 1;
|
||||
%game.SCORE_PER_TEAM_FLIPFLOP_HOLD = 1;
|
||||
|
||||
%game.SCORE_PER_TURRET_KILL = 1;
|
||||
%game.SCORE_PER_FLIPFLOP_DEFEND = 1;
|
||||
%game.SCORE_LIMIT_PER_TOWER = 1200; //default of 1200 points per tower required to win @ 1 pt per %game.TIME_REQ_TEAM_HOLD_BONUS milliseconds
|
||||
|
||||
%game.TIME_REQ_PLYR_CAP_BONUS = 12 * 1000; //player must hold a switch 12 seconds to get a point for it.
|
||||
%game.TIME_REQ_TEAM_CAP_BONUS = 12 * 1000; //time after touching it takes for team to get a point
|
||||
%game.TIME_REQ_TEAM_HOLD_BONUS = 0.5 * 1000; //recurring time it takes team to earn a point when flipflop held
|
||||
%game.RADIUS_FLIPFLOP_DEFENSE = 20; //meters
|
||||
}
|
||||
|
||||
function CnHGame::setUpTeams(%game)
|
||||
{
|
||||
DefaultGame::setUpTeams(%game);
|
||||
|
||||
// reset the visibility of team 0 (team is still defaulted as friendly)
|
||||
setSensorGroupAlwaysVisMask(0, 0);
|
||||
}
|
||||
|
||||
//-- tracking ---
|
||||
// .deaths .kills .suicides .teamKills .turretKills
|
||||
// .flipFlopDefends .flipFlopsCapped
|
||||
|
||||
function CnHGame::startMatch(%game)
|
||||
{
|
||||
for(%i = 0; %i <= %game.numTeams; %i++)
|
||||
$TeamScore[%i] = 0;
|
||||
|
||||
DefaultGame::startMatch(%game);
|
||||
}
|
||||
|
||||
function CnHGame::checkScoreLimit(%game, %team)
|
||||
{
|
||||
%scoreLimit = %game.getScoreLimit();
|
||||
if($TeamScore[%team] >= %scoreLimit)
|
||||
%game.scoreLimitReached();
|
||||
}
|
||||
|
||||
function CnHGame::getScoreLimit(%game)
|
||||
{
|
||||
%scoreLimit = MissionGroup.CnH_scoreLimit;
|
||||
if(%scoreLimit $= "")
|
||||
%scoreLimit = %game.getNumFlipFlops() * %game.SCORE_LIMIT_PER_TOWER;
|
||||
|
||||
return %scoreLimit;
|
||||
}
|
||||
|
||||
function CnHGame::scoreLimitReached(%game)
|
||||
{
|
||||
logEcho("game over (scorelimit)");
|
||||
%game.gameOver();
|
||||
cycleMissions();
|
||||
}
|
||||
|
||||
function CnHGame::timeLimitReached(%game)
|
||||
{
|
||||
logEcho("game over (timelimit)");
|
||||
%game.gameOver();
|
||||
cycleMissions();
|
||||
}
|
||||
|
||||
function CnHGame::gameOver(%game)
|
||||
{
|
||||
//call the default
|
||||
DefaultGame::gameOver(%game);
|
||||
|
||||
// stop all bonus timers
|
||||
%game.stopScoreTimers();
|
||||
|
||||
//send the winner message
|
||||
%winner = "";
|
||||
if ($teamScore[1] > $teamScore[2])
|
||||
%winner = $teamName[1];
|
||||
else if ($teamScore[2] > $teamScore[1])
|
||||
%winner = $teamName[2];
|
||||
|
||||
if (%winner $= 'Storm')
|
||||
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.stowins.wav" );
|
||||
else if (%winner $= 'Inferno')
|
||||
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.infwins.wav" );
|
||||
else
|
||||
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.gameover.wav" );
|
||||
|
||||
messageAll('MsgClearObjHud', "");
|
||||
for(%i = 0; %i < ClientGroup.getCount(); %i ++)
|
||||
{
|
||||
%client = ClientGroup.getObject(%i);
|
||||
%game.resetScore(%client);
|
||||
}
|
||||
for ( %team = 1; %team <= %game.numTeams; %team++ )
|
||||
{
|
||||
$TeamScore[%team] = 0;
|
||||
messageAll('MsgCnHTeamCap', "", -1, -1, -1, %team, $TeamScore[%team], %game.getScoreLimit());
|
||||
}
|
||||
}
|
||||
|
||||
function CnHGame::stopScoreTimers(%game)
|
||||
{
|
||||
// find all switches and cancel any timers associated with them
|
||||
%ffGroup = nameToId("MissionCleanup/FlipFlops");
|
||||
if(%ffGroup <= 0)
|
||||
return;
|
||||
|
||||
for(%i = 0; %i < %ffGroup.getCount(); %i++)
|
||||
{
|
||||
%curFF = %ffGroup.getObject(%i);
|
||||
cancel(%curFF.tHoldThread);
|
||||
cancel(%curFF.pCapThread);
|
||||
cancel(%curFF.tCapThread);
|
||||
}
|
||||
}
|
||||
|
||||
function CnHGame::clientMissionDropReady(%game, %client)
|
||||
{
|
||||
messageClient(%client, 'MsgClientReady',"", %game.class);
|
||||
%scoreLimit = %game.getScoreLimit();
|
||||
|
||||
for(%i = 1; %i <= %game.numTeams; %i++)
|
||||
{
|
||||
%teamHeld = %game.countFlipsHeld(%i);
|
||||
messageClient(%client, 'MsgCnHAddTeam', "", %i, $TeamName[%i], $TeamScore[%i], %scoreLimit, %teamHeld);
|
||||
}
|
||||
|
||||
//%game.populateTeamRankArray(%client);
|
||||
//messageClient(%client, 'MsgYourRankIs', "", -1);
|
||||
|
||||
messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName );
|
||||
|
||||
DefaultGame::clientMissionDropReady(%game, %client);
|
||||
}
|
||||
|
||||
function CnHGame::assignClientTeam(%game, %client, %respawn)
|
||||
{
|
||||
DefaultGame::assignClientTeam(%game, %client, %respawn);
|
||||
// if player's team is not on top of objective hud, switch lines
|
||||
messageClient(%client, 'MsgCheckTeamLines', "", %client.team);
|
||||
}
|
||||
|
||||
function CnHGame::getNumFlipFlops()
|
||||
{
|
||||
%ffGroup = nameToID("MissionCleanup/FlipFlops");
|
||||
return %ffGroup.getCount();
|
||||
}
|
||||
|
||||
function CnHGame::countFlipsHeld(%game, %team)
|
||||
{
|
||||
%teamHeld = 0;
|
||||
// count how many flipflops each team holds
|
||||
%ffSet = nameToID("MissionCleanup/FlipFlops");
|
||||
if(%ffSet > 0)
|
||||
{
|
||||
%numFF = %ffSet.getCount();
|
||||
for(%j = 0; %j < %numFF; %j++)
|
||||
{
|
||||
%curFF = %ffSet.getObject(%j);
|
||||
if(%curFF.team == %team)
|
||||
%teamHeld++;
|
||||
}
|
||||
}
|
||||
|
||||
return %teamHeld;
|
||||
}
|
||||
|
||||
function CnHGame::countFlips(%game)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
function CnHGame::equip(%game, %player)
|
||||
{
|
||||
for(%i =0; %i<$InventoryHudCount; %i++)
|
||||
%player.client.setInventoryHudItem($InventoryHudData[%i, itemDataName], 0, 1);
|
||||
%player.client.clearBackpackIcon();
|
||||
|
||||
//%player.setArmor("Light");
|
||||
%player.setInventory(Blaster,1);
|
||||
%player.setInventory(Chaingun, 1);
|
||||
%player.setInventory(ChaingunAmmo, 100);
|
||||
%player.setInventory(Disc,1);
|
||||
%player.setInventory(DiscAmmo, 20);
|
||||
%player.setInventory(TargetingLaser, 1);
|
||||
%player.setInventory(Grenade,6);
|
||||
%player.setInventory(Beacon, 3);
|
||||
%player.setInventory(RepairKit,1);
|
||||
%player.weaponCount = 3;
|
||||
|
||||
%player.use("Blaster");
|
||||
}
|
||||
|
||||
//--------------- Scoring functions -----------------
|
||||
function CnHGame::recalcScore(%game, %cl)
|
||||
{
|
||||
%killValue = %cl.kills * %game.SCORE_PER_KILL;
|
||||
%deathValue = %cl.deaths * %game.SCORE_PER_DEATH;
|
||||
|
||||
if (%killValue - %deathValue == 0)
|
||||
%killPoints = 0;
|
||||
else
|
||||
%killPoints = (%killValue * %killValue) / (%killValue - %deathValue);
|
||||
|
||||
%cl.offenseScore = %killPoints;
|
||||
%cl.offenseScore += %cl.suicides * %game.SCORE_PER_SUICIDE; //-1
|
||||
%cl.offenseScore += %cl.teamKills * %game.SCORE_PER_TEAMKILL; // -1
|
||||
%cl.offenseScore += %cl.flipFlopsCapped * %game.SCORE_PER_PLYR_FLIPFLOP_CAP;
|
||||
|
||||
%cl.defenseScore = %cl.turretKills * %game.SCORE_PER_TURRET_KILL; // 1
|
||||
%cl.defenseScore += %cl.flipFlopDefends * %game.SCORE_PER_FLIPFLOP_DEFEND;
|
||||
|
||||
%cl.score = mFloor(%cl.offenseScore + %cl.defenseScore);
|
||||
//track switches held (not touched), switches defended, kills, deaths, suicides, tks
|
||||
|
||||
%game.recalcTeamRanks(%cl);
|
||||
}
|
||||
|
||||
function CnHGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %implement)
|
||||
{
|
||||
if(%game.testTurretKill(%implement)) //check for turretkill before awarded a non client points for a kill
|
||||
{
|
||||
%game.awardScoreTurretKill(%clVictim, %implement);
|
||||
}
|
||||
else if (%game.testKill(%clVictim, %clKiller)) //verify victim was an enemy
|
||||
{
|
||||
%game.awardScoreKill(%clKiller);
|
||||
%game.awardScoreDeath(%clVictim);
|
||||
|
||||
//see if we were defending a flip flop
|
||||
%flipflop = %game.testPlayerFFDefend(%clVictim, %clKiller);
|
||||
if (isObject(%flipflop))
|
||||
%game.awardScorePlayerFFDefend(%clKiller, %flipflop);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (%game.testSuicide(%clVictim, %clKiller, %damageType)) //otherwise test for suicide
|
||||
{
|
||||
%game.awardScoreSuicide(%clVictim);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (%game.testTeamKill(%clVictim, %clKiller)) //otherwise test for a teamkill
|
||||
%game.awardScoreTeamKill(%clVictim, %clKiller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function CnHGame::testPlayerFFDefend(%game, %victimID, %killerID)
|
||||
{
|
||||
if (!isObject(%victimId) || !isObject(%killerId) || %killerId.team <= 0)
|
||||
return -1;
|
||||
|
||||
//loop through the flipflops looking for one within range that belongs to the killer...
|
||||
%ffGroup = nameToID("MissionCleanup/FlipFlops");
|
||||
for (%i = 0; %i < %ffGroup.getCount(); %i++)
|
||||
{
|
||||
%ffObj = %ffGroup.getObject(%i);
|
||||
if (VectorDist(%ffObj.position, %victimID.plyrPointOfDeath) < %game.RADIUS_FLIPFLOP_DEFENSE)
|
||||
{
|
||||
if (%ffObj.team == %killerID.team)
|
||||
return %ffObj;
|
||||
}
|
||||
}
|
||||
|
||||
//none were found
|
||||
return -1;
|
||||
}
|
||||
|
||||
function CnHGame::awardScorePlayerFFDefend(%game, %cl, %flipflop)
|
||||
{
|
||||
%cl.flipFlopDefends++;
|
||||
if (%game.SCORE_PER_FLIPFLOP_DEFEND != 0)
|
||||
{
|
||||
messageClient(%cl, 'msgFFDef', '\c0You received a %1 point bonus for defending %2.', %game.SCORE_PER_FLIPFLOP_DEFEND, %game.cleanWord(%flipflop.name));
|
||||
// messageTeamExcept(%cl, 'msgFFDef', '\c0Teammate %1 received a %2 point bonus for defending %3', %cl.name, %game.SCORE_PER_FLIPFLOP_DEFEND, %game.cleanWord(%flipflop.name));
|
||||
}
|
||||
%game.recalcScore(%cl);
|
||||
}
|
||||
|
||||
function CnHGame::awardScorePlayerFFCap(%game, %cl, %this)
|
||||
{
|
||||
if(!($missionRunning))
|
||||
return;
|
||||
|
||||
%cl.flipFlopsCapped++;
|
||||
if (%game.SCORE_PER_PLYR_FLIPFLOP_CAP != 0)
|
||||
{
|
||||
messageClient(%cl, 'msgFFDef', '\c0You received a %1 point bonus for holding the %2.', %game.SCORE_PER_PLYR_FLIPFLOP_CAP, %game.cleanWord(%this.name));
|
||||
// messageTeamExcept(%cl, 'msgFFDef', '\c0Teammate %1 received a %2 point bonus for holding the %3', %cl.name, %game.SCORE_PER_PLYR_FLIPFLOP_CAP, %game.cleanWord(%this.name));
|
||||
}
|
||||
%game.recalcScore(%cl);
|
||||
}
|
||||
|
||||
function CnHGame::awardScoreTeamFFCap(%game, %team, %this)
|
||||
{
|
||||
cancel(%this.tCapThread);
|
||||
|
||||
if(!($missionRunning))
|
||||
return;
|
||||
|
||||
$TeamScore[%team] +=%game.SCORE_PER_TEAM_FLIPFLOP_CAP;
|
||||
%sLimit = %game.getScoreLimit();
|
||||
if (%game.SCORE_PER_TEAM_FLIPFLOP_CAP)
|
||||
messageAll('MsgCnHTeamCap', "", -1, -1, -1, %team, $teamScore[%team], %sLimit);
|
||||
if (%game.SCORE_PER_TEAM_FLIPFLOP_HOLD != 0)
|
||||
%this.tHoldThread = %game.schedule(%game.TIME_REQ_TEAM_HOLD_BONUS, "awardScoreTeamFFHold", %team, %this);
|
||||
|
||||
%game.checkScoreLimit(%team);
|
||||
}
|
||||
|
||||
function CnHGame::awardScoreTeamFFHold(%game, %team, %this)
|
||||
{
|
||||
cancel(%this.tHoldThread);
|
||||
|
||||
if(!($missionRunning))
|
||||
return;
|
||||
|
||||
$TeamScore[%team] +=%game.SCORE_PER_TEAM_FLIPFLOP_HOLD;
|
||||
%sLimit = %game.getScoreLimit();
|
||||
if (%game.SCORE_PER_TEAM_FLIPFLOP_HOLD)
|
||||
messageAll('MsgCnHTeamCap', "", $TeamName[%team], %game.SCORE_PER_TEAM_FLIPFLOP_HOLD, %game.cleanWord(%this.name), %team, $teamScore[%team], %sLimit);
|
||||
|
||||
// if either team's score is divisible by 100, send a console log message
|
||||
if(($TeamScore[%team] / 100) == (mFloor($TeamScore[%team] / 100)))
|
||||
for(%i = 1; %i <= %game.numTeams; %i++)
|
||||
logEcho("team "@%i@" score "@$TeamScore[%i]);
|
||||
|
||||
%game.checkScoreLimit(%team);
|
||||
|
||||
%this.tHoldThread = %game.schedule(%game.TIME_REQ_TEAM_HOLD_BONUS, "awardScoreTeamFFHold", %team, %this);
|
||||
}
|
||||
|
||||
function CnHGame::testValidRepair(%game, %obj)
|
||||
{
|
||||
return ((%obj.lastDamagedByTeam != %obj.team) && (%obj.repairedBy.team == %obj.team));
|
||||
}
|
||||
|
||||
function CnHGame::genOnRepaired(%game, %obj, %objName)
|
||||
{
|
||||
|
||||
if (%game.testValidRepair(%obj))
|
||||
{
|
||||
%repairman = %obj.repairedBy;
|
||||
messageTeam(%repairman.team, 'msgGenRepaired', '\c0%1 repaired the %2 Generator!', %repairman.name, %obj.nameTag);
|
||||
}
|
||||
}
|
||||
|
||||
function CnHGame::stationOnRepaired(%game, %obj, %objName)
|
||||
{
|
||||
if (%game.testValidRepair(%obj))
|
||||
{
|
||||
%repairman = %obj.repairedBy;
|
||||
messageTeam(%repairman.team, 'msgStationRepaired', '\c0%1 repaired the %2 Inventory Station!', %repairman.name, %obj.nameTag);
|
||||
}
|
||||
}
|
||||
|
||||
function CnHGame::sensorOnRepaired(%game, %obj, %objName)
|
||||
{
|
||||
if (%game.testValidRepair(%obj))
|
||||
{
|
||||
%repairman = %obj.repairedBy;
|
||||
messageTeam(%repairman.team, 'msgSensorRepaired', '\c0%1 repaired the %2 Pulse Sensor!', %repairman.name, %obj.nameTag);
|
||||
}
|
||||
}
|
||||
|
||||
function CnHGame::turretOnRepaired(%game, %obj, %objName)
|
||||
{
|
||||
if (%game.testValidRepair(%obj))
|
||||
{
|
||||
%repairman = %obj.repairedBy;
|
||||
messageTeam(%repairman.team, 'msgTurretRepaired', '\c0%1 repaired the %2 Turret!', %repairman.name, %obj.nameTag);
|
||||
}
|
||||
}
|
||||
|
||||
function CnHGame::vStationOnRepaired(%game, %obj, %objName)
|
||||
{
|
||||
if (%game.testValidRepair(%obj))
|
||||
{
|
||||
%repairman = %obj.repairedBy;
|
||||
messageTeam(%repairman.team, 'msgTurretRepaired', '\c0%1 repaired the %2 Vehicle Station!', %repairman.name, %obj.nameTag);
|
||||
}
|
||||
}
|
||||
|
||||
function CnHGame::startTimerPlayerFFCap(%game, %cl, %this)
|
||||
{
|
||||
cancel(%this.pCapThread); //stop the last owner from collecting a cap bonus
|
||||
%this.pCapThread = %game.schedule(%game.TIME_REQ_PLYR_CAP_BONUS, "awardScorePlayerFFCap", %cl, %this);
|
||||
cancel(%this.tCapThread); //stop the old owners from collecting any cap bonus
|
||||
cancel(%this.tHoldThread); //stop the old owners from collecting any hold bonus
|
||||
%this.tCapThread = %game.schedule(%game.TIME_REQ_TEAM_CAP_BONUS, "awardScoreTeamFFCap", %cl.team, %this);
|
||||
}
|
||||
|
||||
function CnHGame::startTimerTeamFFCap(%game, %team, %this, %time)
|
||||
{
|
||||
%this.tCapThread = %game.schedule(%time, "awardScoreTeamFFCap", %team, %this);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
function CnHGame::resetScore(%game, %client)
|
||||
{
|
||||
%client.offenseScore = 0;
|
||||
%client.kills = 0;
|
||||
%client.deaths = 0;
|
||||
%client.suicides = 0;
|
||||
%client.teamKills = 0;
|
||||
%client.flipFlopsCapped = 0;
|
||||
|
||||
|
||||
%client.defenseScore = 0;
|
||||
%client.turretKills = 0;
|
||||
%client.flipFlopDefends = 0;
|
||||
|
||||
%client.score = 0;
|
||||
|
||||
for ( %team = 1; %team <= %game.numTeams; %team++ )
|
||||
if($TeamScore[%team] != 0)
|
||||
$TeamScore[%team] = 0;
|
||||
}
|
||||
|
||||
function CnHGame::applyConcussion(%game, %player)
|
||||
{
|
||||
}
|
||||
374
docs/base/@vl2/scripts.vl2/scripts/DMGame.cs
Normal file
374
docs/base/@vl2/scripts.vl2/scripts/DMGame.cs
Normal file
|
|
@ -0,0 +1,374 @@
|
|||
// --------------------------------------------------------
|
||||
// Deathmatch mission type
|
||||
// --------------------------------------------------------
|
||||
|
||||
// DisplayName = Deathmatch
|
||||
|
||||
//--- GAME RULES BEGIN ---
|
||||
//There aren't many rules...
|
||||
//Kill
|
||||
//Don't get killed
|
||||
//Points are scored for each kill you make and subtracted each time you die
|
||||
//--- GAME RULES END ---
|
||||
|
||||
$InvBanList[DM, "TurretOutdoorDeployable"] = 1;
|
||||
$InvBanList[DM, "TurretIndoorDeployable"] = 1;
|
||||
$InvBanList[DM, "ElfBarrelPack"] = 1;
|
||||
$InvBanList[DM, "MortarBarrelPack"] = 1;
|
||||
$InvBanList[DM, "PlasmaBarrelPack"] = 1;
|
||||
$InvBanList[DM, "AABarrelPack"] = 1;
|
||||
$InvBanList[DM, "MissileBarrelPack"] = 1;
|
||||
$InvBanList[DM, "Mine"] = 1;
|
||||
|
||||
function DMGame::setUpTeams(%game)
|
||||
{
|
||||
%group = nameToID("MissionGroup/Teams");
|
||||
if(%group == -1)
|
||||
return;
|
||||
|
||||
// create a team0 if it does not exist
|
||||
%team = nameToID("MissionGroup/Teams/team0");
|
||||
if(%team == -1)
|
||||
{
|
||||
%team = new SimGroup("team0");
|
||||
%group.add(%team);
|
||||
}
|
||||
|
||||
// 'team0' is not counted as a team here
|
||||
%game.numTeams = 0;
|
||||
while(%team != -1)
|
||||
{
|
||||
// create drop set and add all spawnsphere objects into it
|
||||
%dropSet = new SimSet("TeamDrops" @ %game.numTeams);
|
||||
MissionCleanup.add(%dropSet);
|
||||
|
||||
%spawns = nameToID("MissionGroup/Teams/team" @ %game.numTeams @ "/SpawnSpheres");
|
||||
if(%spawns != -1)
|
||||
{
|
||||
%count = %spawns.getCount();
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
%dropSet.add(%spawns.getObject(%i));
|
||||
}
|
||||
|
||||
// set the 'team' field for all the objects in this team
|
||||
%team.setTeam(0);
|
||||
|
||||
clearVehicleCount(%team+1);
|
||||
// get next group
|
||||
%team = nameToID("MissionGroup/Teams/team" @ %game.numTeams + 1);
|
||||
if (%team != -1)
|
||||
%game.numTeams++;
|
||||
}
|
||||
|
||||
// set the number of sensor groups (including team0) that are processed
|
||||
setSensorGroupCount(%game.numTeams + 1);
|
||||
%game.numTeams = 1;
|
||||
|
||||
// allow teams 1->31 to listen to each other (team 0 can only listen to self)
|
||||
for(%i = 1; %i < 32; %i++)
|
||||
setSensorGroupListenMask(%i, 0xfffffffe);
|
||||
}
|
||||
|
||||
function DMGame::initGameVars(%game)
|
||||
{
|
||||
%game.SCORE_PER_KILL = 1;
|
||||
%game.SCORE_PER_DEATH = -1;
|
||||
%game.SCORE_PER_SUICIDE = -1;
|
||||
}
|
||||
|
||||
exec("scripts/aiDeathMatch.cs");
|
||||
|
||||
function DMGame::allowsProtectedStatics(%game)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
function DMGame::equip(%game, %player)
|
||||
{
|
||||
for(%i =0; %i<$InventoryHudCount; %i++)
|
||||
%player.client.setInventoryHudItem($InventoryHudData[%i, itemDataName], 0, 1);
|
||||
%player.client.clearBackpackIcon();
|
||||
|
||||
//%player.setArmor("Light");
|
||||
%player.setInventory(RepairKit, 1);
|
||||
%player.setInventory("Disc", 1);
|
||||
%player.setInventory("DiscAmmo", 15);
|
||||
%player.setInventory("TargetingLaser", 1);
|
||||
%player.weaponCount = 1;
|
||||
|
||||
// do we want to give players a disc launcher instead? GJL: Yes we do!
|
||||
%player.use("Disc");
|
||||
}
|
||||
|
||||
function DMGame::pickPlayerSpawn(%game, %client, %respawn)
|
||||
{
|
||||
// all spawns come from team 1
|
||||
return %game.pickTeamSpawn(1);
|
||||
}
|
||||
|
||||
function DMGame::clientJoinTeam( %game, %client, %team, %respawn )
|
||||
{
|
||||
%game.assignClientTeam( %client );
|
||||
|
||||
// Spawn the player:
|
||||
%game.spawnPlayer( %client, %respawn );
|
||||
}
|
||||
|
||||
function DMGame::assignClientTeam(%game, %client)
|
||||
{
|
||||
for(%i = 1; %i < 32; %i++)
|
||||
$DMTeamArray[%i] = false;
|
||||
|
||||
%maxSensorGroup = 0;
|
||||
%count = ClientGroup.getCount();
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if(%cl != %client)
|
||||
{
|
||||
$DMTeamArray[%cl.team] = true;
|
||||
if (%cl.team > %maxSensorGroup)
|
||||
%maxSensorGroup = %cl.team;
|
||||
}
|
||||
}
|
||||
|
||||
//now loop through the team array, looking for an empty team
|
||||
for(%i = 1; %i < 32; %i++)
|
||||
{
|
||||
if (! $DMTeamArray[%i])
|
||||
{
|
||||
%client.team = %i;
|
||||
if (%client.team > %maxSensorGroup)
|
||||
%maxSensorGroup = %client.team;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// set player's skin pref here
|
||||
setTargetSkin(%client.target, %client.skin);
|
||||
|
||||
// Let everybody know you are no longer an observer:
|
||||
messageAll( 'MsgClientJoinTeam', '\c1%1 has joined the fray.', %client.name, "", %client, 1 );
|
||||
updateCanListenState( %client );
|
||||
|
||||
//now set the max number of sensor groups...
|
||||
setSensorGroupCount(%maxSensorGroup + 1);
|
||||
}
|
||||
|
||||
function DMGame::clientMissionDropReady(%game, %client)
|
||||
{
|
||||
messageClient(%client, 'MsgClientReady',"", %game.class);
|
||||
messageClient(%client, 'MsgYourScoreIs', "", 0);
|
||||
messageClient(%client, 'MsgDMPlayerDies', "", 0);
|
||||
messageClient(%client, 'MsgDMKill', "", 0);
|
||||
%game.resetScore(%client);
|
||||
|
||||
messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName );
|
||||
|
||||
DefaultGame::clientMissionDropReady(%game, %client);
|
||||
}
|
||||
|
||||
function DMGame::AIHasJoined(%game, %client)
|
||||
{
|
||||
//let everyone know the player has joined the game
|
||||
//messageAllExcept(%client, -1, 'MsgClientJoinTeam', '%1 has joined the fray.', %client.name, "", %client, 1 );
|
||||
}
|
||||
|
||||
function DMGame::checkScoreLimit(%game, %client)
|
||||
{
|
||||
//there's no score limit in DM
|
||||
}
|
||||
|
||||
function DMGame::createPlayer(%game, %client, %spawnLoc, %respawn)
|
||||
{
|
||||
DefaultGame::createPlayer(%game, %client, %spawnLoc, %respawn);
|
||||
%client.setSensorGroup(%client.team);
|
||||
}
|
||||
|
||||
function DMGame::resetScore(%game, %client)
|
||||
{
|
||||
%client.deaths = 0;
|
||||
%client.kills = 0;
|
||||
%client.score = 0;
|
||||
%client.efficiency = 0.0;
|
||||
%client.suicides = 0;
|
||||
}
|
||||
|
||||
function DMGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc)
|
||||
{
|
||||
cancel(%clVictim.player.alertThread);
|
||||
DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc);
|
||||
}
|
||||
|
||||
function DMGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %implement)
|
||||
{
|
||||
if (%game.testKill(%clVictim, %clKiller)) //verify victim was an enemy
|
||||
{
|
||||
%game.awardScoreKill(%clKiller);
|
||||
messageClient(%clKiller, 'MsgDMKill', "", %clKiller.kills);
|
||||
%game.awardScoreDeath(%clVictim);
|
||||
}
|
||||
else if (%game.testSuicide(%clVictim, %clKiller, %damageType)) //otherwise test for suicide
|
||||
%game.awardScoreSuicide(%clVictim);
|
||||
|
||||
messageClient(%clVictim, 'MsgDMPlayerDies', "", %clVictim.deaths + %clVictim.suicides);
|
||||
}
|
||||
|
||||
function DMGame::recalcScore(%game, %client)
|
||||
{
|
||||
%killValue = %client.kills * %game.SCORE_PER_KILL;
|
||||
%deathValue = %client.deaths * %game.SCORE_PER_DEATH;
|
||||
%suicideValue = %client.suicides * %game.SCORE_PER_SUICIDE;
|
||||
|
||||
if (%killValue - %deathValue == 0)
|
||||
%client.efficiency = %suicideValue;
|
||||
else
|
||||
%client.efficiency = ((%killValue * %killValue) / (%killValue - %deathValue)) + %suicideValue;
|
||||
|
||||
%client.score = mFloatLength(%client.efficiency, 1);
|
||||
messageClient(%client, 'MsgYourScoreIs', "", %client.score);
|
||||
%game.recalcTeamRanks(%client);
|
||||
%game.checkScoreLimit(%client);
|
||||
}
|
||||
|
||||
function DMGame::timeLimitReached(%game)
|
||||
{
|
||||
logEcho("game over (timelimit)");
|
||||
%game.gameOver();
|
||||
cycleMissions();
|
||||
}
|
||||
|
||||
function DMGame::scoreLimitReached(%game)
|
||||
{
|
||||
logEcho("game over (scorelimit)");
|
||||
%game.gameOver();
|
||||
cycleMissions();
|
||||
}
|
||||
|
||||
function DMGame::gameOver(%game)
|
||||
{
|
||||
//call the default
|
||||
DefaultGame::gameOver(%game);
|
||||
|
||||
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.gameover.wav" );
|
||||
|
||||
cancel(%game.timeThread);
|
||||
messageAll('MsgClearObjHud', "");
|
||||
for(%i = 0; %i < ClientGroup.getCount(); %i ++) {
|
||||
%client = ClientGroup.getObject(%i);
|
||||
%game.resetScore(%client);
|
||||
}
|
||||
}
|
||||
|
||||
function DMGame::enterMissionArea(%game, %playerData, %player)
|
||||
{
|
||||
%player.client.outOfBounds = false;
|
||||
messageClient(%player.client, 'EnterMissionArea', '\c1You are back in the mission area.');
|
||||
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") entered mission area");
|
||||
cancel(%player.alertThread);
|
||||
}
|
||||
|
||||
function DMGame::leaveMissionArea(%game, %playerData, %player)
|
||||
{
|
||||
if(%player.getState() $= "Dead")
|
||||
return;
|
||||
|
||||
%player.client.outOfBounds = true;
|
||||
messageClient(%player.client, 'LeaveMissionArea', '\c1You have left the mission area. Return or take damage.~wfx/misc/warning_beep.wav');
|
||||
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") left mission area");
|
||||
%player.alertThread = %game.schedule(1000, "DMAlertPlayer", 3, %player);
|
||||
}
|
||||
|
||||
function DMGame::DMAlertPlayer(%game, %count, %player)
|
||||
{
|
||||
// MES - I commented below line out because it prints a blank line to chat window
|
||||
//messageClient(%player.client, 'MsgDMLeftMisAreaWarn', '~wfx/misc/red_alert.wav');
|
||||
if(%count > 1)
|
||||
%player.alertThread = %game.schedule(1000, "DMAlertPlayer", %count - 1, %player);
|
||||
else
|
||||
%player.alertThread = %game.schedule(1000, "MissionAreaDamage", %player);
|
||||
}
|
||||
|
||||
function DMGame::MissionAreaDamage(%game, %player)
|
||||
{
|
||||
if(%player.getState() !$= "Dead") {
|
||||
%player.setDamageFlash(0.1);
|
||||
%prevHurt = %player.getDamageLevel();
|
||||
%player.setDamageLevel(%prevHurt + 0.05);
|
||||
%player.alertThread = %game.schedule(1000, "MissionAreaDamage", %player);
|
||||
}
|
||||
else
|
||||
%game.onClientKilled(%player.client, 0, $DamageType::OutOfBounds);
|
||||
}
|
||||
|
||||
function DMGame::updateScoreHud(%game, %client, %tag)
|
||||
{
|
||||
// Clear the header:
|
||||
messageClient( %client, 'SetScoreHudHeader', "", "" );
|
||||
|
||||
// Send the subheader:
|
||||
messageClient(%client, 'SetScoreHudSubheader', "", '<tab:15,235,340,415>\tPLAYER\tRATING\tKILLS\tDEATHS');
|
||||
|
||||
for (%index = 0; %index < $TeamRank[0, count]; %index++)
|
||||
{
|
||||
//get the client info
|
||||
%cl = $TeamRank[0, %index];
|
||||
|
||||
//get the score
|
||||
%clScore = mFloatLength( %cl.efficiency, 1 );
|
||||
|
||||
%clKills = mFloatLength( %cl.kills, 0 );
|
||||
%clDeaths = mFloatLength( %cl.deaths + %cl.suicides, 0 );
|
||||
%clStyle = %cl == %client ? "<color:dcdcdc>" : "";
|
||||
|
||||
//if the client is not an observer, send the message
|
||||
if (%client.team != 0)
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '%5<tab:20, 450>\t<clip:200>%1</clip><rmargin:280><just:right>%2<rmargin:370><just:right>%3<rmargin:460><just:right>%4',
|
||||
%cl.name, %clScore, %clKills, %clDeaths, %clStyle );
|
||||
}
|
||||
//else for observers, create an anchor around the player name so they can be observed
|
||||
else
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '%5<tab:20, 450>\t<clip:200><a:gamelink\t%6>%1</a></clip><rmargin:280><just:right>%2<rmargin:370><just:right>%3<rmargin:460><just:right>%4',
|
||||
%cl.name, %clScore, %clKills, %clDeaths, %clStyle, %cl );
|
||||
}
|
||||
}
|
||||
|
||||
// Tack on the list of observers:
|
||||
%observerCount = 0;
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl.team == 0)
|
||||
%observerCount++;
|
||||
}
|
||||
|
||||
if (%observerCount > 0)
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, "");
|
||||
%index++;
|
||||
messageClient(%client, 'SetLineHud', "", %tag, %index, '<tab:10, 310><spush><font:Univers Condensed:22>\tOBSERVERS (%1)<rmargin:260><just:right>TIME<spop>', %observerCount);
|
||||
%index++;
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
//if this is an observer
|
||||
if (%cl.team == 0)
|
||||
{
|
||||
%obsTime = getSimTime() - %cl.observerStartTime;
|
||||
%obsTimeStr = %game.formatTime(%obsTime, false);
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:20, 310>\t<clip:150>%1</clip><rmargin:260><just:right>%2',
|
||||
%cl.name, %obsTimeStr );
|
||||
%index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//clear the rest of Hud so we don't get old lines hanging around...
|
||||
messageClient( %client, 'ClearHud', "", %tag, %index );
|
||||
}
|
||||
|
||||
function DMGame::applyConcussion(%game, %player)
|
||||
{
|
||||
}
|
||||
138
docs/base/@vl2/scripts.vl2/scripts/DebriefGui.cs
Normal file
138
docs/base/@vl2/scripts.vl2/scripts/DebriefGui.cs
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// DebriefGui.cs
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function DebriefGui::onWake( %this )
|
||||
{
|
||||
moveMap.pop();
|
||||
if ( isObject( passengerKeys ) )
|
||||
passengerKeys.pop();
|
||||
if ( isObject( observerBlockMap ) )
|
||||
observerBlockMap.pop();
|
||||
if ( isObject( observerMap ) )
|
||||
observerMap.pop();
|
||||
//flyingCameraMove.pop();
|
||||
|
||||
if ( isObject( debriefMap ) )
|
||||
{
|
||||
debriefMap.pop();
|
||||
debriefMap.delete();
|
||||
}
|
||||
new ActionMap( debriefMap );
|
||||
%bind = moveMap.getBinding( toggleMessageHud );
|
||||
debriefMap.bind( getField( %bind, 0 ), getField( %bind, 1 ), toggleDebriefChat );
|
||||
debriefMap.copyBind( moveMap, activateChatMenuHud );
|
||||
debriefMap.bindCmd( keyboard, escape, "", "debriefContinue();" );
|
||||
debriefMap.push();
|
||||
|
||||
DB_ChatVector.attach( HudMessageVector );
|
||||
DB_ChatScroll.scrollToBottom();
|
||||
DB_LoadingProgress.setValue( 0 );
|
||||
LoadingProgress.setValue( 0 );
|
||||
DB_LoadingProgressTxt.setValue( "LOADING MISSION" );
|
||||
LoadingProgressTxt.setValue( "LOADING MISSION" );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function DebriefGui::onSleep( %this )
|
||||
{
|
||||
debriefMap.pop();
|
||||
debriefMap.delete();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function DebriefResultText::onResize( %this, %width, %height )
|
||||
{
|
||||
%fieldHeight = getWord( DB_ResultPane.getExtent(), 1 );
|
||||
%x = getWord( DB_ResultScroll.getPosition(), 0 );
|
||||
%w = getWord( DB_ResultScroll.getExtent(), 0 );
|
||||
%h = %fieldHeight - %height - 4;
|
||||
DB_ResultScroll.resize( %x, %height + 2, %w, %h );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function toggleDebriefChat()
|
||||
{
|
||||
Canvas.pushDialog( DB_ChatDlg );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function DB_ChatDlg::onWake( %this )
|
||||
{
|
||||
DB_ChatEntry.setValue( "" );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function DB_ChatEntry::onEscape( %this )
|
||||
{
|
||||
Canvas.popDialog( DB_ChatDlg );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function DB_ChatEntry::sendChat( %this )
|
||||
{
|
||||
%text = %this.getValue();
|
||||
if ( %text !$= "" )
|
||||
commandToServer( 'MessageSent', %text );
|
||||
|
||||
Canvas.popDialog( DB_ChatDlg );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function debriefDisconnect()
|
||||
{
|
||||
MessageBoxYesNo( "DISCONNECT", "Are you sure you want to leave this game?", "Disconnect();" );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function debriefContinue()
|
||||
{
|
||||
checkGotLoadInfo();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
addMessageCallback( 'MsgGameOver', handleGameOverMessage );
|
||||
addMessageCallback( 'MsgClearDebrief', handleClearDebriefMessage );
|
||||
addMessageCallback( 'MsgDebriefResult', handleDebriefResultMessage );
|
||||
addMessageCallback( 'MsgDebriefAddLine', handleDebriefLineMessage );
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function handleGameOverMessage( %msgType, %msgString )
|
||||
{
|
||||
weaponsHud.clearAll();
|
||||
inventoryHud.clearAll();
|
||||
|
||||
// Fill the Debriefer up with stuff...
|
||||
Canvas.setContent( DebriefGui );
|
||||
}
|
||||
|
||||
function handleClearDebriefMessage( %msgType, %msgString )
|
||||
{
|
||||
DebriefResultText.setText( "" );
|
||||
DebriefText.setText( "" );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function handleDebriefResultMessage( %msgType, %msgString, %string )
|
||||
{
|
||||
%text = DebriefResultText.getText();
|
||||
if ( %text $= "" )
|
||||
%newText = detag( %string );
|
||||
else
|
||||
%newText = %text NL detag( %string );
|
||||
DebriefResultText.setText( %newText );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function handleDebriefLineMessage( %msgType, %msgString, %string )
|
||||
{
|
||||
%text = DebriefText.getText();
|
||||
if ( %text $= "" )
|
||||
%newText = detag( %string );
|
||||
else
|
||||
%newText = %text NL detag( %string );
|
||||
DebriefText.setText( %newText );
|
||||
}
|
||||
29
docs/base/@vl2/scripts.vl2/scripts/DemoEndGui.cs
Normal file
29
docs/base/@vl2/scripts.vl2/scripts/DemoEndGui.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
$DemoCycleDelay = 6000;
|
||||
|
||||
function DemoEndGui::onWake(%this)
|
||||
{
|
||||
%this.index = 1;
|
||||
new ActionMap( DemoEndMap );
|
||||
DemoEndMap.bindCmd( mouse, button0, "DemoEndGui.forceBitmapCycle();", "" );
|
||||
DemoEndMap.bindCmd( keyboard, space, "DemoEndGui.forceBitmapCycle();", "" );
|
||||
DemoEndMap.push();
|
||||
%this.cycleTimer = %this.schedule($DemoCycleDelay, cycleBitmaps);
|
||||
}
|
||||
|
||||
function DemoEndGui::cycleBitmaps(%this)
|
||||
{
|
||||
if (%this.index == 3)
|
||||
quit();
|
||||
else
|
||||
{
|
||||
%this.index++;
|
||||
%this.setBitmap("gui/bg_DemoEnd" @ %this.index);
|
||||
%this.cycleTimer = %this.schedule( $DemoCycleDelay, cycleBitmaps );
|
||||
}
|
||||
}
|
||||
|
||||
function DemoEndGui::forceBitmapCycle( %this )
|
||||
{
|
||||
cancel( %this.cycleTimer );
|
||||
%this.cycleBitmaps();
|
||||
}
|
||||
1331
docs/base/@vl2/scripts.vl2/scripts/DnDGame.cs
Normal file
1331
docs/base/@vl2/scripts.vl2/scripts/DnDGame.cs
Normal file
File diff suppressed because it is too large
Load diff
508
docs/base/@vl2/scripts.vl2/scripts/EditChatMenuGui.cs
Normal file
508
docs/base/@vl2/scripts.vl2/scripts/EditChatMenuGui.cs
Normal file
|
|
@ -0,0 +1,508 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// EditChatMenuGui.cs
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function EditChatMenuGui::onWake( %this )
|
||||
{
|
||||
fillChatMenuTree();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function EditChatMenuGui::onSleep( %this )
|
||||
{
|
||||
chatMenuGuiTree.clear();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function fillChatMenuTree()
|
||||
{
|
||||
%guiRoot = chatMenuGuiTree.getFirstRootItem();
|
||||
%newGuiId = chatMenuGuiTree.insertItem( %guiRoot, "CHAT MENU ROOT", 0 );
|
||||
traverseChatMenu( %newGuiId, $RootChatMenu );
|
||||
chatMenuGuiTree.expandItem( %newGuiId );
|
||||
chatMenuGuiTree.selectItem( %newGuiId );
|
||||
chatMenuGuiTree.dirty = false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function traverseChatMenu( %guiID, %menu )
|
||||
{
|
||||
for ( %i = 0; %i < %menu.optionCount; %i++ )
|
||||
{
|
||||
%text = %menu.option[%i];
|
||||
|
||||
if ( %menu.isMenu[%i] )
|
||||
{
|
||||
//echo( "** add menu item \"" @ %menu.option[%i] @ "\" **" );
|
||||
%newGuiID = chatMenuGuiTree.insertItem( %guiID, %text, 0 );
|
||||
traverseChatMenu( %newGuiID, %menu.command[%i] );
|
||||
}
|
||||
else
|
||||
{
|
||||
//echo( "** add command item \"" @ %menu.option[%i] @ "\" (" @ %menu.command[%i] @ ") **" );
|
||||
%temp = %menu.command[%i];
|
||||
%cmdId = getSubStr( %temp, 1, strlen( temp ) - 1 );
|
||||
%commandName = $ChatTable[%cmdId].name;
|
||||
%text = %text @ " - ( " @ %commandName @ " )";
|
||||
chatMenuGuiTree.insertItem( %guiID, %text, %cmdId );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function newChatMenu()
|
||||
{
|
||||
chatMenuGuiTree.clear();
|
||||
%guiRoot = chatMenuGuiTree.getFirstRootItem();
|
||||
chatMenuGuiTree.insertItem( %guiRoot, "CHAT MENU ROOT", 0 );
|
||||
chatMenuGuiTree.dirty = true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function saveChatMenu()
|
||||
{
|
||||
//getSaveFilename( "prefs/chatMenu/*.cs", doSaveChatMenu );
|
||||
doSaveChatMenu( "customVoiceBinds.cs" );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function resetChatMenu()
|
||||
{
|
||||
doLoadChatMenu( "scripts/voiceBinds.cs" );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//function loadChatMenu()
|
||||
//{
|
||||
// getLoadFilename( "prefs/chatMenu/*.cs", doLoadChatMenu );
|
||||
//}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function doSaveChatMenu( %filename )
|
||||
{
|
||||
%filename = fileBase( %filename );
|
||||
if ( %filename $= "" )
|
||||
return;
|
||||
|
||||
new fileObject( "saveFile" );
|
||||
saveFile.openForWrite( "prefs/" @ %filename @ ".cs" );
|
||||
|
||||
// Write a little header...
|
||||
saveFile.writeLine( "//------------------------------------------------------------------------------" );
|
||||
saveFile.writeLine( "//" );
|
||||
saveFile.writeLine( "// Tribes 2 voice chat menu." );
|
||||
saveFile.writeLine( "//" );
|
||||
saveFile.writeLine( "//------------------------------------------------------------------------------" );
|
||||
saveFile.writeLine( " " );
|
||||
|
||||
// Fire off the tree-traversing write function:
|
||||
%rootItem = chatMenuGuiTree.getFirstRootItem();
|
||||
writeTreeNode( saveFile, chatMenuGuiTree.getChild( %rootItem ) );
|
||||
|
||||
saveFile.close();
|
||||
saveFile.delete();
|
||||
|
||||
chatMenuGuiTree.dirty = false;
|
||||
|
||||
MessageBoxOK( "SAVED", "Save successful." );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function writeTreeNode( %file, %item )
|
||||
{
|
||||
%temp = chatMenuGuiTree.getItemText( %item );
|
||||
%key = getSubStr( firstWord( %temp ), 0, 1 );
|
||||
%text = restWords( %temp );
|
||||
%command = chatMenuGuiTree.getItemValue( %item );
|
||||
|
||||
if ( strcmp( %command, "0" ) == 0 )
|
||||
{
|
||||
%file.writeLine( "startChatMenu( \"" @ %key @ " " @ %text @ "\" );" );
|
||||
%child = chatMenuGuiTree.getChild( %item );
|
||||
if ( %child )
|
||||
writeTreeNode( %file, %child );
|
||||
|
||||
%file.writeLine( "endChatMenu(); // " @ %text );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Clip the command text off of the string:
|
||||
%cmdName = $ChatTable[%command].name;
|
||||
%text = getSubStr( %text, 0, strlen( %text ) - strlen( %cmdName ) - 7 );
|
||||
%file.writeLine( "addChat( \"" @ %key @ " " @ %text @ "\", '" @ %cmdName @ "' );" );
|
||||
}
|
||||
|
||||
%sibling = chatMenuGuiTree.getNextSibling( %item );
|
||||
if ( %sibling != 0 )
|
||||
writeTreeNode( %file, %sibling );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function doLoadChatMenu( %filename )
|
||||
{
|
||||
// Clear existing chat menu:
|
||||
chatMenuGuiTree.clear();
|
||||
|
||||
// Load the file...
|
||||
activateChatMenu( %filename );
|
||||
fillChatMenuTree();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function chatMenuGuiTree::onRightMouseDown( %this, %item, %pos )
|
||||
{
|
||||
// launch the action menu...
|
||||
chatMenuGuiTree.selectItem( %item );
|
||||
ChatMenuItemActionPopup.awaken( %item, %pos );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function editSelectedChatMenuItem()
|
||||
{
|
||||
%item = chatMenuGuiTree.getSelectedItem();
|
||||
if ( %item != chatMenuGuiTree.getFirstRootItem() )
|
||||
{
|
||||
%temp = chatMenuGuiTree.getItemText( %item );
|
||||
if ( strlen( %temp ) > 0 )
|
||||
{
|
||||
%key = getSubStr( firstWord( %temp ), 0, 1 );
|
||||
%text = restWords( %temp );
|
||||
%command = chatMenuGuiTree.getItemValue( %item );
|
||||
if ( %command $= "0" )
|
||||
editChatMenu( %key, %text, "doEditChatMenu" );
|
||||
else
|
||||
{
|
||||
%temp = strlen( $ChatTable[%command].name ) + 7;
|
||||
%text = getSubStr( %text, 0, strlen( %text ) - %temp );
|
||||
editChatCommand( %key, %text, %command, "doEditChatCommand" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
function ChatMenuItemActionPopup::awaken( %this, %item, %pos )
|
||||
{
|
||||
%this.position = %pos;
|
||||
%this.clear();
|
||||
|
||||
%treeRoot = chatMenuGuiTree.getFirstRootItem();
|
||||
%isMenu = ( strcmp( chatMenuGuiTree.getItemValue( %item ), "0" ) == 0 );
|
||||
|
||||
if ( %item != %treeRoot )
|
||||
%this.addEntry( "Edit", 0 );
|
||||
|
||||
if ( %isMenu )
|
||||
{
|
||||
%this.addEntry( "Add menu", 1 );
|
||||
%this.addEntry( "Add command", 2 );
|
||||
}
|
||||
|
||||
if ( chatMenuGuiTree.getPrevSibling( %item ) )
|
||||
%this.addEntry( "Move up", 3 );
|
||||
|
||||
if ( chatMenuGuiTree.getNextSibling( %item ) )
|
||||
%this.addEntry( "Move down", 4 );
|
||||
|
||||
if ( %item != %treeRoot )
|
||||
%this.addEntry( "Delete", 5 );
|
||||
|
||||
if ( %this.numEntries == 0 )
|
||||
return;
|
||||
|
||||
Canvas.pushDialog( ChatMenuItemActionDlg );
|
||||
%this.forceOnAction();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function ChatMenuItemActionPopup::addEntry( %this, %text, %id )
|
||||
{
|
||||
%this.numEntries++;
|
||||
%this.add( %text, %id );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function ChatMenuItemActionPopup::reset( %this )
|
||||
{
|
||||
%this.numEntries = 0;
|
||||
%this.forceClose();
|
||||
Canvas.popDialog( ChatMenuItemActionDlg );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function ChatMenuItemActionPopup::onSelect( %this, %id, %text )
|
||||
{
|
||||
%item = chatMenuGuiTree.getSelectedItem();
|
||||
|
||||
switch ( %id )
|
||||
{
|
||||
case 0: // Edit
|
||||
%temp = chatMenuGuiTree.getItemText( %item );
|
||||
%key = getSubStr( firstWord( %temp ), 0, 1 );
|
||||
%text = restWords( %temp );
|
||||
%command = chatMenuGuiTree.getItemValue( %item );
|
||||
if ( strcmp( %command, "0" ) == 0 )
|
||||
editChatMenu( %key, %text, "doEditChatMenu" );
|
||||
else
|
||||
{
|
||||
// Strip the command name from the text:
|
||||
%temp = strlen( $ChatTable[%command].name ) + 7;
|
||||
%text = getSubStr( %text, 0, strlen( %text ) - %temp );
|
||||
editChatCommand( %key, %text, %command, "doEditChatCommand" );
|
||||
}
|
||||
case 1: // Add menu
|
||||
editChatMenu( "", "", "doNewChatMenu" );
|
||||
case 2: // Add command
|
||||
editChatCommand( "", "", "", "doNewChatCommand" );
|
||||
case 3: // Move up
|
||||
chatMenuGuiTree.moveItemUp( %item );
|
||||
chatMenuGuiTree.dirty = true;
|
||||
case 4: // Move down
|
||||
%nextItem = chatMenuGuiTree.getNextSibling( %item );
|
||||
chatMenuGuiTree.moveItemUp( %nextItem );
|
||||
chatMenuGuiTree.dirty = true;
|
||||
case 5: // Delete
|
||||
chatMenuGuiTree.removeItem( %item );
|
||||
chatMenuGuiTree.dirty = true;
|
||||
}
|
||||
|
||||
%this.reset();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function ChatMenuItemActionPopup::onCancel( %this )
|
||||
{
|
||||
%this.reset();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function editChatMenu( %key, %text, %callback )
|
||||
{
|
||||
$ECI::key = %key;
|
||||
$ECI::text = %text;
|
||||
$ECI::OKCommand = %callback @ "($ECI::key, $ECI::text);";
|
||||
Canvas.pushDialog( EditChatMenuDlg );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function editChatCommand( %key, %text, %command, %callback )
|
||||
{
|
||||
$ECI::key = %key;
|
||||
$ECI::text = %text;
|
||||
$ECI::command = %command;
|
||||
$ECI::OKCommand = %callback @ "($ECI::key, $ECI::text, $ECI::command);";
|
||||
Canvas.pushDialog( EditChatCommandDlg );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function doEditChatMenu( %key, %text )
|
||||
{
|
||||
if ( strlen( %key ) && strlen( %text ) )
|
||||
{
|
||||
Canvas.popDialog( EditChatMenuDlg );
|
||||
%item = chatMenuGuiTree.getSelectedItem();
|
||||
%newText = %key @ ": " @ %text;
|
||||
chatMenuGuiTree.editItem( %item, %newText, "0" );
|
||||
checkSiblings( %item );
|
||||
chatMenuGuiTree.dirty = true;
|
||||
}
|
||||
//else
|
||||
// WARN
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function doEditChatCommand( %key, %text, %command )
|
||||
{
|
||||
if ( strlen( %key ) && strlen( %text ) && isObject( $ChatTable[%command] ) )
|
||||
{
|
||||
Canvas.popDialog( EditChatCommandDlg );
|
||||
%item = chatMenuGuiTree.getSelectedItem();
|
||||
%newText = %key @ ": " @ %text @ " - ( " @ $ChatTable[%command].name @ " )";
|
||||
chatMenuGuiTree.editItem( %item, %newText, %command );
|
||||
checkSiblings( %item );
|
||||
chatMenuGuiTree.dirty = true;
|
||||
}
|
||||
//else
|
||||
// WARN
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function doNewChatMenu( %key, %text )
|
||||
{
|
||||
if ( strlen( %key ) && strlen( %text ) )
|
||||
{
|
||||
Canvas.popDialog( EditChatMenuDlg );
|
||||
%item = chatMenuGuiTree.getSelectedItem();
|
||||
%newText = %key @ ": " @ %text;
|
||||
%newItem = chatMenuGuiTree.insertItem( %item, %newText, "0" );
|
||||
chatMenuGuiTree.expandItem( %item );
|
||||
chatMenuGuiTree.selectItem( %newItem );
|
||||
checkSiblings( %newItem );
|
||||
chatMenuGuiTree.dirty = true;
|
||||
}
|
||||
//else
|
||||
// WARN
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function doNewChatCommand( %key, %text, %command )
|
||||
{
|
||||
if ( strlen( %key ) && strlen( %text ) && isObject( $ChatTable[%command] ) )
|
||||
{
|
||||
Canvas.popDialog( EditChatCommandDlg );
|
||||
%item = chatMenuGuiTree.getSelectedItem();
|
||||
%newText = %key @ ": " @ %text @ " - ( " @ $ChatTable[%command].name @ " )";
|
||||
%newItem = chatMenuGuiTree.insertItem( %item, %newText, %command );
|
||||
chatMenuGuiTree.expandItem( %item );
|
||||
chatMenuGuiTree.selectItem( %newItem );
|
||||
checkSiblings( %newItem );
|
||||
chatMenuGuiTree.dirty = true;
|
||||
}
|
||||
//else
|
||||
// WARN
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
function EditChatMenuDlg::onWake( %this )
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function EditChatCommandDlg::onWake( %this )
|
||||
{
|
||||
// Fill the command popup list:
|
||||
EditChatCommandList.clear();
|
||||
for ( %i = $MinChatItemId; %i <= $MaxChatItemId; %i++ )
|
||||
{
|
||||
if ( isObject( $ChatTable[%i] ) )
|
||||
EditChatCommandList.add( $ChatTable[%i].name, %i );
|
||||
}
|
||||
EditChatCommandList.sort( true );
|
||||
|
||||
// Select the current command:
|
||||
if ( isObject( $ChatTable[$ECI::command] ) )
|
||||
{
|
||||
EditChatCommandList.setSelected( $ECI::command );
|
||||
EditChatCommandMessage.setText( $ChatTable[$ECI::command].text );
|
||||
ChatCommandTestBtn.setVisible( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
EditChatCommandList.setText( "Select command" );
|
||||
EditChatCommandMessage.setText( " " );
|
||||
ChatCommandTestBtn.setVisible( false );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function EditChatCommandList::onSelect( %this, %index, %value )
|
||||
{
|
||||
$ECI::command = %index;
|
||||
EditChatCommandMessage.setText( $ChatTable[%index].text );
|
||||
ChatCommandTestBtn.setVisible( true );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function checkSiblings( %item )
|
||||
{
|
||||
%allClear = true;
|
||||
%sibling = chatMenuGuiTree.getPrevSibling( %item );
|
||||
while ( %sibling != 0 )
|
||||
{
|
||||
%siblingKey = getSubStr( firstWord( chatMenuGuiTree.getItemText( %sibling ) ), 0, 1 );
|
||||
if ( %siblingKey $= $ECI::key )
|
||||
{
|
||||
%allClear = false;
|
||||
break;
|
||||
}
|
||||
%sibling = chatMenuGuiTree.getPrevSibling( %sibling );
|
||||
}
|
||||
|
||||
if ( %allClear )
|
||||
{
|
||||
%sibling = chatMenuGuiTree.getNextSibling( %item );
|
||||
while ( %sibling != 0 )
|
||||
{
|
||||
%siblingKey = getSubStr( firstWord( chatMenuGuiTree.getItemText( %sibling ) ), 0, 1 );
|
||||
if ( %siblingKey $= $ECI::key )
|
||||
{
|
||||
%allClear = false;
|
||||
break;
|
||||
}
|
||||
%sibling = chatMenuGuiTree.getNextSibling( %sibling );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !%allClear )
|
||||
{
|
||||
if ( chatMenuGuiTree.getItemValue( %item ) $= "0" )
|
||||
%text1 = restWords( chatMenuGuiTree.getItemText( %item ) );
|
||||
else
|
||||
{
|
||||
%temp = chatMenuGuiTree.getItemText( %item );
|
||||
%text1 = getWords( %temp, 1, getWordCount( %temp ) - 5 );
|
||||
}
|
||||
|
||||
if ( chatMenuGuiTree.getItemValue( %sibling ) $= "0" )
|
||||
%text2 = restWords( chatMenuGuiTree.getItemText( %sibling ) );
|
||||
else
|
||||
{
|
||||
%temp = chatMenuGuiTree.getItemText( %sibling );
|
||||
%text2 = getWords( %temp, 1, getWordCount( %temp ) - 5 );
|
||||
}
|
||||
|
||||
MessageBoxOK( "WARNING", "Menu siblings \"" @ %text1 @ "\" and \"" @ %text2 @ "\" are both bound to the \'" @ %siblingKey @ "\' key!" );
|
||||
}
|
||||
|
||||
return %allClear;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function testChatCommand( %command )
|
||||
{
|
||||
// Play the sound:
|
||||
if ( $pref::Player::Count > 0 )
|
||||
%voiceSet = getField( $pref::Player[$pref::Player::Current], 3 );
|
||||
else
|
||||
%voiceSet = "Male1";
|
||||
|
||||
ChatCommandTestBtn.setActive( false );
|
||||
%wav = "voice/" @ %voiceSet @ "/" @ $ChatTable[%command].audioFile @ ".wav";
|
||||
%handle = alxCreateSource( AudioChat, %wav );
|
||||
alxPlay( %handle );
|
||||
%delay = alxGetWaveLen( %wav );
|
||||
schedule( %delay, 0, "restoreCommandTestBtn" );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function restoreCommandTestBtn()
|
||||
{
|
||||
ChatCommandTestBtn.setActive( true );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function leaveChatMenuEditor()
|
||||
{
|
||||
if ( chatMenuGuiTree.dirty )
|
||||
MessageBoxYesNo( "CHANGES", "Do you want to save your changes?",
|
||||
"saveChatMenu(); reallyLeaveChatMenuEditor();",
|
||||
"reallyLeaveChatMenuEditor();" );
|
||||
else
|
||||
reallyLeaveChatMenuEditor();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function reallyLeaveChatMenuEditor()
|
||||
{
|
||||
activateChatMenu( "prefs/customVoiceBinds.cs" );
|
||||
Canvas.popDialog( EditChatMenuGui );
|
||||
Canvas.pushDialog( OptionsDlg );
|
||||
}
|
||||
|
||||
|
||||
3161
docs/base/@vl2/scripts.vl2/scripts/EditorGui.cs
Normal file
3161
docs/base/@vl2/scripts.vl2/scripts/EditorGui.cs
Normal file
File diff suppressed because it is too large
Load diff
460
docs/base/@vl2/scripts.vl2/scripts/EditorProfiles.cs
Normal file
460
docs/base/@vl2/scripts.vl2/scripts/EditorProfiles.cs
Normal file
|
|
@ -0,0 +1,460 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
//
|
||||
// Copyright (c) 2001 GarageGames.Com
|
||||
// Portions Copyright (c) 2001 by Sierra Online, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
$Gui::fontCacheDirectory = expandFilename("./cache");
|
||||
$Gui::clipboardFile = expandFilename("./cache/clipboard.gui");
|
||||
|
||||
// GuiDefaultProfile is a special case, all other profiles are initialized
|
||||
// to the contents of this profile first then the profile specific
|
||||
// overrides are assigned.
|
||||
|
||||
if(!isObject(GuiDefaultProfile)) new GuiControlProfile (GuiDefaultProfile)
|
||||
{
|
||||
tab = false;
|
||||
canKeyFocus = false;
|
||||
hasBitmapArray = false;
|
||||
mouseOverSelected = false;
|
||||
|
||||
// fill color
|
||||
opaque = false;
|
||||
fillColor = ($platform $= "macos") ? "211 211 211" : "192 192 192";
|
||||
fillColorHL = ($platform $= "macos") ? "244 244 244" : "220 220 220";
|
||||
fillColorNA = ($platform $= "macos") ? "244 244 244" : "220 220 220";
|
||||
|
||||
// border color
|
||||
border = false;
|
||||
borderColor = "0 0 0";
|
||||
borderColorHL = "128 128 128";
|
||||
borderColorNA = "64 64 64";
|
||||
|
||||
// font
|
||||
fontType = "Arial";
|
||||
fontSize = 14;
|
||||
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "32 100 100";
|
||||
fontColorNA = "0 0 0";
|
||||
fontColorSEL= "200 200 200";
|
||||
|
||||
// bitmap information
|
||||
bitmap = "gui/darkWindow";
|
||||
bitmapBase = "";
|
||||
textOffset = "0 0";
|
||||
|
||||
// used by guiTextControl
|
||||
modal = true;
|
||||
justify = "left";
|
||||
autoSizeWidth = false;
|
||||
autoSizeHeight = false;
|
||||
returnTab = false;
|
||||
numbersOnly = false;
|
||||
cursorColor = "0 0 0 255";
|
||||
|
||||
// sounds
|
||||
soundButtonDown = "";
|
||||
soundButtonOver = "";
|
||||
};
|
||||
|
||||
if(!isObject(GuiInputCtrlProfile)) new GuiControlProfile( GuiInputCtrlProfile )
|
||||
{
|
||||
tab = true;
|
||||
canKeyFocus = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiDialogProfile)) new GuiControlProfile(GuiDialogProfile);
|
||||
|
||||
|
||||
if(!isObject(GuiSolidDefaultProfile)) new GuiControlProfile (GuiSolidDefaultProfile)
|
||||
{
|
||||
opaque = true;
|
||||
border = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiWindowProfile)) new GuiControlProfile (GuiWindowProfile)
|
||||
{
|
||||
opaque = true;
|
||||
border = 2;
|
||||
fillColor = ($platform $= "macos") ? "211 211 211" : "192 192 192";
|
||||
fillColorHL = ($platform $= "macos") ? "190 255 255" : "64 150 150";
|
||||
fillColorNA = ($platform $= "macos") ? "255 255 255" : "150 150 150";
|
||||
fontColor = ($platform $= "macos") ? "0 0 0" : "255 255 255";
|
||||
fontColorHL = ($platform $= "macos") ? "200 200 200" : "0 0 0";
|
||||
text = "GuiWindowCtrl test";
|
||||
bitmap = "gui/darkWindow";
|
||||
textOffset = ($platform $= "macos") ? "5 5" : "6 6";
|
||||
hasBitmapArray = true;
|
||||
justify = ($platform $= "macos") ? "center" : "left";
|
||||
};
|
||||
|
||||
if(!isObject(EditorToolButtonProfile)) new GuiControlProfile (EditorToolButtonProfile)
|
||||
{
|
||||
opaque = true;
|
||||
border = 2;
|
||||
};
|
||||
|
||||
if(!isObject(GuiContentProfile)) new GuiControlProfile (GuiContentProfile)
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = "255 255 255";
|
||||
};
|
||||
|
||||
if(!isObject(GuiModelessDialogProfile)) new GuiControlProfile("GuiModelessDialogProfile")
|
||||
{
|
||||
modal = false;
|
||||
};
|
||||
|
||||
if(!isObject(GuiButtonProfile)) new GuiControlProfile (GuiButtonProfile)
|
||||
{
|
||||
opaque = true;
|
||||
border = true;
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "32 100 100";
|
||||
fixedExtent = true;
|
||||
justify = "center";
|
||||
canKeyFocus = false;
|
||||
};
|
||||
|
||||
if(!isObject(GuiBorderButtonProfile)) new GuiControlProfile (GuiBorderButtonProfile)
|
||||
{
|
||||
fontColorHL = "0 0 0";
|
||||
};
|
||||
|
||||
if(!isObject(GuiMenuBarProfile)) new GuiControlProfile (GuiMenuBarProfile)
|
||||
{
|
||||
fontType = "Arial";
|
||||
fontSize = 14;
|
||||
opaque = true;
|
||||
fillColor = "192 192 192";
|
||||
fillColorHL = "220 220 220";
|
||||
fillColorNA = "220 220 220";
|
||||
fillColorHL = "0 0 96";
|
||||
border = 4;
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "255 255 255";
|
||||
fontColorNA = "128 128 128";
|
||||
fixedExtent = true;
|
||||
justify = "center";
|
||||
canKeyFocus = false;
|
||||
mouseOverSelected = true;
|
||||
//bitmap = ($platform $= "macos") ? "./osxMenu" : "./torqueMenu";
|
||||
//hasBitmapArray = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiButtonSmProfile)) new GuiControlProfile (GuiButtonSmProfile)
|
||||
{
|
||||
fontSize = 14;
|
||||
};
|
||||
|
||||
if(!isObject(GuiRadioProfile)) new GuiControlProfile (GuiRadioProfile)
|
||||
{
|
||||
fontSize = 14;
|
||||
fillColor = "232 232 232";
|
||||
fontColorHL = "32 100 100";
|
||||
fixedExtent = true;
|
||||
bitmap = "gui/darkWindow";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiScrollProfile)) new GuiControlProfile (GuiScrollProfile)
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = "255 255 255";
|
||||
border = 3;
|
||||
borderThickness = 2;
|
||||
borderColor = "0 0 0";
|
||||
bitmap = "gui/darkScroll";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiSliderProfile)) new GuiControlProfile (GuiSliderProfile);
|
||||
|
||||
|
||||
if(!isObject(PainterTextProfile)) new GuiControlProfile (PainterTextProfile)
|
||||
{
|
||||
fontType = "Univers Condensed";
|
||||
fontSize = 16;
|
||||
fontColor = "0 0 0";
|
||||
fontColorLink = "255 96 96";
|
||||
fontColorLinkHL = "0 0 255";
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiTextProfile)) new GuiControlProfile (GuiTextProfile)
|
||||
{
|
||||
fontColor = "0 0 0";
|
||||
fontColorLink = "255 96 96";
|
||||
fontColorLinkHL = "0 0 255";
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
};
|
||||
|
||||
if(!isObject(EditorTextProfile)) new GuiControlProfile (EditorTextProfile)
|
||||
{
|
||||
fontType = "Arial Bold";
|
||||
fontColor = "0 0 0";
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
};
|
||||
|
||||
if(!isObject(EditorTextProfileWhite)) new GuiControlProfile (EditorTextProfileWhite)
|
||||
{
|
||||
fontType = "Arial Bold";
|
||||
fontColor = "255 255 255";
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiMediumTextProfile)) new GuiControlProfile (GuiMediumTextProfile)
|
||||
{
|
||||
fontType = "Arial Bold";
|
||||
fontColor = "0 0 0";
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
fontSize = 24;
|
||||
};
|
||||
|
||||
if(!isObject(GuiBigTextProfile)) new GuiControlProfile (GuiBigTextProfile)
|
||||
{
|
||||
fontType = "Arial Bold";
|
||||
fontColor = "0 0 0";
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
fontSize = 36;
|
||||
};
|
||||
|
||||
if(!isObject(GuiCenterTextProfile)) new GuiControlProfile (GuiCenterTextProfile)
|
||||
{
|
||||
fontType = "Arial Bold";
|
||||
fontColor = "0 0 0";
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
justify = "center";
|
||||
};
|
||||
|
||||
if(!isObject(MissionEditorProfile)) new GuiControlProfile (MissionEditorProfile)
|
||||
{
|
||||
canKeyFocus = true;
|
||||
};
|
||||
|
||||
if(!isObject(EditorScrollProfile)) new GuiControlProfile (EditorScrollProfile)
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = "192 192 192 192";
|
||||
border = 3;
|
||||
borderThickness = 2;
|
||||
borderColor = "0 0 0";
|
||||
bitmap = "gui/darkScroll";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiTextEditProfile)) new GuiControlProfile (GuiTextEditProfile)
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = "255 255 255";
|
||||
fillColorHL = "128 128 128";
|
||||
border = 3;
|
||||
borderThickness = 2;
|
||||
borderColor = "0 0 0";
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "255 255 255";
|
||||
fontColorNA = "128 128 128";
|
||||
textOffset = "0 2";
|
||||
autoSizeWidth = false;
|
||||
autoSizeHeight = true;
|
||||
tab = true;
|
||||
canKeyFocus = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiControlListPopupProfile)) new GuiControlProfile (GuiControlListPopupProfile)
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = "255 255 255";
|
||||
fillColorHL = "128 128 128";
|
||||
border = true;
|
||||
borderColor = "0 0 0";
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "255 255 255";
|
||||
fontColorNA = "128 128 128";
|
||||
textOffset = "0 2";
|
||||
autoSizeWidth = false;
|
||||
autoSizeHeight = true;
|
||||
tab = true;
|
||||
canKeyFocus = true;
|
||||
bitmap = "gui/darkScroll";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiTextArrayProfile)) new GuiControlProfile (GuiTextArrayProfile)
|
||||
{
|
||||
fontType = "Arial Bold";
|
||||
fontColor = "0 0 0";
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
fontColorHL = "32 100 100";
|
||||
fillColorHL = "200 200 200";
|
||||
};
|
||||
|
||||
if(!isObject(GuiTextListProfile)) new GuiControlProfile (GuiTextListProfile)
|
||||
{
|
||||
fontType = "Arial Bold";
|
||||
fontColor = "0 0 0";
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
|
||||
} ;
|
||||
|
||||
if(!isObject(GuiTreeViewProfile)) new GuiControlProfile (GuiTreeViewProfile)
|
||||
{
|
||||
fontSize = 13; // dhc - trying a better fit...
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "64 150 150";
|
||||
};
|
||||
|
||||
if(!isObject(GuiCheckBoxProfile)) new GuiControlProfile (GuiCheckBoxProfile)
|
||||
{
|
||||
opaque = false;
|
||||
fillColor = "232 232 232";
|
||||
border = false;
|
||||
borderColor = "0 0 0";
|
||||
fontSize = 14;
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "32 100 100";
|
||||
fixedExtent = true;
|
||||
justify = "left";
|
||||
bitmap = "gui/darkScroll";
|
||||
hasBitmapArray = true;
|
||||
|
||||
};
|
||||
|
||||
if(!isObject(GuiPopUpMenuProfile)) new GuiControlProfile (GuiPopUpMenuProfile)
|
||||
{
|
||||
opaque = true;
|
||||
mouseOverSelected = true;
|
||||
|
||||
border = 4;
|
||||
borderThickness = 2;
|
||||
borderColor = "0 0 0";
|
||||
fontSize = 14;
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "32 100 100";
|
||||
fontColorSEL = "32 100 100";
|
||||
fixedExtent = true;
|
||||
justify = "center";
|
||||
bitmap = "gui/darkScroll";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
||||
if(!isObject(GuiEditorClassProfile)) new GuiControlProfile (GuiEditorClassProfile)
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = "232 232 232";
|
||||
border = true;
|
||||
borderColor = "0 0 0";
|
||||
borderColorHL = "127 127 127";
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "32 100 100";
|
||||
fixedExtent = true;
|
||||
justify = "center";
|
||||
bitmap = "gui/darkScroll";
|
||||
hasBitmapArray = true;
|
||||
};
|
||||
|
||||
|
||||
if(!isObject(LoadTextProfile)) new GuiControlProfile ("LoadTextProfile")
|
||||
{
|
||||
fontColor = "66 219 234";
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
};
|
||||
|
||||
|
||||
if(!isObject(GuiMLTextProfile)) new GuiControlProfile ("GuiMLTextProfile")
|
||||
{
|
||||
fontColorLink = "255 96 96";
|
||||
fontColorLinkHL = "0 0 255";
|
||||
};
|
||||
|
||||
if(!isObject(GuiMLTextEditProfile)) new GuiControlProfile (GuiMLTextEditProfile)
|
||||
{
|
||||
fontColorLink = "255 96 96";
|
||||
fontColorLinkHL = "0 0 255";
|
||||
|
||||
fillColor = "255 255 255";
|
||||
fillColorHL = "128 128 128";
|
||||
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "255 255 255";
|
||||
fontColorNA = "128 128 128";
|
||||
|
||||
autoSizeWidth = true;
|
||||
autoSizeHeight = true;
|
||||
tab = true;
|
||||
canKeyFocus = true;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Console Window
|
||||
|
||||
if(!isObject(GuiConsoleProfile)) new GuiControlProfile ("GuiConsoleProfile")
|
||||
{
|
||||
fontType = ($platform $= "macos") ? "Courier New" : "Lucida Console";
|
||||
fontSize = 12;
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "130 130 130";
|
||||
fontColorNA = "255 0 0";
|
||||
fontColors[6] = "50 50 50";
|
||||
fontColors[7] = "50 50 0";
|
||||
fontColors[8] = "0 0 50";
|
||||
fontColors[9] = "0 50 0";
|
||||
};
|
||||
|
||||
|
||||
if(!isObject(GuiProgressProfile)) new GuiControlProfile ("GuiProgressProfile")
|
||||
{
|
||||
opaque = false;
|
||||
fillColor = "44 152 162 100";
|
||||
border = true;
|
||||
borderColor = "78 88 120";
|
||||
};
|
||||
|
||||
if(!isObject(GuiProgressTextProfile)) new GuiControlProfile ("GuiProgressTextProfile")
|
||||
{
|
||||
fontColor = "0 0 0";
|
||||
justify = "center";
|
||||
};
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Gui Inspector
|
||||
|
||||
if(!isObject(GuiInspectorTextEditProfile)) new GuiControlProfile ("GuiInspectorTextEditProfile")
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = "255 255 255";
|
||||
fillColorHL = "128 128 128";
|
||||
border = true;
|
||||
borderColor = "0 0 0";
|
||||
fontColor = "0 0 0";
|
||||
fontColorHL = "255 255 255";
|
||||
autoSizeWidth = false;
|
||||
autoSizeHeight = true;
|
||||
tab = false;
|
||||
canKeyFocus = true;
|
||||
};
|
||||
|
||||
//-------------------------------------- Cursors
|
||||
//
|
||||
if(!isObject(DefaultCursor)) new GuiCursor(DefaultCursor)
|
||||
{
|
||||
hotSpot = "1 1";
|
||||
bitmapName = "gui/CUR_3darrow";
|
||||
};
|
||||
|
||||
1826
docs/base/@vl2/scripts.vl2/scripts/GameGui.cs
Normal file
1826
docs/base/@vl2/scripts.vl2/scripts/GameGui.cs
Normal file
File diff suppressed because it is too large
Load diff
1745
docs/base/@vl2/scripts.vl2/scripts/HuntersGame.cs
Normal file
1745
docs/base/@vl2/scripts.vl2/scripts/HuntersGame.cs
Normal file
File diff suppressed because it is too large
Load diff
381
docs/base/@vl2/scripts.vl2/scripts/LaunchLanGui.cs
Normal file
381
docs/base/@vl2/scripts.vl2/scripts/LaunchLanGui.cs
Normal file
|
|
@ -0,0 +1,381 @@
|
|||
//--------------------------------------------------------
|
||||
function QueryServers( %searchCriteria )
|
||||
{
|
||||
GMJ_Browser.lastQuery = %searchCriteria;
|
||||
LaunchGame( "JOIN" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
function QueryOnlineServers()
|
||||
{
|
||||
QueryServers("Master");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
// Launch gui functions
|
||||
//--------------------------------------------------------
|
||||
function PlayOffline()
|
||||
{
|
||||
$FirstLaunch = true;
|
||||
setNetPort(0);
|
||||
$PlayingOnline = false;
|
||||
Canvas.setContent(LaunchGui);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
function OnlineLogIn()
|
||||
{
|
||||
$FirstLaunch = true;
|
||||
setNetPort(0);
|
||||
$PlayingOnline = true;
|
||||
FilterEditGameType.clear();
|
||||
FilterEditMissionType.clear();
|
||||
queryMasterGameTypes();
|
||||
// Start the Email checking...
|
||||
EmailGui.checkSchedule = schedule( 5000, 0, CheckEmail, true );
|
||||
|
||||
// Load the player database...
|
||||
%guid = getField( WONGetAuthInfo(), 3 );
|
||||
if ( %guid > 0 )
|
||||
loadPlayerDatabase( "prefs/pyrdb" @ %guid );
|
||||
Canvas.setContent(LaunchGui);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
function LaunchToolbarMenu::onSelect(%this, %id, %text)
|
||||
{
|
||||
switch(%id)
|
||||
{
|
||||
case 0:
|
||||
LaunchGame();
|
||||
case 1: // Start Training Mission
|
||||
LaunchTraining();
|
||||
case 2:
|
||||
LaunchNews();
|
||||
case 3:
|
||||
LaunchForums();
|
||||
case 4:
|
||||
LaunchEmail();
|
||||
case 5: // Join Chat Room
|
||||
Canvas.pushDialog(JoinChatDlg);
|
||||
case 6:
|
||||
LaunchBrowser();
|
||||
case 7: // Options
|
||||
Canvas.pushDialog(OptionsDlg);
|
||||
case 8: // Play Recording
|
||||
Canvas.pushDialog(RecordingsDlg);
|
||||
case 9: // Quit
|
||||
if(isObject($IRCClient.tcp))
|
||||
IRCClient::quit();
|
||||
LaunchTabView.closeAllTabs();
|
||||
if (!isDemo())
|
||||
quit();
|
||||
else
|
||||
Canvas.setContent(DemoEndGui);
|
||||
//case 10: // Log Off
|
||||
// LaunchTabView.closeAllTabs();
|
||||
// PlayOffline();
|
||||
//case 11: // Log On
|
||||
// LaunchTabView.closeAllTabs();
|
||||
// OnlineLogIn();
|
||||
case 12:
|
||||
LaunchCredits();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
function LaunchToolbarDlg::onWake(%this)
|
||||
{
|
||||
// Play the shell hum:
|
||||
if ( $HudHandle[shellScreen] $= "" )
|
||||
$HudHandle[shellScreen] = alxPlay( ShellScreenHumSound, 0, 0, 0 );
|
||||
|
||||
LaunchToolbarMenu.clear();
|
||||
|
||||
if ( isDemo() )
|
||||
{
|
||||
LaunchToolbarMenu.add( 1, "TRAINING" );
|
||||
LaunchToolbarMenu.add( 0, "GAME" );
|
||||
LaunchToolbarMenu.add( 2, "NEWS" );
|
||||
}
|
||||
else if ( $PlayingOnline )
|
||||
{
|
||||
LaunchToolbarMenu.add( 0, "GAME" );
|
||||
LaunchToolbarMenu.add( 4, "EMAIL" );
|
||||
LaunchToolbarMenu.add( 5, "CHAT" );
|
||||
LaunchToolbarMenu.add( 6, "BROWSER" );
|
||||
}
|
||||
else
|
||||
{
|
||||
LaunchToolbarMenu.add( 1, "TRAINING" );
|
||||
LaunchToolbarMenu.add( 0, "LAN GAME" );
|
||||
}
|
||||
|
||||
LaunchToolbarMenu.addSeparator();
|
||||
LaunchToolbarMenu.add( 7, "SETTINGS" );
|
||||
if ( !isDemo() )
|
||||
LaunchToolbarMenu.add( 8, "RECORDINGS" );
|
||||
LaunchToolbarMenu.add( 12, "CREDITS" );
|
||||
|
||||
LaunchToolbarMenu.addSeparator();
|
||||
LaunchToolbarMenu.add( 9, "QUIT" );
|
||||
|
||||
%on = false;
|
||||
for ( %tab = 0; %tab < LaunchTabView.tabCount(); %tab++ )
|
||||
{
|
||||
if ( LaunchTabView.isTabActive( %tab ) )
|
||||
{
|
||||
%on = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
LaunchToolbarCloseButton.setVisible( %on );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Launch Tab Group functions:
|
||||
//----------------------------------------------------------------------------
|
||||
function OpenLaunchTabs( %gotoWarriorSetup )
|
||||
{
|
||||
if ( LaunchTabView.tabCount() > 0 || !$FirstLaunch )
|
||||
return;
|
||||
|
||||
$FirstLaunch = "";
|
||||
|
||||
// Set up all of the launch bar tabs:
|
||||
if ( isDemo() )
|
||||
{
|
||||
LaunchTabView.addLaunchTab( "TRAINING", TrainingGui );
|
||||
LaunchTabView.addLaunchTab( "GAME", GameGui );
|
||||
LaunchTabView.addLaunchTab( "NEWS", NewsGui );
|
||||
LaunchTabView.addLaunchTab( "FORUMS", "", true );
|
||||
LaunchTabView.addLaunchTab( "EMAIL", "", true );
|
||||
LaunchTabView.addLaunchTab( "CHAT", "", true );
|
||||
LaunchTabView.addLaunchTab( "BROWSER", "", true );
|
||||
%launchGui = NewsGui;
|
||||
}
|
||||
else if ( $PlayingOnline )
|
||||
{
|
||||
LaunchTabView.addLaunchTab( "GAME", GameGui );
|
||||
LaunchTabView.addLaunchTab( "EMAIL", EmailGui );
|
||||
LaunchTabView.addLaunchTab( "CHAT", ChatGui );
|
||||
LaunchTabView.addLaunchTab( "BROWSER", TribeandWarriorBrowserGui);
|
||||
|
||||
switch$ ( $pref::Shell::LaunchGui )
|
||||
{
|
||||
case "News": %launchGui = NewsGui;
|
||||
case "Forums": %launchGui = ForumsGui;
|
||||
case "Email": %launchGui = EmailGui;
|
||||
case "Chat": %launchGui = ChatGui;
|
||||
case "Browser": %launchGui = TribeandWarriorBrowserGui;
|
||||
default: %launchGui = GameGui;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LaunchTabView.addLaunchTab( "TRAINING", TrainingGui );
|
||||
LaunchTabView.addLaunchTab( "LAN GAME", GameGui );
|
||||
%launchGui = TrainingGui;
|
||||
}
|
||||
|
||||
if ( %gotoWarriorSetup )
|
||||
LaunchGame( "WARRIOR" );
|
||||
else
|
||||
LaunchTabView.viewTab( "", %launchGui, 0 );
|
||||
|
||||
if ( $IssueVoodooWarning && !$pref::SawVoodooWarning )
|
||||
{
|
||||
$pref::SawVoodooWarning = 1;
|
||||
schedule( 0, 0, MessageBoxOK, "WARNING", "A Voodoo card has been detected. If you experience any graphical oddities, you should try the WickedGl drivers available at www.wicked3d.com" );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
function LaunchTabView::addLaunchTab( %this, %text, %gui, %makeInactive )
|
||||
{
|
||||
%tabCount = %this.tabCount();
|
||||
%this.gui[%tabCount] = %gui;
|
||||
%this.key[%tabCount] = 0;
|
||||
%this.addTab( %tabCount, %text );
|
||||
if ( %makeInactive )
|
||||
%this.setTabActive( %tabCount, false );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
function LaunchTabView::onSelect( %this, %id, %text )
|
||||
{
|
||||
// Ignore the ID - it can't be trusted.
|
||||
%tab = %this.getSelectedTab();
|
||||
|
||||
if ( isObject( %this.gui[%tab] ) )
|
||||
{
|
||||
Canvas.setContent( %this.gui[%tab] );
|
||||
%this.gui[%tab].setKey( %this.key[%tab] );
|
||||
%this.lastTab = %tab;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
function LaunchTabView::viewLastTab( %this )
|
||||
{
|
||||
if ( %this.tabCount() == 0 || %this.lastTab $= "" )
|
||||
return;
|
||||
|
||||
%this.setSelectedByIndex( %this.lastTab );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
function LaunchTabView::viewTab( %this, %text, %gui, %key )
|
||||
{
|
||||
%tabCount = %this.tabCount();
|
||||
for ( %tab = 0; %tab < %tabCount; %tab++ )
|
||||
if ( %this.gui[%tab] $= %gui && %this.key[%tab] $= %key )
|
||||
break;
|
||||
|
||||
if ( %tab == %tabCount )
|
||||
{
|
||||
// Add a new tab:
|
||||
%this.gui[%tab] = %gui;
|
||||
%this.key[%tab] = %key;
|
||||
// WARNING! This id may not be unique and therefore should
|
||||
// not be relied on! Use index instead!
|
||||
%this.addTab( %tab, %text );
|
||||
}
|
||||
|
||||
if ( %this.getSelectedTab() != %tab )
|
||||
%this.setSelectedByIndex( %tab );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
function LaunchTabView::closeCurrentTab( %this )
|
||||
{
|
||||
%tab = %this.getSelectedTab();
|
||||
%this.closeTab( %this.gui[%tab], %this.key[%tab] );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
function LaunchTabView::closeTab( %this, %gui, %key )
|
||||
{
|
||||
%tabCount = %this.tabCount();
|
||||
%activeCount = 0;
|
||||
for ( %i = 0; %i < %tabCount; %i++ )
|
||||
{
|
||||
if ( %this.gui[%i] $= %gui && %this.key[%i] $= %key )
|
||||
%tab = %i;
|
||||
else if ( %this.isTabActive( %i ) )
|
||||
%activeCount++;
|
||||
}
|
||||
|
||||
if ( %tab == %tabCount )
|
||||
return;
|
||||
|
||||
for( %i = %tab; %i < %tabCount; %i++ )
|
||||
{
|
||||
%this.gui[%i] = %this.gui[%i+1];
|
||||
%this.key[%i] = %this.key[%i+1];
|
||||
}
|
||||
|
||||
%this.removeTabByIndex( %tab );
|
||||
%gui.onClose( %key );
|
||||
|
||||
if ( %activeCount == 0 )
|
||||
{
|
||||
%this.lastTab = "";
|
||||
Canvas.setContent( LaunchGui );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
function LaunchTabView::closeAllTabs( %this )
|
||||
{
|
||||
%tabCount = %this.tabCount();
|
||||
for ( %i = 0; %i < %tabCount; %i++ )
|
||||
{
|
||||
if ( isObject( %this.gui[%i] ) )
|
||||
%this.gui[%i].onClose( %this.key[%i] );
|
||||
%this.gui[%i] = "";
|
||||
%this.key[%i] = "";
|
||||
}
|
||||
|
||||
%this.clear();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// LaunchGui functions:
|
||||
//----------------------------------------------------------------------------
|
||||
function LaunchGui::onAdd(%this)
|
||||
{
|
||||
%this.getWarrior = true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
function LaunchGui::onWake(%this)
|
||||
{
|
||||
$enableDirectInput = "0";
|
||||
deactivateDirectInput();
|
||||
Canvas.pushDialog(LaunchToolbarDlg);
|
||||
if ( !$FirstLaunch )
|
||||
LaunchTabView.viewLastTab();
|
||||
|
||||
if ( !isDemo() )
|
||||
checkNamesAndAliases();
|
||||
else
|
||||
OpenLaunchTabs();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
function LaunchGui::onSleep(%this)
|
||||
{
|
||||
//alxStop($HudHandle['shellScreen']);
|
||||
Canvas.popDialog( LaunchToolbarDlg );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
function checkNamesAndAliases()
|
||||
{
|
||||
%gotoWarriorSetup = false;
|
||||
if ( $PlayingOnline )
|
||||
{
|
||||
// When first launching, make sure we have a valid warrior:
|
||||
if ( LaunchGui.getWarrior )
|
||||
{
|
||||
%cert = WONGetAuthInfo();
|
||||
if ( %cert !$= "" )
|
||||
{
|
||||
LaunchGui.getWarrior = "";
|
||||
if ( %cert $= "" )
|
||||
%warrior = $CreateAccountWarriorName;
|
||||
else
|
||||
%warrior = getField( %cert, 0 );
|
||||
|
||||
%warriorIdx = -1;
|
||||
for ( %i = 0; %i < $pref::Player::count; %i++ )
|
||||
{
|
||||
if ( %warrior $= getField( $pref::Player[%i], 0 ) )
|
||||
{
|
||||
%warriorIdx = %i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( %warriorIdx == -1 )
|
||||
{
|
||||
// Create new warrior:
|
||||
$pref::Player[$pref::Player::Count] = %warrior @ "\tHuman Male\tbeagle\tMale1";
|
||||
$pref::Player::Current = $pref::Player::Count;
|
||||
$pref::Player::Count++;
|
||||
%gotoWarriorSetup = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
MessageBoxOK( "WARNING", "Failed to get account information. You may need to quit the game and log in again." );
|
||||
}
|
||||
}
|
||||
else if ( $pref::Player::Count == 0 )
|
||||
{
|
||||
%gotoWarriorSetup = true;
|
||||
}
|
||||
|
||||
OpenLaunchTabs( %gotoWarriorSetup );
|
||||
}
|
||||
615
docs/base/@vl2/scripts.vl2/scripts/LobbyGui.cs
Normal file
615
docs/base/@vl2/scripts.vl2/scripts/LobbyGui.cs
Normal file
|
|
@ -0,0 +1,615 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// LobbyGui.cs
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
$InLobby = false;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LobbyGui::onAdd( %this )
|
||||
{
|
||||
// Add the Player popup menu:
|
||||
new GuiControl(LobbyPlayerActionDlg) {
|
||||
profile = "GuiModelessDialogProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
setFirstResponder = "0";
|
||||
modal = "1";
|
||||
|
||||
new ShellPopupMenu( LobbyPlayerPopup ) {
|
||||
profile = "ShellPopupProfile";
|
||||
position = "0 0";
|
||||
extent = "0 0";
|
||||
minExtent = "0 0";
|
||||
visible = "1";
|
||||
maxPopupHeight = "200";
|
||||
noButtonStyle = "1";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LobbyGui::onWake( %this )
|
||||
{
|
||||
if ( !%this.initialized )
|
||||
{
|
||||
LobbyPlayerList.setSortColumn( $pref::Lobby::SortColumnKey );
|
||||
LobbyPlayerList.setSortIncreasing( $pref::Lobby::SortInc );
|
||||
|
||||
%this.initialized = true;
|
||||
}
|
||||
|
||||
$InLobby = true;
|
||||
|
||||
//pop any key maps
|
||||
moveMap.pop();
|
||||
if ( isObject( passengerkeys ) )
|
||||
passengerKeys.pop();
|
||||
if ( isObject( observerBlockMap ) )
|
||||
observerBlockMap.pop();
|
||||
if ( isObject( observerMap ) )
|
||||
observerMap.pop();
|
||||
|
||||
$enableDirectInput = "0";
|
||||
deactivateDirectInput();
|
||||
|
||||
LobbyMessageVector.attach(HudMessageVector);
|
||||
LobbyMessageScroll.scrollToBottom();
|
||||
updateLobbyPlayerList();
|
||||
|
||||
LobbyServerName.setText( $clServerName );
|
||||
|
||||
%headerStyle = "<font:" @ $ShellLabelFont @ ":" @ $ShellFontSize @ "><color:00DC00>";
|
||||
%statusText = "<spop><spush>" @ %headerStyle @ "MISSION TYPE:<spop>" SPC $clMissionType
|
||||
NL "<spush>" @ %headerStyle @ "MISSION:<spop>" SPC $clMissionName
|
||||
NL "<spush>" @ %headerStyle @ "OBJECTIVES:<spop>";
|
||||
|
||||
for ( %line = 0; %this.objLine[%line] !$= ""; %line++ )
|
||||
%statusText = %statusText NL "<lmargin:10>* <lmargin:24>" @ %this.objLine[%line];
|
||||
|
||||
LobbyStatusText.setText( %statusText );
|
||||
|
||||
fillLobbyVoteMenu();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LobbyGui::onSleep( %this )
|
||||
{
|
||||
if ( %this.playerDialogOpen )
|
||||
LobbyPlayerPopup.forceClose();
|
||||
|
||||
LobbyVoteMenu.clear();
|
||||
LobbyVoteMenu.mode = "";
|
||||
LobbyCancelBtn.setVisible( false );
|
||||
LobbyStatusText.setText( "" );
|
||||
$InLobby = false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function lobbyDisconnect()
|
||||
{
|
||||
MessageBoxYesNo( "CONFIRM", "Are you sure you want to leave this game?", "lobbyLeaveGame();", "" );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function lobbyLeaveGame()
|
||||
{
|
||||
Canvas.popDialog( LobbyGui );
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function lobbyReturnToGame()
|
||||
{
|
||||
Canvas.setContent( PlayGui );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LobbyChatEnter::onEscape( %this )
|
||||
{
|
||||
%this.setValue( "" );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LobbyChatEnter::send( %this )
|
||||
{
|
||||
%text = %this.getValue();
|
||||
if ( %text $= "" )
|
||||
%text = " ";
|
||||
commandToServer( 'MessageSent', %text );
|
||||
%this.setValue( "" );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LobbyPlayerList::initColumns( %this )
|
||||
{
|
||||
%this.clear();
|
||||
%this.clearColumns();
|
||||
%this.addColumn( 0, " ", 24, 24, 24, "center" ); // Flag column
|
||||
%this.addColumn( 6, "lobby_headset", 36, 36, 36, "headericon" ); // Voice Com column
|
||||
%this.addColumn( 1, "Player", $pref::Lobby::Column1, 50, 200 );
|
||||
if ( $clTeamCount > 1 )
|
||||
%this.addColumn( 2, "Team", $pref::Lobby::Column2, 50, 200 );
|
||||
%this.addColumn( 3, "Score", $pref::Lobby::Column3, 25, 200, "numeric center" );
|
||||
%this.addColumn( 4, "Ping", $pref::Lobby::Column4, 25, 200, "numeric center" );
|
||||
%this.addColumn( 5, "PL", $pref::Lobby::Column5, 25, 200, "numeric center" );
|
||||
|
||||
commandToServer( 'getScores' );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LobbyPlayerList::onColumnResize( %this, %col, %size )
|
||||
{
|
||||
$pref::Lobby::Column[%this.getColumnKey( %col )] = %size;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LobbyPlayerList::onSetSortKey( %this, %key, %increasing )
|
||||
{
|
||||
$pref::Lobby::SortColumnKey = %key;
|
||||
$pref::Lobby::SortInc = %increasing;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function updateLobbyPlayerList()
|
||||
{
|
||||
if ( $InLobby )
|
||||
{
|
||||
// Let the server know we want an update:
|
||||
commandToServer( 'getScores' );
|
||||
schedule( 4000, 0, updateLobbyPlayerList );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function lobbyUpdatePlayer( %clientId )
|
||||
{
|
||||
%player = $PlayerList[%clientId];
|
||||
if ( !isObject( %player ) )
|
||||
{
|
||||
warn( "lobbyUpdatePlayer( " @ %clientId @ " ) - there is no client object with that id!" );
|
||||
return;
|
||||
}
|
||||
|
||||
// Build the text:
|
||||
if ( %player.isSuperAdmin )
|
||||
%tag = "SA";
|
||||
else if ( %player.isAdmin )
|
||||
%tag = "A";
|
||||
else if ( %player.isBot )
|
||||
%tag = "B";
|
||||
else
|
||||
%tag = " ";
|
||||
|
||||
if ( %player.canListen )
|
||||
{
|
||||
if ( %player.voiceEnabled )
|
||||
{
|
||||
%voiceIcons = "lobby_icon_speak";
|
||||
if ( %player.isListening )
|
||||
%voiceIcons = %voiceIcons @ ":lobby_icon_listen";
|
||||
}
|
||||
else
|
||||
%voiceIcons = %player.isListening ? "lobby_icon_listen" : "";
|
||||
}
|
||||
else
|
||||
%voiceIcons = "shll_icon_timedout";
|
||||
|
||||
if ( $clTeamCount > 1 )
|
||||
{
|
||||
if ( %player.teamId == 0 )
|
||||
%teamName = "Observer";
|
||||
else
|
||||
%teamName = $clTeamScore[%player.teamId, 0] $= "" ? "-" : $clTeamScore[%player.teamId, 0];
|
||||
%text = %tag TAB %voiceIcons TAB %player.name TAB %teamName TAB %player.score TAB %player.ping TAB %player.packetLoss;
|
||||
}
|
||||
else
|
||||
%text = %tag TAB %voiceIcons TAB %player.name TAB %player.score TAB %player.ping TAB %player.packetLoss;
|
||||
|
||||
if ( LobbyPlayerList.getRowNumById( %clientId ) == -1 )
|
||||
LobbyPlayerList.addRow( %clientId, %text );
|
||||
else
|
||||
LobbyPlayerList.setRowById( %clientId, %text );
|
||||
|
||||
if ( $InLobby )
|
||||
LobbyPlayerList.sort();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function lobbyRemovePlayer( %clientId )
|
||||
{
|
||||
LobbyPlayerList.removeRowById( %clientId );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LobbyPlayerList::onRightMouseDown( %this, %column, %row, %mousePos )
|
||||
{
|
||||
// Open the action menu:
|
||||
%clientId = %this.getRowId( %row );
|
||||
LobbyPlayerPopup.player = $PlayerList[%clientId];
|
||||
|
||||
if ( LobbyPlayerPopup.player !$= "" )
|
||||
{
|
||||
LobbyPlayerPopup.position = %mousePos;
|
||||
Canvas.pushDialog( LobbyPlayerActionDlg );
|
||||
LobbyPlayerPopup.forceOnAction();
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LobbyPlayerActionDlg::onWake( %this )
|
||||
{
|
||||
LobbyGui.playerDialogOpen = true;
|
||||
fillPlayerPopupMenu();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LobbyPlayerActionDlg::onSleep( %this )
|
||||
{
|
||||
LobbyGui.playerDialogOpen = false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LobbyPlayerPopup::onSelect( %this, %id, %text )
|
||||
{
|
||||
//the id's for these are used in DefaultGame::sendGamePlayerPopupMenu()...
|
||||
//mute: 1
|
||||
//admin: 2
|
||||
//kick: 3
|
||||
//ban: 4
|
||||
//force observer: 5
|
||||
//switch team: 6
|
||||
|
||||
switch( %id )
|
||||
{
|
||||
case 1: // Mute/Unmute
|
||||
togglePlayerMute(%this.player.clientId);
|
||||
|
||||
case 2: // Admin
|
||||
MessageBoxYesNo( "CONFIRM", "Are you sure you want to make " @ %this.player.name @ " an admin?",
|
||||
"lobbyPlayerVote( VoteAdminPlayer, \"ADMIN player\", " @ %this.player.clientId @ " );" );
|
||||
|
||||
case 3: // Kick
|
||||
MessageBoxYesNo( "CONFIRM", "Are you sure you want to kick " @ %this.player.name @ "?",
|
||||
"lobbyPlayerVote( VoteKickPlayer, \"KICK player\", " @ %this.player.clientId @ " );" );
|
||||
|
||||
case 4: // Ban
|
||||
MessageBoxYesNo( "CONFIRM", "Are you sure you want to ban " @ %this.player.name @ "?",
|
||||
"lobbyPlayerVote( BanPlayer, \"BAN player\", " @ %this.player.clientId @ " );" );
|
||||
|
||||
case 5: // force observer
|
||||
forceToObserver(%this.player.clientId);
|
||||
|
||||
case 6: //change team 1
|
||||
changePlayersTeam(%this.player.clientId, 1);
|
||||
|
||||
case 7: //change team 2
|
||||
changePlayersTeam(%this.player.clientId, 2);
|
||||
|
||||
case 8:
|
||||
adminAddPlayerToGame(%this.player.clientId);
|
||||
|
||||
case 9: // enable/disable voice communication
|
||||
togglePlayerVoiceCom( %this.player );
|
||||
|
||||
case 10:
|
||||
confirmAdminListAdd( %this.player, false );
|
||||
|
||||
case 11:
|
||||
confirmAdminListAdd( %this.player, true );
|
||||
}
|
||||
|
||||
Canvas.popDialog( LobbyPlayerActionDlg );
|
||||
}
|
||||
|
||||
function confirmAdminListAdd( %client, %super )
|
||||
{
|
||||
if( %super )
|
||||
MessageBoxYesNo( "CONFIRM", "Are you sure you want to add " @ %client.name @ " to the server super admin list?", "toSuperList( " @ %client.clientId @ " );" );
|
||||
|
||||
else
|
||||
MessageBoxYesNo( "CONFIRM", "Are you sure you want to add " @ %client.name @ " to the server admin list?", "toAdminList( " @ %client.clientId @ " );" );
|
||||
}
|
||||
|
||||
function toSuperList( %client )
|
||||
{
|
||||
commandToServer( 'AddToSuperAdminList', %client );
|
||||
}
|
||||
|
||||
function toAdminList( %client )
|
||||
{
|
||||
commandToServer( 'AddToAdminList', %client );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LobbyPlayerPopup::onCancel( %this )
|
||||
{
|
||||
Canvas.popDialog( LobbyPlayerActionDlg );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function togglePlayerMute(%client)
|
||||
{
|
||||
commandToServer( 'togglePlayerMute', %client );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function togglePlayerVoiceCom( %playerRep )
|
||||
{
|
||||
commandToServer( 'ListenTo', %playerRep.clientId, !%playerRep.voiceEnabled, true );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function forceToObserver( %client )
|
||||
{
|
||||
commandToServer( 'forcePlayerToObserver', %client );
|
||||
}
|
||||
|
||||
function AdminAddPlayerToGame(%client)
|
||||
{
|
||||
CommandToServer( 'clientAddToGame', %client );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function changePlayersTeam(%client, %team)
|
||||
{
|
||||
commandToServer( 'changePlayersTeam', %client, %team);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function fillLobbyVoteMenu()
|
||||
{
|
||||
LobbyVoteMenu.key++;
|
||||
LobbyVoteMenu.clear();
|
||||
LobbyVoteMenu.tourneyChoose = 0;
|
||||
commandToServer( 'GetVoteMenu', LobbyVoteMenu.key );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function fillLobbyTeamMenu()
|
||||
{
|
||||
LobbyVoteMenu.key++;
|
||||
LobbyVoteMenu.clear();
|
||||
LobbyVoteMenu.mode = "team";
|
||||
commandToServer( 'GetTeamList', LobbyVoteMenu.key );
|
||||
LobbyCancelBtn.setVisible( true );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function fillPlayerPopupMenu()
|
||||
{
|
||||
LobbyPlayerPopup.key++;
|
||||
LobbyPlayerPopup.clear();
|
||||
|
||||
LobbyPlayerPopup.add(LobbyPlayerPopup.player.name, 0);
|
||||
commandToServer( 'GetPlayerPopupMenu', LobbyPlayerPopup.player.clientId, LobbyPlayerPopup.key );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function fillLobbyMissionTypeMenu()
|
||||
{
|
||||
LobbyVoteMenu.key++;
|
||||
LobbyVoteMenu.clear();
|
||||
LobbyVoteMenu.mode = "type";
|
||||
commandToServer( 'GetMissionTypes', LobbyVoteMenu.key );
|
||||
LobbyCancelBtn.setVisible( true );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function fillLobbyMissionMenu( %type, %typeName )
|
||||
{
|
||||
LobbyVoteMenu.key++;
|
||||
LobbyVoteMenu.clear();
|
||||
LobbyVoteMenu.mode = "mission";
|
||||
LobbyVoteMenu.missionType = %type;
|
||||
LobbyVoteMenu.typeName = %typeName;
|
||||
commandToServer( 'GetMissionList', LobbyVoteMenu.key, %type );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function fillLobbyTimeLimitMenu()
|
||||
{
|
||||
LobbyVoteMenu.key++;
|
||||
LobbyVoteMenu.clear();
|
||||
LobbyVoteMenu.mode = "timeLimit";
|
||||
commandToServer( 'GetTimeLimitList', LobbyVoteMenu.key );
|
||||
LobbyCancelBtn.setVisible( true );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
addMessageCallback( 'MsgVoteItem', handleVoteItemMessage );
|
||||
addMessageCallback( 'MsgPlayerPopupItem', handlePlayerPopupMessage );
|
||||
addMessageCallback( 'MsgVotePassed', handleVotePassedMessage );
|
||||
addMessageCallback( 'MsgVoteFailed', handleVoteFailedMessage );
|
||||
addMessageCallback( 'MsgAdminPlayer', handleAdminPlayerMessage );
|
||||
addMessageCallback( 'MsgAdminAdminPlayer', handleAdminAdminPlayerMessage );
|
||||
addMessageCallback( 'MsgSuperAdminPlayer', handleSuperAdminPlayerMessage );
|
||||
addMessageCallback( 'MsgAdminForce', handleAdminForceMessage );
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function handleAdminForceMessage()
|
||||
{
|
||||
alxPlay(AdminForceSound, 0, 0, 0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function handleAdminAdminPlayerMessage( %msgType, %msgString, %client )
|
||||
{
|
||||
%player = $PlayerList[%client];
|
||||
if(%player)
|
||||
%player.isAdmin = true;
|
||||
alxPlay(AdminForceSound, 0, 0, 0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function handleAdminPlayerMessage( %msgType, %msgString, %client )
|
||||
{
|
||||
%player = $PlayerList[%client];
|
||||
if(%player)
|
||||
%player.isAdmin = true;
|
||||
alxPlay(VotePassSound, 0, 0, 0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function handleSuperAdminPlayerMessage( %msgType, %msgString, %client )
|
||||
{
|
||||
%player = $PlayerList[%client];
|
||||
if(%player)
|
||||
{
|
||||
%player.isSuperAdmin = true;
|
||||
%player.isAdmin = true;
|
||||
}
|
||||
alxPlay(AdminForceSound, 0, 0, 0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function handleVoteItemMessage( %msgType, %msgString, %key, %voteName, %voteActionMsg, %voteText, %sort )
|
||||
{
|
||||
if ( %key != LobbyVoteMenu.key )
|
||||
return;
|
||||
|
||||
%index = LobbyVoteMenu.rowCount();
|
||||
LobbyVoteMenu.addRow( %index, detag( %voteText ) );
|
||||
if ( %sort )
|
||||
LobbyVoteMenu.sort( 0 );
|
||||
$clVoteCmd[%index] = detag( %voteName );
|
||||
$clVoteAction[%index] = detag( %voteActionMsg );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function handlePlayerPopupMessage( %msgType, %msgString, %key, %voteName, %voteActionMsg, %voteText, %popupEntryId )
|
||||
{
|
||||
if ( %key != LobbyPlayerPopup.key )
|
||||
return;
|
||||
|
||||
LobbyPlayerPopup.add( " " @ detag( %voteText ), %popupEntryId );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function handleVotePassedMessage( %msgType, %msgString, %voteName, %voteText )
|
||||
{
|
||||
if ( $InLobby )
|
||||
fillLobbyVoteMenu();
|
||||
|
||||
alxPlay(VotePassSound, 0, 0, 0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function handleVoteFailedMessage( %msgType, %msgString, %voteName, %voteText )
|
||||
{
|
||||
if ( $InLobby )
|
||||
fillLobbyVoteMenu();
|
||||
|
||||
alxPlay(VoteNotPassSound, 0, 0, 0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function lobbyVote()
|
||||
{
|
||||
%id = LobbyVoteMenu.getSelectedId();
|
||||
%text = LobbyVoteMenu.getRowTextById( %id );
|
||||
|
||||
switch$ ( LobbyVoteMenu.mode )
|
||||
{
|
||||
case "": // Default case...
|
||||
// Test for special cases:
|
||||
switch$ ( $clVoteCmd[%id] )
|
||||
{
|
||||
case "JoinGame":
|
||||
CommandToServer( 'clientJoinGame' );
|
||||
schedule( 100, 0, lobbyReturnToGame );
|
||||
return;
|
||||
|
||||
case "ChooseTeam":
|
||||
commandToServer( 'ClientJoinTeam', -1, true );
|
||||
schedule( 100, 0, lobbyReturnToGame );
|
||||
return;
|
||||
|
||||
case "VoteTournamentMode":
|
||||
LobbyVoteMenu.tourneyChoose = 1;
|
||||
fillLobbyMissionTypeMenu();
|
||||
return;
|
||||
|
||||
case "VoteMatchStart":
|
||||
startNewVote( "VoteMatchStart" );
|
||||
schedule( 100, 0, lobbyReturnToGame );
|
||||
return;
|
||||
|
||||
case "MakeObserver":
|
||||
commandToServer( 'ClientMakeObserver' );
|
||||
schedule( 100, 0, lobbyReturnToGame );
|
||||
return;
|
||||
|
||||
case "VoteChangeMission":
|
||||
fillLobbyMissionTypeMenu();
|
||||
return;
|
||||
|
||||
case "VoteChangeTimeLimit":
|
||||
fillLobbyTimeLimitMenu();
|
||||
return;
|
||||
|
||||
case "Addbot":
|
||||
commandToServer( 'addBot' );
|
||||
return;
|
||||
}
|
||||
|
||||
case "team":
|
||||
commandToServer( 'ClientJoinTeam', %id++ );
|
||||
LobbyVoteMenu.reset();
|
||||
return;
|
||||
|
||||
case "type":
|
||||
fillLobbyMissionMenu( $clVoteCmd[%id], %text );
|
||||
return;
|
||||
|
||||
case "mission":
|
||||
if( !LobbyVoteMenu.tourneyChoose )
|
||||
{
|
||||
startNewVote( "VoteChangeMission",
|
||||
%text, // Mission display name
|
||||
LobbyVoteMenu.typeName, // Mission type display name
|
||||
$clVoteCmd[%id], // Mission id
|
||||
LobbyVoteMenu.missionType ); // Mission type id
|
||||
}
|
||||
else
|
||||
{
|
||||
startNewVote( "VoteTournamentMode",
|
||||
%text, // Mission display name
|
||||
LobbyVoteMenu.typeName, // Mission type display name
|
||||
$clVoteCmd[%id], // Mission id
|
||||
LobbyVoteMenu.missionType ); // Mission type id
|
||||
LobbyVoteMenu.tourneyChoose = 0;
|
||||
}
|
||||
LobbyVoteMenu.reset();
|
||||
return;
|
||||
|
||||
case "timeLimit":
|
||||
startNewVote( "VoteChangeTimeLimit", $clVoteCmd[%id] );
|
||||
LobbyVoteMenu.reset();
|
||||
return;
|
||||
}
|
||||
|
||||
startNewVote( $clVoteCmd[%id], $clVoteAction[%id] );
|
||||
fillLobbyVoteMenu();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LobbyVoteMenu::reset( %this )
|
||||
{
|
||||
%this.mode = "";
|
||||
%this.tourneyChoose = 0;
|
||||
LobbyCancelBtn.setVisible( false );
|
||||
fillLobbyVoteMenu();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function lobbyPlayerVote(%voteType, %actionMsg, %playerId)
|
||||
{
|
||||
startNewVote(%voteType, %playerId, 0, 0, 0, true);
|
||||
fillLobbyVoteMenu();
|
||||
}
|
||||
2644
docs/base/@vl2/scripts.vl2/scripts/OptionsDlg.cs
Normal file
2644
docs/base/@vl2/scripts.vl2/scripts/OptionsDlg.cs
Normal file
File diff suppressed because it is too large
Load diff
33
docs/base/@vl2/scripts.vl2/scripts/PantherXL.cs
Normal file
33
docs/base/@vl2/scripts.vl2/scripts/PantherXL.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// PantherXL.cs
|
||||
//
|
||||
// These are the default control bindings for the Mad Catz Panther XL Pro
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
moveMap.bind( joystick, xaxis, D, "-0.1 0.1", joystickMoveX );
|
||||
moveMap.bind( joystick, yaxis, D, "-0.1 0.1", joystickMoveY );
|
||||
moveMap.bind( joystick, rxaxis, I, joystickPitch );
|
||||
moveMap.bind( joystick, ryaxis, joystickYaw );
|
||||
|
||||
moveMap.bind( joystick, button0, mouseFire );
|
||||
moveMap.bind( joystick, button1, mouseJet );
|
||||
moveMap.bindCmd( joystick, button2, "setFov(30);", "setFov($pref::player::defaultFOV);" );
|
||||
moveMap.bind( joystick, button3, jump );
|
||||
|
||||
moveMap.bindCmd( joystick, upov, "use(Plasma);", "" );
|
||||
moveMap.bindCmd( joystick, rpov, "use(Chaingun);", "" );
|
||||
moveMap.bindCmd( joystick, dpov, "use(Disc);", "" );
|
||||
moveMap.bindCmd( joystick, lpov, "use(GrenadeLauncher);", "" );
|
||||
|
||||
moveMap.bindCmd( joystick, button4, "use(SniperRifle);", "" ); // Second POV buttons...
|
||||
moveMap.bindCmd( joystick, button5, "use(ELFGun);", "" );
|
||||
moveMap.bindCmd( joystick, button6, "use(Mortar);", "" );
|
||||
moveMap.bindCmd( joystick, button7, "use(MissileLauncher);", "" );
|
||||
|
||||
moveMap.bindCmd( joystick, button8, "use(RepairKit);", "" );
|
||||
moveMap.bind( joystick, button9, toggleFirstPerson );
|
||||
moveMap.bindCmd( joystick, button10, "prevWeapon();", "" );
|
||||
moveMap.bindCmd( joystick, button11, "use(Backpack);", "" );
|
||||
moveMap.bindCmd( joystick, button12, "nextWeapon();", "" );
|
||||
110
docs/base/@vl2/scripts.vl2/scripts/PathEdit.cs
Normal file
110
docs/base/@vl2/scripts.vl2/scripts/PathEdit.cs
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
//
|
||||
// PathEdit.cs
|
||||
//
|
||||
function PathEdit::initInteriorEditor()
|
||||
{
|
||||
echo("interior editor startup...");
|
||||
aiEdit.setPathMode();
|
||||
new ActionMap(PathEditMap);
|
||||
PathEditMap.bindCmd(keyboard, g, "PathEdit::grabNode();", "");
|
||||
PathEditMap.bindCmd(keyboard, f, "PathEdit::dropNode();", "");
|
||||
PathEditMap.bindCmd(keyboard, u, "PathEdit::undoNodeGrab();", "");
|
||||
PathEditMap.bindCmd(keyboard, t, "PathEdit::createEdge();", "");
|
||||
PathEditMap.bindCmd(keyboard, r, "PathEdit::connectEdge();", "");
|
||||
PathEditMap.bindCmd(keyboard, "alt r", "PathEdit::grabEdge();", "");
|
||||
PathEditMap.bindCmd(keyboard, "alt t", "PathEdit::deleteEdge();", "");
|
||||
PathEditMap.bindCmd(keyboard, "alt g", "PathEdit::deleteNode();", "");
|
||||
PathEditMap.bindCmd(keyboard, "alt d", "PathEdit::beginEnd();", "");
|
||||
PathEditMap.bindCmd(keyboard, "j", "PathEdit::setJet();", "");
|
||||
PathEditMap.bindCmd(keyboard, "alt j", "PathEdit::setNotJet();", "");
|
||||
PathEditMap.bindCmd(keyboard, "alt s", "PathEdit::saveGraph();", "");
|
||||
PathEditMap.bindCmd(keyboard, "h", "PathEdit::createNode();", "");
|
||||
PathEditMap.push();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function PathEdit::closeInteriorEdit()
|
||||
{
|
||||
aiEdit.setUninitMode();
|
||||
PathEditMap.pop();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function PathEdit::grabNode()
|
||||
{
|
||||
aiEdit.grabNode();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
||||
function PathEdit::createNode()
|
||||
{
|
||||
aiEdit.createNode();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
||||
function PathEdit::grabEdge()
|
||||
{
|
||||
aiEdit.grabEdge();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
||||
function PathEdit::dropNode()
|
||||
{
|
||||
aiEdit.placeNode();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
||||
function PathEdit::undoNodeGrab()
|
||||
{
|
||||
aiEdit.putBackNode();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
||||
function PathEdit::deleteNode()
|
||||
{
|
||||
aiEdit.deleteNode();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
||||
function PathEdit::deleteEdge()
|
||||
{
|
||||
aiEdit.deleteEdge();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
||||
function PathEdit::createEdge()
|
||||
{
|
||||
aiEdit.createEdge();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
||||
function PathEdit::connectEdge()
|
||||
{
|
||||
aiEdit.connectEdge();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
||||
function PathEdit::setJet()
|
||||
{
|
||||
aiEdit.setJetting(true);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
||||
function PathEdit::setNotJet()
|
||||
{
|
||||
aiEdit.setJetting(false);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
739
docs/base/@vl2/scripts.vl2/scripts/RabbitGame.cs
Normal file
739
docs/base/@vl2/scripts.vl2/scripts/RabbitGame.cs
Normal file
|
|
@ -0,0 +1,739 @@
|
|||
//-------------------------------------------------------------------
|
||||
// Team Rabbit script
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
//--- GAME RULES BEGIN ---
|
||||
//Grab the flag
|
||||
//Run like crazy
|
||||
//EVERYONE tries to kill the person with the flag (the Rabbit)
|
||||
//The longer the Rabbit keeps the flag, the more points he scores
|
||||
//--- GAME RULES END ---
|
||||
|
||||
package RabbitGame {
|
||||
|
||||
function Flag::objectiveInit(%data, %flag)
|
||||
{
|
||||
$flagStatus = "<At Home>";
|
||||
%flag.carrier = "";
|
||||
%flag.originalPosition = %flag.getTransform();
|
||||
%flag.isHome = true;
|
||||
|
||||
// create a waypoint to the flag's starting place
|
||||
%flagWaypoint = new WayPoint()
|
||||
{
|
||||
position = %flag.position;
|
||||
rotation = "1 0 0 0";
|
||||
name = "Flag Home";
|
||||
dataBlock = "WayPointMarker";
|
||||
team = $NonRabbitTeam;
|
||||
};
|
||||
|
||||
$AIRabbitFlag = %flag;
|
||||
|
||||
MissionCleanup.add(%flagWaypoint);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//exec the AI scripts
|
||||
exec("scripts/aiRabbit.cs");
|
||||
|
||||
$InvBanList[Rabbit, "TurretOutdoorDeployable"] = 1;
|
||||
$InvBanList[Rabbit, "TurretIndoorDeployable"] = 1;
|
||||
$InvBanList[Rabbit, "ElfBarrelPack"] = 1;
|
||||
$InvBanList[Rabbit, "MortarBarrelPack"] = 1;
|
||||
$InvBanList[Rabbit, "PlasmaBarrelPack"] = 1;
|
||||
$InvBanList[Rabbit, "AABarrelPack"] = 1;
|
||||
$InvBanList[Rabbit, "MissileBarrelPack"] = 1;
|
||||
$InvBanList[Rabbit, "MissileLauncher"] = 1;
|
||||
$InvBanList[Rabbit, "Mortar"] = 1;
|
||||
$InvBanList[Rabbit, "Mine"] = 1;
|
||||
|
||||
function RabbitGame::setUpTeams(%game)
|
||||
{
|
||||
// Force the numTeams variable to one:
|
||||
DefaultGame::setUpTeams(%game);
|
||||
%game.numTeams = 1;
|
||||
setSensorGroupCount(3);
|
||||
|
||||
//team damage should always be off for Rabbit
|
||||
$teamDamage = 0;
|
||||
|
||||
//make all the sensor groups visible at all times
|
||||
if (!Game.teamMode)
|
||||
{
|
||||
setSensorGroupAlwaysVisMask($NonRabbitTeam, 0xffffffff);
|
||||
setSensorGroupAlwaysVisMask($RabbitTeam, 0xffffffff);
|
||||
|
||||
// non-rabbits can listen to the rabbit: all others can only listen to self
|
||||
setSensorGroupListenMask($NonRabbitTeam, (1 << $RabbitTeam) | (1 << $NonRabbitTeam));
|
||||
}
|
||||
}
|
||||
|
||||
function RabbitGame::initGameVars(%game)
|
||||
{
|
||||
%game.playerBonusValue = 1;
|
||||
%game.playerBonusTime = 3 * 1000; //3 seconds
|
||||
|
||||
%game.teamBonusValue = 1;
|
||||
%game.teamBonusTime = 15 * 1000; //15 seconds
|
||||
%game.flagReturnTime = 45 * 1000; //45 seconds
|
||||
|
||||
%game.waypointFrequency = 24000;
|
||||
%game.waypointDuration = 6000;
|
||||
}
|
||||
|
||||
$RabbitTeam = 2;
|
||||
$NonRabbitTeam = 1;
|
||||
|
||||
// ----- These functions supercede those in DefaultGame.cs
|
||||
|
||||
function RabbitGame::allowsProtectedStatics(%game)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
function RabbitGame::clientMissionDropReady(%game, %client)
|
||||
{
|
||||
messageClient(%client, 'MsgClientReady', "", %game.class);
|
||||
messageClient(%client, 'MsgYourScoreIs', "", 0);
|
||||
//messageClient(%client, 'MsgYourRankIs', "", -1);
|
||||
messageClient(%client, 'MsgRabbitFlagStatus', "", $flagStatus);
|
||||
|
||||
messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName );
|
||||
|
||||
DefaultGame::clientMissionDropReady(%game,%client);
|
||||
}
|
||||
|
||||
function RabbitGame::AIHasJoined(%game, %client)
|
||||
{
|
||||
//let everyone know the player has joined the game
|
||||
//messageAllExcept(%client, -1, 'MsgClientJoinTeam', '%1 has joined the hunt.', %client.name, "", %client, $NonRabbitTeam);
|
||||
}
|
||||
|
||||
function RabbitGame::clientJoinTeam( %game, %client, %team, %respawn )
|
||||
{
|
||||
%game.assignClientTeam( %client );
|
||||
|
||||
// Spawn the player:
|
||||
%game.spawnPlayer( %client, %respawn );
|
||||
}
|
||||
|
||||
|
||||
function RabbitGame::assignClientTeam(%game, %client)
|
||||
{
|
||||
// all players start on team 1
|
||||
%client.team = $NonRabbitTeam;
|
||||
|
||||
// set player's skin pref here
|
||||
setTargetSkin(%client.target, %client.skin);
|
||||
|
||||
// Let everybody know you are no longer an observer:
|
||||
messageAll( 'MsgClientJoinTeam', '\c1%1 has joined the hunt.', %client.name, "", %client, %client.team );
|
||||
updateCanListenState( %client );
|
||||
}
|
||||
|
||||
function RabbitGame::playerSpawned(%game, %player)
|
||||
{
|
||||
//call the default stuff first...
|
||||
DefaultGame::playerSpawned(%game, %player);
|
||||
|
||||
//find the rabbit
|
||||
%clRabbit = -1;
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (isObject(%cl.player) && isObject(%cl.player.holdingFlag))
|
||||
{
|
||||
%clRabbit = %cl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//now set a waypoint just for that client...
|
||||
cancel(%player.client.waypointSchedule);
|
||||
if (isObject(%clRabbit) && !%player.client.isAIControlled())
|
||||
%player.client.waypointSchedule = %game.showRabbitWaypointClient(%clRabbit, %player.client);
|
||||
}
|
||||
|
||||
function RabbitGame::pickPlayerSpawn(%game, %client, %respawn)
|
||||
{
|
||||
// all spawns come from team 1
|
||||
return %game.pickTeamSpawn($NonRabbitTeam);
|
||||
}
|
||||
|
||||
function RabbitGame::createPlayer(%game, %client, %spawnLoc, %respawn)
|
||||
{
|
||||
%client.team = $NonRabbitTeam;
|
||||
DefaultGame::createPlayer(%game, %client, %spawnLoc, %respawn);
|
||||
}
|
||||
|
||||
function RabbitGame::recalcScore(%game, %client)
|
||||
{
|
||||
//score is grabs + kills + (totalTime / 15 seconds);
|
||||
%timeHoldingFlagMS = %client.flagTimeMS;
|
||||
if (isObject(%client.player.holdingFlag))
|
||||
%timeHoldingFlagMS += getSimTime() - %client.startTime;
|
||||
%client.score = %client.flagGrabs + %client.kills + mFloor(%timeHoldingFlagMS / 15000);
|
||||
messageClient(%client, 'MsgYourScoreIs', "", %client.score);
|
||||
%game.recalcTeamRanks(%client);
|
||||
%game.checkScoreLimit(%client);
|
||||
}
|
||||
|
||||
function RabbitGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %sourceObject)
|
||||
{
|
||||
//if the victim is the rabbit, and the attacker is not the rabbit, set the damage time...
|
||||
if (isObject(%clAttacker) && %clAttacker != %clVictim)
|
||||
{
|
||||
if (%clVictim.team == $RabbitTeam)
|
||||
%game.rabbitDamageTime = getSimTime();
|
||||
}
|
||||
|
||||
//call the default
|
||||
DefaultGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %sourceObject);
|
||||
}
|
||||
|
||||
function RabbitGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc)
|
||||
{
|
||||
//see if the killer was the rabbit and the victim was someone else...
|
||||
if (isObject(%clKiller) && (%clKiller != %clVictim) && (%clKiller.team == $RabbitTeam))
|
||||
{
|
||||
%clKiller.kills++;
|
||||
%game.recalcScore(%clKiller);
|
||||
}
|
||||
|
||||
DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc);
|
||||
}
|
||||
|
||||
function RabbitGame::playerDroppedFlag(%game, %player)
|
||||
{
|
||||
//set the flag status
|
||||
%flag = %player.holdingFlag;
|
||||
%player.holdingFlag = "";
|
||||
%flag.carrier = "";
|
||||
$flagStatus = "<In the Field>";
|
||||
|
||||
%player.unmountImage($FlagSlot);
|
||||
%flag.hide(false);
|
||||
|
||||
//hide the rabbit waypoint
|
||||
cancel(%game.waypointSchedule);
|
||||
%game.hideRabbitWaypoint(%player.client);
|
||||
|
||||
//set the client status
|
||||
%player.client.flagTimeMS += getSimTime() - %player.client.startTime;
|
||||
%player.client.team = $NonRabbitTeam;
|
||||
%player.client.setSensorGroup($NonRabbitTeam);
|
||||
setTargetSensorGroup(%player.getTarget(), $NonRabbitTeam);
|
||||
|
||||
messageAllExcept(%player.client, -1, 'MsgRabbitFlagDropped', '\c2%1 dropped the flag!~wfx/misc/flag_drop.wav', %player.client.name);
|
||||
// if the player left the mission area, he's already been notified
|
||||
if(!%player.outArea)
|
||||
messageClient(%player.client, 'MsgRabbitFlagDropped', '\c2You dropped the flag!~wfx/misc/flag_drop.wav');
|
||||
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") dropped flag");
|
||||
|
||||
%flag.returnThread = %game.schedule(%game.flagReturnTime, "returnFlag", %flag);
|
||||
}
|
||||
|
||||
function RabbitGame::playerTouchFlag(%game, %player, %flag)
|
||||
{
|
||||
if ((%flag.carrier $= "") && (%player.getState() !$= "Dead"))
|
||||
{
|
||||
%player.client.startTime = getSimTime();
|
||||
%player.holdingFlag = %flag;
|
||||
%flag.carrier = %player;
|
||||
%player.mountImage(FlagImage, $FlagSlot, true); //, $teamSkin[$RabbitTeam]);
|
||||
cancel(%flag.returnThread);
|
||||
%flag.hide(true);
|
||||
%flag.isHome = false;
|
||||
$flagStatus = %client.name;
|
||||
messageAll('MsgRabbitFlagTaken', '\c2%1 has taken the flag!~wfx/misc/flag_snatch.wav', %player.client.name);
|
||||
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") took flag");
|
||||
%player.client.team = $RabbitTeam;
|
||||
%player.client.setSensorGroup($RabbitTeam);
|
||||
setTargetSensorGroup(%player.getTarget(), $RabbitTeam);
|
||||
|
||||
//increase the score
|
||||
%player.client.flagGrabs++;
|
||||
%game.recalcScore(%player.client);
|
||||
%game.schedule(5000, "RabbitFlagCheck", %player);
|
||||
|
||||
//show the rabbit waypoint
|
||||
%game.rabbitDamageTime = 0;
|
||||
cancel(%game.waypointSchedule);
|
||||
%game.showRabbitWaypoint(%player.client);
|
||||
}
|
||||
}
|
||||
|
||||
function RabbitGame::rabbitFlagCheck(%game, %player)
|
||||
{
|
||||
// this function calculates the score for the rabbit. It must be done periodically
|
||||
// since the rabbit's score is based on how long the flag has been in possession.
|
||||
if((%player.holdingFlag != 0) && (%player.getState() !$= "Dead"))
|
||||
{
|
||||
%game.recalcScore(%player.client);
|
||||
//reschedule this flagcheck for 5 seconds
|
||||
%game.schedule(5000, "RabbitFlagCheck", %player);
|
||||
}
|
||||
}
|
||||
|
||||
function RabbitGame::returnFlag(%game, %flag)
|
||||
{
|
||||
messageAll('MsgRabbitFlagReturned', '\c2The flag was returned to its starting point.~wfx/misc/flag_return.wav');
|
||||
logEcho("flag return (timeout)");
|
||||
%game.resetFlag(%flag);
|
||||
}
|
||||
|
||||
function RabbitGame::resetFlag(%game, %flag)
|
||||
{
|
||||
%flag.setVelocity("0 0 0");
|
||||
%flag.setTransform(%flag.originalPosition);
|
||||
%flag.isHome = true;
|
||||
%flag.carrier = "";
|
||||
$flagStatus = "<At Home>";
|
||||
%flag.hide(false);
|
||||
}
|
||||
|
||||
// ----- These functions are native to Rabbit
|
||||
|
||||
function RabbitGame::timeLimitReached(%game)
|
||||
{
|
||||
logEcho("game over (timelimit)");
|
||||
%game.gameOver();
|
||||
cycleMissions();
|
||||
}
|
||||
|
||||
function RabbitGame::scoreLimitReached(%game)
|
||||
{
|
||||
logEcho("game over (scorelimit)");
|
||||
%game.gameOver();
|
||||
cycleMissions();
|
||||
}
|
||||
|
||||
function RabbitGame::checkScoreLimit(%game, %client)
|
||||
{
|
||||
%scoreLimit = MissionGroup.Rabbit_scoreLimit;
|
||||
// default of 1200 if scoreLimit not defined (that's 1200 seconds worth - 20 minutes)
|
||||
if(%scoreLimit $= "")
|
||||
%scoreLimit = 1200;
|
||||
if(%client.score >= %scoreLimit)
|
||||
%game.scoreLimitReached();
|
||||
}
|
||||
|
||||
function RabbitGame::gameOver(%game)
|
||||
{
|
||||
//call the default
|
||||
DefaultGame::gameOver(%game);
|
||||
|
||||
//send the message
|
||||
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.gameover.wav" );
|
||||
|
||||
cancel(%game.rabbitWaypointThread);
|
||||
messageAll('MsgClearObjHud', "");
|
||||
for(%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%client = ClientGroup.getObject(%i);
|
||||
%game.resetScore(%client);
|
||||
cancel(%client.waypointSchedule);
|
||||
}
|
||||
|
||||
cancel(%game.waypointSchedule);
|
||||
}
|
||||
|
||||
function RabbitGame::resetScore(%game, %client)
|
||||
{
|
||||
%client.score = 0;
|
||||
%client.kills = 0;
|
||||
%client.deaths = 0;
|
||||
%client.suicides = 0;
|
||||
%client.flagGrabs = 0;
|
||||
%client.flagTimeMS = 0;
|
||||
}
|
||||
|
||||
function RabbitGame::enterMissionArea(%game, %playerData, %player)
|
||||
{
|
||||
%player.client.outOfBounds = false;
|
||||
messageClient(%player.client, 'EnterMissionArea', '\c1You are back in the mission area.');
|
||||
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") entered mission area");
|
||||
cancel(%player.alertThread);
|
||||
}
|
||||
|
||||
function RabbitGame::leaveMissionArea(%game, %playerData, %player)
|
||||
{
|
||||
if(%player.getState() $= "Dead")
|
||||
return;
|
||||
|
||||
%player.client.outOfBounds = true;
|
||||
if (%player.client.team == $RabbitTeam)
|
||||
messageClient(%player.client, 'LeaveMissionArea', '\c1You have left the mission area. Return or take damage.~wfx/misc/warning_beep.wav');
|
||||
else
|
||||
messageClient(%player.client, 'LeaveMissionArea', '\c1You have left the mission area.~wfx/misc/warning_beep.wav');
|
||||
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") left mission area");
|
||||
%player.alertThread = %game.schedule(1000, "AlertPlayer", 3, %player);
|
||||
}
|
||||
|
||||
function RabbitGame::AlertPlayer(%game, %count, %player)
|
||||
{
|
||||
if (%player.client.team == $RabbitTeam)
|
||||
{
|
||||
if(%count > 1)
|
||||
%player.alertThread = %game.schedule(1000, "AlertPlayer", %count - 1, %player);
|
||||
else
|
||||
%player.alertThread = %game.schedule(1000, "MissionAreaDamage", %player);
|
||||
}
|
||||
|
||||
//keep the thread going for non rabbits, but give the new rabbit time to return to the mission area...
|
||||
else
|
||||
%player.alertThread = %game.schedule(1000, "AlertPlayer", 3, %player);
|
||||
}
|
||||
|
||||
function RabbitGame::MissionAreaDamage(%game, %player)
|
||||
{
|
||||
if(%player.getState() !$= "Dead") {
|
||||
%player.setDamageFlash(0.1);
|
||||
%damageRate = 0.05;
|
||||
%pack = %player.getMountedImage($BackpackSlot);
|
||||
if(%pack.getName() $= "RepairPackImage")
|
||||
if(%player.getMountedImage($WeaponSlot).getName() $= "RepairGunImage")
|
||||
%damageRate = 0.15;
|
||||
%prevHurt = %player.getDamageLevel();
|
||||
%player.setDamageLevel(%prevHurt + %damageRate);
|
||||
// a little redundancy to see if the lastest damage killed the player
|
||||
if(%player.getState() $= "Dead")
|
||||
%game.onClientKilled(%player.client, 0, $DamageType::OutOfBounds);
|
||||
else
|
||||
%player.alertThread = %game.schedule(1000, "MissionAreaDamage", %player);
|
||||
}
|
||||
else
|
||||
{
|
||||
%game.onClientKilled(%player.client, 0, $DamageType::OutOfBounds);
|
||||
}
|
||||
}
|
||||
|
||||
function RabbitGame::dropFlag(%game, %player)
|
||||
{
|
||||
//you can no longer throw the flag in Rabbit...
|
||||
}
|
||||
|
||||
function RabbitGame::updateScoreHud(%game, %client, %tag)
|
||||
{
|
||||
//tricky stuff here... use two columns if we have more than 15 clients...
|
||||
%numClients = $TeamRank[0, count];
|
||||
if ( %numClients > $ScoreHudMaxVisible )
|
||||
%numColumns = 2;
|
||||
|
||||
// Clear the header:
|
||||
messageClient( %client, 'SetScoreHudHeader', "", "" );
|
||||
|
||||
// Send subheader:
|
||||
if (%numColumns == 2)
|
||||
messageClient(%client, 'SetScoreHudSubheader', "", '<tab:5,155,225,305,455,525>\tPLAYER\tSCORE\tTIME\tPLAYER\tSCORE\tTIME');
|
||||
else
|
||||
messageClient(%client, 'SetScoreHudSubheader', "", '<tab:15,235,335>\tPLAYER\tSCORE\tTIME');
|
||||
|
||||
//recalc the score for whoever is holding the flag
|
||||
if (isObject($AIRabbitFlag.carrier))
|
||||
%game.recalcScore($AIRabbitFlag.carrier.client);
|
||||
|
||||
%countMax = %numClients;
|
||||
if ( %countMax > ( 2 * $ScoreHudMaxVisible ) )
|
||||
{
|
||||
if ( %countMax & 1 )
|
||||
%countMax++;
|
||||
%countMax = %countMax / 2;
|
||||
}
|
||||
else if ( %countMax > $ScoreHudMaxVisible )
|
||||
%countMax = $ScoreHudMaxVisible;
|
||||
|
||||
for (%index = 0; %index < %countMax; %index++)
|
||||
{
|
||||
//get the client info
|
||||
%col1Client = $TeamRank[0, %index];
|
||||
%col1ClientScore = %col1Client.score $= "" ? 0 : %col1Client.score;
|
||||
%col1Style = "";
|
||||
|
||||
if (isObject(%col1Client.player.holdingFlag))
|
||||
{
|
||||
%col1ClientTimeMS = %col1Client.flagTimeMS + getSimTime() - %col1Client.startTime;
|
||||
%col1Style = "<color:00dc00>";
|
||||
}
|
||||
else
|
||||
{
|
||||
%col1ClientTimeMS = %col1Client.flagTimeMS;
|
||||
if ( %col1Client == %client )
|
||||
%col1Style = "<color:dcdcdc>";
|
||||
}
|
||||
|
||||
if (%col1ClientTimeMS <= 0)
|
||||
%col1ClientTime = "";
|
||||
else
|
||||
{
|
||||
%minutes = mFloor(%col1ClientTimeMS / (60 * 1000));
|
||||
if (%minutes <= 0)
|
||||
%minutes = "0";
|
||||
%seconds = mFloor(%col1ClientTimeMS / 1000) % 60;
|
||||
if (%seconds < 10)
|
||||
%seconds = "0" @ %seconds;
|
||||
|
||||
%col1ClientTime = %minutes @ ":" @ %seconds;
|
||||
}
|
||||
|
||||
//see if we have two columns
|
||||
if (%numColumns == 2)
|
||||
{
|
||||
%col2Client = "";
|
||||
%col2ClientScore = "";
|
||||
%col2ClientTime = "";
|
||||
%col2Style = "";
|
||||
|
||||
//get the column 2 client info
|
||||
%col2Index = %index + %countMax;
|
||||
if (%col2Index < %numClients)
|
||||
{
|
||||
%col2Client = $TeamRank[0, %col2Index];
|
||||
%col2ClientScore = %col2Client.score $= "" ? 0 : %col2Client.score;
|
||||
|
||||
if (isObject(%col2Client.player.holdingFlag))
|
||||
{
|
||||
%col2ClientTimeMS = %col2Client.flagTimeMS + getSimTime() - %col2Client.startTime;
|
||||
%col2Style = "<color:00dc00>";
|
||||
}
|
||||
else
|
||||
{
|
||||
%col2ClientTimeMS = %col2Client.flagTimeMS;
|
||||
if ( %col2Client == %client )
|
||||
%col2Style = "<color:dcdcdc>";
|
||||
}
|
||||
|
||||
if (%col2ClientTimeMS <= 0)
|
||||
%col2ClientTime = "";
|
||||
else
|
||||
{
|
||||
%minutes = mFloor(%col2ClientTimeMS / (60 * 1000));
|
||||
if (%minutes <= 0)
|
||||
%minutes = "0";
|
||||
%seconds = mFloor(%col2ClientTimeMS / 1000) % 60;
|
||||
if (%seconds < 10)
|
||||
%seconds = "0" @ %seconds;
|
||||
|
||||
%col2ClientTime = %minutes @ ":" @ %seconds;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if the client is not an observer, send the message
|
||||
if (%client.team != 0)
|
||||
{
|
||||
if ( %numColumns == 2 )
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:10><spush>%7\t<clip:150>%1</clip><rmargin:205><just:right>%2<rmargin:270><just:right>%3<spop><rmargin:505><lmargin:310>%8<just:left>%4<rmargin:505><just:right>%5<rmargin:570><just:right>%6',
|
||||
%col1Client.name, %col1ClientScore, %col1ClientTime, %col2Client.name, %col2ClientScore, %col2ClientTime, %col1Style, %col2Style );
|
||||
else
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:20>%4\t<clip:200>%1</clip><rmargin:280><just:right>%2<rmargin:375><just:right>%3',
|
||||
%col1Client.name, %col1ClientScore, %col1ClientTime, %col1Style );
|
||||
}
|
||||
//else for observers, create an anchor around the player name so they can be observed
|
||||
else
|
||||
{
|
||||
if ( %numColumns == 2 )
|
||||
{
|
||||
//this is really crappy, but I need to save 1 tag - can only pass in up to %9, %10 doesn't work...
|
||||
if (%col2Style $= "<color:00dc00>")
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:10><spush>%7\t<clip:150><a:gamelink\t%8>%1</a></clip><rmargin:205><just:right>%2<rmargin:270><just:right>%3<spop><rmargin:505><lmargin:310><color:00dc00><just:left><clip:150><a:gamelink\t%9>%4</a></clip><rmargin:505><just:right>%5<rmargin:570><just:right>%6',
|
||||
%col1Client.name, %col1ClientScore, %col1ClientTime,
|
||||
%col2Client.name, %col2ClientScore, %col2ClientTime,
|
||||
%col1Style, %col1Client, %col2Client );
|
||||
}
|
||||
else if (%col2Style $= "<color:dcdcdc>")
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:10><spush>%7\t<clip:150><a:gamelink\t%8>%1</a></clip><rmargin:205><just:right>%2<rmargin:270><just:right>%3<spop><rmargin:505><lmargin:310><color:dcdcdc><just:left><clip:150><a:gamelink\t%9>%4</a></clip><rmargin:505><just:right>%5<rmargin:570><just:right>%6',
|
||||
%col1Client.name, %col1ClientScore, %col1ClientTime,
|
||||
%col2Client.name, %col2ClientScore, %col2ClientTime,
|
||||
%col1Style, %col1Client, %col2Client );
|
||||
}
|
||||
else
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:10><spush>%7\t<clip:150><a:gamelink\t%8>%1</a></clip><rmargin:205><just:right>%2<rmargin:270><just:right>%3<spop><rmargin:505><lmargin:310><just:left><clip:150><a:gamelink\t%9>%4</a></clip><rmargin:505><just:right>%5<rmargin:570><just:right>%6',
|
||||
%col1Client.name, %col1ClientScore, %col1ClientTime,
|
||||
%col2Client.name, %col2ClientScore, %col2ClientTime,
|
||||
%col1Style, %col1Client, %col2Client );
|
||||
}
|
||||
}
|
||||
else
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:20>%4\t<clip:200><a:gamelink\t%5>%1</a></clip><rmargin:280><just:right>%2<rmargin:375><just:right>%3',
|
||||
%col1Client.name, %col1ClientScore, %col1ClientTime, %col1Style, %col1Client );
|
||||
}
|
||||
}
|
||||
|
||||
// Tack on the list of observers:
|
||||
%observerCount = 0;
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl.team == 0)
|
||||
%observerCount++;
|
||||
}
|
||||
|
||||
if (%observerCount > 0)
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, "");
|
||||
%index++;
|
||||
messageClient(%client, 'SetLineHud', "", %tag, %index, '<tab:10, 310><spush><font:Univers Condensed:22>\tOBSERVERS (%1)<rmargin:260><just:right>TIME<spop>', %observerCount);
|
||||
%index++;
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
//if this is an observer
|
||||
if (%cl.team == 0)
|
||||
{
|
||||
%obsTime = getSimTime() - %cl.observerStartTime;
|
||||
%obsTimeStr = %game.formatTime(%obsTime, false);
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:20, 310>\t<clip:150>%1</clip><rmargin:260><just:right>%2',
|
||||
%cl.name, %obsTimeStr );
|
||||
%index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//clear the rest of Hud so we don't get old lines hanging around...
|
||||
messageClient( %client, 'ClearHud', "", %tag, %index );
|
||||
}
|
||||
|
||||
function RabbitGame::showRabbitWaypointClient(%game, %clRabbit, %client)
|
||||
{
|
||||
//make sure we have a rabbit
|
||||
if (!isObject(%clRabbit) || !isObject(%clRabbit.player) || !isObject(%clRabbit.player.holdingFlag))
|
||||
return;
|
||||
|
||||
//no waypoints for bots
|
||||
if (%client.isAIControlled())
|
||||
return;
|
||||
|
||||
//scope the client, then set the always vis mask...
|
||||
%clRabbit.player.scopeToClient(%client);
|
||||
%visMask = getSensorGroupAlwaysVisMask(%clRabbit.getSensorGroup());
|
||||
%visMask |= (1 << %client.getSensorGroup());
|
||||
setSensorGroupAlwaysVisMask(%clRabbit.getSensorGroup(), %visMask);
|
||||
|
||||
//now issue a command to kill the target
|
||||
%client.setTargetId(%clRabbit.target);
|
||||
commandToClient(%client, 'TaskInfo', %client, -1, false, "Kill the Rabbit!");
|
||||
%client.sendTargetTo(%client, true);
|
||||
|
||||
//send the "waypoint is here sound"
|
||||
messageClient(%client, 'MsgRabbitWaypoint', '~wfx/misc/target_waypoint.wav');
|
||||
|
||||
//and hide the waypoint
|
||||
%client.waypointSchedule = %game.schedule(%game.waypointDuration, "hideRabbitWaypointClient", %clRabbit, %client);
|
||||
}
|
||||
|
||||
function RabbitGame::hideRabbitWaypointClient(%game, %clRabbit, %client)
|
||||
{
|
||||
//no waypoints for bots
|
||||
if (%client.isAIControlled())
|
||||
return;
|
||||
|
||||
//unset the always vis mask...
|
||||
%visMask = getSensorGroupAlwaysVisMask(%clRabbit.getSensorGroup());
|
||||
%visMask &= ~(1 << %client.getSensorGroup());
|
||||
setSensorGroupAlwaysVisMask(%clRabbit.getSensorGroup(), %visMask);
|
||||
|
||||
//kill the actually task...
|
||||
removeClientTargetType(%client, "AssignedTask");
|
||||
}
|
||||
|
||||
function RabbitGame::showRabbitWaypoint(%game, %clRabbit)
|
||||
{
|
||||
//make sure we have a rabbit
|
||||
if (!isObject(%clRabbit) || !isObject(%clRabbit.player) || !isObject(%clRabbit.player.holdingFlag))
|
||||
return;
|
||||
|
||||
//only show the rabbit waypoint if the rabbit hasn't been damaged within the frequency period
|
||||
if (getSimTime() - %game.rabbitDamageTime < %game.waypointFrequency)
|
||||
{
|
||||
%game.waypointSchedule = %game.schedule(%game.waypointFrequency, "showRabbitWaypoint", %clRabbit);
|
||||
return;
|
||||
}
|
||||
|
||||
//loop through all the clients and flash a waypoint at the rabbits position
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl.isAIControlled() || %cl == %clRabbit)
|
||||
continue;
|
||||
|
||||
//scope the client, then set the always vis mask...
|
||||
%clRabbit.player.scopeToClient(%cl);
|
||||
%visMask = getSensorGroupAlwaysVisMask(%clRabbit.getSensorGroup());
|
||||
%visMask |= (1 << %cl.getSensorGroup());
|
||||
setSensorGroupAlwaysVisMask(%clRabbit.getSensorGroup(), %visMask);
|
||||
|
||||
//now issue a command to kill the target
|
||||
%cl.setTargetId(%clRabbit.target);
|
||||
commandToClient(%cl, 'TaskInfo', %cl, -1, false, "Kill the Rabbit!");
|
||||
%cl.sendTargetTo(%cl, true);
|
||||
|
||||
//send the "waypoint is here sound"
|
||||
messageClient(%cl, 'MsgRabbitWaypoint', '~wfx/misc/target_waypoint.wav');
|
||||
}
|
||||
|
||||
//schedule the time to hide the waypoint
|
||||
%game.waypointSchedule = %game.schedule(%game.waypointDuration, "hideRabbitWaypoint", %clRabbit);
|
||||
}
|
||||
|
||||
function RabbitGame::hideRabbitWaypoint(%game, %clRabbit)
|
||||
{
|
||||
//make sure we have a valid client
|
||||
if (!isObject(%clRabbit))
|
||||
return;
|
||||
|
||||
//loop through all the clients and hide the waypoint
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl.isAIControlled())
|
||||
continue;
|
||||
|
||||
//unset the always vis mask...
|
||||
%visMask = getSensorGroupAlwaysVisMask(%clRabbit.getSensorGroup());
|
||||
%visMask &= ~(1 << %cl.getSensorGroup());
|
||||
setSensorGroupAlwaysVisMask(%clRabbit.getSensorGroup(), %visMask);
|
||||
|
||||
//kill the actually task...
|
||||
removeClientTargetType(%cl, "AssignedTask");
|
||||
}
|
||||
|
||||
//make sure we have a rabbit before scheduling the next showRabbitWaypoint...
|
||||
if (isObject(%clRabbit.player) && isObject(%clRabbit.player.holdingFlag))
|
||||
%game.waypointSchedule = %game.schedule(%game.waypointFrequency, "showRabbitWaypoint", %clRabbit);
|
||||
}
|
||||
|
||||
function RabbitGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %implement)
|
||||
{
|
||||
if(%game.testTurretKill(%implement)) //check for turretkill before awarded a non client points for a kill
|
||||
%game.awardScoreTurretKill(%clVictim, %implement);
|
||||
else if (%game.testKill(%clVictim, %clKiller)) //verify victim was an enemy
|
||||
{
|
||||
%game.awardScoreKill(%clKiller);
|
||||
%game.awardScoreDeath(%clVictim);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (%game.testSuicide(%clVictim, %clKiller, %damageType)) //otherwise test for suicide
|
||||
{
|
||||
%game.awardScoreSuicide(%clVictim);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (%game.testTeamKill(%clVictim, %clKiller)) //otherwise test for a teamkill
|
||||
%game.awardScoreTeamKill(%clVictim, %clKiller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function RabbitGame::applyConcussion(%game, %player)
|
||||
{
|
||||
// MES -- this won't do anything, the function RabbitGame::dropFlag is empty
|
||||
%game.dropFlag( %player );
|
||||
}
|
||||
|
||||
1213
docs/base/@vl2/scripts.vl2/scripts/SiegeGame.cs
Normal file
1213
docs/base/@vl2/scripts.vl2/scripts/SiegeGame.cs
Normal file
File diff suppressed because it is too large
Load diff
1310
docs/base/@vl2/scripts.vl2/scripts/SinglePlayerGame.cs
Normal file
1310
docs/base/@vl2/scripts.vl2/scripts/SinglePlayerGame.cs
Normal file
File diff suppressed because it is too large
Load diff
614
docs/base/@vl2/scripts.vl2/scripts/TeamHuntersGame.cs
Normal file
614
docs/base/@vl2/scripts.vl2/scripts/TeamHuntersGame.cs
Normal file
|
|
@ -0,0 +1,614 @@
|
|||
//--------------------------------------//
|
||||
// TeamHuntersGame.cs //
|
||||
//--------------------------------------//
|
||||
|
||||
// DisplayName = Team Hunters
|
||||
|
||||
//--- GAME RULES BEGIN ---
|
||||
//Collect flags and bring them to Nexus
|
||||
//You may pass flags to a Capper
|
||||
//Capper can collect many flags and try for massive score
|
||||
//However, any player may score at Nexus
|
||||
//All scores of team members count toward team score
|
||||
//--- GAME RULES END ---
|
||||
|
||||
package TeamHuntersGame {
|
||||
|
||||
function Nexus::objectiveInit(%data, %object)
|
||||
{
|
||||
Game.Nexus = %object;
|
||||
Game.Nexus.playThread(0, "ambient");
|
||||
Game.Nexus.setThreadDir(0, true);
|
||||
//The flash animation plays forwards, then back automatically, so we have to alternate the thread direcction...
|
||||
Game.Nexus.flashThreadDir = true;
|
||||
}
|
||||
|
||||
function NexusBase::objectiveInit(%data, %object)
|
||||
{
|
||||
Game.NexusBase = %object;
|
||||
Game.NexusBase.playthread(0, "ambient");
|
||||
Game.NexusBase.setThreadDir(0, true);
|
||||
}
|
||||
|
||||
function NexusCap::objectiveInit(%data, %object)
|
||||
{
|
||||
Game.NexusCap = %object;
|
||||
Game.NexusCap.playthread(0, "ambient");
|
||||
Game.NexusCap.setThreadDir(0, true);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//exec the AI scripts
|
||||
exec("scripts/aiTeamHunters.cs");
|
||||
|
||||
$InvBanList[TeamHunters, "TurretOutdoorDeployable"] = 1;
|
||||
$InvBanList[TeamHunters, "TurretIndoorDeployable"] = 1;
|
||||
$InvBanList[TeamHunters, "ElfBarrelPack"] = 1;
|
||||
$InvBanList[TeamHunters, "MortarBarrelPack"] = 1;
|
||||
$InvBanList[TeamHunters, "PlasmaBarrelPack"] = 1;
|
||||
$InvBanList[TeamHunters, "AABarrelPack"] = 1;
|
||||
$InvBanList[TeamHunters, "MissileBarrelPack"] = 1;
|
||||
$InvBanList[TeamHunters, "Mine"] = 1;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//Game initialization functions
|
||||
|
||||
function TeamHuntersGame::missionLoadDone(%game)
|
||||
{
|
||||
//default version sets up teams - must be called first...
|
||||
DefaultGame::missionLoadDone(%game);
|
||||
|
||||
$numRanked = 0;
|
||||
|
||||
//initialize the score and flag count for all the players
|
||||
%count = ClientGroup.getCount();
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%client = ClientGroup.getObject(%i);
|
||||
%game.resetScore(%client);
|
||||
%client.flagCount = 1;
|
||||
}
|
||||
$TopClient = "";
|
||||
$TopClientScore = 0;
|
||||
|
||||
for(%j = 1; %j < (%game.numTeams + 1); %j++)
|
||||
$teamScore[%j] = 0;
|
||||
|
||||
//create the Flag group
|
||||
$FlagGroup = nameToID("MissionCleanup/FlagGroup");
|
||||
if ($FlagGroup <= 0)
|
||||
{
|
||||
$FlagGroup = new SimGroup("FlagGroup");
|
||||
MissionCleanup.add($FlagGroup);
|
||||
}
|
||||
|
||||
if(nameToId("HuntersYardSaleSet") <= 0)
|
||||
{
|
||||
$HuntersYardSaleSet = new SimSet("HuntersYardSaleSet");
|
||||
MissionCleanup.add($HuntersYardSaleSet);
|
||||
}
|
||||
|
||||
// make a game object for the Nexus (functions defined in HuntersGame.cs)
|
||||
MissionGroup.findNexus();
|
||||
}
|
||||
|
||||
function TeamHuntersGame::initGameVars(%game)
|
||||
{
|
||||
%game.SCORE_PER_SUICIDE = -1;
|
||||
%game.SCORE_PER_TEAMKILL = -1;
|
||||
%game.SCORE_PER_DEATH = -1;
|
||||
%game.SCORE_PER_KILL = 1;
|
||||
%game.SCORE_PER_TURRET_KILL = 1;
|
||||
|
||||
%game.TeamMode = true;
|
||||
|
||||
%game.GreedMode = $Host::TeamHuntersGreedMode;
|
||||
%game.GreedMinFlags = 8; //min number of flags you must have before you can cap
|
||||
|
||||
%game.HoardMode = $Host::TeamHuntersHoardMode;
|
||||
%game.HoardStartTime = 5; //time left in the game at which hoard mode will start
|
||||
%game.HoardDuration = 3; //duration of the hoard period
|
||||
%game.HoardEndTime = %game.HoardStartTime - %game.HoardDuration;
|
||||
|
||||
%game.yardSaleMin = 10;
|
||||
|
||||
//make sure there is enough time in the match to actually have a hoard mode...
|
||||
if ($host::timeLimit < %game.hoardStartTime + 1)
|
||||
%game.hoardMode = false;
|
||||
|
||||
//this is how many milliseconds before a warning is issued for camping near the Nexus
|
||||
%game.nexusCampingTime = 10000;
|
||||
|
||||
//vars for how long before the flag is deleted, and the fade transition time...
|
||||
%game.flagLifeTimeMS = 120000;
|
||||
%game.fadeTimeMS = 2000;
|
||||
|
||||
%game.flagMsgDelayMS = 3000;
|
||||
%game.oobThrowFlagsDelayMS = 3000;
|
||||
|
||||
// targets for each of the flag types (except for base which is properly skinned already)
|
||||
HuntersFlag1.target = -1; // red
|
||||
HuntersFlag2.target = allocTarget("", 'Blue', "", "", 0, "", "");
|
||||
HuntersFlag4.target = allocTarget("", 'Yellow', "", "", 0, "", "");
|
||||
HuntersFlag8.target = allocTarget("", 'Green', "", "", 0, "", "");
|
||||
}
|
||||
|
||||
function TeamHuntersGame::allowsProtectedStatics(%game)
|
||||
{
|
||||
// prevent appropriate equipment from being damaged - invulnerable
|
||||
return true;
|
||||
}
|
||||
|
||||
function TeamHuntersGame::setNexusDisabled(%game)
|
||||
{
|
||||
HuntersGame::setNexusDisabled(%game);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::setNexusEnabled(%game)
|
||||
{
|
||||
HuntersGame::setNexusEnabled(%game);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::flashNexus(%game)
|
||||
{
|
||||
HuntersGame::flashNexus(%game);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::NexusSparkEmitter(%game, %client, %cap, %numToScore)
|
||||
{
|
||||
HuntersGame::NexusSparkEmitter(%game, %client, %cap, %numToScore);
|
||||
}
|
||||
|
||||
|
||||
function TeamHuntersGame::resetScore(%game, %client)
|
||||
{
|
||||
%client.score = 0;
|
||||
%client.suicides = 0;
|
||||
%client.kills = 0;
|
||||
%client.teamKills = 0;
|
||||
%client.deaths = 0;
|
||||
}
|
||||
|
||||
function TeamHuntersGame::recalcScore(%game, %cl)
|
||||
{
|
||||
if (%cl <= 0)
|
||||
return;
|
||||
|
||||
%killValue = %cl.kills * %game.SCORE_PER_KILL;
|
||||
%deathValue = %cl.deaths * %game.SCORE_PER_DEATH;
|
||||
|
||||
if (%killValue - %deathValue == 0)
|
||||
%killPoints = 0;
|
||||
else
|
||||
%killPoints = (%killValue * %killValue) / (%killValue - %deathValue);
|
||||
|
||||
%cl.score = %killPoints;
|
||||
%cl.score += %cl.suicides * %game.SCORE_PER_SUICIDE;
|
||||
%cl.score = mFloor(%cl.score);
|
||||
|
||||
//must send the message to update the HUD
|
||||
messageClient(%cl, 'MsgYourScoreIs', "", %cl.score);
|
||||
|
||||
%game.recalcTeamRanks(%cl);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::startMatch(%game)
|
||||
{
|
||||
HuntersGame::startMatch(%game);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::setupHoardCountdown(%game)
|
||||
{
|
||||
HuntersGame::setupHoardCountdown(%game);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::notifyHoardStart(%game, %seconds)
|
||||
{
|
||||
HuntersGame::notifyHoardStart(%game, %seconds);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::notifyHoardEnd(%game, %seconds)
|
||||
{
|
||||
HuntersGame::notifyHoardEnd(%game, %seconds);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::updateHoardStatusHUD(%game)
|
||||
{
|
||||
HuntersGame::updateHoardStatusHUD(%game);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//Player spawn/death functions
|
||||
|
||||
function TeamHuntersGame::assignClientTeam(%game, %client)
|
||||
{
|
||||
DefaultGame::assignClientTeam(%game, %client);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::createPlayer(%game, %client, %spawnLoc)
|
||||
{
|
||||
HuntersGame::createPlayer(%game, %client, %spawnLoc);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::pickPlayerSpawn(%game, %client, %respawn)
|
||||
{
|
||||
return %game.pickTeamSpawn(%client.team);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::playerSpawned(%game, %player, %armor)
|
||||
{
|
||||
HuntersGame::playerSpawned(%game, %player, %armor);
|
||||
|
||||
//reset the enemy damaged time
|
||||
%player.client.lastEnemyDamagedTime = 0;
|
||||
}
|
||||
|
||||
function TeamHuntersGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %sourceObject)
|
||||
{
|
||||
//first call the default version
|
||||
DefaultGame::onClientDamaged(%game, %clVictim, %clAttacker, %damageType, %sourceObject);
|
||||
|
||||
//now see if the attacker was an enemy
|
||||
if (isObject(%clAttacker) && %clAttacker.team != %clVictim.team)
|
||||
%clVictim.lastEnemyDamagedTime = getSimTime();
|
||||
}
|
||||
|
||||
function TeamHuntersGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement)
|
||||
{
|
||||
//set the flag
|
||||
%clVictim.isDead = true;
|
||||
|
||||
//to prevent suiciders from dropping flags for their teammates - see if the player
|
||||
//has taken enemy damage within the last 20 seconds
|
||||
if ((%game.testSuicide(%clVictim, %clKiller, %damageType) ||
|
||||
(isObject(%clKiller) && %clKiller.team == %clVictim.team)) &&
|
||||
(getSimTime() - %clVictim.lastEnemyDamagedTime > 20000))
|
||||
{
|
||||
%clVictim.flagCount--;
|
||||
}
|
||||
|
||||
//first, drop all the flags
|
||||
HuntersGame::dropFlag(%game, %clVictim.player);
|
||||
|
||||
//now call the default game stuff
|
||||
DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement);
|
||||
|
||||
messageClient(%clVictim, 'MsgHuntYouHaveFlags', "", 0);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %implement)
|
||||
{
|
||||
if (%game.testKill(%clVictim, %clKiller)) //verify victim was an enemy
|
||||
{
|
||||
%game.awardScoreKill(%clKiller);
|
||||
%game.awardScoreDeath(%clVictim);
|
||||
}
|
||||
else if (%game.testSuicide(%clVictim, %clKiller, %damageType)) //otherwise test for suicide
|
||||
%game.awardScoreSuicide(%clVictim);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::equip(%game, %player)
|
||||
{
|
||||
HuntersGame::equip(%game, %player);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::checkTimeLimit(%game)
|
||||
{
|
||||
HuntersGame::checkTimeLimit(%game);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::timeLimitReached(%game)
|
||||
{
|
||||
HuntersGame::timeLimitReached(%game);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::checkScoreLimit(%game, %team)
|
||||
{
|
||||
//no such thing as a score limit in Hunters
|
||||
}
|
||||
|
||||
function TeamHuntersGame::scoreLimitReached(%game)
|
||||
{
|
||||
//no such thing as a score limit in Hunters
|
||||
}
|
||||
|
||||
function TeamHuntersGame::clientMissionDropReady(%game, %client)
|
||||
{
|
||||
//%client.rank = ClientGroup.getCount();
|
||||
messageClient(%client, 'MsgClientReady',"", %game.class);
|
||||
//messageClient(%client, 'MsgHuntModesSet', "", %game.GreedMode, %game.HoardMode);
|
||||
messageClient(%client, 'MsgHuntYouHaveFlags', "", 0);
|
||||
//%game.populateTeamRankArray(%client);
|
||||
//messageClient(%client, 'MsgHuntTeamRankIs', "", -1);
|
||||
for(%i = 1; %i <= %game.numTeams; %i++)
|
||||
messageClient(%client, 'MsgHuntAddTeam', "", %i, $TeamName[%i], $TeamScore[%i]);
|
||||
|
||||
//messageClient(%client, 'MsgHuntGreedStatus', "", %game.GreedMode, %game.GreedMinFlags);
|
||||
//%curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) + $missionStartTime - getSimTime();
|
||||
//messageClient(%client, 'MsgHuntHoardStatus', "", %game.HoardMode, $Host::TimeLimit, %curTimeLeftMS, %game.HoardStartTime, %game.HoardDuration);
|
||||
|
||||
messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName );
|
||||
|
||||
DefaultGame::clientMissionDropReady(%game, %client);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::assignClientTeam(%game, %client, %respawn)
|
||||
{
|
||||
DefaultGame::assignClientTeam(%game, %client, %respawn);
|
||||
// if player's team is not on top of objective hud, switch lines
|
||||
messageClient(%client, 'MsgCheckTeamLines', "", %client.team);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::gameOver(%game)
|
||||
{
|
||||
//call the default
|
||||
DefaultGame::gameOver(%game);
|
||||
|
||||
//send the winner message
|
||||
%winner = "";
|
||||
if ($teamScore[1] > $teamScore[2])
|
||||
%winner = $teamName[1];
|
||||
else if ($teamScore[2] > $teamScore[1])
|
||||
%winner = $teamName[2];
|
||||
|
||||
if (%winner $= 'Storm')
|
||||
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.stowins.wav" );
|
||||
else if (%winner $= 'Inferno')
|
||||
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.infwins.wav" );
|
||||
else
|
||||
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.gameover.wav" );
|
||||
|
||||
messageAll('MsgClearObjHud', "");
|
||||
for(%i = 0; %i < ClientGroup.getCount(); %i ++)
|
||||
{
|
||||
%client = ClientGroup.getObject(%i);
|
||||
Game.resetScore(%client);
|
||||
cancel(%client.oobSched);
|
||||
}
|
||||
}
|
||||
|
||||
function TeamHuntersGame::sendFlagCountMessage(%game, %client)
|
||||
{
|
||||
HuntersGame::sendFlagCountMessage(%game, %client);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::playerTouchFlag(%game, %player, %flag)
|
||||
{
|
||||
HuntersGame::playerTouchFlag(%game, %player, %flag);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::updateFlagHoarder(%game)
|
||||
{
|
||||
//in Team Hunters, no waypoint for the flag hoarder...
|
||||
}
|
||||
|
||||
function TeamHuntersGame::hoardModeActive(%game, %wouldBeActive)
|
||||
{
|
||||
HuntersGame::hoardModeActive(%game, %wouldBeActive);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::playerDroppedFlag(%game, %player)
|
||||
{
|
||||
HuntersGame::playerDroppedFlag(%game, %player);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//VOTING functions
|
||||
function TeamHuntersGame::sendGameVoteMenu( %game, %client, %key )
|
||||
{
|
||||
// Don't send any options if a vote is already running:
|
||||
if ( %game.scheduleVote $= "" )
|
||||
{
|
||||
// First send the common options:
|
||||
DefaultGame::sendGameVoteMenu( %game, %client, %key );
|
||||
|
||||
// Now send the Hunters-specific options:
|
||||
if ( %game.GreedMode )
|
||||
messageClient( %client, 'MsgVoteItem', "", %key, 'VoteGreedMode', 'disable greed mode', 'Disable GREED Mode' );
|
||||
else
|
||||
messageClient( %client, 'MsgVoteItem', "", %key, 'VoteGreedMode', 'enable greed mode', 'Enable GREED Mode' );
|
||||
|
||||
if ( %game.HoardMode )
|
||||
messageClient( %client, 'MsgVoteItem', "", %key, 'VoteHoardMode', 'disable hoard mode', 'Disable HOARD Mode' );
|
||||
else
|
||||
messageClient( %client, 'MsgVoteItem', "", %key, 'VoteHoardMode', 'enable hoard mode', 'Enable HOARD Mode' );
|
||||
}
|
||||
}
|
||||
|
||||
function TeamHuntersGame::voteGreedMode( %game, %admin, %player )
|
||||
{
|
||||
HuntersGame::voteGreedMode( %game, %admin, %player );
|
||||
}
|
||||
|
||||
function TeamHuntersGame::voteHoardMode( %game, %admin, %player )
|
||||
{
|
||||
HuntersGame::voteHoardMode( %game, %admin, %player );
|
||||
}
|
||||
|
||||
function TeamHuntersGame::throwFlags(%game, %player)
|
||||
{
|
||||
HuntersGame::throwFlags(%game, %player);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::outOfBoundsThrowFlags(%game, %client)
|
||||
{
|
||||
HuntersGame::outOfBoundsThrowFlags(%game, %client);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::dropFlag(%game, %player)
|
||||
{
|
||||
HuntersGame::dropFlag(%game, %player);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::enterMissionArea(%game, %playerData, %player)
|
||||
{
|
||||
HuntersGame::enterMissionArea(%game, %playerData, %player);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::leaveMissionArea(%game, %playerData, %player)
|
||||
{
|
||||
HuntersGame::leaveMissionArea(%game, %playerData, %player);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::onEnterTrigger(%game, %triggerName, %data, %obj, %colobj)
|
||||
{
|
||||
HuntersGame::onEnterTrigger(%game, %triggerName, %data, %obj, %colobj);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::onLeaveTrigger(%game, %triggerName, %data, %obj, %colobj)
|
||||
{
|
||||
HuntersGame::onLeaveTrigger(%game, %triggerName, %data, %obj, %colobj);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::CampingDamage(%game, %client, %firstWarning)
|
||||
{
|
||||
HuntersGame::CampingDamage(%game, %client, %firstWarning);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::updateScoreHud(%game, %client, %tag)
|
||||
{
|
||||
messageClient( %client, 'ClearHud', "", %tag, 0 );
|
||||
// Send header:
|
||||
messageClient( %client, 'SetScoreHudHeader', "", '<tab:15,315>\t%1<rmargin:260><just:right>%2<rmargin:560><just:left>\t%3<just:right>%4',
|
||||
$teamName[1], $teamScore[1], $teamName[2], $teamScore[2] );
|
||||
|
||||
// Send subheader:
|
||||
messageClient( %client, 'SetScoreHudSubheader', "", '<tab:5,305>\tPLAYER (%1)<rmargin:210><just:right>SCORE<rmargin:270><just:right>FLAGS<rmargin:510><just:left>\tPLAYER (%2)<just:right>SCORE<rmargin:570><just:right>FLAGS',
|
||||
$TeamRank[1, count], $TeamRank[2, count] );
|
||||
|
||||
//find out who on each team has the most flags
|
||||
%team1ClientMostFlags = -1;
|
||||
%team1ClientMostFlagsCount = -1;
|
||||
for (%i = 0; %i < $TeamRank[1, count]; %i++)
|
||||
{
|
||||
%cl = $TeamRank[1, %i];
|
||||
if (%cl.flagCount > %team1ClientMostFlagsCount)
|
||||
{
|
||||
%team1ClientMostFlagsCount = %cl.flagCount;
|
||||
%team1ClientMostFlags = %cl;
|
||||
}
|
||||
}
|
||||
if (%team1ClientMostFlagsCount <= 1)
|
||||
%team1ClientMostFlags = -1;
|
||||
|
||||
%team2ClientMostFlags = -1;
|
||||
%team2ClientMostFlagsCount = -1;
|
||||
for (%i = 0; %i < $TeamRank[2, count]; %i++)
|
||||
{
|
||||
%cl = $TeamRank[2, %i];
|
||||
if (%cl.flagCount > %team2ClientMostFlagsCount)
|
||||
{
|
||||
%team2ClientMostFlagsCount = %cl.flagCount;
|
||||
%team2ClientMostFlags = %cl;
|
||||
}
|
||||
}
|
||||
if (%team2ClientMostFlagsCount <= 1)
|
||||
%team2ClientMostFlags = -1;
|
||||
|
||||
%index = 0;
|
||||
while (true)
|
||||
{
|
||||
if (%index >= $TeamRank[1, count] && %index >= $TeamRank[2, count])
|
||||
break;
|
||||
|
||||
//get the team1 client info
|
||||
%team1Client = "";
|
||||
%team1ClientScore = "";
|
||||
%team1ClientFlags = "";
|
||||
%col1Style = "";
|
||||
if (%index < $TeamRank[1, count])
|
||||
{
|
||||
%team1Client = $TeamRank[1, %index];
|
||||
%team1ClientScore = %team1Client.score $= "" ? 0 : %team1Client.score;
|
||||
%team1ClientFlags = %team1Client.flagCount - 1;
|
||||
if (%team1ClientFlags <= 0)
|
||||
%team1ClientFlags = "";
|
||||
if ( %team1Client == %team1ClientMostFlags )
|
||||
%col1Style = "<color:00dc00>";
|
||||
else if ( %team1Client == %client )
|
||||
%col1Style = "<color:dcdcdc>";
|
||||
}
|
||||
|
||||
//get the team2 client info
|
||||
%team2Client = "";
|
||||
%team2ClientScore = "";
|
||||
%team2ClientFlags = "";
|
||||
%col2Style = "";
|
||||
if (%index < $TeamRank[2, count])
|
||||
{
|
||||
%team2Client = $TeamRank[2, %index];
|
||||
%team2ClientScore = %team2Client.score $= "" ? 0 : %team2Client.score;
|
||||
%team2ClientFlags = %team2Client.flagCount - 1;
|
||||
if (%team2ClientFlags <= 0)
|
||||
%team2ClientFlags = "";
|
||||
if ( %team2Client == %team2ClientMostFlags )
|
||||
%col2Style = "<color:00dc00>";
|
||||
else if ( %team2Client == %client )
|
||||
%col2Style = "<color:dcdcdc>";
|
||||
}
|
||||
|
||||
|
||||
//if the client is not an observer, send the message
|
||||
if (%client.team != 0)
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:10, 310><spush>%7\t<clip:150>%1</clip><rmargin:200><just:right>%2<rmargin:260><just:right>%3<spop><rmargin:500><just:left>\t%8<clip:150>%4</clip><just:right>%5<rmargin:560><just:right>%6',
|
||||
%team1Client.name, %team1ClientScore, %team1ClientFlags, %team2Client.name, %team2ClientScore, %team2ClientFlags, %col1Style, %col2Style );
|
||||
}
|
||||
//else for observers, create an anchor around the player name so they can be observed
|
||||
else
|
||||
{
|
||||
//this is lame, but we can only have up to %9 args
|
||||
if (%team2Client == %team2ClientMostFlags)
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:10, 310><spush>%7\t<clip:150><a:gamelink\t%8>%1</a></clip><rmargin:200><just:right>%2<rmargin:260><just:right>%3<spop><rmargin:500><just:left>\t<color:00dc00><clip:150><a:gamelink\t%9>%4</a></clip><just:right>%5<rmargin:560><just:right>%6',
|
||||
%team1Client.name, %team1ClientScore, %team1ClientFlags, %team2Client.name, %team2ClientScore, %team2ClientFlags, %col1Style, %team1Client, %team2Client );
|
||||
}
|
||||
else if (%team2Client == %client)
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:10, 310><spush>%7\t<clip:150><a:gamelink\t%8>%1</a></clip><rmargin:200><just:right>%2<rmargin:260><just:right>%3<spop><rmargin:500><just:left>\t<color:dcdcdc><clip:150><a:gamelink\t%9>%4</a></clip><just:right>%5<rmargin:560><just:right>%6',
|
||||
%team1Client.name, %team1ClientScore, %team1ClientFlags, %team2Client.name, %team2ClientScore, %team2ClientFlags, %col1Style, %team1Client, %team2Client );
|
||||
}
|
||||
else
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:10, 310><spush>%7\t<clip:150><a:gamelink\t%8>%1</a></clip><rmargin:200><just:right>%2<rmargin:260><just:right>%3<spop><rmargin:500><just:left>\t<clip:150><a:gamelink\t%9>%4</a></clip><just:right>%5<rmargin:560><just:right>%6',
|
||||
%team1Client.name, %team1ClientScore, %team1ClientFlags, %team2Client.name, %team2ClientScore, %team2ClientFlags, %col1Style, %team1Client, %team2Client );
|
||||
}
|
||||
}
|
||||
|
||||
%index++;
|
||||
}
|
||||
|
||||
// Tack on the list of observers:
|
||||
%observerCount = 0;
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl.team == 0)
|
||||
%observerCount++;
|
||||
}
|
||||
|
||||
if (%observerCount > 0)
|
||||
{
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, "");
|
||||
%index++;
|
||||
messageClient(%client, 'SetLineHud', "", %tag, %index, '<tab:10, 310><spush><font:Univers Condensed:22>\tOBSERVERS (%1)<rmargin:260><just:right>TIME<spop>', %observerCount);
|
||||
%index++;
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
//if this is an observer
|
||||
if (%cl.team == 0)
|
||||
{
|
||||
%obsTime = getSimTime() - %cl.observerStartTime;
|
||||
%obsTimeStr = %game.formatTime(%obsTime, false);
|
||||
messageClient( %client, 'SetLineHud', "", %tag, %index, '<tab:20, 310>\t<clip:150>%1</clip><rmargin:260><just:right>%2',
|
||||
%cl.name, %obsTimeStr );
|
||||
%index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//clear the rest of Hud so we don't get old lines hanging around...
|
||||
messageClient( %client, 'ClearHud', "", %tag, %index );
|
||||
}
|
||||
1539
docs/base/@vl2/scripts.vl2/scripts/Training1.cs
Normal file
1539
docs/base/@vl2/scripts.vl2/scripts/Training1.cs
Normal file
File diff suppressed because it is too large
Load diff
1416
docs/base/@vl2/scripts.vl2/scripts/Training2.cs
Normal file
1416
docs/base/@vl2/scripts.vl2/scripts/Training2.cs
Normal file
File diff suppressed because it is too large
Load diff
567
docs/base/@vl2/scripts.vl2/scripts/Training3.cs
Normal file
567
docs/base/@vl2/scripts.vl2/scripts/Training3.cs
Normal file
|
|
@ -0,0 +1,567 @@
|
|||
// don't want this executing when building graphs
|
||||
if($OFFLINE_NAV_BUILD)
|
||||
return;
|
||||
|
||||
// script fror training mission 3
|
||||
//-------------------------------------------------------------
|
||||
|
||||
//init
|
||||
//-------------------------------------------------------------
|
||||
echo("Running Mission 3 Script");
|
||||
activatePackage(Training3);
|
||||
|
||||
|
||||
$numberOfEnemies[1] = 5;
|
||||
$numberOfEnemies[2] = 7;
|
||||
$numberOfEnemies[3] = 7;
|
||||
$numberOfTeammates = 0;
|
||||
$missionBotSkill[1] = 0.0;
|
||||
$missionBotSkill[2] = 0.5;
|
||||
$missionBotSkill[3] = 0.9;
|
||||
$missionEnemyThreshold[1] = 0;
|
||||
$missionEnemyThreshold[2] = 3;
|
||||
$missionEnemyThreshold[3] = 7;
|
||||
|
||||
|
||||
//the Scout is very important
|
||||
$Shrike = nameToId("Ride");
|
||||
// activate the wings on the flyer
|
||||
$Shrike.playThread($ActivateThread, "activate");
|
||||
|
||||
// for the distance checking
|
||||
addMessageCallback('MsgWeaponMount', playerMountWeapon);
|
||||
|
||||
package training3 {
|
||||
//===============================================begin the training 3 package stuff====
|
||||
|
||||
function SinglePlayerGame::initGameVars(%game)
|
||||
{
|
||||
// for many of the objectives we are going to periodically
|
||||
// check the players distance vs some object
|
||||
// you could do this much prettier but its going to be very specific
|
||||
// so a cut and paste eyesore will be fine
|
||||
echo("initializing training3 game vars");
|
||||
%game.base = nameToId("Shield");
|
||||
%game.baseLocation = game.base.getTransform();
|
||||
%game.base.threshold = 400;
|
||||
%game.end = nameToId("PlayerDropPoint");
|
||||
%game.endLocation = game.end.getTransform();
|
||||
}
|
||||
|
||||
function MP3Audio::play(%this)
|
||||
{
|
||||
//too bad...no mp3 in training
|
||||
}
|
||||
|
||||
// force always scope for testing
|
||||
function singlePlayerGame::onAIRespawn(%game, %client)
|
||||
{
|
||||
if(! isObject("MissionCleanup/TeamDrops2")) {
|
||||
//this is the snippet of script from default games that puts teamdrops
|
||||
// into the mission cleanup group...slightly modified to suit our needs
|
||||
%dropSet = new SimSet("TeamDrops2");
|
||||
MissionCleanup.add(%dropSet);
|
||||
|
||||
%spawns = nameToID("MissionGroup/Teams/team2/TeamDrops");
|
||||
if(%spawns != -1)
|
||||
{
|
||||
%count = %spawns.getCount();
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
%dropSet.add(%spawns.getObject(%i));
|
||||
}
|
||||
}
|
||||
|
||||
// error("Forcing AI Scope!!!!!!!!!!!!!");
|
||||
// %client.player.scopeToClient($player);
|
||||
|
||||
parent:: onAIRespawn(%game, %client);
|
||||
}
|
||||
|
||||
function getTeammateGlobals()
|
||||
{
|
||||
echo("You have no teammates in this mission");
|
||||
}
|
||||
|
||||
function toggleScoreScreen(%val)
|
||||
{
|
||||
if ( %val )
|
||||
//error("No Score Screen in training.......");
|
||||
messageClient($player, 0, $player.miscMsg[noScoreScreen]);
|
||||
}
|
||||
|
||||
function toggleCommanderMap(%val)
|
||||
{
|
||||
if ( %val )
|
||||
messageClient($player, 0, $player.miscMsg[noCC]);
|
||||
}
|
||||
|
||||
function toggleTaskListDlg( %val )
|
||||
{
|
||||
if ( %val )
|
||||
messageClient( $player, 0, $player.miscMsg[noTaskListDlg] );
|
||||
}
|
||||
|
||||
function toggleNetDisplayHud( %val )
|
||||
{
|
||||
// Hello, McFly? This is training! There's no net in training!
|
||||
}
|
||||
|
||||
function voiceCapture( %val )
|
||||
{
|
||||
// Uh, who do you think you are talking to?
|
||||
}
|
||||
|
||||
function giveall()
|
||||
{
|
||||
error("When the going gets tough...wussies like you start cheating!");
|
||||
messageClient($player, 0, "Cheating eh? What\'s next? Camping?");
|
||||
}
|
||||
|
||||
function kobayashi_maru()
|
||||
{
|
||||
$testcheats = true;
|
||||
commandToServer('giveAll');
|
||||
}
|
||||
|
||||
function AIEngageTask::assume(%task, %client)
|
||||
{
|
||||
Parent::assume(%task, %client);
|
||||
|
||||
if(%client.team != $playerTeam)
|
||||
game.biodermAssume(%client);
|
||||
}
|
||||
|
||||
function countTurretsAllowed(%type)
|
||||
{
|
||||
return $TeamDeployableMax[%type];
|
||||
}
|
||||
|
||||
|
||||
function FlipFlop::objectiveInit(%data, %flipflop)
|
||||
{
|
||||
}
|
||||
|
||||
function ClientCmdSetHudMode(%mode, %type, %node)
|
||||
{
|
||||
parent::ClientCmdSetHudMode(%mode, %type, %node);
|
||||
//TrainingMap.push();
|
||||
}
|
||||
|
||||
|
||||
// get the ball rolling
|
||||
function startCurrentMission(%game)
|
||||
{
|
||||
|
||||
//just in case
|
||||
setFlipFlopSkins();
|
||||
schedule(5000, %game, opening);
|
||||
schedule(30000, %game, objectiveDistanceChecks);
|
||||
updateTrainingObjectiveHud(obj1);
|
||||
|
||||
if($pref::trainingDifficulty == 1) {
|
||||
nameToId(BackEnterSentry).hide(true);
|
||||
freeTarget(nameToId(BackEnterSentry).getTarget());
|
||||
}
|
||||
}
|
||||
|
||||
function opening()
|
||||
{
|
||||
if(game.vehicleMount)
|
||||
return;
|
||||
doText(T3_01);
|
||||
//doText(T3_02);
|
||||
doText(T3_cloaking);
|
||||
doText(T3_tipCloaking01);
|
||||
doText(T3_tipCloaking02);
|
||||
}
|
||||
|
||||
function SinglePlayerGame::equip(%game, %player)
|
||||
{
|
||||
//ya start with nothing...NOTHING!
|
||||
%player.clearInventory();
|
||||
|
||||
for(%i =0; %i<$InventoryHudCount; %i++)
|
||||
%player.client.setInventoryHudItem($InventoryHudData[%i, itemDataName], 0, 1);
|
||||
%player.client.clearBackpackIcon();
|
||||
|
||||
//echo("Light Assassin Config");
|
||||
|
||||
%player.setArmor("Light");
|
||||
|
||||
%player.setInventory(CloakingPack, 1);
|
||||
|
||||
%player.setInventory(RepairKit,1);
|
||||
%player.setInventory(FlashGrenade,5);
|
||||
%player.setInventory(Mine,3);
|
||||
|
||||
%player.setInventory(Plasma, 1);
|
||||
%player.setInventory(PlasmaAmmo, 20);
|
||||
%player.setInventory(Disc,1);
|
||||
%player.setInventory(DiscAmmo, 15);
|
||||
%player.setInventory(TargetingLaser, 1);
|
||||
%player.setInventory(ShockLance,1);
|
||||
%player.weaponCount = 3;
|
||||
|
||||
%player.use("Disc");
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
function singlePlayerGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
%teamCount = getPlayersOnTeam(%clVictim.team);
|
||||
//echo("Team count:" SPC %teamCount);
|
||||
%maintNum = $missionEnemyThreshold[$pref::trainingDifficulty];
|
||||
//echo("Maintain:" SPC %maintNum);
|
||||
|
||||
%clVictim.useSpawnSphere = true;
|
||||
|
||||
// this will respawn the AI if
|
||||
if( %teamCount < %maintNum )
|
||||
DefaultGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement);
|
||||
|
||||
}
|
||||
|
||||
function singleplayerGame::pickTeamSpawn(%game, %client, %respawn)
|
||||
{
|
||||
if(%client.useSpawnSphere)
|
||||
DefaultGame::pickTeamSpawn(%game, %client.team);
|
||||
else
|
||||
parent::pickTeamSpawn(%game, %client, %respawn);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function clientCmdVehicleMount()
|
||||
{
|
||||
if(game.vehicleMount++ == 1) {
|
||||
doText(Any_Waypoint01, 2000);
|
||||
//doText(Any_Waypoint03, 4000);
|
||||
doText(T3_tipPiloting01);
|
||||
doText(T3_02);
|
||||
doText(T3_05);
|
||||
schedule(4000, game, setWaypointAt, game.baseLocation, "Icefell Ridge Base");
|
||||
updateTrainingObjectiveHud(obj2);
|
||||
|
||||
game.pilotingTips = schedule(60000, game, PilotingTips);
|
||||
}
|
||||
if(game.phase == 4) {
|
||||
setWaypointAt(game.endLocation, "Extraction Point");
|
||||
updateTrainingObjectiveHud(obj3);
|
||||
doText(T3_11);
|
||||
doText(T3_12);
|
||||
game.phase = 5;
|
||||
|
||||
if(!nameToId(AATurretGen).isDisabled())
|
||||
doText(t3_12a);
|
||||
}
|
||||
}
|
||||
|
||||
function RepairPack::onCollision(%this,%obj,%col)
|
||||
{
|
||||
if($player.player.getInventory(CloakingPack) && $player.player.getDamageLevel() > 0.2
|
||||
&& !game.msgtipEquip && %col == $player.player) {
|
||||
game.msgTipEquip = true;
|
||||
doText(T3_tipEquipment02);
|
||||
}
|
||||
|
||||
parent::onCollision(%this,%obj,%col);
|
||||
}
|
||||
|
||||
|
||||
// 86 the vehicle removal on dying
|
||||
function vehicleAbandonTimeOut(%vehicle)
|
||||
{
|
||||
// dont mess it up
|
||||
}
|
||||
|
||||
function playerMountWeapon(%tag, %text, %image, %player, %slot)
|
||||
{
|
||||
if( game.firstTime++ < 2)
|
||||
return; // initial weapon mount doesnt count
|
||||
|
||||
if(%image.getName() $= "ShockLanceImage" && !game.msgShock) {
|
||||
game.msgShock = true;
|
||||
//doText(T3_TipShockLance);
|
||||
}
|
||||
}
|
||||
|
||||
function FlipFlop::playerTouch(%data, %flipFlop, %player )
|
||||
{
|
||||
|
||||
//echo("singlePlayer::playerTouchFlipFlop");
|
||||
%client = %player.client;
|
||||
%flipTeam = %flipflop.team;
|
||||
|
||||
if(%flipTeam == %client.team)
|
||||
return false;
|
||||
|
||||
nameToId(Shield).delete();
|
||||
|
||||
//just the sound
|
||||
messageAll( 'MsgClaimFlipFlop', '~wfx/misc/flipflop_taken.wav', %client.name, Game.cleanWord( %flipflop.name ), $TeamName[%client.team] );
|
||||
|
||||
if(%player == $player.player)
|
||||
schedule( 1500, game, flipFlopFlipped);
|
||||
|
||||
objectiveDistanceChecks();
|
||||
|
||||
//change the skin on the switch to claiming team's logo
|
||||
setTargetSkin(%flipflop.getTarget(), $teamSkin[%player.team]);
|
||||
setTargetSensorGroup(%flipflop.getTarget(), %player.team);
|
||||
|
||||
// convert the resources associated with the flipflop
|
||||
Game.claimFlipflopResources(%flipflop, %client.team);
|
||||
|
||||
Game.AIplayerCaptureFlipFlop(%player, %flipflop);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function scoutFlyer::onRemove(%this, %obj)
|
||||
{
|
||||
error("scoutFlyer::onRemove("@ %obj@") called");
|
||||
if ( ! isObject( ServerConnection ) )
|
||||
return;
|
||||
if(%obj == $Shrike ) {
|
||||
// we dont want the player to die hitting the ground
|
||||
cancel(game.pilotingTips);
|
||||
$player.player.invincible = true;
|
||||
missionFailed($player.miscMsg[training3shrikeLoss]);
|
||||
}
|
||||
}
|
||||
|
||||
function WeaponImage::onMount(%this,%obj,%slot)
|
||||
{
|
||||
messageClient(%obj.client, 'MsgWeaponMount', "", %this, %obj, %slot);
|
||||
Parent::onMount(%this,%obj,%slot);
|
||||
}
|
||||
|
||||
function GeneratorLarge::onDestroyed(%dataBlock, %destroyedObj, %prevState)
|
||||
{
|
||||
if(%destroyedObj == nameToId("PrisonGen") && !game.msgGenDestroyed)
|
||||
{
|
||||
game.msgGenDestroyed = true;
|
||||
doText(Any_ObjComplete01);
|
||||
updateTrainingObjectiveHud(obj6);
|
||||
}
|
||||
else if(%destroyedObj == nameToId(AATurretGen))
|
||||
$player.AAGenWaypoint.delete();
|
||||
|
||||
}
|
||||
|
||||
// If the forcefield is shot we play this little wav file
|
||||
function ProjectileData::onCollision(%data, %projectile, %targetObject, %modifier, %position, %normal)
|
||||
{
|
||||
//error("ProjectileData::onCollision("@%data@", "@%projectile@", "@%targetObject@", "@%modifier@", "@%position@", "@%normal@")");
|
||||
parent::onCollision(%data, %projectile, %targetObject, %modifier, %position, %normal);
|
||||
|
||||
if(game.msgGenDestroyed)
|
||||
return;
|
||||
else if(%targetObject.getDataBlock().getName() $= nameToId(Shield).dataBlock) {
|
||||
//error("someone shot the force field");
|
||||
if(%projectile.sourceObject == $player.player){
|
||||
//error("it was you f00");
|
||||
if(!game.msgMustDestroyGen) {
|
||||
game.msgMustDestroyGen = true;
|
||||
doText(T3_07b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function addTraining3Waypoints()
|
||||
{
|
||||
//do the hud updating also
|
||||
$player.currentWaypoint.delete();
|
||||
updateTrainingObjectiveHud(obj5);
|
||||
|
||||
%Training3WaypointsGroup = new simGroup(Training3Waypoints);
|
||||
MissionCleanup.add(%Training3WaypointsGroup);
|
||||
|
||||
%waypoint = new WayPoint() {
|
||||
position = nameToId(FF).position;
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
dataBlock = "WayPointMarker";
|
||||
lockCount = "0";
|
||||
homingCount = "0";
|
||||
name = "Control Point";
|
||||
team = "0";
|
||||
locked = "true";
|
||||
};
|
||||
%Training3WaypointsGroup.add(%waypoint);
|
||||
|
||||
%waypoint = new WayPoint() {
|
||||
position = nameToId(BaseGen).getWorldBoxCenter();
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
dataBlock = "WayPointMarker";
|
||||
lockCount = "0";
|
||||
homingCount = "0";
|
||||
name = "Main Base Power";
|
||||
team = "0";
|
||||
locked = "true";
|
||||
};
|
||||
%Training3WaypointsGroup.add(%waypoint);
|
||||
|
||||
%waypoint = new WayPoint() {
|
||||
position = nameToId(sensorNetGen).getWorldBoxCenter();
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
dataBlock = "WayPointMarker";
|
||||
lockCount = "0";
|
||||
homingCount = "0";
|
||||
name = "Sensor Power";
|
||||
team = "0";
|
||||
locked = "true";
|
||||
};
|
||||
%Training3WaypointsGroup.add(%waypoint);
|
||||
|
||||
%waypoint = new WayPoint() {
|
||||
position = nameToId(AATurretGen).getWorldBoxCenter();
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
dataBlock = "WayPointMarker";
|
||||
lockCount = "0";
|
||||
homingCount = "0";
|
||||
name = "AntiAircraft Turret Power";
|
||||
team = "0";
|
||||
locked = "true";
|
||||
};
|
||||
//%Training3WaypointsGroup.add(%waypoint);
|
||||
$player.AAGenWaypoint = %waypoint;
|
||||
|
||||
%waypoint = new WayPoint() {
|
||||
position = nameToId(prisonGen).getWorldBoxCenter();
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
dataBlock = "WayPointMarker";
|
||||
lockCount = "0";
|
||||
homingCount = "0";
|
||||
name = "Forcefield Power";
|
||||
team = "0";
|
||||
locked = "true";
|
||||
};
|
||||
%Training3WaypointsGroup.add(%waypoint);
|
||||
}
|
||||
|
||||
function RandomPilotingTips()
|
||||
{
|
||||
// this is unused as testers claimed it sounded 'disjointed and random'
|
||||
|
||||
if(pilotingTips())
|
||||
game.pilotingTips = schedule(20000, $player.player, RandomPilotingTips);
|
||||
}
|
||||
|
||||
function pilotingTips()
|
||||
{
|
||||
%num = 2;
|
||||
if(game.Training3tips == %num)
|
||||
return false;
|
||||
%tip = getRandom(1, %num);
|
||||
if( game.training3TipUsed[%tip] )
|
||||
return true;
|
||||
switch(%tip){
|
||||
case 1:
|
||||
doText(T3_tipfreelook);
|
||||
case 2:
|
||||
doText(T3_tipPiloting04);
|
||||
// case 3:
|
||||
// doText(T3_tipPiloting02);
|
||||
// case 4:
|
||||
// doText(T3_tipUnderwater01);
|
||||
}
|
||||
game.training3Tips++;
|
||||
game.training3TipUsed[%tip] = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//misc
|
||||
//-------------------------------------------------------------
|
||||
|
||||
function objectiveDistanceChecks()
|
||||
{
|
||||
%playerPos = $player.player.getTransform();
|
||||
if(!%playerPos) {
|
||||
schedule(2000, game, objectiveDistanceChecks);
|
||||
return;
|
||||
}
|
||||
|
||||
%cont = true;
|
||||
%basedistance = vectorDist( %playerPos, game.baseLocation );
|
||||
|
||||
if(game.phase == 0 && %basedistance < game.base.threshold ) {
|
||||
doText(T3_06, 4000);
|
||||
doText(T3_tipCloaking03);
|
||||
doText(T3_07);
|
||||
game.phase = 1;
|
||||
%cont = false;
|
||||
cancel(game.pilotingTips);
|
||||
addTraining3Waypoints();
|
||||
game.respawnPoint = 1;
|
||||
|
||||
}
|
||||
if(game.phase == 5 && vectorDist(%playerPos, game.baseLocation) > 1000 )
|
||||
{
|
||||
game.phase = 6;
|
||||
serverConnection.setBlackout(true, 3000);
|
||||
schedule(3000, game, finishMission);
|
||||
}
|
||||
|
||||
if(%cont)
|
||||
schedule(2000, game, objectiveDistanceChecks);
|
||||
}
|
||||
|
||||
function finishMission()
|
||||
{
|
||||
$shrike.setFrozenState(true);
|
||||
nameToId(AATurretGen).setDamageState(Disabled); //hack! cheating!
|
||||
doText(T3_13);
|
||||
//messageAll(0, "Nya, nya, nyanyanay...this missions oh-ohover!");
|
||||
missionComplete($player.miscMsg[training3win]);
|
||||
%cont = false;
|
||||
}
|
||||
|
||||
|
||||
function flipFlopFlipped()
|
||||
{
|
||||
//error("flip flop flipped");
|
||||
if(!game.flipFlopped) {
|
||||
game.flipFlopped = true;
|
||||
|
||||
// if we need a message modify this.
|
||||
//messageTeam( %client.team, 'MsgClaimFlipFlop', '\c2%1 claimed %2 for %3.~wfx/misc/flipflop_taken.wav', %client.name, Game.cleanWord( %flipflop.name ), $TeamName[%client.team] );
|
||||
|
||||
doText(T3_09, 8000);
|
||||
doText(T3_10);
|
||||
game.phase = 4;
|
||||
|
||||
if(!nameToId(AATurretGen).isDisabled())
|
||||
doText(t3_09a);
|
||||
|
||||
// new waypoint at the shrike
|
||||
setWaypointAt($shrike.getTransform(), "Shrike");
|
||||
updateTrainingObjectiveHud(obj4);
|
||||
|
||||
//get rid of the other waypoints
|
||||
nameToId(Training3Waypoints).delete();
|
||||
}
|
||||
}
|
||||
|
||||
// Mission area is pointless this time out
|
||||
function SinglePlayerGame::leaveMissionArea(%game, %player)
|
||||
{
|
||||
}
|
||||
function SinglePlayerGame::enterMissionArea(%game, %player)
|
||||
{
|
||||
}
|
||||
|
||||
//===============================================END the training 3 package stuff====
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
988
docs/base/@vl2/scripts.vl2/scripts/Training4.cs
Normal file
988
docs/base/@vl2/scripts.vl2/scripts/Training4.cs
Normal file
|
|
@ -0,0 +1,988 @@
|
|||
// don't want this executing when building graphs
|
||||
if($OFFLINE_NAV_BUILD)
|
||||
return;
|
||||
|
||||
echo("Running Mission 4 Script");
|
||||
activatePackage(Training4);
|
||||
activatePackage(singlePlayerMissionAreaEnforce);
|
||||
|
||||
|
||||
//special sound
|
||||
datablock AudioProfile(HudFlashSound)
|
||||
{
|
||||
filename = "gui/buttonover.wav";
|
||||
description = AudioDefault3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
$numberOfEnemies[1] = 0;
|
||||
$numberOfEnemies[2] = 0;
|
||||
$numberOfEnemies[3] = 0;
|
||||
|
||||
// Mission Variables
|
||||
$numberOfWaves[1] = 3;
|
||||
$numberOfWaves[2] = 5;
|
||||
$numberOfWaves[3] = 7;
|
||||
|
||||
$numberInWave[1] = 3;
|
||||
$numberInWave[2] = 5;
|
||||
$numberInWave[3] = 7;
|
||||
|
||||
$delayBeforeFirstWave[1] = 300000;
|
||||
$delayBeforeFirstWave[2] = 200000;
|
||||
$delayBeforeFirstWave[3] = 20000;
|
||||
|
||||
$missionBotSkill[1] = 0.0;
|
||||
$missionBotSkill[2] = 0.5;
|
||||
$missionBotSkill[3] = 0.8;
|
||||
|
||||
$numberOfTeammates = 2;
|
||||
|
||||
package training4 {
|
||||
//===============================================begin the training 4 package stuff====
|
||||
function getTeammateGlobals()
|
||||
{
|
||||
$TeammateWarnom0 = "Firecrow";
|
||||
$teammateskill0 = 0.5;
|
||||
$teammateVoice0 = Fem3;
|
||||
$teammateEquipment0 = 0;
|
||||
$teammateGender0 = Female;
|
||||
|
||||
$TeammateWarnom1 = "Proteus";
|
||||
$teammateSkill1 = 0.5;
|
||||
$teammateVoice1 = Male4;
|
||||
$teammateEquipment1 = 0;
|
||||
$teammateGender1 = Male;
|
||||
}
|
||||
|
||||
|
||||
function MP3Audio::play(%this)
|
||||
{
|
||||
//too bad...no mp3 in training
|
||||
}
|
||||
|
||||
|
||||
function ClientCmdSetHudMode(%mode, %type, %node)
|
||||
{
|
||||
parent::ClientCmdSetHudMode(%mode, %type, %node);
|
||||
//TrainingMap.push();
|
||||
}
|
||||
|
||||
// get the ball rolling
|
||||
function startCurrentMission(%game)
|
||||
{
|
||||
game.equip($player.player);
|
||||
|
||||
if($pref::TrainingDifficulty == 3)
|
||||
updateTrainingObjectiveHud(obj10);
|
||||
else{
|
||||
schedule(5000, game, repairSensorTower);
|
||||
updateTrainingObjectiveHud(obj1);
|
||||
}
|
||||
$player.beginSpawn = schedule($delayBeforeFirstWave[$pref::TrainingDifficulty], %game, spawnWave, 1);
|
||||
$AIDisableChat = true;
|
||||
game.missionTime = getSimTime();
|
||||
activateskillSpecificTrainingSettings();
|
||||
}
|
||||
|
||||
function activateskillSpecificTrainingSettings()
|
||||
{
|
||||
%skill = $pref::TrainingDifficulty;
|
||||
|
||||
// all
|
||||
nameToId("Team1SensorLargePulse1").setDamageLevel(1.5);
|
||||
nameToId("Team1SensorLargePulse2").setDamageLevel(1.5);
|
||||
|
||||
//skill 2 & 3 :
|
||||
//no forcefield, no upstairs Inventory deploy, aaturret(in the mis file)
|
||||
if(%skill > 1) {
|
||||
|
||||
%invDepObj = findObjByDescription("Deploy Upstairs Station", 1);
|
||||
removeDescribedObj(%invDepObj, 1);
|
||||
}
|
||||
// skill 3: no turret, no destroy turret or upstairs gen objectives
|
||||
if(%skill > 2) {
|
||||
nameToId(Team1TurretBaseLarge1).hide(true);
|
||||
freeTarget(nameToId(Team1TurretBaseLarge1).getTarget());
|
||||
nameToId(GenForceField).delete();
|
||||
}
|
||||
}
|
||||
|
||||
function countTurretsAllowed(%type)
|
||||
{
|
||||
return $TeamDeployableMax[%type];
|
||||
}
|
||||
|
||||
function giveall()
|
||||
{
|
||||
error("When the going gets tough...wussies like you start cheating!");
|
||||
messageClient($player, 0, "Cheating eh? What\'s next? Camping?");
|
||||
}
|
||||
|
||||
function kobayashi_maru()
|
||||
{
|
||||
$testcheats = true;
|
||||
commandToServer('giveAll');
|
||||
}
|
||||
|
||||
|
||||
function pickEquipment()
|
||||
{
|
||||
return getRandom(10);
|
||||
}
|
||||
|
||||
function AIEngageTask::assume(%task, %client)
|
||||
{
|
||||
Parent::assume(%task, %client);
|
||||
|
||||
if(%client.team != $playerTeam)
|
||||
game.biodermAssume(%client);
|
||||
}
|
||||
|
||||
function toggleScoreScreen(%val)
|
||||
{
|
||||
if ( %val )
|
||||
messageClient($player, 0, $player.miscMsg[noScoreScreen]);
|
||||
}
|
||||
|
||||
function toggleNetDisplayHud( %val )
|
||||
{
|
||||
// Hello, McFly? This is training! There's no net in training!
|
||||
}
|
||||
|
||||
function voiceCapture( %val )
|
||||
{
|
||||
// Uh, who do you think you are talking to?
|
||||
}
|
||||
|
||||
function singlePlayerGame::pickTeamSpawn(%game, %client)
|
||||
{
|
||||
if(%client.team == $player.team)
|
||||
return parent::pickTeamSpawn(%game, %client);
|
||||
%dp = game.pickRandomDropPoint(%client);
|
||||
InitContainerRadiusSearch(%dp.position, 2, $TypeMasks::PlayerObjectType);
|
||||
if( containerSearchNext() ) {
|
||||
//echo("Too close object, picking again?");
|
||||
if(game.DPRetries++ > 100)
|
||||
return "0 0 300";
|
||||
else return game.pickTeamSpawn(%client);
|
||||
}
|
||||
|
||||
else {
|
||||
game.DPRetries = 0;
|
||||
return %dp.getTransform();
|
||||
}
|
||||
}
|
||||
|
||||
function singlePlayerGame::pickRandomDropPoint(%game, %client)
|
||||
{
|
||||
error("picking random point for "@%client);
|
||||
%group = nameToID("MissionGroup/Teams/team" @ %client.team @ "/DropPoints");
|
||||
%num = %group.getCount();
|
||||
%random = getRandom(1,%num);
|
||||
%dp = %group.getObject( %random );
|
||||
|
||||
return %dp;
|
||||
}
|
||||
|
||||
function spawnSinglePlayer()
|
||||
{
|
||||
$player.lives--;
|
||||
|
||||
%spawn = DefaultGame::pickTeamSpawn(game, $playerTeam);
|
||||
game.createPlayer($player, %spawn);
|
||||
$player.setControlObject($player.player);
|
||||
//messageClient($player, 0, "Respawns Remaining: "@$player.lives);
|
||||
game.equip($player.player, 0);
|
||||
}
|
||||
|
||||
function Generator::onDisabled(%data, %obj, %prevState)
|
||||
{
|
||||
Parent::onDisabled(%data, %obj, %prevState);
|
||||
if(%obj == nameToId(BaseGen)) //its our primary gen
|
||||
{
|
||||
doText(T4_Warning02);
|
||||
game.MissionCounter = schedule(60000, 0, MissionFailedTimer);
|
||||
setWaypointAt(%obj.position, "Repair Generator");
|
||||
clockHud.setTime(1);
|
||||
updateTrainingObjectiveHud(obj5);
|
||||
}
|
||||
else if($pref::trainingDifficulty < 2)
|
||||
{
|
||||
if (getRandom() < 0.5 )
|
||||
doText(T4_ForceFields01);
|
||||
else doText(T4_FFGenDown01);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function Generator::onEnabled(%data, %obj, %prevState)
|
||||
{
|
||||
Parent::onEnabled(%data, %obj, %prevState);
|
||||
//error("Gen up somewhere");
|
||||
if(%obj == nameToId(BaseGen)) {
|
||||
cancel(game.MissionCounter);
|
||||
objectiveHud.trainingTimer.setVisible(false);
|
||||
updateTrainingObjectiveHud(obj10);
|
||||
$player.currentWaypoint.delete();
|
||||
cancel($player.player.trainingTimerHide);
|
||||
doText(T4_GenUp);
|
||||
checkForWin();
|
||||
//error("its the main gen");
|
||||
|
||||
//restore the clock
|
||||
%time = getSimTime() - game.missionTime;
|
||||
%dif = %time /60000;
|
||||
clockHud.setTime(%dif * -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// mortar mount
|
||||
function playerMountWeapon(%tag, %text, %image, %player, %slot)
|
||||
{
|
||||
if( game.firstTime++ < 2)
|
||||
return; // initial weapon mount doesnt count
|
||||
if(%image.getName() $= "MortarImage" && !game.msgMortar) {
|
||||
game.msgMortar = true;
|
||||
doText(T4_TipMortar);
|
||||
}
|
||||
}
|
||||
|
||||
// station use
|
||||
function StationInvEnter(%a1, %a2, %data, %obj, %colObj)
|
||||
{
|
||||
if(%colObj != $player.player)
|
||||
return;
|
||||
//clearQueue();
|
||||
//if(!game.blowoff)
|
||||
//blowoff();
|
||||
if(game.msgEnterInv++ == 1){
|
||||
doText(T4_tipDefense05);
|
||||
}
|
||||
}
|
||||
|
||||
function stationTrigger::onEnterTrigger(%data, %obj, %colObj)
|
||||
{
|
||||
Parent::onEnterTrigger(%data, %obj, %colObj);
|
||||
messageClient(%colObj.client, 'msgEnterInvStation', "", %data, %obj, %colObj);
|
||||
}
|
||||
|
||||
|
||||
function serverCmdBuildClientTask(%client, %task, %team)
|
||||
{
|
||||
parent::serverCmdBuildClientTask(%client, %task, %team);
|
||||
error("serverCmdBuildClientTask(" @%client@", "@%task@", "@%team@")");
|
||||
|
||||
if($pref::trainingDifficulty > 2)
|
||||
return;
|
||||
|
||||
//hack: we have to get %objective from the parent function
|
||||
// this seems to work
|
||||
%objective = %client.currentAIObjective;
|
||||
error(%client.currentAIObjective SPC %objective.getName());
|
||||
|
||||
if ((%objective.getName() $= "AIORepairObject") &&
|
||||
(%objective.targetObjectId.getDataBlock().getName() $= "SensorLargePulse")) {
|
||||
|
||||
//error("repair order issued and forced");
|
||||
// force the ai
|
||||
%objective.weightLevel1 = 10000;
|
||||
|
||||
if(!game.issueRepairOrder && game.expectingRepairOrder) {
|
||||
game.issueRepairOrder = true;
|
||||
doText(Any_good, 2000);
|
||||
cameraSpiel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function CommanderMapGui::onWake(%this)
|
||||
{
|
||||
|
||||
parent::onWake(%this);
|
||||
if(game.firstSpawn)
|
||||
return;
|
||||
//error("Waking the command map.");
|
||||
messageClient($player, 'commandMapWake', "");
|
||||
}
|
||||
|
||||
function CommanderTree::onCategoryOpen(%this, %category, %open)
|
||||
{
|
||||
//error("commander tree button pressed");
|
||||
parent::onCategoryOpen(%this, %category, %open);
|
||||
|
||||
if(%category $= "Support" && game.ExpectiongSupportButton) {
|
||||
game.ExpectiongSupportButton = false;
|
||||
doText(ANY_check01);
|
||||
doText(T4_03i, 1000);
|
||||
doText(T4_03j);
|
||||
}
|
||||
if(%category $= "Tactical" && game.ExpectiongTacticalButton) {
|
||||
game.ExpectiongTacticalButton = false;
|
||||
doText(ANY_check02);
|
||||
messageClient($player, 0, "Click on the control box after the turrets name to control the turret.");
|
||||
game.CheckingTurretControl = true;
|
||||
}
|
||||
}
|
||||
|
||||
// control turret/camera
|
||||
//------------------------------------------------------------------------------
|
||||
function serverCmdControlObject(%client, %targetId)
|
||||
{
|
||||
parent::serverCmdControlObject(%client, %targetId);
|
||||
|
||||
if(game.firstSpawn)
|
||||
return;
|
||||
|
||||
error("Training 4 serverCmdControlObject");
|
||||
%obj = getTargetObject(%targetId);
|
||||
echo("what do we get back from the parent funtion ? "@%obj);
|
||||
%objType = %obj.getDataBlock().getName();
|
||||
echo("it is a "@%objType);
|
||||
|
||||
if(game.CheckingTurretControl) {
|
||||
if(%objType $= "TurretBaseLarge") {
|
||||
game.CheckingTurretControl = false;
|
||||
schedule(3000, game, turretSpielEnd);
|
||||
//error("Debug: You are controlling a turret f00!");
|
||||
}
|
||||
}
|
||||
// if(game.CheckingCameraControl) {
|
||||
// if(%objType $= "TurretDeployedCamera") {
|
||||
// game.CheckingCameraControl = false;
|
||||
// schedule(3000, $player.player, cameraSpielEnd);
|
||||
// //error("Debug: You are controlling a camera, w00t!");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
function singlePlayerGame::sensorOnRepaired(%obj, %objName)
|
||||
{
|
||||
//error("singlePlayerGame::sensorOnRepaired called");
|
||||
Parent::sensorOnRepaired(%obj, %objName);
|
||||
if(game.expectingTowerRepair && !game.playedOpening && !game.firstSpawn)
|
||||
openingSpiel();
|
||||
}
|
||||
|
||||
function cameraSpiel()
|
||||
{
|
||||
if(game.firstSpawn)
|
||||
return;
|
||||
|
||||
doText(T4_tipCamera01);
|
||||
updateTrainingObjectiveHud(obj3);
|
||||
$player.player.setInventory(CameraGrenade , 8); // cheating just in case the player is a dufas
|
||||
game.CheckingCameraControl = true;
|
||||
|
||||
}
|
||||
|
||||
function CameraGrenadeThrown::onThrow(%this, %camGren)
|
||||
{
|
||||
Parent::onThrow(%this, %camGren);
|
||||
if(game.CheckingCameraControl && !game.firstSpawn) {
|
||||
messageClient($player, 0, "Go back to the command map to access camera view.");
|
||||
game.CheckingCameraControl = false;
|
||||
game.wakeExpectingCamera = true;
|
||||
updateTrainingObjectiveHud(obj2);
|
||||
doText(T4_tipCamera02);
|
||||
}
|
||||
}
|
||||
|
||||
//like mission 1 and 2 there is a spiel at the begining
|
||||
function repairSensorTower()
|
||||
{
|
||||
if(game.firstSpawn)
|
||||
return;
|
||||
|
||||
setWaypointAt(nameToId(Team1SensorLargePulse2).position, "Repair Sensor");
|
||||
game.expectingTowerRepair = true;
|
||||
doText(T4_01);
|
||||
doText(T4_01b);
|
||||
}
|
||||
|
||||
function openingSpiel()
|
||||
{
|
||||
if(game.firstSpawn)
|
||||
return;
|
||||
|
||||
$player.currentWaypoint.delete();
|
||||
updateTrainingObjectiveHud(obj7);
|
||||
|
||||
game.playedOpening = true;
|
||||
//doText(T4_01c);
|
||||
doText(T4_02a);
|
||||
doText(T4_03);
|
||||
doText(T4_02);
|
||||
//doText(T4_02b);
|
||||
doText(T4_03a);
|
||||
}
|
||||
|
||||
function ThreeAEval()
|
||||
{
|
||||
if(game.firstSpawn)
|
||||
return;
|
||||
|
||||
game.wakeExpectingSquadOrder = true;
|
||||
updateTrainingObjectiveHud(obj2);
|
||||
}
|
||||
|
||||
function missionSpawnedAI()
|
||||
{
|
||||
if(!game.firstSpawn) {
|
||||
game.firstspawn = true;
|
||||
doText(ANY_warning05);
|
||||
doText(ANY_warning03); // does a playgui check
|
||||
|
||||
//updateTrainingObjectiveHud(obj5);
|
||||
}
|
||||
}
|
||||
|
||||
function singlePlayerPlayGuiCheck()
|
||||
{
|
||||
if(CommanderMapGui.open)
|
||||
CommanderMapGui.close();
|
||||
|
||||
updateTrainingObjectiveHud(obj10);
|
||||
}
|
||||
|
||||
|
||||
function missionWaveDestroyed(%wave)
|
||||
{
|
||||
if(%wave == 1) {
|
||||
doText(T4_06);
|
||||
doText(T4_tipDefense02);
|
||||
}
|
||||
else if(%wave == 2)
|
||||
doText(T4_08);
|
||||
|
||||
else if( %wave == $numberOfWaves[$pref::TrainingDifficulty] ) {
|
||||
//MessageAll(0, "The last wave is destroyed. This mission would end.");
|
||||
game.allEnemiesKilled = true;
|
||||
checkForWin();
|
||||
}
|
||||
}
|
||||
|
||||
function checkForWin()
|
||||
{
|
||||
if(game.allEnemiesKilled && nameToId(BaseGen).isEnabled()) {
|
||||
clearQueue();
|
||||
doText(T4_10);
|
||||
doText(T4_11);
|
||||
schedule(4000, game, missionComplete, $player.miscMsg[training4win]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function cameraSpielEnd()
|
||||
{
|
||||
if(game.firstSpawn)
|
||||
return;
|
||||
|
||||
doText(T4_tipCamera03);
|
||||
doText(T4_tipCamera04, 2000);
|
||||
doText(T4_controlTurret);
|
||||
game.CheckingTurretControl = true;
|
||||
game.wakeExpectingTurret = true;
|
||||
updateTrainingObjectiveHud(obj4);
|
||||
}
|
||||
|
||||
function turretSpielEnd()
|
||||
{
|
||||
if(game.firstSpawn)
|
||||
return;
|
||||
|
||||
doText(T4_tipObjects);
|
||||
doText(T4_CCend, 4000);
|
||||
|
||||
doText(T4_TipGenerator01, 2000);
|
||||
doText(T4_TipGenerator01a);
|
||||
doText(T4_TipGenerator01b);
|
||||
doText(T4_TipGenerator02, 2000);
|
||||
|
||||
|
||||
doText(T4_tipDefense01);
|
||||
// doText(T4_tipDefense06);
|
||||
// doText(T4_tipDefense07);
|
||||
// doText(T4_tipDefense08);
|
||||
// doText(T4_tipDefense09);
|
||||
updateTrainingObjectiveHud(obj9);
|
||||
//game.blowOff = true; //feel free to use the inventory stations
|
||||
}
|
||||
|
||||
|
||||
// turret deployment advice and messages
|
||||
function singlePlayerFailDeploy(%tag, %message)
|
||||
{
|
||||
%text = detag(%message);
|
||||
%phrase = getWord(%text, 0) SPC getWord(%text, 1);
|
||||
//echo(%phrase);
|
||||
|
||||
switch$(%phrase) {
|
||||
case "\c2Item must":
|
||||
if(!game.tipDep1) {
|
||||
game.tipDep1 = true;
|
||||
doText(T4_tipDeploy01);
|
||||
}
|
||||
case "\c2You cannot":
|
||||
if(!game.tipDep2) {
|
||||
game.tipDep2 = true;
|
||||
doText(T4_tipDeploy02);
|
||||
}
|
||||
case "\c2Interference from":
|
||||
if(!game.tipDepT) {
|
||||
game.tipDepT = true;
|
||||
doText(T4_tipDepTurret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// not really a callback but this prolly goes here
|
||||
function cloakingUnitAdded()
|
||||
{
|
||||
if(game.addedCloak++ < 2) {
|
||||
doText(T4_TipDefense03);
|
||||
}
|
||||
}
|
||||
|
||||
function RepairingObj(%tag, %text, %name, %obj)
|
||||
{
|
||||
if(%obj.getDataBlock().getName() $= "SensorLargePulse" && !game.repairingSensor) {
|
||||
game.repairingSensor = true;
|
||||
schedule(2000, $player.player, doText, T4_01c);
|
||||
}
|
||||
}
|
||||
|
||||
// equipment =======================================================================
|
||||
//===================================================================================
|
||||
|
||||
//there are a plethora of configs in this mission
|
||||
|
||||
function SinglePlayerGame::equip(%game, %player, %set)
|
||||
{
|
||||
if(!isObject(%player))
|
||||
return;
|
||||
|
||||
//ya start with nothing...NOTHING!
|
||||
%player.clearInventory();
|
||||
|
||||
for(%i =0; %i<$InventoryHudCount; %i++)
|
||||
%player.client.setInventoryHudItem($InventoryHudData[%i, itemDataName], 0, 1);
|
||||
%player.client.clearBackpackIcon();
|
||||
|
||||
//error("equping Player "@%player@" with set"@%set);
|
||||
switch (%set)
|
||||
{
|
||||
case 0:
|
||||
//echo("player Heavy");
|
||||
|
||||
%player.setArmor("Heavy");
|
||||
|
||||
%player.setInventory(RepairPack, 1);
|
||||
|
||||
%player.setInventory(RepairKit,1);
|
||||
%player.setInventory(CameraGrenade,8);
|
||||
%player.setInventory(Mine,3);
|
||||
|
||||
%player.setInventory(Chaingun, 1);
|
||||
%player.setInventory(ChaingunAmmo, 200);
|
||||
%player.setInventory(Disc,1);
|
||||
%player.setInventory(DiscAmmo, 15);
|
||||
%player.setInventory(Mortar, 1);
|
||||
%player.setInventory(MortarAmmo, 10);
|
||||
%player.setInventory(Blaster,1);
|
||||
%player.setInventory(GrenadeLauncher,1);
|
||||
%player.setInventory(GrenadeLauncherAmmo,15);
|
||||
%player.setInventory(TargetingLaser, 1);
|
||||
|
||||
%player.use("Disc");
|
||||
%player.weaponCount = 5;
|
||||
|
||||
case 1:
|
||||
//echo("Light Skirmisher");
|
||||
|
||||
%player.setArmor("Light");
|
||||
|
||||
%player.setInventory(EnergyPack, 1);
|
||||
|
||||
%player.setInventory(RepairKit,1);
|
||||
%player.setInventory(ConcussionGrenade,5);
|
||||
|
||||
%player.setInventory(Blaster,1);
|
||||
%player.setInventory(Disc,1);
|
||||
%player.setInventory(DiscAmmo, 15);
|
||||
%player.setInventory(Chaingun, 1);
|
||||
%player.setInventory(ChaingunAmmo, 100);
|
||||
%player.setInventory(TargetingLaser, 1);
|
||||
|
||||
%player.use("Chaingun");
|
||||
%player.weaponCount = 3;
|
||||
|
||||
case 2:
|
||||
//script hook in our equip stuff also
|
||||
cloakingUnitAdded();
|
||||
|
||||
//echo("Light Assassin Config");
|
||||
|
||||
%player.setArmor("Light");
|
||||
|
||||
%player.setInventory(CloakingPack, 1);
|
||||
|
||||
%player.setInventory(RepairKit,1);
|
||||
%player.setInventory(FlashGrenade,5);
|
||||
%player.setInventory(Mine,3);
|
||||
|
||||
%player.setInventory(Plasma, 1);
|
||||
%player.setInventory(PlasmaAmmo, 20);
|
||||
%player.setInventory(Disc,1);
|
||||
%player.setInventory(DiscAmmo, 15);
|
||||
%player.setInventory(ShockLance,1);
|
||||
%player.setInventory(TargetingLaser, 1);
|
||||
|
||||
%player.use("Disc");
|
||||
%player.weaponCount = 3;
|
||||
|
||||
case 3:
|
||||
//echo("Light Sniper");
|
||||
|
||||
%player.setArmor("Light");
|
||||
|
||||
%player.setInventory(EnergyPack, 1);
|
||||
|
||||
%player.setInventory(RepairKit,1);
|
||||
%player.setInventory(ConcussionGrenade,5);
|
||||
|
||||
%player.setInventory(Chaingun,1);
|
||||
%player.setInventory(ChaingunAmmo,100);
|
||||
%player.setInventory(Disc,1);
|
||||
%player.setInventory(DiscAmmo, 15);
|
||||
%player.setInventory(SniperRifle, 1);
|
||||
%player.setInventory(TargetingLaser, 1);
|
||||
|
||||
%player.use("SniperRifle");
|
||||
%player.weaponCount = 3;
|
||||
|
||||
case 4:
|
||||
echo("Medium Base Rape");
|
||||
|
||||
%player.setArmor("Medium");
|
||||
|
||||
%player.setInventory(ShieldPack, 1);
|
||||
|
||||
%player.setInventory(RepairKit,1);
|
||||
%player.setInventory(Grenade,6);
|
||||
%player.setInventory(Mine,3);
|
||||
|
||||
%player.setInventory(Plasma, 1);
|
||||
%player.setInventory(PlasmaAmmo, 40);
|
||||
%player.setInventory(Disc,1);
|
||||
%player.setInventory(DiscAmmo, 15);
|
||||
%player.setInventory(ElfGun, 1);
|
||||
%player.setInventory(GrenadeLauncher,1);
|
||||
%player.setInventory(GrenadeLauncherAmmo, 10);
|
||||
%player.setInventory(TargetingLaser, 1);
|
||||
|
||||
%player.use("GrenadeLauncher");
|
||||
%player.weaponCount = 4;
|
||||
|
||||
case 5:
|
||||
//echo("Medium Killing Machine");
|
||||
|
||||
%player.setArmor("Medium");
|
||||
|
||||
%player.setInventory(AmmoPack, 1);
|
||||
|
||||
%player.setInventory(RepairKit,1);
|
||||
%player.setInventory(Grenade,6);
|
||||
%player.setInventory(Mine,3);
|
||||
|
||||
%player.setInventory(Plasma, 1);
|
||||
%player.setInventory(PlasmaAmmo, 40);
|
||||
%player.setInventory(Disc,1);
|
||||
%player.setInventory(DiscAmmo, 15);
|
||||
%player.setInventory(GrenadeLauncher, 1);
|
||||
%player.setInventory(GrenadeLauncherAmmo, 10);
|
||||
%player.setInventory(MissileLauncher,1);
|
||||
%player.setInventory(MissileLauncherAmmo, 10);
|
||||
%player.setInventory(TargetingLaser, 1);
|
||||
|
||||
%player.use("Plasma");
|
||||
%player.weaponCount = 4;
|
||||
|
||||
case 6:
|
||||
//echo("Medium Wuss");
|
||||
|
||||
%player.setArmor("Medium");
|
||||
|
||||
%player.setInventory(EnergyPack, 1);
|
||||
|
||||
%player.setInventory(RepairKit,1);
|
||||
%player.setInventory(ConcussionGrenade,6);
|
||||
|
||||
%player.setInventory(Blaster, 1);
|
||||
%player.setInventory(Disc,1);
|
||||
%player.setInventory(DiscAmmo, 15);
|
||||
%player.setInventory(Elf, 1);
|
||||
%player.setInventory(Chaingun,1);
|
||||
%player.setInventory(ChaingunAmmo, 150);
|
||||
%player.setInventory(TargetingLaser, 1);
|
||||
|
||||
%player.use("Disc");
|
||||
%player.weaponCount = 4;
|
||||
|
||||
case 7:
|
||||
//echo("Heavy Long Range");
|
||||
|
||||
%player.setArmor("Heavy");
|
||||
|
||||
%player.setInventory(EnergyPack, 1);
|
||||
|
||||
%player.setInventory(RepairKit,1);
|
||||
%player.setInventory(Grenade,8);
|
||||
%player.setInventory(Mine,3);
|
||||
|
||||
%player.setInventory(Plasma, 1);
|
||||
%player.setInventory(PlasmaAmmo, 50);
|
||||
%player.setInventory(Disc,1);
|
||||
%player.setInventory(DiscAmmo, 15);
|
||||
%player.setInventory(Mortar, 1);
|
||||
%player.setInventory(MortarAmmo, 10);
|
||||
%player.setInventory(MissileLauncher,1);
|
||||
%player.setInventory(MissileLauncherAmmo, 15);
|
||||
%player.setInventory(GrenadeLauncher,1);
|
||||
%player.setInventory(GrenadeLauncherAmmo,15);
|
||||
%player.setInventory(TargetingLaser, 1);
|
||||
|
||||
%player.use("Mortar");
|
||||
%player.weaponCount = 5;
|
||||
|
||||
case 8:
|
||||
//echo("Default Config");
|
||||
|
||||
%player.setArmor("Light");
|
||||
|
||||
%player.setInventory(RepairKit,1);
|
||||
|
||||
%player.setInventory(Blaster,1);
|
||||
%player.setInventory(Disc,1);
|
||||
%player.setInventory(DiscAmmo, 15);
|
||||
%player.setInventory(Chaingun, 1);
|
||||
%player.setInventory(ChaingunAmmo, 100);
|
||||
%player.setInventory(TargetingLaser, 1);
|
||||
|
||||
%player.use("Blaster");
|
||||
%player.weaponCount = 3;
|
||||
|
||||
case 9:
|
||||
//echo("Heavy Rate of Fire");
|
||||
|
||||
%player.setArmor("Heavy");
|
||||
|
||||
%player.setInventory(AmmoPack, 1);
|
||||
|
||||
%player.setInventory(RepairKit,1);
|
||||
%player.setInventory(Grenade,8);
|
||||
%player.setInventory(Mine,3);
|
||||
|
||||
%player.setInventory(Chaingun, 1);
|
||||
%player.setInventory(ChaingunAmmo, 200);
|
||||
%player.setInventory(Disc,1);
|
||||
%player.setInventory(DiscAmmo, 15);
|
||||
%player.setInventory(Mortar, 1);
|
||||
%player.setInventory(MortarAmmo, 10);
|
||||
%player.setInventory(Plasma,1);
|
||||
%player.setInventory(PlasmaAmmo, 50);
|
||||
%player.setInventory(GrenadeLauncher,1);
|
||||
%player.setInventory(GrenadeLauncherAmmo,15);
|
||||
%player.setInventory(TargetingLaser, 1);
|
||||
|
||||
%player.use("Mortar");
|
||||
%player.weaponCount = 5;
|
||||
|
||||
case 10:
|
||||
//echo("Heavy Inside Attacker");
|
||||
|
||||
%player.setArmor("Heavy");
|
||||
|
||||
%player.setInventory(ShieldPack, 1);
|
||||
|
||||
%player.setInventory(RepairKit,1);
|
||||
%player.setInventory(ConcussionGrenade,8);
|
||||
%player.setInventory(Mine,3);
|
||||
|
||||
%player.setInventory(Plasma, 1);
|
||||
%player.setInventory(PlasmaAmmo, 50);
|
||||
%player.setInventory(Disc,1);
|
||||
%player.setInventory(DiscAmmo, 15);
|
||||
%player.setInventory(Mortar, 1);
|
||||
%player.setInventory(MortarAmmo, 10);
|
||||
%player.setInventory(ShockLance,1);
|
||||
%player.setInventory(Chaingun,1);
|
||||
%player.setInventory(ChaingunAmmo,200);
|
||||
%player.setInventory(TargetingLaser, 1);
|
||||
|
||||
%player.use("Mortar");
|
||||
%player.weaponCount = 5;
|
||||
}
|
||||
}
|
||||
|
||||
// silly littly functions
|
||||
function flashButton(%buttonName)
|
||||
{
|
||||
%time = 800;
|
||||
%num = 6;
|
||||
for(%i=0; %i<%num; %i++) {
|
||||
schedule( %time*%i, $player.player, "eval", %buttonName@".setVisible(false);");
|
||||
|
||||
schedule(%time*%i + %time/2, $player.player, "eval", %buttonName@".setVisible(true);");
|
||||
schedule(%time*%i, $player.player, serverPlay2d, HudFlashSound);
|
||||
}
|
||||
}
|
||||
|
||||
function showCommandPulldown(%button)
|
||||
{
|
||||
//this is what I hacked in to make pretty with the showing off of the command tree
|
||||
commanderTree.openCategory(%button, true);
|
||||
mentionPulldown(%button);
|
||||
commanderTree.schedule(3000, openCategory, %button, false);
|
||||
}
|
||||
|
||||
function affectAllCommandPulldown(%open)
|
||||
{
|
||||
commanderTree.openCategory(Clients, %open);
|
||||
commanderTree.openCategory(Tactical, %open);
|
||||
commanderTree.openCategory(Support, %open);
|
||||
commanderTree.openCategory(Waypoints, %open);
|
||||
commanderTree.openCategory(Objectives, %open);
|
||||
}
|
||||
|
||||
function mentionPulldown(%button)
|
||||
{
|
||||
switch$(%button)
|
||||
{
|
||||
case "Clients":
|
||||
doText(T4_03b);
|
||||
|
||||
case "Tactical":
|
||||
doText(T4_03c);
|
||||
|
||||
case "Support":
|
||||
doText(T4_03d);
|
||||
|
||||
case "Waypoints":
|
||||
doText(T4_03e);
|
||||
|
||||
case "Objectives":
|
||||
doText(T4_03f);
|
||||
doText(T4_03g);
|
||||
doText(t4_03h);
|
||||
}
|
||||
}
|
||||
|
||||
function training4CommandMapWake()
|
||||
{
|
||||
error("training4CommandMapWake Called");
|
||||
if(game.wakeExpectingSquadOrder && !game.firstSpawn) {
|
||||
game.wakeExpectingSquadOrder = false;
|
||||
|
||||
// commander map waypoint
|
||||
%pos = nameToId(Base).position;
|
||||
%obj = createClientTarget(-1, %pos);
|
||||
%obj.createWaypoint("Nagakhun Base");
|
||||
|
||||
// cmap objective
|
||||
commanderTree.registerEntryType("Objectives", getTag('Base'), false, "commander/MiniIcons/com_flag_grey", "255 255 255");
|
||||
createTarget(%id, 'Defend', "", "", 'Base', $player.getSensorGroup());
|
||||
|
||||
affectAllCommandPulldown(false);
|
||||
|
||||
//here we go...drop down the thingies
|
||||
schedule( 2500, $player.player, showCommandPulldown, Clients);
|
||||
schedule( 6000, $player.player, showCommandPulldown, Tactical);
|
||||
schedule(10000, $player.player, showCommandPulldown, Support);
|
||||
schedule(14000, $player.player, showCommandPulldown, Waypoints);
|
||||
schedule(18000, $player.player, showCommandPulldown, Objectives);
|
||||
|
||||
//schedule(24000, $player.player, affectAllCommandPulldown, true);
|
||||
}
|
||||
else if(game.wakeExpectingTurret && !game.firstSpawn) {
|
||||
messageClient($player, 0, "Click on \"Tactical Assets\" to view turrets.");
|
||||
//flashButton(CMDTacticalButton);
|
||||
game.ExpectiongTacticalButton = true;
|
||||
game.wakeExpectingTurret = false;
|
||||
}
|
||||
else if(game.wakeExpectingCamera && !game.firstSpawn) {
|
||||
messageClient($player, 0, "Click on the control box to the right of the camera\'s name to control the camera.");
|
||||
cameraSpielEnd();
|
||||
game.wakeExpectingCamera = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Objectives ==================================================================
|
||||
//================================================================================
|
||||
function missionFailedTimer()
|
||||
{
|
||||
missionFailed($player.miscMsg[training4GenLoss]);
|
||||
}
|
||||
|
||||
|
||||
function blowoff()
|
||||
{
|
||||
game.blowoff = true;
|
||||
clearQueue();
|
||||
doText(Any_Blowoff02, 2000, 1);
|
||||
|
||||
// okay, the player wants to play huh?
|
||||
// if we are still waiting for the enemies to spawn at this point
|
||||
// cancel that and spawn them now...well, soon
|
||||
if($player.beginSpawn){
|
||||
cancel($player.beginSpawn);
|
||||
%time = getRandom(1, 20);
|
||||
//error("Blowing off the training: spawning enemies in "@ %time * 1000 @" seconds.");
|
||||
schedule(%time*1000, game, beginTraining4Enemies);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function findObjbyDescription(%desc, %team)
|
||||
{
|
||||
%q = $objectiveQ[%team];
|
||||
for(%i = 0; %i < %q.getCount(); %i++)
|
||||
{
|
||||
%objective = %q.getObject(%i);
|
||||
if(%objective.description $= %desc)
|
||||
return %objective;
|
||||
}
|
||||
}
|
||||
|
||||
function removeDescribedObj( %obj )
|
||||
{
|
||||
%invDepObj.weightLevel1 = 0;
|
||||
%invDepObj.weightLevel2 = 0;
|
||||
%invDepObj.weightLevel3 = 0;
|
||||
%invDepObj.weightLevel4 = 0;
|
||||
$ObjectiveQ[1].remove(%invDepObj);
|
||||
// clear it in case anyone has picked it up
|
||||
AIClearObjective(%invDepObj);
|
||||
}
|
||||
|
||||
//===============================================END the training 4 package stuff====
|
||||
};
|
||||
|
||||
// Dialog stuff ===================================================================
|
||||
//=================================================================================
|
||||
|
||||
|
||||
|
||||
// Callbacks //==================================================================
|
||||
//================================================================================
|
||||
|
||||
//add callbacks
|
||||
addMessageCallback('MsgDeployFailed', singlePlayerFailDeploy);
|
||||
addMessageCallback('MsgWeaponMount', playerMountWeapon);
|
||||
addMessageCallback('msgEnterInvStation', StationInvEnter);
|
||||
addMessageCallback('MsgRepairPackRepairingObj', RepairingObj);
|
||||
addMessageCallback('commandMapWake', training4CommandMapWake);
|
||||
|
||||
613
docs/base/@vl2/scripts.vl2/scripts/Training5.cs
Normal file
613
docs/base/@vl2/scripts.vl2/scripts/Training5.cs
Normal file
|
|
@ -0,0 +1,613 @@
|
|||
// don't want this executing when building graphs
|
||||
if($OFFLINE_NAV_BUILD)
|
||||
return;
|
||||
|
||||
echo("-----------------Running Training5");
|
||||
activatePackage(Training5);
|
||||
|
||||
//BaseExplosion sound
|
||||
datablock EffectProfile(Training5BaseExplosionEffect)
|
||||
{
|
||||
effectname = "explosions/explosion.xpl27";
|
||||
minDistance = 20;
|
||||
maxDistance = 100;
|
||||
};
|
||||
|
||||
datablock AudioProfile(Training5BaseExplosionSound)
|
||||
{
|
||||
filename = "fx/explosions/explosion.xpl27.wav";
|
||||
description = AudioDefault3d;
|
||||
effect = Training5BaseExplosionEffect;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
|
||||
//mission variables
|
||||
$numberOfTeammates = 0;
|
||||
$numberOfEnemies[1] = 6;
|
||||
$numberOfEnemies[2] = 6;
|
||||
$numberOfEnemies[3] = 8;
|
||||
$missionBotSkill[1] = 0.0;
|
||||
$missionBotSkill[2] = 0.5;
|
||||
$missionBotSkill[3] = 0.9;
|
||||
$missionEnemyThreshold[1] = 1;
|
||||
$missionEnemyThreshold[2] = 3;
|
||||
$missionEnemyThreshold[3] = 8;
|
||||
$bridgeTime[1] = 30;
|
||||
$bridgeTime[2] = 20;
|
||||
$bridgeTime[3] = 5;
|
||||
|
||||
package Training5 {
|
||||
//Training5 package functions begin=======================================================
|
||||
|
||||
function SinglePlayerGame::initGameVars(%game)
|
||||
{
|
||||
// for many of the objectives we are going to periodically
|
||||
// check the players distance vs some object
|
||||
// you could do this much prettier but its going to be very specific
|
||||
// so a cut and paste eyesore will be fine
|
||||
echo("initializing training5 game vars");
|
||||
%game.targetObject1 = nameToId("ObjectiveGen1");
|
||||
%game.targetObject2 = nameToId("ObjectiveGen2");
|
||||
%game.tower = nameToId("MissionGroup/Teams/Team2/tower/tower");
|
||||
%game.base = nameToId("DBase2");
|
||||
%game.minimumSafeDistance = 500;
|
||||
%game.West = nameToId(WestBridgeGen);
|
||||
%game.East = nameToId(EastBridgeGen);
|
||||
%game.North = nameToId(NorthBridgeGen);
|
||||
%game.South = nameToId(SouthBridgeGen);
|
||||
}
|
||||
|
||||
function MP3Audio::play(%this)
|
||||
{
|
||||
//too bad...no mp3 in training
|
||||
}
|
||||
|
||||
|
||||
function toggleScoreScreen(%val)
|
||||
{
|
||||
if ( %val )
|
||||
//error("No Score Screen in training.......");
|
||||
messageClient($player, 0, $player.miscMsg[noScoreScreen]);
|
||||
}
|
||||
|
||||
function toggleNetDisplayHud( %val )
|
||||
{
|
||||
// Hello, McFly? This is training! There's no net in training!
|
||||
}
|
||||
|
||||
function voiceCapture( %val )
|
||||
{
|
||||
// Uh, who do you think you are talking to?
|
||||
}
|
||||
|
||||
function ClientCmdSetHudMode(%mode, %type, %node)
|
||||
{
|
||||
parent::ClientCmdSetHudMode(%mode, %type, %node);
|
||||
//TrainingMap.push();
|
||||
}
|
||||
|
||||
// get the ball rolling
|
||||
function startCurrentMission(%game)
|
||||
{
|
||||
setFlipFlopSkins();
|
||||
doText(Any_Waypoint01, 2000);
|
||||
if(getRandom(3) == 1)
|
||||
doText(Any_warning01);
|
||||
setWaypointAt(nameToId(TowerSwitch).position, "Periphery Tower Control");
|
||||
objectiveDistanceChecks();
|
||||
updateTrainingObjectiveHud(obj1);
|
||||
|
||||
// adding a little something for the players followers to do
|
||||
//training5AddEscort($teammate0);
|
||||
|
||||
// Tower FFs all start off by default
|
||||
// we cheat and disable their hidden generators
|
||||
nameToId(CatwalkFFGen).setDamageState(Disabled);
|
||||
game.West.setDamageState(Disabled);
|
||||
game.East.setDamageState(Disabled);
|
||||
game.North.setDamageState(Disabled);
|
||||
game.South.setDamageState(Disabled);
|
||||
|
||||
// but we start the rotation
|
||||
%skill = $pref::trainingDifficulty;
|
||||
//%time = 1000 * (10 - %skill * skill );
|
||||
%time = $bridgeTime[%skill] * 1000;
|
||||
rotateDrawbridgeFFs(%time);
|
||||
|
||||
setUpDifficultySettings($pref::trainingDifficulty);
|
||||
}
|
||||
|
||||
function setUpDifficultySettings(%skill)
|
||||
{
|
||||
if(%skill < 2)
|
||||
{
|
||||
nameToId(DownStairsSentry).hide(true);
|
||||
freeTarget(nameToId(DownStairsSentry).getTarget());
|
||||
nameToId(UpstairsTurret).hide(true);
|
||||
freeTarget(nameToId(UpstairsTurret).getTarget());
|
||||
}
|
||||
if(%skill == 3)
|
||||
nameToId(SatchelChargePack).hide(true);
|
||||
}
|
||||
|
||||
function countTurretsAllowed(%type)
|
||||
{
|
||||
return $TeamDeployableMax[%type];
|
||||
}
|
||||
|
||||
function getTeammateGlobals()
|
||||
{
|
||||
echo("You have no teammates in this mission");
|
||||
}
|
||||
|
||||
function FlipFlop::objectiveInit(%data, %flipflop)
|
||||
{
|
||||
}
|
||||
|
||||
function giveall()
|
||||
{
|
||||
error("When the going gets tough...wussies like you start cheating!");
|
||||
messageClient($player, 0, "Cheating eh? What\'s next? Camping?");
|
||||
}
|
||||
|
||||
function kobayashi_maru()
|
||||
{
|
||||
$testCheats = true;
|
||||
commandToServer('giveAll');
|
||||
}
|
||||
|
||||
|
||||
// Distance Check =============================================================
|
||||
// Ive never done this before :P but im going to use a periodic self-scheduling
|
||||
// distance checking mechanism in this mission also
|
||||
|
||||
function objectiveDistanceChecks()
|
||||
{
|
||||
%playerLocation = $player.player.position;
|
||||
if(!%playerLocation) {
|
||||
schedule(5000, game, objectiveDistanceChecks);
|
||||
return;
|
||||
}
|
||||
|
||||
// %baseDist = vectorDist(%playerLocation, %game.base.position);
|
||||
// if(%baseDist < 600 && !%game.training5SwitchObjective && !%game.turretsWarn){
|
||||
// %game.turretsWarn = true;
|
||||
// doText(Any_warning06);
|
||||
// }
|
||||
|
||||
%baseDist = vectorDist(%playerLocation, game.base.position);
|
||||
if(%baseDist < 200 && game.respawnPoint == 1) {
|
||||
game.respawnPoint = 2;
|
||||
return; // kill the distCheck
|
||||
}
|
||||
|
||||
|
||||
%dist = vectorDist(%playerLocation, game.tower.position);
|
||||
//error("Tower Dist = "@%dist);
|
||||
|
||||
if( %dist < 400 && !game.t5distcheck1) {
|
||||
game.t5distcheck1 = true;
|
||||
doText(T5_04);
|
||||
return;
|
||||
}
|
||||
|
||||
if( %dist > 200 && game.training5SwitchObjective && !game.tipFirepower) {
|
||||
|
||||
%packImage = $player.player.getMountedImage($backPackSlot).getName();
|
||||
if(%packImage !$= "SatchelChargeImage" && %packImage !$= "InventoryDeployableImage") {
|
||||
game.tipFirepower = true;
|
||||
doText(T5_tipFirepower);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
schedule(5000, game, objectiveDistanceChecks);
|
||||
}
|
||||
|
||||
//======================================================================================
|
||||
// Objective Generators
|
||||
//======================================================================================
|
||||
function GeneratorLarge::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
|
||||
{
|
||||
if(%targetObject == game.targetObject1 || %targetObject == game.targetObject2)
|
||||
%message = training5ObjectiveGenDamaged(%targetObject, %damageType);
|
||||
else
|
||||
Parent::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType);
|
||||
|
||||
if(%message)
|
||||
training5messageDamageFailed();
|
||||
}
|
||||
|
||||
function training5ObjectiveGenDamaged(%targetObject, %damageType)
|
||||
{
|
||||
//error("training5ObjectiveGenDamaged("@%targetObject@", "@%damageType@")");
|
||||
|
||||
if(game.genDestroyed[%targetObject])
|
||||
return false;
|
||||
|
||||
if(%damageType != $DamageType::SatchelCharge)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
game.objectiveDestroyed = true;
|
||||
%targetObject.applyDamage(%targetObject.getDataBlock().maxDamage);
|
||||
return false;
|
||||
}
|
||||
|
||||
function training5messageDamageFailed()
|
||||
{
|
||||
if(!game.tooSoonMsg && !game.objectiveDestroyed) {
|
||||
game.tooSoonMsg = true;
|
||||
schedule(15000, game, eval, "game.tooSoonMsg = false;");
|
||||
messageClient($player, 0, $player.miscMsg[genAttackNoSatchel]);
|
||||
|
||||
training5easySatchelWaypoint();
|
||||
}
|
||||
}
|
||||
|
||||
function training5easySatchelWaypoint()
|
||||
{
|
||||
if($pref::trainingDifficulty == 1 &&
|
||||
$player.player.getMountedImage($backPackSlot).getName() !$= "SatchelChargeImage" && !game.satchelWaypointSet) {
|
||||
|
||||
%waypoint = new WayPoint() {
|
||||
position = nameToId(SatchelChargePack).position;
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
dataBlock = "WayPointMarker";
|
||||
lockCount = "0";
|
||||
homingCount = "0";
|
||||
name = "Satchel Charge";
|
||||
team = 1;
|
||||
locked = "true";
|
||||
};
|
||||
$player.satchelWaypoint = %waypoint;
|
||||
game.satchelWaypointSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
//======================================================================================
|
||||
|
||||
|
||||
function AIEngageTask::assume(%task, %client)
|
||||
{
|
||||
Parent::assume(%task, %client);
|
||||
|
||||
if(%client.team != $playerTeam)
|
||||
game.biodermAssume(%client);
|
||||
}
|
||||
|
||||
|
||||
// ============================================================================
|
||||
function singlePlayerGame::onAIRespawn(%game, %client)
|
||||
{
|
||||
if(! isObject("MissionCleanup/TeamDrops2")) {
|
||||
//this is the snippet of script from default games that puts teamdrops
|
||||
// into the mission cleanup group...slightly modified to suit our needs
|
||||
%dropSet = new SimSet("TeamDrops2");
|
||||
MissionCleanup.add(%dropSet);
|
||||
|
||||
%spawns = nameToID("MissionGroup/Teams/team2/TeamDrops");
|
||||
if(%spawns != -1)
|
||||
{
|
||||
%count = %spawns.getCount();
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
%dropSet.add(%spawns.getObject(%i));
|
||||
}
|
||||
}
|
||||
|
||||
parent:: onAIRespawn(%game, %client);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ============================================================================
|
||||
function singlePlayerGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
%teamCount = getPlayersOnTeam(%clVictim.team);
|
||||
//echo("Team count:" SPC %teamCount);
|
||||
%maintNum = $missionEnemyThreshold[$pref::trainingDifficulty];
|
||||
//echo("Maintain:" SPC %maintNum);
|
||||
|
||||
%clVictim.useSpawnSphere = true;
|
||||
|
||||
// this will respawn the AI if
|
||||
if( %teamCount < %maintNum )
|
||||
DefaultGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement);
|
||||
|
||||
}
|
||||
|
||||
function singleplayerGame::pickTeamSpawn(%game, %client, %respawn)
|
||||
{
|
||||
if(%client.useSpawnSphere)
|
||||
DefaultGame::pickTeamSpawn(%game, %client.team);
|
||||
else
|
||||
parent::pickTeamSpawn(%game, %client, %respawn);
|
||||
}
|
||||
|
||||
function SinglePlayerGame::equip(%game, %player, %set)
|
||||
{
|
||||
if(!isObject(%player))
|
||||
return;
|
||||
|
||||
%player.clearInventory();
|
||||
if(!%set)
|
||||
%set = %player.client.equipment;
|
||||
|
||||
for(%i =0; %i<$InventoryHudCount; %i++)
|
||||
%player.client.setInventoryHudItem($InventoryHudData[%i, itemDataName], 0, 1);
|
||||
%player.client.clearBackpackIcon();
|
||||
|
||||
%player.setArmor("Medium");
|
||||
|
||||
%player.setInventory(SatchelCharge, 1);
|
||||
|
||||
%player.setInventory(RepairKit, 1);
|
||||
%player.setInventory(ConcussionGrenade, 8);
|
||||
%player.setInventory(Mine, 3);
|
||||
|
||||
%player.setInventory(Plasma, 1);
|
||||
%player.setInventory(PlasmaAmmo, 40);
|
||||
%player.setInventory(Chaingun, 1);
|
||||
%player.setInventory(ChaingunAmmo, 200);
|
||||
%player.setInventory(Disc, 1);
|
||||
%player.setInventory(DiscAmmo, 15);
|
||||
%player.setInventory(GrenadeLauncher, 1);
|
||||
%player.setInventory(GrenadeLauncherAmmo, 15);
|
||||
%player.setInventory(TargetingLaser, 1);
|
||||
|
||||
%player.use("Disc");
|
||||
|
||||
%player.weaponCount = 4;
|
||||
}
|
||||
|
||||
|
||||
//the generator destroyed trigers the detonation sequence
|
||||
function Generator::onDestroyed(%data, %destroyedObj)
|
||||
{
|
||||
//error("GeneratorLarge::onDestroyed");
|
||||
if(%destroyedObj == game.targetObject1 || %destroyedObj == game.targetObject2)
|
||||
if(!game.detonationSequenceStarted) {
|
||||
game.detonationSequenceStarted = true;
|
||||
|
||||
error("The satchel waypoint is:" SPC $player.satchelWaypoint);
|
||||
$player.satchelWaypoint.delete();
|
||||
detonationSequence();
|
||||
updateTrainingObjectiveHud(obj4);
|
||||
game.respawnPoint = 3;
|
||||
|
||||
$missionEnemyThreshold[1] = 0;
|
||||
$missionEnemyThreshold[2] = 0;
|
||||
$missionEnemyThreshold[3] = 0;
|
||||
}
|
||||
|
||||
Parent::onDestroyed(%data, %destroyedObj);
|
||||
}
|
||||
|
||||
function FlipFlop::objectiveInit(%data, %flipflop)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function FlipFlop::playerTouch(%data, %flipFlop, %player)
|
||||
{
|
||||
//error("singlePlayer::playerTouchFlipFlop Training5");
|
||||
//echo("has been touched before? " SPC game.training5SwitchObjective);
|
||||
|
||||
Parent::playerTouch(%data, %flipFlop, %player);
|
||||
|
||||
//This disables the base door FFs
|
||||
%state = (%flipFlop.team == $playerTeam ? "Disabled" : "Enabled");
|
||||
game.targetObject2.setDamageState(%state);
|
||||
|
||||
if(!game.training5SwitchObjective) {
|
||||
game.training5SwitchObjective = true;
|
||||
doText(T5_05, 10000);
|
||||
doText(T5_05b);
|
||||
doText(T5_05a);
|
||||
schedule(10000, game, setWaypointAt, game.targetObject2.getWorldBoxCenter(), "Reactor Regulator" );
|
||||
schedule(10000, game, updateTrainingObjectiveHud , obj2);
|
||||
|
||||
//start the distance check again
|
||||
objectiveDistanceChecks();
|
||||
game.respawnPoint = 1;
|
||||
|
||||
rotateDrawbridgeFFs(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//EndingExplosionStuff=========================================================================
|
||||
|
||||
|
||||
function detonationSequence()
|
||||
{
|
||||
// first a little eye candy
|
||||
%oldEmitter = nameToId(LavaSmoke);
|
||||
%oldEmitter.delete();
|
||||
|
||||
%newEmitter = new ParticleEmissionDummy(LavaSmoke) {
|
||||
position = "-462.4 -366.791 5.12867";
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
dataBlock = "defaultEmissionDummy";
|
||||
emitter = "AfterT5";
|
||||
velocity = "1";
|
||||
};
|
||||
|
||||
%detonationTime = 1000 * 90; // 90 is a guess, at least 67 before you cut lines
|
||||
schedule(3000, game, doText, T5_06); //Get Out Hurry!
|
||||
schedule(%detonationTime, game, detonateBase ); //BOOM //moved to t5_08d,eval
|
||||
schedule(%detonationTime - 5000, game, doText, T5_08urgent); //5..4..3..2..1
|
||||
schedule(%detonationTime - 9000, game, doText, T5_07); //ComeOn
|
||||
schedule(%detonationTime - 10000, game, doText, T5_06d); //10
|
||||
schedule(%detonationTime - 30000, game, doText, T5_06c); // 30 secs
|
||||
schedule(%detonationTime - 64000, game, doText, T5_06a); //reaction building fast
|
||||
schedule(%detonationTime - 60000, game, doText, T5_06b); //1 min
|
||||
|
||||
}
|
||||
|
||||
function detonateBase()
|
||||
{
|
||||
%playerDist = vectorDist($player.player.position, game.base.position);
|
||||
//BOOM
|
||||
//schedule(0.33 * %playerDist, game, serverplay2d, Training5BaseExplosionSound);
|
||||
schedule(0.33 * %playerDist, game, damagePlayersInBlast, game.minimumSafeDistance);
|
||||
$player.player.setWhiteOut(8);
|
||||
//messageAll(0, "You were "@%playerDist@"meters away. Minimum safe distance is "@game.minimumSafeDistance);
|
||||
|
||||
if( %playerDist < game.minimumSafeDistance || !$player.player) {
|
||||
schedule(5000, game, missionFailed, $player.miscMsg[training5loss] );
|
||||
moveMap.pop();
|
||||
}
|
||||
else {
|
||||
//messageAll(0, "You won!");
|
||||
schedule(5000, game, doText, T5_09, 3000);
|
||||
schedule(13000, game, messageBoxOK, "Victory", $player.miscMsg[training5win], "Canvas.popDialog(MessageBoxOKDlg); schedule(1000, game, trainingComplete);");
|
||||
moveMap.schedule(13000, "pop");
|
||||
}
|
||||
}
|
||||
|
||||
function trainingComplete()
|
||||
{
|
||||
|
||||
%skill = $pref::trainingDifficulty;
|
||||
switch (%skill)
|
||||
{
|
||||
case 2:
|
||||
%msg = "trainingOverMed";
|
||||
case 3:
|
||||
%msg = "trainingOverHard";
|
||||
default:
|
||||
%msg = "trainingOverEasy";
|
||||
}
|
||||
missionComplete( $player.miscMsg[%msg] );
|
||||
}
|
||||
|
||||
|
||||
function damagePlayersInBlast(%minDist)
|
||||
{
|
||||
Canvas.popDialog(MessageBoxOKDlg);
|
||||
Canvas.popDialog(MessageBoxYesNoDlg);
|
||||
serverPlay2d(Training5BaseExplosionSound);
|
||||
|
||||
%num = ClientGroup.getCount();
|
||||
for(%i = 0; %i < %num; %i++)
|
||||
{
|
||||
%client = clientGroup.getObject(%i);
|
||||
if(%client.player)
|
||||
{
|
||||
%Dist = vectorDist(%client.player.position, game.base.position);
|
||||
if(%dist < %minDist)
|
||||
{
|
||||
if(%client != $player)
|
||||
%client.player.scriptKill($DamageType::Explosion);
|
||||
else {
|
||||
moveMap.pop();
|
||||
|
||||
if($firstperson)
|
||||
toggleFirstPerson($player);
|
||||
|
||||
serverConnection.setBlackout(true, 3000);
|
||||
%client.player.setActionThread(Death11, true);
|
||||
%client.player.setDamageFlash(0.75);
|
||||
}
|
||||
}
|
||||
else
|
||||
$player.player.setWhiteOut(12);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// turninig off the Mission area on this one too folks
|
||||
function SinglePlayerGame::leaveMissionArea(%game, %player)
|
||||
{
|
||||
}
|
||||
function SinglePlayerGame::enterMissionArea(%game, %player)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
function rotateDrawbridgeFFs(%time)
|
||||
{
|
||||
if(%time == 0)
|
||||
{
|
||||
// catwalks on
|
||||
nameToId(CatwalkFFGen).setDamageState(Enabled);
|
||||
|
||||
// stop rotation
|
||||
cancel(game.FFRotate);
|
||||
|
||||
// set Enabled All bridges
|
||||
game.West.setDamageState(Enabled);
|
||||
game.East.setDamageState(Enabled);
|
||||
game.North.setDamageState(Enabled);
|
||||
game.South.setDamageState(Enabled);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// start these bad boys rotating
|
||||
|
||||
if(game.activeBridgeSet == 1) {
|
||||
game.West.setDamageState(Enabled);
|
||||
game.East.setDamageState(Enabled);
|
||||
game.North.setDamageState(Disabled);
|
||||
game.South.setDamageState(Disabled);
|
||||
game.activeBridgeSet = 2;
|
||||
}
|
||||
else {
|
||||
game.West.setDamageState(Disabled);
|
||||
game.East.setDamageState(Disabled);
|
||||
game.North.setDamageState(Enabled);
|
||||
game.South.setDamageState(Enabled);
|
||||
game.activeBridgeSet = 1;
|
||||
}
|
||||
|
||||
game.FFRotate = schedule(%time, game, rotateDrawbridgeFFs, %time);
|
||||
}
|
||||
}
|
||||
|
||||
// helpful satchel charge instructions
|
||||
function armSatchelCharge(%satchel)
|
||||
{
|
||||
%deployer = %satchel.sourceObject;
|
||||
messageClient(%deployer.client, 0, "\c2Satchel Charge Armed! Press" SPC findTrainingControlButtons(useBackPack) SPC"to detonate.");
|
||||
if(!game.msgSatchelActivate)
|
||||
{
|
||||
game.msgSatchelActivate = true;
|
||||
doText(T5_tipSatchel01);
|
||||
}
|
||||
parent::armSatchelCharge(%satchel);
|
||||
}
|
||||
|
||||
function Pack::onInventory(%data, %obj, %amount)
|
||||
{
|
||||
%oldSatchelCharge = (%obj.thrownChargeId ? true : false);
|
||||
Parent::onInventory(%data, %obj, %amount);
|
||||
%nowSatchelCharge = (%obj.thrownChargeId ? true : false);
|
||||
|
||||
if(%oldSatchelCharge && !%nowSatchelCharge)
|
||||
messageClient(%obj.client, 0, "\c2You got a pack and nullified your satchel charge.");
|
||||
}
|
||||
|
||||
function singlePlayerGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement)
|
||||
{
|
||||
%hadSatchelCharge = (%clvictim.player.thrownChargeId ? true : false);
|
||||
if(%hadSatchelCharge)
|
||||
schedule(1500, game, messageClient, %clVictim, 0, "Your satchel charge has been nullified.");
|
||||
|
||||
Parent::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement);
|
||||
}
|
||||
|
||||
function missionClientKilled()
|
||||
{
|
||||
//no console spam
|
||||
}
|
||||
|
||||
//Training5 package functions end=======================================================
|
||||
};
|
||||
|
||||
264
docs/base/@vl2/scripts.vl2/scripts/TrainingGui.cs
Normal file
264
docs/base/@vl2/scripts.vl2/scripts/TrainingGui.cs
Normal file
|
|
@ -0,0 +1,264 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// TrainingGui.cs
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LaunchTraining()
|
||||
{
|
||||
LaunchTabView.viewTab( "TRAINING", TrainingGui, 0 );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function TrainingGui::onWake( %this )
|
||||
{
|
||||
Canvas.pushDialog( LaunchToolbarDlg );
|
||||
|
||||
%this.soundHandle = 0;
|
||||
%this.briefEventCount = 0;
|
||||
%this.briefWAV = "";
|
||||
%ct = 1;
|
||||
%fobject = new FileObject();
|
||||
%search = "missions/*.mis";
|
||||
TrainingMissionList.clear();
|
||||
for ( %file = findFirstFile( %search ); %file !$= ""; %file = findNextFile( %search ) )
|
||||
{
|
||||
%name = fileBase(%file); // get the mission name
|
||||
|
||||
if ( !%fobject.openForRead( %file ) )
|
||||
continue;
|
||||
|
||||
%typeList = "None";
|
||||
|
||||
while( !%fobject.isEOF() )
|
||||
{
|
||||
%line = %fobject.readLine();
|
||||
if ( getSubStr( %line, 0, 18 ) $= "// MissionTypes = " )
|
||||
{
|
||||
%typeList = getSubStr( %line, 18, 1000 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( strstr( %typeList, "SinglePlayer" ) != -1 )
|
||||
{
|
||||
// Get the mission display name:
|
||||
%displayName = %name;
|
||||
while ( !%fobject.isEOF() )
|
||||
{
|
||||
%line = %fobject.readLine();
|
||||
if ( getSubStr( %line, 0, 16 ) $= "// PlanetName = " )
|
||||
{
|
||||
%displayName = getSubStr( %line, 16, 1000 );
|
||||
// Strip the date:
|
||||
%pos = strpos( %displayName, "," );
|
||||
if ( %pos != -1 )
|
||||
%displayName = getSubStr( %displayName, 0, %pos );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TrainingMissionList.addRow( %ct++, %displayName TAB %name );
|
||||
}
|
||||
|
||||
%fobject.close();
|
||||
}
|
||||
|
||||
TrainingMissionList.sort( 1 );
|
||||
TrainingMissionList.setSelectedRow( 0 );
|
||||
if ( $pref::TrainingDifficulty > 0 && $pref::TrainingDifficulty < 4 )
|
||||
TrainingDifficultyMenu.setSelected( $pref::TrainingDifficulty );
|
||||
else
|
||||
TrainingDifficultyMenu.setSelected( 1 );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function TrainingGui::onSleep( %this )
|
||||
{
|
||||
%this.stopBriefing();
|
||||
|
||||
Canvas.popDialog(LaunchToolbarDlg);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function TrainingGui::setKey( %this )
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function TrainingGui::onClose( %this )
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function TrainingDifficultyMenu::onAdd( %this )
|
||||
{
|
||||
%this.add( "Easy", 1 );
|
||||
%this.add( "Medium", 2 );
|
||||
%this.add( "Hard", 3 );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function TrainingDifficultyMenu::onSelect( %this, %id, %text )
|
||||
{
|
||||
$pref::TrainingDifficulty = %id;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function TrainingMissionList::onSelect( %this, %id, %text )
|
||||
{
|
||||
TrainingGui.stopBriefing();
|
||||
%fileName = "missions/" @ getField( %text, 1 ) @ ".mis";
|
||||
%file = new FileObject();
|
||||
%state = 0;
|
||||
if ( %file.openForRead( %fileName ) )
|
||||
{
|
||||
// Get the mission briefing text:
|
||||
while ( !%file.isEOF() )
|
||||
{
|
||||
%line = %file.readLine();
|
||||
if ( %state == 0 && %line $= "//--- MISSION BRIEFING BEGIN ---" )
|
||||
%state = 1;
|
||||
else if ( %state > 0 && %line $= "//--- MISSION BRIEFING END ---" )
|
||||
break;
|
||||
else if ( %state == 1 )
|
||||
{
|
||||
%briefText = %briefText @ getSubStr( %line, 2, 1000 );
|
||||
%state = 2;
|
||||
}
|
||||
else if ( %state == 2 )
|
||||
%briefText = %briefText NL getSubStr( %line, 2, 1000 );
|
||||
}
|
||||
|
||||
// Get the mission briefing WAV file:
|
||||
while ( !%file.isEOF() )
|
||||
{
|
||||
%line = %file.readLine();
|
||||
if ( getSubStr( %line, 0, 17 ) $= "// BriefingWAV = " )
|
||||
{
|
||||
%briefWAV = getSubStr( %line, 17, 1000 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the bitmap name:
|
||||
while ( !%file.isEOF() )
|
||||
{
|
||||
%line = %file.readLine();
|
||||
if ( getSubStr( %line, 0, 12 ) $= "// Bitmap = " )
|
||||
{
|
||||
%briefPic = getSubStr( %line, 12, 1000 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
%file.close();
|
||||
}
|
||||
else
|
||||
error( "Failed to open Single Player mission file " @ %fileName @ "!" );
|
||||
|
||||
if (!isDemo())
|
||||
%bmp = "gui/" @ %briefPic @ ".png";
|
||||
else
|
||||
%bmp = "gui/" @ %briefPic @ ".bm8";
|
||||
if ( isFile( "textures/" @ %bmp ) )
|
||||
{
|
||||
TrainingPic.setBitmap( %bmp );
|
||||
TrainingPicFrame.setVisible( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
TrainingPic.setBitmap( "" );
|
||||
TrainingPicFrame.setVisible( false );
|
||||
}
|
||||
|
||||
TrainingPlayBtn.setActive( %briefWAV !$= "" );
|
||||
TrainingBriefingText.setValue( %briefText );
|
||||
TrainingBriefingScroll.scrollToTop();
|
||||
TrainingGui.WAVBase = firstWord( %briefWAV );
|
||||
TrainingGui.WAVCount = restWords( %briefWAV );
|
||||
%file.delete();
|
||||
|
||||
//if ( TrainingPlayTgl.getValue() )
|
||||
// TrainingGui.startBriefing();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function TrainingPlayTgl::onAction( %this )
|
||||
{
|
||||
if ( %this.getValue() )
|
||||
{
|
||||
if ( TrainingMissionList.getSelectedId() != -1 )
|
||||
TrainingGui.startBriefing();
|
||||
}
|
||||
else
|
||||
TrainingGui.stopBriefing();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
function TrainingGui::toggleBriefing( %this )
|
||||
{
|
||||
if ( %this.soundHandle $= "" )
|
||||
%this.startBriefing();
|
||||
else
|
||||
%this.stopBriefing();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
function TrainingGui::startBriefing( %this )
|
||||
{
|
||||
%this.stopBriefing();
|
||||
if ( %this.WAVBase !$= "" )
|
||||
{
|
||||
%this.instance = %this.instance $= "" ? 0 : %this.instance;
|
||||
%this.playNextBriefWAV( %this.WAVBase, 0, %this.WAVCount, %this.instance );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
function TrainingGui::playNextBriefWAV( %this, %wavBase, %id, %count, %instance )
|
||||
{
|
||||
if ( %instance == %this.instance )
|
||||
{
|
||||
if ( %id < %count )
|
||||
{
|
||||
%wav = "voice/Training/Briefings/" @ %wavBase @ ".brief0" @ ( %id + 1 ) @ ".wav";
|
||||
%this.soundHandle = alxCreateSource( AudioGui, %wav );
|
||||
alxPlay( %this.soundHandle );
|
||||
|
||||
// Schedule the next WAV:
|
||||
%delay = alxGetWaveLen( %wav ) + 500;
|
||||
%this.schedule( %delay, playNextBriefWAV, %wavBase, %id + 1, %count, %instance );
|
||||
}
|
||||
else
|
||||
{
|
||||
// We're all done!
|
||||
%this.soundHandle = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
function TrainingGui::stopBriefing( %this )
|
||||
{
|
||||
if ( %this.soundHandle !$= "" )
|
||||
{
|
||||
alxStop( %this.soundHandle );
|
||||
%this.soundHandle = "";
|
||||
%this.instance++;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
function TrainingGui::startTraining( %this )
|
||||
{
|
||||
MessagePopup( "STARTING MISSION", "Initializing, please wait..." );
|
||||
Canvas.repaint();
|
||||
cancelServerQuery();
|
||||
%file = getField( TrainingMissionList.getValue(), 1 );
|
||||
$ServerName = "Single Player Training";
|
||||
$HostGameType = "SinglePlayer";
|
||||
CreateServer( %file, "SinglePlayer" );
|
||||
localConnect( "Lone Wolf", "Human Male", "swolf", "Male1" );
|
||||
}
|
||||
407
docs/base/@vl2/scripts.vl2/scripts/admin.cs
Normal file
407
docs/base/@vl2/scripts.vl2/scripts/admin.cs
Normal file
|
|
@ -0,0 +1,407 @@
|
|||
// These have been secured against all those wanna-be-hackers.
|
||||
$VoteMessage["VoteAdminPlayer"] = "Admin Player";
|
||||
$VoteMessage["VoteKickPlayer"] = "Kick Player";
|
||||
$VoteMessage["BanPlayer"] = "Ban Player";
|
||||
$VoteMessage["VoteChangeMission"] = "change the mission to";
|
||||
$VoteMessage["VoteTeamDamage", 0] = "enable team damage";
|
||||
$VoteMessage["VoteTeamDamage", 1] = "disable team damage";
|
||||
$VoteMessage["VoteTournamentMode"] = "change the server to";
|
||||
$VoteMessage["VoteFFAMode"] = "change the server to";
|
||||
$VoteMessage["VoteChangeTimeLimit"] = "change the time limit to";
|
||||
$VoteMessage["VoteMatchStart"] = "start the match";
|
||||
$VoteMessage["VoteGreedMode", 0] = "enable Hoard Mode";
|
||||
$VoteMessage["VoteGreedMode", 1] = "disable Hoard Mode";
|
||||
$VoteMessage["VoteHoardMode", 0] = "enable Greed Mode";
|
||||
$VoteMessage["VoteHoardMode", 1] = "disable Greed Mode";
|
||||
|
||||
function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %playerVote)
|
||||
{
|
||||
//DEMO VERSION - only voteKickPlayer is allowed
|
||||
if ((isDemo()) && %typeName !$= "VoteKickPlayer")
|
||||
{
|
||||
messageClient(%client, '', "All voting options except to kick a player are disabled in the DEMO VERSION.");
|
||||
return;
|
||||
}
|
||||
|
||||
// haha - who gets the last laugh... No admin for you!
|
||||
if( %typeName $= "VoteAdminPlayer" && !$Host::allowAdminPlayerVotes )
|
||||
return;
|
||||
|
||||
%typePass = true;
|
||||
|
||||
// if not a valid vote, turn back.
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteTeamDamage" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteHoardMode" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteGreedMode" )
|
||||
%typePass = false;
|
||||
|
||||
if(( $VoteMessage[ %typeName, $TeamDamage ] $= "" && %typeName $= "VoteTeamDamage" ))
|
||||
%typePass = false;
|
||||
|
||||
if( !%typePass )
|
||||
return; // -> bye ;)
|
||||
|
||||
// z0dd - ZOD, 10/03/02. This was busted, BanPlayer was never delt with.
|
||||
if( %typeName $= "BanPlayer" )
|
||||
{
|
||||
if( !%client.isSuperAdmin || %arg1.isAdmin )
|
||||
{
|
||||
return; // -> bye ;)
|
||||
}
|
||||
else
|
||||
{
|
||||
ban( %arg1, %client );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
%isAdmin = ( %client.isAdmin || %client.isSuperAdmin );
|
||||
|
||||
// keep these under the server's control. I win.
|
||||
if( !%playerVote )
|
||||
%actionMsg = $VoteMessage[ %typeName ];
|
||||
else if( %typeName $= "VoteTeamDamage" || %typeName $= "VoteGreedMode" || %typeName $= "VoteHoardMode" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $TeamDamage ];
|
||||
else
|
||||
%actionMsg = $VoteMessage[ %typeName ];
|
||||
|
||||
if( !%client.canVote && !%isAdmin )
|
||||
return;
|
||||
|
||||
if ( !%isAdmin || ( ( %arg1.isAdmin && ( %client != %arg1 ) ) ) )
|
||||
{
|
||||
%teamSpecific = false;
|
||||
%gender = (%client.sex $= "Male" ? 'he' : 'she');
|
||||
if ( Game.scheduleVote $= "" )
|
||||
{
|
||||
%clientsVoting = 0;
|
||||
|
||||
//send a message to everyone about the vote...
|
||||
if ( %playerVote )
|
||||
{
|
||||
%teamSpecific = ( %typeName $= "VoteKickPlayer" ) && ( Game.numTeams > 1 );
|
||||
%kickerIsObs = %client.team == 0;
|
||||
%kickeeIsObs = %arg1.team == 0;
|
||||
%sameTeam = %client.team == %arg1.team;
|
||||
|
||||
if( %kickeeIsObs )
|
||||
{
|
||||
%teamSpecific = false;
|
||||
%sameTeam = false;
|
||||
}
|
||||
|
||||
if(( !%sameTeam && %teamSpecific) && %typeName !$= "VoteAdminPlayer")
|
||||
{
|
||||
messageClient(%client, '', "\c2Player votes must be team based.");
|
||||
return;
|
||||
}
|
||||
|
||||
// kicking is team specific
|
||||
if( %typeName $= "VoteKickPlayer" )
|
||||
{
|
||||
if(%arg1.isSuperAdmin)
|
||||
{
|
||||
messageClient(%client, '', '\c2You can not %1 %2, %3 is a Super Admin!', %actionMsg, %arg1.name, %gender);
|
||||
return;
|
||||
}
|
||||
|
||||
Game.kickClient = %arg1;
|
||||
Game.kickClientName = %arg1.name;
|
||||
Game.kickGuid = %arg1.guid;
|
||||
Game.kickTeam = %arg1.team;
|
||||
|
||||
if(%teamSpecific)
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
|
||||
if (%cl.team == %client.team && !%cl.isAIControlled())
|
||||
{
|
||||
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %actionMsg, %arg1.name);
|
||||
%clientsVoting++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
if ( !%cl.isAIControlled() )
|
||||
{
|
||||
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %actionMsg, %arg1.name);
|
||||
%clientsVoting++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
if ( !%cl.isAIControlled() )
|
||||
{
|
||||
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %actionMsg, %arg1.name);
|
||||
%clientsVoting++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( %typeName $= "VoteChangeMission" )
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
if ( !%cl.isAIControlled() )
|
||||
{
|
||||
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3 (%4).', %client.name, %actionMsg, %arg1, %arg2 );
|
||||
%clientsVoting++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (%arg1 !$= 0)
|
||||
{
|
||||
if (%arg2 !$= 0)
|
||||
{
|
||||
if(%typeName $= "VoteTournamentMode")
|
||||
{
|
||||
%admin = getAdmin();
|
||||
if(%admin > 0)
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
if ( !%cl.isAIControlled() )
|
||||
{
|
||||
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 Tournament Mode (%3).', %client.name, %actionMsg, %arg1);
|
||||
%clientsVoting++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
messageClient( %client, 'clientMsg', 'There must be a server admin to play in Tournament Mode.');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
if ( !%cl.isAIControlled() )
|
||||
{
|
||||
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3 %4.', %client.name, %actionMsg, %arg1, %arg2);
|
||||
%clientsVoting++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
if ( !%cl.isAIControlled() )
|
||||
{
|
||||
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %actionMsg, %arg1);
|
||||
%clientsVoting++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
if ( !%cl.isAIControlled() )
|
||||
{
|
||||
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, %actionMsg);
|
||||
%clientsVoting++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// open the vote hud for all clients that will participate in this vote
|
||||
if(%teamSpecific)
|
||||
{
|
||||
for ( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %clientIndex );
|
||||
|
||||
if(%cl.team == %client.team && !%cl.isAIControlled())
|
||||
messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %clientIndex );
|
||||
if ( !%cl.isAIControlled() )
|
||||
messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100));
|
||||
}
|
||||
}
|
||||
|
||||
clearVotes();
|
||||
Game.voteType = %typeName;
|
||||
Game.scheduleVote = schedule( ($Host::VoteTime * 1000), 0, "calcVotes", %typeName, %arg1, %arg2, %arg3, %arg4 );
|
||||
%client.vote = true;
|
||||
messageAll('addYesVote', "");
|
||||
|
||||
if(!%client.team == 0)
|
||||
clearBottomPrint(%client);
|
||||
}
|
||||
else
|
||||
messageClient( %client, 'voteAlreadyRunning', '\c2A vote is already in progress.' );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( Game.scheduleVote !$= "" && Game.voteType $= %typeName )
|
||||
{
|
||||
messageAll('closeVoteHud', "");
|
||||
cancel(Game.scheduleVote);
|
||||
Game.scheduleVote = "";
|
||||
}
|
||||
|
||||
// if this is a superAdmin, don't kick or ban
|
||||
if(%arg1 != %client)
|
||||
{
|
||||
if(!%arg1.isSuperAdmin)
|
||||
{
|
||||
// Set up kick/ban values:
|
||||
if ( %typeName $= "VoteBanPlayer" || %typeName $= "VoteKickPlayer" )
|
||||
{
|
||||
Game.kickClient = %arg1;
|
||||
Game.kickClientName = %arg1.name;
|
||||
Game.kickGuid = %arg1.guid;
|
||||
Game.kickTeam = %arg1.team;
|
||||
}
|
||||
|
||||
//Tinman - PURE servers can't call "eval"
|
||||
//Mark - True, but neither SHOULD a normal server
|
||||
// - thanks Ian Hardingham
|
||||
Game.evalVote(%typeName, true, %arg1, %arg2, %arg3, %arg4);
|
||||
}
|
||||
else
|
||||
messageClient(%client, '', '\c2You can not %1 %2, %3 is a Super Admin!', %actionMsg, %arg1.name, %gender);
|
||||
}
|
||||
}
|
||||
|
||||
%client.canVote = false;
|
||||
%client.rescheduleVote = schedule( ($Host::voteSpread * 1000) + ($Host::voteTime * 1000) , 0, "resetVotePrivs", %client );
|
||||
}
|
||||
|
||||
function resetVotePrivs( %client )
|
||||
{
|
||||
//messageClient( %client, '', 'You may now start a new vote.');
|
||||
%client.canVote = true;
|
||||
%client.rescheduleVote = "";
|
||||
}
|
||||
|
||||
function serverCmdSetPlayerVote(%client, %vote)
|
||||
{
|
||||
// players can only vote once
|
||||
if( %client.vote $= "" )
|
||||
{
|
||||
%client.vote = %vote;
|
||||
if(%client.vote == 1)
|
||||
messageAll('addYesVote', "");
|
||||
else
|
||||
messageAll('addNoVote', "");
|
||||
|
||||
commandToClient(%client, 'voteSubmitted', %vote);
|
||||
}
|
||||
}
|
||||
|
||||
function calcVotes(%typeName, %arg1, %arg2, %arg3, %arg4)
|
||||
{
|
||||
if(%typeName $= "voteMatchStart")
|
||||
if($MatchStarted || $countdownStarted)
|
||||
return;
|
||||
|
||||
for ( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %clientIndex );
|
||||
messageClient(%cl, 'closeVoteHud', "");
|
||||
|
||||
if ( %cl.vote !$= "" )
|
||||
{
|
||||
if ( %cl.vote )
|
||||
{
|
||||
Game.votesFor[%cl.team]++;
|
||||
Game.totalVotesFor++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Game.votesAgainst[%cl.team]++;
|
||||
Game.totalVotesAgainst++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Game.votesNone[%cl.team]++;
|
||||
Game.totalVotesNone++;
|
||||
}
|
||||
}
|
||||
//Tinman - PURE servers can't call "eval"
|
||||
//Mark - True, but neither SHOULD a normal server
|
||||
// - thanks Ian Hardingham
|
||||
Game.evalVote(%typeName, false, %arg1, %arg2, %arg3, %arg4);
|
||||
Game.scheduleVote = "";
|
||||
Game.kickClient = "";
|
||||
clearVotes();
|
||||
}
|
||||
|
||||
function clearVotes()
|
||||
{
|
||||
for(%clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++)
|
||||
{
|
||||
%client = ClientGroup.getObject(%clientIndex);
|
||||
%client.vote = "";
|
||||
messageClient(%client, 'clearVoteHud', "");
|
||||
}
|
||||
|
||||
for(%team = 1; %team < 5; %team++)
|
||||
{
|
||||
Game.votesFor[%team] = 0;
|
||||
Game.votesAgainst[%team] = 0;
|
||||
Game.votesNone[%team] = 0;
|
||||
Game.totalVotesFor = 0;
|
||||
Game.totalVotesAgainst = 0;
|
||||
Game.totalVotesNone = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Tournament mode Stuff-----------------------------------
|
||||
|
||||
function setModeFFA( %mission, %missionType )
|
||||
{
|
||||
if( $Host::TournamentMode )
|
||||
{
|
||||
$Host::TournamentMode = false;
|
||||
|
||||
if( isObject( Game ) )
|
||||
Game.gameOver();
|
||||
|
||||
loadMission(%mission, %missionType, false);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
function setModeTournament( %mission, %missionType )
|
||||
{
|
||||
if( !$Host::TournamentMode )
|
||||
{
|
||||
$Host::TournamentMode = true;
|
||||
|
||||
if( isObject( Game ) )
|
||||
Game.gameOver();
|
||||
|
||||
loadMission(%mission, %missionType, false);
|
||||
}
|
||||
}
|
||||
907
docs/base/@vl2/scripts.vl2/scripts/ai.cs
Normal file
907
docs/base/@vl2/scripts.vl2/scripts/ai.cs
Normal file
|
|
@ -0,0 +1,907 @@
|
|||
//-----------------------------------//
|
||||
// AI SCRIPT FUNCTIONS //
|
||||
//-----------------------------------//
|
||||
|
||||
//first, exec the supporting scripts
|
||||
exec("scripts/aiDebug.cs");
|
||||
exec("scripts/aiDefaultTasks.cs");
|
||||
exec("scripts/aiObjectives.cs");
|
||||
exec("scripts/aiInventory.cs");
|
||||
exec("scripts/aiChat.cs");
|
||||
exec("scripts/aiHumanTasks.cs");
|
||||
exec("scripts/aiObjectiveBuilder.cs");
|
||||
exec("scripts/aiBotProfiles.cs");
|
||||
|
||||
$AIModeStop = 0;
|
||||
$AIModeWalk = 1;
|
||||
$AIModeGainHeight = 2;
|
||||
$AIModeExpress = 3;
|
||||
$AIModeMountVehicle = 4;
|
||||
|
||||
$AIClientLOSTimeout = 15000; //how long a client has to remain out of sight of the bot
|
||||
//before the bot "can't see" the client anymore...
|
||||
$AIClientMinLOSTime = 10000; //how long a bot will search for a client
|
||||
|
||||
|
||||
//-----------------------------------//
|
||||
//Objective weights - level 1
|
||||
|
||||
$AIWeightCapFlag[1] = 5000; //range 5100 to 5320
|
||||
$AIWeightKillFlagCarrier[1] = 4800; //range 4800 to 5120
|
||||
$AIWeightReturnFlag[1] = 5001; //range 5101 to 5321
|
||||
$AIWeightDefendFlag[1] = 3900; //range 4000 to 4220
|
||||
$AIWeightGrabFlag[1] = 3850; //range 3950 to 4170
|
||||
|
||||
$AIWeightDefendFlipFlop[1] = 3900; //range 4000 to 4220
|
||||
$AIWeightCaptureFlipFlop[1] = 3850; //range 3850 to 4170
|
||||
|
||||
$AIWeightAttackGenerator[1] = 3100; //range 3200 to 3520
|
||||
$AIWeightRepairGenerator[1] = 3200; //range 3300 to 3620
|
||||
$AIWeightDefendGenerator[1] = 3100; //range 3200 to 3420
|
||||
|
||||
$AIWeightMortarTurret[1] = 3400; //range 3500 to 3600
|
||||
$AIWeightLazeObject[1] = 3200; //range 3300 to 3400
|
||||
$AIWeightRepairTurret[1] = 3100; //range 3200 to 3420
|
||||
|
||||
$AIWeightAttackInventory[1] = 2900; //range 2800 to 2920
|
||||
$AIWeightRepairInventory[1] = 2900; //range 2800 to 2920
|
||||
|
||||
$AIWeightEscortOffense[1] = 2900; //range 2800 to 2920
|
||||
$AIWeightEscortCapper[1] = 3250; //range 3350 to 3470
|
||||
|
||||
//used to allow a bot to finish tasks once started.
|
||||
$AIWeightContinueDeploying = 4250;
|
||||
$AIWeightContinueRepairing = 4250;
|
||||
|
||||
//Objective weights from human
|
||||
$AIWeightHumanIssuedCommand = 4450;
|
||||
$AIWeightHumanIssuedEscort = 4425;
|
||||
|
||||
//Objective weights - level 2
|
||||
$AIWeightCapFlag[2] = 0; //only one person can ever cap a flag
|
||||
$AIWeightKillFlagCarrier[2] = 4800; //range 4800 to 5020
|
||||
$AIWeightReturnFlag[2] = 4100; //range 4200 to 4320
|
||||
$AIWeightDefendFlag[2] = 2000; //range 2100 to 2220
|
||||
$AIWeightGrabFlag[2] = 2000; //range 2100 to 2220
|
||||
|
||||
$AIWeightDefendFlipFlop[2] = 2000; //range 2100 to 2220
|
||||
$AIWeightDefendFlipFlop[3] = 1500; //range 1600 to 1720
|
||||
$AIWeightDefendFlipFlop[4] = 1000; //range 1100 to 1220
|
||||
|
||||
$AIWeightAttackGenerator[2] = 1600; //range 1700 to 1920
|
||||
$AIWeightRepairGenerator[2] = 1600; //range 1700 to 1920
|
||||
$AIWeightDefendGenerator[2] = 1500; //range 1600 to 1720
|
||||
|
||||
$AIWeightAttackInventory[2] = 1400; //range 1500 to 1720
|
||||
$AIWeightRepairInventory[2] = 1400; //range 1500 to 1720
|
||||
|
||||
$AIWeightMortarTurret[2] = 1000; //range 1100 to 1320
|
||||
$AIWeightLazeObject[2] = 0; //no need to have more than one targetter
|
||||
$AIWeightRepairTurret[2] = 1000; //range 1100 to 1320
|
||||
|
||||
$AIWeightEscortOffense[2] = 2900; //range 3300 to 3420
|
||||
$AIWeightEscortCapper[2] = 3000; //range 3100 to 3220
|
||||
|
||||
|
||||
function AIInit()
|
||||
{
|
||||
AISlicerInit();
|
||||
installNavThreats();
|
||||
NavDetectForceFields();
|
||||
// ShowFPS();
|
||||
|
||||
//enable the use of grenades
|
||||
$AIDisableGrenades = false;
|
||||
$AIDisableChat = false;
|
||||
|
||||
//create the "objective delete set"
|
||||
if(nameToId("AIBombLocationSet") <= 0)
|
||||
{
|
||||
$AIBombLocationSet = new SimSet("AIBombLocationSet");
|
||||
MissionCleanup.add($AIBombLocationSet);
|
||||
}
|
||||
|
||||
//create the Inventory group
|
||||
if(nameToId("AIStationInventorySet") <= 0)
|
||||
{
|
||||
$AIInvStationSet = new SimSet("AIStationInventorySet");
|
||||
MissionCleanup.add($AIInvStationSet);
|
||||
}
|
||||
|
||||
//create the Item group
|
||||
if (nameToId("AIItemSet") <= 0)
|
||||
{
|
||||
$AIItemSet = new SimSet("AIItemSet");
|
||||
MissionCleanup.add($AIItemSet);
|
||||
}
|
||||
|
||||
//create the Item group
|
||||
if (nameToId("AIGrenadeSet") <= 0)
|
||||
{
|
||||
$AIGrenadeSet = new SimSet("AIGrenadeSet");
|
||||
MissionCleanup.add($AIGrenadeSet);
|
||||
}
|
||||
|
||||
//create the weapon group
|
||||
if (nameToId("AIWeaponSet") <= 0)
|
||||
{
|
||||
$AIWeaponSet = new SimSet("AIWeaponSet");
|
||||
MissionCleanup.add($AIWeaponSet);
|
||||
}
|
||||
|
||||
//create the deployed turret group
|
||||
if (nameToID("AIRemoteTurretSet") <= 0)
|
||||
{
|
||||
$AIRemoteTurretSet = new SimSet("AIRemoteTurretSet");
|
||||
MissionCleanup.add($AIRemoteTurretSet);
|
||||
}
|
||||
|
||||
//create the deployed turret group
|
||||
if (nameToID("AIDeployedMineSet") <= 0)
|
||||
{
|
||||
$AIDeployedMineSet = new SimSet("AIDeployedMineSet");
|
||||
MissionCleanup.add($AIDeployedMineSet);
|
||||
}
|
||||
|
||||
//create the deployed turret group
|
||||
if (nameToID("AIVehicleSet") <= 0)
|
||||
{
|
||||
$AIVehicleSet = new SimSet("AIVehicleSet");
|
||||
MissionCleanup.add($AIVehicleSet);
|
||||
}
|
||||
|
||||
%missionGroupFolder = nameToID("MissionGroup");
|
||||
%missionGroupFolder.AIMissionInit();
|
||||
}
|
||||
|
||||
// this is called at mission load by the specific game type
|
||||
function AIInitObjectives(%team, %game)
|
||||
{
|
||||
%group = nameToID("MissionGroup/Teams/team" @ %team @ "/AIObjectives");
|
||||
if(%group < 0)
|
||||
return; // opps, there is no Objectives set for this team.
|
||||
|
||||
// add the grouped objectives to the teams Q
|
||||
%count = %group.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%objective = %group.getObject(%i);
|
||||
if (%objective.getClassName() !$= "AIObjective")
|
||||
{
|
||||
%grpCount = %objective.getCount();
|
||||
for (%j = 0; %j < %grpCount; %j++)
|
||||
{
|
||||
%grpObj = %objective.getObject(%j);
|
||||
if (%objective.gameType $= "" || %objective.gameType $= "all")
|
||||
%objType = "";
|
||||
else
|
||||
%objType = %objective.gameType @ "Game";
|
||||
|
||||
if (%objType $= "" || %objType $= %game.class)
|
||||
{
|
||||
%grpObj.group = %objective;
|
||||
$ObjectiveQ[%team].add(%grpObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// add the non-grouped objectives to the teams Q
|
||||
%count = %group.getCount();
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%objective = %group.getObject(%i);
|
||||
|
||||
//if the objective is not an "AIObjective", assume it's a group and continue
|
||||
if (%objective.getClassName() !$= "AIObjective")
|
||||
continue;
|
||||
|
||||
if (%objective.gameType $= "" || %objective.gameType $= "all")
|
||||
%objType = "";
|
||||
else
|
||||
%objType = %objective.gameType @ "Game";
|
||||
|
||||
if (%objType $= "" || %objType $= %game.class)
|
||||
{
|
||||
%objective.group = "";
|
||||
$ObjectiveQ[%team].add(%objective);
|
||||
}
|
||||
}
|
||||
|
||||
// initialize the objectives
|
||||
%count = $ObjectiveQ[%team].getCount();
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%objective = $ObjectiveQ[%team].getObject(%i);
|
||||
|
||||
//clear out any dynamic fields
|
||||
%objective.clientLevel1 = "";
|
||||
%objective.clientLevel2 = "";
|
||||
%objective.clientLevel3 = "";
|
||||
%objective.isInvalid = false;
|
||||
%objective.repairObjective = "";
|
||||
|
||||
//set the location, if required
|
||||
if (%objective.position !$= "0 0 0")
|
||||
%objective.location = %objective.position;
|
||||
|
||||
// find targeted object ID's
|
||||
if(%objective.targetObject !$= "")
|
||||
%objective.targetObjectId = NameToId(%objective.targetObject);
|
||||
else
|
||||
%objective.targetObjectId = -1;
|
||||
|
||||
if(%objective.targetClientObject !$= "")
|
||||
%objective.targetClientId = NameToId(%objective.targetClient);
|
||||
else
|
||||
%objective.targetClientId = -1;
|
||||
|
||||
if (%objective.position $= "0 0 0")
|
||||
{
|
||||
if (%objective.location $= "0 0 0")
|
||||
{
|
||||
if (%objective.targetObjectId > 0)
|
||||
%objective.position = %objective.targetObjectId.position;
|
||||
}
|
||||
else
|
||||
%objective.position = %objective.location;
|
||||
}
|
||||
}
|
||||
|
||||
//finally, sort the objectiveQ
|
||||
$ObjectiveQ[%team].sortByWeight();
|
||||
}
|
||||
|
||||
//This function is designed to clear out the objective Q's, and clear the task lists from all the AIs
|
||||
function AIMissionEnd()
|
||||
{
|
||||
//disable the AI system
|
||||
AISystemEnabled(false);
|
||||
|
||||
//loop through the client list, and clear the tasks of each bot
|
||||
%count = ClientGroup.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%client = ClientGroup.getObject(%i);
|
||||
if (%client.isAIControlled())
|
||||
{
|
||||
//cancel the respawn thread and the objective thread...
|
||||
cancel(%client.respawnThread);
|
||||
cancel(%client.objectiveThread);
|
||||
|
||||
//reset the clients tasks, variables, etc...
|
||||
AIUnassignClient(%client);
|
||||
%client.stop();
|
||||
%client.clearTasks();
|
||||
%client.clearStep();
|
||||
%client.lastDamageClient = -1;
|
||||
%client.lastDamageTurret = -1;
|
||||
%client.shouldEngage = -1;
|
||||
%client.setEngageTarget(-1);
|
||||
%client.setTargetObject(-1);
|
||||
%client.pilotVehicle = false;
|
||||
%client.defaultTasksAdded = false;
|
||||
|
||||
//do the nav graph cleanup
|
||||
%client.missionCycleCleanup();
|
||||
}
|
||||
}
|
||||
|
||||
//clear the objective Q's
|
||||
for (%i = 0; %i <= Game.numTeams; %i++)
|
||||
{
|
||||
if (isObject($ObjectiveQ[%i]))
|
||||
{
|
||||
$ObjectiveQ[%i].clear();
|
||||
$ObjectiveQ[%i].delete();
|
||||
}
|
||||
$ObjectiveQ[%i] = "";
|
||||
}
|
||||
|
||||
//now delete all the sets used by the AI system...
|
||||
if (isObject($AIBombLocationSet))
|
||||
$AIBombLocationSet.delete();
|
||||
$AIBombLocationSet = "";
|
||||
|
||||
if (isObject($AIInvStationSet))
|
||||
$AIInvStationSet.delete();
|
||||
$AIInvStationSet = "";
|
||||
|
||||
if (isObject($AIItemSet))
|
||||
$AIItemSet.delete();
|
||||
$AIItemSet = "";
|
||||
|
||||
if (isObject($AIGrenadeSet))
|
||||
$AIGrenadeSet.delete();
|
||||
$AIGrenadeSet = "";
|
||||
|
||||
if (isObject($AIWeaponSet))
|
||||
$AIWeaponSet.delete();
|
||||
$AIWeaponSet = "";
|
||||
|
||||
if (isObject($AIRemoteTurretSet))
|
||||
$AIRemoteTurretSet.delete();
|
||||
$AIRemoteTurretSet = "";
|
||||
|
||||
if (isObject($AIDeployedMineSet))
|
||||
$AIDeployedMineSet.delete();
|
||||
$AIDeployedMineSet = "";
|
||||
|
||||
if (isObject($AIVehicleSet))
|
||||
$AIVehicleSet.delete();
|
||||
$AIVehicleSet = "";
|
||||
}
|
||||
|
||||
//FUNCTIONS ON EACH OBJECT EXECUTED AT MISSION LOAD TIME
|
||||
function SimGroup::AIMissionInit(%this)
|
||||
{
|
||||
for(%i = 0; %i < %this.getCount(); %i++)
|
||||
%this.getObject(%i).AIMissionInit(%this);
|
||||
}
|
||||
|
||||
function GameBase::AIMissionInit(%this)
|
||||
{
|
||||
%this.getDataBlock().AIMissionInit(%this);
|
||||
}
|
||||
|
||||
function StationInventory::AIMissionInit(%data, %object)
|
||||
{
|
||||
$AIInvStationSet.add(%object);
|
||||
}
|
||||
|
||||
function Flag::AIMissionInit(%data, %object)
|
||||
{
|
||||
if (%object.team >= 0)
|
||||
$AITeamFlag[%object.team] = %object;
|
||||
}
|
||||
|
||||
function SimObject::AIMissionInit(%this)
|
||||
{
|
||||
//this function is declared to prevent console error msg spam...
|
||||
}
|
||||
|
||||
function ItemData::AIMissionInit(%data, %object)
|
||||
{
|
||||
$AIItemSet.add(%object);
|
||||
}
|
||||
|
||||
function AIThrowObject(%object)
|
||||
{
|
||||
$AIItemSet.add(%object);
|
||||
}
|
||||
|
||||
function AIGrenadeThrown(%object)
|
||||
{
|
||||
$AIGrenadeSet.add(%object);
|
||||
}
|
||||
|
||||
function AIDeployObject(%client, %object)
|
||||
{
|
||||
//first, set the object id on the client
|
||||
%client.lastDeployedObject = %object;
|
||||
|
||||
//now see if it was a turret...
|
||||
%type = %object.getDataBlock().getName();
|
||||
if (%type $= "TurretDeployedFloorIndoor" || %type $= "TurretDeployedWallIndoor" ||
|
||||
%type $= "TurretDeployedCeilingIndoor" || %type $= "TurretDeployedOutdoor")
|
||||
{
|
||||
$AIRemoteTurretSet.add(%object);
|
||||
}
|
||||
}
|
||||
|
||||
function AIDeployMine(%object)
|
||||
{
|
||||
$AIDeployedMineSet.add(%object);
|
||||
}
|
||||
|
||||
function AIVehicleMounted(%vehicle)
|
||||
{
|
||||
$AIVehicleSet.add(%vehicle);
|
||||
}
|
||||
|
||||
function AICorpseAdded(%corpse)
|
||||
{
|
||||
if (isObject(%corpse))
|
||||
{
|
||||
%corpse.isCorpse = true;
|
||||
$AIItemSet.add(%corpse);
|
||||
}
|
||||
}
|
||||
|
||||
//OTHER UTILITY FUNCTIONS
|
||||
|
||||
function AIConnection::onAIDrop(%client)
|
||||
{
|
||||
//make sure we're trying to drop an AI
|
||||
if (!isObject(%client) || !%client.isAIControlled())
|
||||
return;
|
||||
|
||||
//clear the ai from any objectives, etc...
|
||||
AIUnassignClient(%client);
|
||||
%client.clearTasks();
|
||||
%client.clearStep();
|
||||
%client.defaultTasksAdded = false;
|
||||
|
||||
//kill the player, which should cause the Game object to perform whatever cleanup is required.
|
||||
if (isObject(%client.player))
|
||||
%client.player.scriptKill(0);
|
||||
|
||||
//do the nav graph cleanup
|
||||
%client.missionCycleCleanup();
|
||||
}
|
||||
|
||||
function AIConnection::endMission(%client)
|
||||
{
|
||||
//cancel the respawn thread, and spawn them manually
|
||||
cancel(%client.respawnThread);
|
||||
cancel(%client.objectiveThread);
|
||||
}
|
||||
|
||||
function AIConnection::startMission(%client)
|
||||
{
|
||||
//assign the team
|
||||
if (%client.team <= 0)
|
||||
Game.assignClientTeam(%client);
|
||||
|
||||
//set the client's sensor group...
|
||||
setTargetSensorGroup( %client.target, %client.team );
|
||||
%client.setSensorGroup( %client.team );
|
||||
|
||||
//sends a message so everyone know the bot is in the game...
|
||||
Game.AIHasJoined(%client);
|
||||
%client.matchStartReady = true;
|
||||
|
||||
//spawn the bot...
|
||||
onAIRespawn(%client);
|
||||
}
|
||||
|
||||
function AIConnection::onAIConnect(%client, %name, %team, %skill, %offense, %voice, %voicePitch)
|
||||
{
|
||||
// Sex/Race defaults
|
||||
%client.sex = "Male";
|
||||
%client.race = "Human";
|
||||
%client.armor = "Light";
|
||||
|
||||
//setup the voice and voicePitch
|
||||
if (%voice $= "")
|
||||
%voice = "Bot1";
|
||||
%client.voice = %voice;
|
||||
%client.voiceTag = addTaggedString(%voice);
|
||||
|
||||
if (%voicePitch $= "" || %voicePitch < 0.5 || %voicePitch > 2.0)
|
||||
%voicePitch = 1.0;
|
||||
%client.voicePitch = %voicePitch;
|
||||
|
||||
%client.name = addTaggedString( "\cp\c9" @ %name @ "\co" );
|
||||
%client.nameBase = %name;
|
||||
|
||||
echo(%client.name);
|
||||
echo("CADD: " @ %client @ " " @ %client.getAddress());
|
||||
$HostGamePlayerCount++;
|
||||
|
||||
//set the initial team - Game.assignClientTeam() should be called later on...
|
||||
%client.team = %team;
|
||||
if ( %client.team & 1 )
|
||||
%client.skin = addTaggedString( "basebot" );
|
||||
else
|
||||
%client.skin = addTaggedString( "basebbot" );
|
||||
|
||||
//setup the target for use with the sensor net, etc...
|
||||
%client.target = allocClientTarget(%client, %client.name, %client.skin, %client.voiceTag, '_ClientConnection', 0, 0, %client.voicePitch);
|
||||
|
||||
//i need to send a "silent" version of this for single player but still use the callback -jr`
|
||||
if($currentMissionType $= "SinglePlayer")
|
||||
messageAllExcept(%client, -1, 'MsgClientJoin', "", %name, %client, %client.target, true);
|
||||
else
|
||||
messageAllExcept(%client, -1, 'MsgClientJoin', '\c1%1 joined the game.', %name, %client, %client.target, true);
|
||||
|
||||
//assign the skill
|
||||
%client.setSkillLevel(%skill);
|
||||
|
||||
//assign the affinity
|
||||
%client.offense = %offense;
|
||||
|
||||
//clear any flags
|
||||
%client.stop(); // this will clear the players move state
|
||||
%client.clearStep();
|
||||
%client.lastDamageClient = -1;
|
||||
%client.lastDamageTurret = -1;
|
||||
%client.setEngageTarget(-1);
|
||||
%client.setTargetObject(-1);
|
||||
%client.objective = "";
|
||||
|
||||
//clear the defaulttasks flag
|
||||
%client.defaultTasksAdded = false;
|
||||
|
||||
//if the mission is already running, spawn the bot
|
||||
if ($missionRunning)
|
||||
%client.startMission();
|
||||
}
|
||||
|
||||
// This routes through C++ code so profiler can register it. Also, the console function
|
||||
// ProfilePatch1() tracks time spent (at MS resolution), # calls, average time per call.
|
||||
// See console variables $patch1Total (MS so far in routine), $patch1Avg (average MS
|
||||
// per call), and $patch1Calls (# of calls).
|
||||
function patchForTimeTest(%client)
|
||||
{
|
||||
if( isObject( Game ) )
|
||||
Game.AIChooseGameObjective(%client);
|
||||
}
|
||||
|
||||
function AIReassessObjective(%client)
|
||||
{
|
||||
ProfilePatch1(patchForTimeTest, %client);
|
||||
// Game.AIChooseGameObjective(%client);
|
||||
%client.objectiveThread = schedule(5000, %client, "AIReassessObjective", %client);
|
||||
}
|
||||
|
||||
function onAIRespawn(%client)
|
||||
{
|
||||
%markerObj = Game.pickPlayerSpawn(%client, true);
|
||||
Game.createPlayer(%client, %markerObj);
|
||||
|
||||
//make sure the player object is the AI's control object - even during the mission warmup time
|
||||
//the function AISystemEnabled(true/false) will control whether they actually move...
|
||||
%client.setControlObject(%client.player);
|
||||
|
||||
if (%client.objective)
|
||||
error("ERROR!!! " @ %client @ " is still assigned to objective: " @ %client.objective);
|
||||
|
||||
//clear the objective and choose a new one
|
||||
AIUnassignClient(%client);
|
||||
%client.stop();
|
||||
%client.clearStep();
|
||||
%client.lastDamageClient = -1;
|
||||
%client.lastDamageTurret = -1;
|
||||
%client.shouldEngage = -1;
|
||||
%client.setEngageTarget(-1);
|
||||
%client.setTargetObject(-1);
|
||||
%client.pilotVehicle = false;
|
||||
|
||||
//set the spawn time
|
||||
%client.spawnTime = getSimTime();
|
||||
%client.respawnThread = "";
|
||||
|
||||
//timeslice the objective reassessment for the bots
|
||||
if (!isEventPending(%client.objectiveThread))
|
||||
{
|
||||
%curTime = getSimTime();
|
||||
%remainder = %curTime % 5000;
|
||||
%schedTime = $AITimeSliceReassess - %remainder;
|
||||
if (%schedTime <= 0)
|
||||
%schedTime += 5000;
|
||||
%client.objectiveThread = schedule(%schedTime, %client, "AIReassessObjective", %client);
|
||||
|
||||
//set the next time slice "slot"
|
||||
$AITimeSliceReassess += 300;
|
||||
if ($AITimeSliceReassess > 5000)
|
||||
$AITimeSliceReassess -= 5000;
|
||||
}
|
||||
|
||||
//call the game specific spawn function
|
||||
Game.onAIRespawn(%client);
|
||||
}
|
||||
|
||||
function AIClientIsAlive(%client, %duration)
|
||||
{
|
||||
if(%client < 0 || %client.player <= 0)
|
||||
return false;
|
||||
if (isObject(%client.player))
|
||||
{
|
||||
%state = %client.player.getState();
|
||||
if (%state !$= "Dead" && %state !$= "" && (%duration $= "" || getSimTime() - %client.spawnTime >= %duration))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------------------------
|
||||
function AIFindClosestEnemy(%srcClient, %radius, %losTimeout)
|
||||
{
|
||||
//see if there's an enemy near our defense location...
|
||||
if (isObject(%srcClient.player))
|
||||
%srcLocation = %srcClient.player.getWorldBoxCenter();
|
||||
else
|
||||
%srcLocation = "0 0 0";
|
||||
return AIFindClosestEnemyToLoc(%srcClient, %srcLocation, %radius, %losTimeout, false, true);
|
||||
}
|
||||
|
||||
function AIFindClosestEnemyToLoc(%srcClient, %srcLocation, %radius, %losTimeout, %ignoreLOS, %distFromClient)
|
||||
{
|
||||
if (%ignoreLOS $= "")
|
||||
%ignoreLOS = false;
|
||||
if (%distFromClient $= "")
|
||||
%distFromClient = false;
|
||||
|
||||
%count = ClientGroup.getCount();
|
||||
%closestClient = -1;
|
||||
%closestDistance = 32767;
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
|
||||
//make sure we find someone who's alive
|
||||
if (AIClientIsAlive(%cl) && %cl.team != %srcClient.team)
|
||||
{
|
||||
%clIsCloaked = !isTargetVisible(%cl.target, %srcClient.getSensorGroup());
|
||||
|
||||
//make sure the client can see the enemy
|
||||
%hasLOS = %srcClient.hasLOSToClient(%cl);
|
||||
%losTime = %srcClient.getClientLOSTime(%cl);
|
||||
if (%ignoreLOS || %hasLOS || (%losTime < %losTimeout && AIClientIsAlive(%cl, %losTime + 1000)))
|
||||
{
|
||||
%testPos = %cl.player.getWorldBoxCenter();
|
||||
if (%distFromClient)
|
||||
%distance = %srcClient.getPathDistance(%testPos);
|
||||
else
|
||||
%distance = AIGetPathDistance(%srcLocation, %testPos);
|
||||
if (%distance > 0 && (%radius < 0 || %distance < %radius) && %distance < %closestDistance && (!%clIsCloaked || %distance < 8))
|
||||
{
|
||||
%closestClient = %cl;
|
||||
%closestDistance = %distance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return %closestClient SPC %closestDistance;
|
||||
}
|
||||
|
||||
function AIFindClosestEnemyPilot(%client, %radius, %losTimeout)
|
||||
{
|
||||
//loop through the vehicle set, looking for pilotted vehicles...
|
||||
%closestPilot = -1;
|
||||
%closestDist = %radius;
|
||||
%count = $AIVehicleSet.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
//first, make sure the vehicle is mounted by pilotted
|
||||
%vehicle = $AIVehicleSet.getObject(%i);
|
||||
%pilot = %vehicle.getMountNodeObject(0);
|
||||
if (%pilot <= 0 || !AIClientIsAlive(%pilot.client))
|
||||
continue;
|
||||
|
||||
//make sure the pilot is an enemy
|
||||
if (%pilot.client.team == %client.team)
|
||||
continue;
|
||||
|
||||
//see if the pilot has been seen by the client
|
||||
%hasLOS = %client.hasLOSToClient(%pilot.client);
|
||||
%losTime = %client.getClientLOSTime(%pilot.client);
|
||||
if (%hasLOS || (%losTime < %losTimeout && AIClientIsAlive(%pilot.client, %losTime + 1000)))
|
||||
{
|
||||
//see if it's the closest
|
||||
%clientPos = %client.player.getWorldBoxCenter();
|
||||
%pilotPos = %pilot.getWorldBoxCenter();
|
||||
%dist = VectorDist(%clientPos, %pilotPos);
|
||||
if (%dist < %closestDist)
|
||||
{
|
||||
%closestPilot = %pilot.client;
|
||||
%closestDist = %dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return %closestPilot SPC %closestDist;
|
||||
}
|
||||
|
||||
function AIFindAIClientInView(%srcClient, %team, %radius)
|
||||
{
|
||||
//make sure the player is alive
|
||||
if (! AIClientIsAlive(%srcClient))
|
||||
return -1;
|
||||
|
||||
//get various info about the player's eye
|
||||
%srcEyeTransform = %srcClient.player.getEyeTransform();
|
||||
%srcEyePoint = firstWord(%srcEyeTransform) @ " " @ getWord(%srcEyeTransform, 1) @ " " @ getWord(%srcEyeTransform, 2);
|
||||
%srcEyeVector = VectorNormalize(%srcClient.player.getEyeVector());
|
||||
|
||||
//see if there's an enemy near our defense location...
|
||||
%count = ClientGroup.getCount();
|
||||
%viewedClient = -1;
|
||||
%clientDot = -1;
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
|
||||
//make sure we find an AI who's alive and not the srcClient
|
||||
if (%cl != %srcClient && AIClientIsAlive(%cl) && %cl.isAIControlled() && (%team < 0 || %cl.team == %team))
|
||||
{
|
||||
//make sure the player is within range
|
||||
%clPos = %cl.player.getWorldBoxCenter();
|
||||
%distance = VectorDist(%clPos, %srcEyePoint);
|
||||
if (%radius <= 0 || %distance <= %radius)
|
||||
{
|
||||
//create the vector from the srcClient to the client
|
||||
%clVector = VectorNormalize(VectorSub(%clPos, %srcEyePoint));
|
||||
|
||||
//see if the dot product is greater than our current, and greater than 0.6
|
||||
%dot = VectorDot(%clVector, %srcEyeVector);
|
||||
|
||||
if (%dot > 0.6 && %dot > %clientDot)
|
||||
{
|
||||
%viewedClient = %cl;
|
||||
%clientDot = %dot;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return %viewedClient;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//AI VEHICLE FUNCTIONS
|
||||
|
||||
function Armor::AIonMount(%this, %obj, %vehicle, %node)
|
||||
{
|
||||
//set the client var...
|
||||
%client = %obj.client;
|
||||
%client.turretMounted = -1;
|
||||
|
||||
//make sure the AI was *supposed* to mount the vehicle
|
||||
if (!%client.isMountingVehicle())
|
||||
{
|
||||
AIDisembarkVehicle(%client);
|
||||
return;
|
||||
}
|
||||
|
||||
//get the vehicle's pilot
|
||||
%pilot = %vehicle.getMountNodeObject(0);
|
||||
|
||||
//make sure the bot is in node 0 if'f the bot is piloting the vehicle
|
||||
if ((%node == 0 && !%client.pilotVehicle) || (%node > 0 && %client.pilotVehicle))
|
||||
{
|
||||
AIDisembarkVehicle(%client);
|
||||
return;
|
||||
}
|
||||
|
||||
//make sure the bot didn't is on the same team as the pilot
|
||||
if (%pilot > 0 && isObject(%pilot) && %pilot.client.team != %client.team)
|
||||
{
|
||||
AIDisembarkVehicle(%client);
|
||||
return;
|
||||
}
|
||||
|
||||
//if we're supposed to pilot the vehicle, set the control object
|
||||
if (%client.pilotVehicle)
|
||||
%client.setControlObject(%vehicle);
|
||||
|
||||
//each vehicle may be built differently...
|
||||
if (%vehicle.getDataBlock().getName() $= "AssaultVehicle")
|
||||
{
|
||||
//node 1 is this vehicle's turret seat
|
||||
if (%node == 1)
|
||||
{
|
||||
%turret = %vehicle.getMountNodeObject(10);
|
||||
%skill = %client.getSkillLevel();
|
||||
%turret.setSkill(%skill);
|
||||
%client.turretMounted = %turret;
|
||||
%turret.setAutoFire(true);
|
||||
}
|
||||
}
|
||||
|
||||
else if (%vehicle.getDataBlock().getName() $= "BomberFlyer")
|
||||
{
|
||||
//node 1 is this vehicle's turret seat
|
||||
if (%node == 1)
|
||||
{
|
||||
%turret = %vehicle.getMountNodeObject(10);
|
||||
%skill = %client.getSkillLevel();
|
||||
%turret.setSkill(%skill);
|
||||
%client.turretMounted = %turret;
|
||||
%client.setTurretMounted(%turret);
|
||||
%turret.setAutoFire(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Armor::AIonUnMount(%this, %obj, %vehicle, %node)
|
||||
{
|
||||
//get the client var
|
||||
%client = %obj.client;
|
||||
|
||||
//reset the control object
|
||||
if (%client.pilotVehicle)
|
||||
%client.setControlObject(%client.player);
|
||||
%client.pilotVehicle = false;
|
||||
|
||||
//if the client had mounted a turret, turn the turret back off
|
||||
if (%client.turretMounted > 0)
|
||||
%client.turretMounted.setAutoFire(false);
|
||||
%client.turretMounted = -1;
|
||||
%client.setTurretMounted(-1);
|
||||
|
||||
// reset the turret skill level
|
||||
if(%vehicle.getDataBlock().getName() $= "AssaultVehicle")
|
||||
if (%node == 1)
|
||||
%vehicle.getMountNodeObject(10).setSkill(1.0);
|
||||
|
||||
if(%vehicle.getDataBlock().getName() $= "BomberFlyer")
|
||||
if(%node == 1)
|
||||
%vehicle.getMountNodeObject(10).setSkill(1.0);
|
||||
}
|
||||
|
||||
function AIDisembarkVehicle(%client)
|
||||
{
|
||||
if (%client.player.isMounted())
|
||||
{
|
||||
if (%client.pilotVehicle)
|
||||
%client.setControlObject(%client.player);
|
||||
%client.pressJump();
|
||||
}
|
||||
}
|
||||
|
||||
function AIProcessVehicle(%client)
|
||||
{
|
||||
//see if we're mounted on a turret, and if that turret has a target
|
||||
if (%client.turretMounted > 0)
|
||||
{
|
||||
%turretDB = %client.turretMounted.getDataBlock();
|
||||
|
||||
//see if we're in a bomber close to a bomb site...
|
||||
if (%turretDB.getName() $= "BomberTurret")
|
||||
{
|
||||
%clientPos = getWords(%client.player.position, 0, 1) @ " 0";
|
||||
%found = false;
|
||||
%count = $AIBombLocationSet.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%bombObj = $AIBombLocationSet.getObject(%i);
|
||||
%bombLocation = %bombObj.location;
|
||||
|
||||
//make sure the objective was issued by someone in the vehicle
|
||||
if (%bombObj.issuedByClientId.vehicleMounted == %client.vehicleMounted)
|
||||
{
|
||||
//find out where the bomb is going to drop... first, how high up are we...
|
||||
%bombLocation2D = getWord(%bombLocation, 0) SPC getWord(%bombLocation, 1) SPC "0";
|
||||
%height = getWord(%client.vehicleMounted.position, 2) - getWord(%bombLocation, 2);
|
||||
|
||||
//find out how long it'll take the bomb to fall that far...
|
||||
//assume no initial velocity in the Z axis...
|
||||
%timeToFall = mSqrt((2.0 * %height) / 9.81);
|
||||
|
||||
//how fast is the vehicle moving in the XY plane...
|
||||
%myLocation = %client.vehicleMounted.position;
|
||||
%myLocation2D = getWord(%myLocation, 0) SPC getWord(%myLocation, 1) SPC "0";
|
||||
%vel = %client.vehicleMounted.getVelocity();
|
||||
%vel2D = getWord(%vel, 0) SPC getWord(%vel, 1) SPC "0";
|
||||
|
||||
%bombImpact2D = VectorAdd(%myLocation2D, VectorScale(%vel2D, %timeToFall));
|
||||
|
||||
//see if the bomb inpact position is within 20m of the desired bomb site...
|
||||
%distToBombsite2D = VectorDist(%bombImpact2D, %bombLocation2D);
|
||||
if (%height > 20 && %distToBombsite2D < 25)
|
||||
{
|
||||
%found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//see if we found a bomb site
|
||||
if (%found)
|
||||
{
|
||||
%client.turretMounted.selectedWeapon = 2;
|
||||
%turretDB.onTrigger(%client.turretMounted, 0, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//we're not bombing, make sure we have the regular weapon selected
|
||||
%client.turretMounted.selectedWeapon = 1;
|
||||
if (isObject(%client.turretMounted.getTargetObject()))
|
||||
%turretDB.onTrigger(%client.turretMounted, 0, true);
|
||||
else
|
||||
%turretDB.onTrigger(%client.turretMounted, 0, false);
|
||||
}
|
||||
}
|
||||
|
||||
function AIPilotVehicle(%client)
|
||||
{
|
||||
//this is not very well supported, but someone will find a use for this function...
|
||||
}
|
||||
551
docs/base/@vl2/scripts.vl2/scripts/aiBotProfiles.cs
Normal file
551
docs/base/@vl2/scripts.vl2/scripts/aiBotProfiles.cs
Normal file
|
|
@ -0,0 +1,551 @@
|
|||
function aiConnectByIndex(%index, %team)
|
||||
{
|
||||
if (%index < 0 || $BotProfile[%index, name] $= "")
|
||||
return;
|
||||
|
||||
if (%team $= "")
|
||||
%team = -1;
|
||||
|
||||
//initialize the profile, if required
|
||||
if ($BotProfile[%index, skill] $= "")
|
||||
$BotProfile[%index, skill] = 0.5;
|
||||
|
||||
return aiConnect($BotProfile[%index, name], %team, $BotProfile[%index, skill], $BotProfile[%index, offense], $BotProfile[%index, voice], $BotProfile[%index, voicePitch]);
|
||||
}
|
||||
|
||||
function aiConnectByName(%name, %team)
|
||||
{
|
||||
if (%name $= "")
|
||||
return;
|
||||
|
||||
if (%team $= "")
|
||||
%team = -1;
|
||||
|
||||
%foundIndex = -1;
|
||||
%index = 0;
|
||||
while ($BotProfile[%index, name] !$= "")
|
||||
{
|
||||
if ($BotProfile[%index, name] $= %name)
|
||||
{
|
||||
%foundIndex = %index;
|
||||
break;
|
||||
}
|
||||
else
|
||||
%index++;
|
||||
}
|
||||
|
||||
//see if we found our bot
|
||||
if (%foundIndex >= 0)
|
||||
return aiConnectByIndex(%foundIndex, %team);
|
||||
|
||||
//else add a new bot profile
|
||||
else
|
||||
{
|
||||
$BotProfile[%index, name] = %name;
|
||||
return aiConnectByIndex(%index, %team);
|
||||
}
|
||||
}
|
||||
|
||||
function aiBotAlreadyConnected(%name)
|
||||
{
|
||||
%count = ClientGroup.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%client = ClientGroup.getObject(%i);
|
||||
if (%name $= getTaggedString(%client.name))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function aiConnectMultiple(%numToConnect, %minSkill, %maxSkill, %team)
|
||||
{
|
||||
//validate the args
|
||||
if (%numToConnect <= 0)
|
||||
return;
|
||||
|
||||
if (%maxSkill < 0)
|
||||
%maxSkill = 0;
|
||||
|
||||
if (%minSkill >= %maxSkill)
|
||||
%minSkill = %maxSkill - 0.01;
|
||||
|
||||
if (%team $= "")
|
||||
%team = -1;
|
||||
|
||||
//loop through the profiles, and set the flags and initialize
|
||||
%numBotsAlreadyConnected = 0;
|
||||
%index = 0;
|
||||
while ($BotProfile[%index, name] !$= "")
|
||||
{
|
||||
//initialize the profile if required
|
||||
if ($BotProfile[%index, skill] $= "")
|
||||
$BotProfile[%index, skill] = 0.5;
|
||||
|
||||
//if the bot is already playing, it shouldn't be reselected
|
||||
if (aiBotAlreadyConnected($BotProfile[%index, name]))
|
||||
{
|
||||
$BotProfile[%index, canSelect] = false;
|
||||
%numBotsAlreadyConnected++;
|
||||
}
|
||||
else
|
||||
$BotProfile[%index, canSelect] = true;
|
||||
|
||||
%index++;
|
||||
}
|
||||
|
||||
//make sure we're not trying to add more bots than we have...
|
||||
if (%numToConnect > (%index - %numBotsAlreadyConnected))
|
||||
%numToConnect = (%index - %numBotsAlreadyConnected);
|
||||
|
||||
//build the array of possible candidates...
|
||||
%index = 0;
|
||||
%tableCount = 0;
|
||||
while ($BotProfile[%index, name] !$= "")
|
||||
{
|
||||
%botSkill = $BotProfile[%index, skill];
|
||||
|
||||
//see if the skill is within range
|
||||
if ($BotProfile[%index, canSelect] && %botSkill >= %minSkill && %botSkill <= %maxSkill)
|
||||
{
|
||||
$BotSelectTable[%tableCount] = %index;
|
||||
%tableCount++;
|
||||
$BotProfile[%index, canSelect] = false;
|
||||
}
|
||||
|
||||
//check the next bot
|
||||
%index++;
|
||||
}
|
||||
|
||||
//if we didn't find enough bots, we'll have to search the rest of the profiles...
|
||||
%searchMinSkill = %minSkill;
|
||||
while ((%tableCount < %numToConnect) && (%searchMinSkill > 0))
|
||||
{
|
||||
%index = 0;
|
||||
while ($BotProfile[%index, name] !$= "")
|
||||
{
|
||||
%botSkill = $BotProfile[%index, skill];
|
||||
|
||||
//see if the skill is within range
|
||||
if ($BotProfile[%index, canSelect] && %botSkill >= (%searchMinSkill - 0.1) && %botSkill <= %searchMinSkill)
|
||||
{
|
||||
$BotSelectTable[%tableCount] = %index;
|
||||
%tableCount++;
|
||||
$BotProfile[%index, canSelect] = false;
|
||||
}
|
||||
|
||||
//check the next bot
|
||||
%index++;
|
||||
}
|
||||
|
||||
//now lower the search min Skill, and take another pass at a lower skill level
|
||||
%searchMinSkill = %searchMinSkill - 0.1;
|
||||
}
|
||||
|
||||
//if we're still short of bots, search the higher skill levels
|
||||
%searchMaxSkill = %maxSkill;
|
||||
while ((%tableCount < %numToConnect) && (%searchMaxSkill < 1.0))
|
||||
{
|
||||
%index = 0;
|
||||
while ($BotProfile[%index, name] !$= "")
|
||||
{
|
||||
%botSkill = $BotProfile[%index, skill];
|
||||
//see if the skill is within range
|
||||
if ($BotProfile[%index, canSelect] && %botSkill >= %searchMaxSkill && %botSkill <= (%searchMaxSkill + 0.1))
|
||||
{
|
||||
$BotSelectTable[%tableCount] = %index;
|
||||
%tableCount++;
|
||||
$BotProfile[%index, canSelect] = false;
|
||||
}
|
||||
|
||||
//check the next bot
|
||||
%index++;
|
||||
}
|
||||
|
||||
//now raise the search max Skill, and take another pass at a higher skill level
|
||||
%searchMaxSkill = %searchMaxSkill + 0.1;
|
||||
}
|
||||
|
||||
//since the numToConnect was capped at the table size, we should have enough bots in the
|
||||
//table to fulfill the quota
|
||||
|
||||
//loop through five times, picking random indices, and adding them until we've added enough
|
||||
%numBotsConnected = 0;
|
||||
for (%i = 0; %i < 5; %i++)
|
||||
{
|
||||
for (%j = 0; %j < %numToConnect; %j++)
|
||||
{
|
||||
%selectedIndex = mFloor(getRandom() * (%tableCount - 0.1));
|
||||
if ($BotSelectTable[%selectedIndex] >= 0)
|
||||
{
|
||||
//connect the bot
|
||||
%botClient = aiConnectByIndex($BotSelectTable[%selectedIndex], %team);
|
||||
%numBotsConnected++;
|
||||
|
||||
//adjust the skill level, if required
|
||||
%botSkill = %botClient.getSkillLevel();
|
||||
if (%botSkill < %minSkill || %botSkill > %maxSkill)
|
||||
{
|
||||
%newSkill = %minSKill + (getRandom() * (%maxSkill - %minSkill));
|
||||
%botClient.setSkillLevel(%newSkill);
|
||||
}
|
||||
|
||||
//clear the table entry to avoid connecting duplicates
|
||||
$BotSelectTable[%selectedIndex] = -1;
|
||||
|
||||
//see if we've connected enough
|
||||
if (%numBotsConnected == %numToConnect)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//at this point, we've looped though the table, and kept hitting duplicates, search the table sequentially
|
||||
for (%i = 0; %i < %tableCount; %i++)
|
||||
{
|
||||
if ($BotSelectTable[%i] >= 0)
|
||||
{
|
||||
//connect the bot
|
||||
%botClient = aiConnectByIndex($BotSelectTable[%i], %team);
|
||||
%numBotsConnected++;
|
||||
|
||||
//adjust the skill level, if required
|
||||
%botSkill = %botClient.getSkillLevel();
|
||||
if (%botSkill < %minSkill || %botSkill > %maxSkill)
|
||||
{
|
||||
%newSkill = %minSKill + (getRandom() * (%maxSkill - %minSkill));
|
||||
%botClient.setSkillLevel(%newSkill);
|
||||
}
|
||||
|
||||
//clear the table entry to avoid connecting duplicates
|
||||
$BotSelectTable[%i] = -1;
|
||||
|
||||
//see if we've connected enough
|
||||
if (%numBotsConnected == %numToConnect)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$BotProfile[0, name] = "Kidney BOT";
|
||||
$BotProfile[0, skill] = 0.99;
|
||||
$BotProfile[0, offense] = true;
|
||||
$BotProfile[0, voicePitch] = 0.875;
|
||||
$BotProfile[1, name] = "BOT Milk?";
|
||||
$BotProfile[1, skill] = 0.99;
|
||||
$BotProfile[1, offense] = true;
|
||||
$BotProfile[1, voicePitch] = 0.89;
|
||||
$BotProfile[2, name] = "UberBOT";
|
||||
$BotProfile[2, skill] = 0.99;
|
||||
$BotProfile[2, offense] = true;
|
||||
$BotProfile[2, voicePitch] = 0.95;
|
||||
$BotProfile[3, name] = "SymBOT";
|
||||
$BotProfile[3, skill] = 0.99;
|
||||
$BotProfile[3, offense] = true;
|
||||
$BotProfile[3, voicePitch] = 1.1;
|
||||
$BotProfile[4, name] = "QIX BOT";
|
||||
$BotProfile[4, skill] = 0.99;
|
||||
$BotProfile[4, offense] = false;
|
||||
$BotProfile[4, voicePitch] = 1.12;
|
||||
$BotProfile[5, name] = "Rated BOT";
|
||||
$BotProfile[5, skill] = 0.99;
|
||||
$BotProfile[5, offense] = true;
|
||||
$BotProfile[5, voicePitch] = 0.92;
|
||||
$BotProfile[6, name] = "Dr.BOTward";
|
||||
$BotProfile[6, skill] = 0.99;
|
||||
$BotProfile[6, offense] = true;
|
||||
$BotProfile[6, voicePitch] = 0.96;
|
||||
$BotProfile[7, name] = "Frank BOTzo";
|
||||
$BotProfile[7, skill] = 0.99;
|
||||
$BotProfile[7, offense] = true;
|
||||
$BotProfile[7, voicePitch] = 0.88;
|
||||
$BotProfile[8, name] = "Missing BOT";
|
||||
$BotProfile[8, skill] = 0.99;
|
||||
$BotProfile[8, offense] = true;
|
||||
$BotProfile[8, voicePitch] = 1.125;
|
||||
$BotProfile[9, name] = "Jett BOT";
|
||||
$BotProfile[9, skill] = 0.99;
|
||||
$BotProfile[9, offense] = false;
|
||||
$BotProfile[9, voicePitch] = 1.12;
|
||||
$BotProfile[10, name] = "HexaBOTic";
|
||||
$BotProfile[10, skill] = 0.99;
|
||||
$BotProfile[10, offense] = true;
|
||||
$BotProfile[10, voicePitch] = 0.895;
|
||||
$BotProfile[11, name] = "Sne/\\kBOT";
|
||||
$BotProfile[11, skill] = 0.99;
|
||||
$BotProfile[11, offense] = true;
|
||||
$BotProfile[11, voicePitch] = 0.885;
|
||||
$BotProfile[12, name] = "DiamondBOT";
|
||||
$BotProfile[12, skill] = 0.99;
|
||||
$BotProfile[12, offense] = true;
|
||||
$BotProfile[12, voicePitch] = 1.05;
|
||||
$BotProfile[13, name] = "Jimmy BOT";
|
||||
$BotProfile[13, skill] = 0.99;
|
||||
$BotProfile[13, offense] = true;
|
||||
$BotProfile[13, voicePitch] = 1.09;
|
||||
$BotProfile[14, name] = "Skeet BOT";
|
||||
$BotProfile[14, skill] = 0.99;
|
||||
$BotProfile[14, offense] = false;
|
||||
$BotProfile[14, voicePitch] = 1.0;
|
||||
$BotProfile[15, name] = "BigBOTDawg";
|
||||
$BotProfile[15, skill] = 0.99;
|
||||
$BotProfile[15, offense] = true;
|
||||
$BotProfile[15, voicePitch] = 0.9;
|
||||
$BotProfile[16, name] = "BOTIN8R";
|
||||
$BotProfile[16, skill] = 0.99;
|
||||
$BotProfile[16, offense] = true;
|
||||
$BotProfile[16, voicePitch] = 0.97;
|
||||
$BotProfile[17, name] = "OrphanKazBOT";
|
||||
$BotProfile[17, skill] = 0.99;
|
||||
$BotProfile[17, offense] = true;
|
||||
$BotProfile[17, voicePitch] = 0.925;
|
||||
$BotProfile[18, name] = "Terrible BOT";
|
||||
$BotProfile[18, skill] = 0.99;
|
||||
$BotProfile[18, offense] = true;
|
||||
$BotProfile[18, voicePitch] = 1.115;
|
||||
$BotProfile[19, name] = "Mongo BOT";
|
||||
$BotProfile[19, skill] = 0.99;
|
||||
$BotProfile[19, offense] = false;
|
||||
$BotProfile[19, voicePitch] = 1.12;
|
||||
$BotProfile[20, name] = "East BOT";
|
||||
$BotProfile[20, skill] = 0.99;
|
||||
$BotProfile[20, offense] = true;
|
||||
$BotProfile[20, voicePitch] = 1.125;
|
||||
$BotProfile[21, name] = "Snow LeoBOT";
|
||||
$BotProfile[21, skill] = 0.99;
|
||||
$BotProfile[21, offense] = true;
|
||||
$BotProfile[21, voicePitch] = 1.05;
|
||||
$BotProfile[22, name] = "Twitch BOT";
|
||||
$BotProfile[22, skill] = 0.99;
|
||||
$BotProfile[22, offense] = true;
|
||||
$BotProfile[22, voicePitch] = 0.893;
|
||||
$BotProfile[23, name] = "ShazBOT";
|
||||
$BotProfile[23, skill] = 0.99;
|
||||
$BotProfile[23, offense] = true;
|
||||
$BotProfile[23, voicePitch] = 0.879;
|
||||
|
||||
$BotProfile[24, name] = "Fishbait";
|
||||
$BotProfile[24, skill] = 0.00;
|
||||
$BotProfile[24, offense] = true;
|
||||
$BotProfile[24, voicePitch] = 1.125;
|
||||
$BotProfile[25, name] = "Skulker";
|
||||
$BotProfile[25, skill] = 0.00;
|
||||
$BotProfile[25, offense] = false;
|
||||
$BotProfile[25, voicePitch] = 1.1;
|
||||
$BotProfile[26, name] = "Dogstar";
|
||||
$BotProfile[26, skill] = 0.00;
|
||||
$BotProfile[26, offense] = false;
|
||||
$BotProfile[26, voicePitch] = 1.02;
|
||||
$BotProfile[27, name] = "Bonehead";
|
||||
$BotProfile[27, skill] = 0.00;
|
||||
$BotProfile[27, offense] = false;
|
||||
$BotProfile[27, voicePitch] = 0.975;
|
||||
$BotProfile[28, name] = "Torus";
|
||||
$BotProfile[28, skill] = 0.00;
|
||||
$BotProfile[28, offense] = false;
|
||||
$BotProfile[28, voicePitch] = 0.9;
|
||||
$BotProfile[29, name] = "Glitter";
|
||||
$BotProfile[29, skill] = 0.05;
|
||||
$BotProfile[29, offense] = true;
|
||||
$BotProfile[29, voicePitch] = 1.1;
|
||||
$BotProfile[30, name] = "Wirehead";
|
||||
$BotProfile[30, skill] = 0.05;
|
||||
$BotProfile[30, offense] = false;
|
||||
$BotProfile[30, voicePitch] = 1.03;
|
||||
$BotProfile[31, name] = "Ironbreath";
|
||||
$BotProfile[31, skill] = 0.10;
|
||||
$BotProfile[31, offense] = false;
|
||||
$BotProfile[31, voicePitch] = 1.02;
|
||||
$BotProfile[32, name] = "Hagstomper";
|
||||
$BotProfile[32, skill] = 0.10;
|
||||
$BotProfile[32, offense] = false;
|
||||
$BotProfile[32, voicePitch] = 0.899;
|
||||
$BotProfile[33, name] = "Doormat";
|
||||
$BotProfile[33, skill] = 0.15;
|
||||
$BotProfile[33, offense] = false;
|
||||
$BotProfile[33, voicePitch] = 0.97;
|
||||
$BotProfile[34, name] = "TickTock";
|
||||
$BotProfile[34, skill] = 0.15;
|
||||
$BotProfile[34, offense] = true;
|
||||
$BotProfile[34, voicePitch] = 1.07;
|
||||
$BotProfile[35, name] = "ElectroJag";
|
||||
$BotProfile[35, skill] = 0.20;
|
||||
$BotProfile[35, offense] = false;
|
||||
$BotProfile[35, voicePitch] = 0.915;
|
||||
$BotProfile[36, name] = "Jetsam";
|
||||
$BotProfile[36, skill] = 0.20;
|
||||
$BotProfile[36, offense] = false;
|
||||
$BotProfile[36, voicePitch] = 1.09;
|
||||
$BotProfile[37, name] = "Newguns";
|
||||
$BotProfile[37, skill] = 0.25;
|
||||
$BotProfile[37, offense] = false;
|
||||
$BotProfile[37, voicePitch] = 0.885;
|
||||
$BotProfile[38, name] = "WrongWay";
|
||||
$BotProfile[38, skill] = 0.25;
|
||||
$BotProfile[38, offense] = false;
|
||||
$BotProfile[38, voicePitch] = 0.875;
|
||||
$BotProfile[39, name] = "Ragbinder";
|
||||
$BotProfile[39, skill] = 0.30;
|
||||
$BotProfile[39, offense] = true;
|
||||
$BotProfile[39, voicePitch] = 1.1;
|
||||
$BotProfile[40, name] = "Retch";
|
||||
$BotProfile[40, skill] = 0.30;
|
||||
$BotProfile[40, offense] = false;
|
||||
$BotProfile[40, voicePitch] = 1.12;
|
||||
$BotProfile[41, name] = "Hotfoot";
|
||||
$BotProfile[41, skill] = 0.35;
|
||||
$BotProfile[41, offense] = false;
|
||||
$BotProfile[41, voicePitch] = 0.93;
|
||||
$BotProfile[42, name] = "Trail of Rust";
|
||||
$BotProfile[42, skill] = 0.35;
|
||||
$BotProfile[42, offense] = false;
|
||||
$BotProfile[42, voicePitch] = 0.88;
|
||||
$BotProfile[43, name] = "Zigzag";
|
||||
$BotProfile[43, skill] = 0.40;
|
||||
$BotProfile[43, offense] = false;
|
||||
$BotProfile[43, voicePitch] = 0.89;
|
||||
$BotProfile[44, name] = "Gray Sabot";
|
||||
$BotProfile[44, skill] = 0.40;
|
||||
$BotProfile[44, offense] = true;
|
||||
$BotProfile[44, voicePitch] = 0.879;
|
||||
$BotProfile[45, name] = "Hellefleur";
|
||||
$BotProfile[45, skill] = 0.45;
|
||||
$BotProfile[45, offense] = false;
|
||||
$BotProfile[45, voicePitch] = 1.11;
|
||||
$BotProfile[46, name] = "Slicer";
|
||||
$BotProfile[46, skill] = 0.45;
|
||||
$BotProfile[46, offense] = false;
|
||||
$BotProfile[46, voicePitch] = 1.12;
|
||||
$BotProfile[47, name] = "Rampant";
|
||||
$BotProfile[47, skill] = 0.45;
|
||||
$BotProfile[47, offense] = false;
|
||||
$BotProfile[47, voicePitch] = 0.935;
|
||||
$BotProfile[48, name] = "Troglodyte";
|
||||
$BotProfile[48, skill] = 0.45;
|
||||
$BotProfile[48, offense] = true;
|
||||
$BotProfile[48, voicePitch] = 1.121;
|
||||
$BotProfile[49, name] = "Evenkill";
|
||||
$BotProfile[49, skill] = 0.50;
|
||||
$BotProfile[49, offense] = false;
|
||||
$BotProfile[49, voicePitch] = 1.05;
|
||||
$BotProfile[50, name] = "Simrionic";
|
||||
$BotProfile[50, skill] = 0.50;
|
||||
$BotProfile[50, offense] = false;
|
||||
$BotProfile[50, voicePitch] = 0.895;
|
||||
$BotProfile[51, name] = "Cathode Kiss";
|
||||
$BotProfile[51, skill] = 0.50;
|
||||
$BotProfile[51, offense] = false;
|
||||
$BotProfile[51, voicePitch] = 0.97;
|
||||
$BotProfile[52, name] = "So Dark";
|
||||
$BotProfile[52, skill] = 0.55;
|
||||
$BotProfile[52, offense] = true;
|
||||
$BotProfile[52, voicePitch] = 1.01;
|
||||
$BotProfile[53, name] = "Deathwind";
|
||||
$BotProfile[53, skill] = 0.55;
|
||||
$BotProfile[53, offense] = false;
|
||||
$BotProfile[53, voicePitch] = 1.12;
|
||||
$BotProfile[54, name] = "Dharmic Sword";
|
||||
$BotProfile[54, skill] = 0.55;
|
||||
$BotProfile[54, offense] = false;
|
||||
$BotProfile[54, voicePitch] = 1.0;
|
||||
$BotProfile[55, name] = "Demonshriek";
|
||||
$BotProfile[55, skill] = 0.60;
|
||||
$BotProfile[55, offense] = false;
|
||||
$BotProfile[55, voicePitch] = 1.05;
|
||||
$BotProfile[56, name] = "Terrapin";
|
||||
$BotProfile[56, skill] = 0.60;
|
||||
$BotProfile[56, offense] = true;
|
||||
$BotProfile[56, voicePitch] = 1.085;
|
||||
$BotProfile[57, name] = "No-Dachi";
|
||||
$BotProfile[57, skill] = 0.60;
|
||||
$BotProfile[57, offense] = true;
|
||||
$BotProfile[57, voicePitch] = 0.905;
|
||||
$BotProfile[58, name] = "Irrelevant Smoke";
|
||||
$BotProfile[58, skill] = 0.65;
|
||||
$BotProfile[58, offense] = false;
|
||||
$BotProfile[58, voicePitch] = 0.935;
|
||||
$BotProfile[59, name] = "Red Ghost";
|
||||
$BotProfile[59, skill] = 0.65;
|
||||
$BotProfile[59, offense] = false;
|
||||
$BotProfile[59, voicePitch] = 1.21;
|
||||
$BotProfile[60, name] = "Perilous";
|
||||
$BotProfile[60, skill] = 0.65;
|
||||
$BotProfile[60, offense] = true;
|
||||
$BotProfile[60, voicePitch] = 0.895;
|
||||
$BotProfile[61, name] = "The Golden";
|
||||
$BotProfile[61, skill] = 0.70;
|
||||
$BotProfile[61, offense] = true;
|
||||
$BotProfile[61, voicePitch] = 0.88;
|
||||
$BotProfile[62, name] = "Vanguard";
|
||||
$BotProfile[62, skill] = 0.70;
|
||||
$BotProfile[62, offense] = false;
|
||||
$BotProfile[62, voicePitch] = 1.1;
|
||||
$BotProfile[63, name] = "Heretik";
|
||||
$BotProfile[63, skill] = 0.70;
|
||||
$BotProfile[63, offense] = true;
|
||||
$BotProfile[63, voicePitch] = 0.945;
|
||||
$BotProfile[64, name] = "Akhiles";
|
||||
$BotProfile[64, skill] = 0.75;
|
||||
$BotProfile[64, offense] = true;
|
||||
$BotProfile[64, voicePitch] = 0.915;
|
||||
$BotProfile[65, name] = "Nova-9";
|
||||
$BotProfile[65, skill] = 0.75;
|
||||
$BotProfile[65, offense] = false;
|
||||
$BotProfile[65, voicePitch] = 1.12;
|
||||
$BotProfile[66, name] = "Hotspur";
|
||||
$BotProfile[66, skill] = 0.75;
|
||||
$BotProfile[66, offense] = true;
|
||||
$BotProfile[66, voicePitch] = 1.11;
|
||||
$BotProfile[67, name] = "DustWitch";
|
||||
$BotProfile[67, skill] = 0.80;
|
||||
$BotProfile[67, offense] = true;
|
||||
$BotProfile[67, voicePitch] = 0.875;
|
||||
$BotProfile[68, name] = "Mojo Savage";
|
||||
$BotProfile[68, skill] = 0.80;
|
||||
$BotProfile[68, offense] = true;
|
||||
$BotProfile[68, voicePitch] = 1.05;
|
||||
$BotProfile[69, name] = "Velomancer";
|
||||
$BotProfile[69, skill] = 0.80;
|
||||
$BotProfile[69, offense] = false;
|
||||
$BotProfile[69, voicePitch] = 1.085;
|
||||
$BotProfile[70, name] = "Mohican";
|
||||
$BotProfile[70, skill] = 0.85;
|
||||
$BotProfile[70, offense] = true;
|
||||
$BotProfile[70, voicePitch] = 1.045;
|
||||
$BotProfile[71, name] = "Widowmaker";
|
||||
$BotProfile[71, skill] = 0.85;
|
||||
$BotProfile[71, offense] = true;
|
||||
$BotProfile[71, voicePitch] = 1.04;
|
||||
$BotProfile[72, name] = "Punch";
|
||||
$BotProfile[72, skill] = 0.85;
|
||||
$BotProfile[72, offense] = true;
|
||||
$BotProfile[72, voicePitch] = 0.89;
|
||||
$BotProfile[73, name] = "Mameluke";
|
||||
$BotProfile[73, skill] = 0.90;
|
||||
$BotProfile[73, offense] = false;
|
||||
$BotProfile[73, voicePitch] = 0.882;
|
||||
$BotProfile[74, name] = "King Snake";
|
||||
$BotProfile[74, skill] = 0.90;
|
||||
$BotProfile[74, offense] = true;
|
||||
$BotProfile[74, voicePitch] = 1.05;
|
||||
$BotProfile[75, name] = "Sorrow";
|
||||
$BotProfile[75, skill] = 0.90;
|
||||
$BotProfile[75, offense] = true;
|
||||
$BotProfile[75, voicePitch] = 1.09;
|
||||
$BotProfile[76, name] = "Devourer";
|
||||
$BotProfile[76, skill] = 0.95;
|
||||
$BotProfile[76, offense] = true;
|
||||
$BotProfile[76, voicePitch] = 0.929;
|
||||
$BotProfile[77, name] = "Fated to Glory";
|
||||
$BotProfile[77, skill] = 0.95;
|
||||
$BotProfile[77, offense] = true;
|
||||
$BotProfile[77, voicePitch] = 0.915;
|
||||
$BotProfile[78, name] = "Neon Blossom";
|
||||
$BotProfile[78, skill] = 0.95;
|
||||
$BotProfile[78, offense] = false;
|
||||
$BotProfile[78, voicePitch] = 1.125;
|
||||
$BotProfile[79, name] = "Shiver";
|
||||
$BotProfile[79, skill] = 0.95;
|
||||
$BotProfile[79, offense] = true;
|
||||
$BotProfile[79, voicePitch] = 0.875;
|
||||
320
docs/base/@vl2/scripts.vl2/scripts/aiBountyGame.cs
Normal file
320
docs/base/@vl2/scripts.vl2/scripts/aiBountyGame.cs
Normal file
|
|
@ -0,0 +1,320 @@
|
|||
// bounty game support
|
||||
|
||||
function BountyGame::onAIRespawn(%game, %client)
|
||||
{
|
||||
//add the default task
|
||||
if (! %client.defaultTasksAdded)
|
||||
{
|
||||
%client.defaultTasksAdded = true;
|
||||
%client.addTask(AIPickupItemTask);
|
||||
%client.addTask(AIUseInventoryTask);
|
||||
%client.addTask(AITauntCorpseTask);
|
||||
%client.addTask(AIEngageTurretTask);
|
||||
%client.addTask(AIDetectMineTask);
|
||||
%client.addTask(AIBountyPatrolTask);
|
||||
%client.bountyTask = %client.addTask(AIBountyEngageTask);
|
||||
}
|
||||
|
||||
//set the inv flag
|
||||
%client.spawnUseInv = true;
|
||||
}
|
||||
|
||||
function BountyGame::AIInit(%game)
|
||||
{
|
||||
AIInit();
|
||||
}
|
||||
|
||||
function BountyGame::aiBountyAssignTarget(%game, %client, %target)
|
||||
{
|
||||
if (!isObject(%client.bountyTask))
|
||||
%client.bountyTask = %client.addTask(AIBountyEngageTask);
|
||||
%task = %client.bountyTask;
|
||||
|
||||
%task.baseWeight = $AIWeightKillFlagCarrier[1];
|
||||
%task.buyEquipmentSet = "LightEnergySniper";
|
||||
}
|
||||
|
||||
function AIBountyEngageTask::assume(%task, %client)
|
||||
{
|
||||
%task.setWeightFreq(15);
|
||||
%task.setMonitorFreq(15);
|
||||
}
|
||||
|
||||
function AIBountyEngageTask::retire(%task, %client)
|
||||
{
|
||||
%client.setEngageTarget(-1);
|
||||
}
|
||||
|
||||
function AIBountyEngageTask::weight(%task, %client)
|
||||
{
|
||||
%player = %client.player;
|
||||
if (!isObject(%player))
|
||||
return;
|
||||
|
||||
%clientPos = %player.getWorldBoxCenter();
|
||||
%client.shouldEngage = -1;
|
||||
|
||||
//first, make sure we actually can fight
|
||||
if (AIEngageOutOfAmmo(%client))
|
||||
{
|
||||
%task.setWeight(0);
|
||||
return;
|
||||
}
|
||||
|
||||
//see if anyone has fired on us recently...
|
||||
%mustEngage = false;
|
||||
%losTimeout = $AIClientMinLOSTime + ($AIClientLOSTimeout * %client.getSkillLevel());
|
||||
if (AIClientIsAlive(%client.lastDamageClient, %losTimeout) && getSimTime() - %client.lastDamageTime < %losTimeout)
|
||||
{
|
||||
//see if the attacker is either our target or, we are their target
|
||||
if (%client.lastDamageClient == %client.objectiveTarget || %client.lastDamageClient.objectiveTarget == %client)
|
||||
{
|
||||
%mustEngage = true;
|
||||
%currentTarget = %client.getEngageTarget();
|
||||
|
||||
//see if this is a new attacker
|
||||
if (AIClientIsAlive(%currentTarget) && %currentTarget != %client.lastDamageClient)
|
||||
{
|
||||
%targPos = %currentTarget.player.getWorldBoxCenter();
|
||||
%curTargDist = %client.getPathDistance(%targPos);
|
||||
|
||||
%newTargPos = %client.lastDamageClient.player.getWorldBoxCenter();
|
||||
%newTargDist = %client.getPathDistance(%newTargPos);
|
||||
|
||||
//see if the new targ is no more than 30 m further
|
||||
if (%newTargDist > 0 && %newTargDist < %curTargDist + 30)
|
||||
%client.shouldEngage = %client.lastDamageClient;
|
||||
else
|
||||
%client.shouldEngage = %currentTarget;
|
||||
}
|
||||
else
|
||||
%client.shouldEngage = %client.lastDamageClient;
|
||||
}
|
||||
|
||||
//otherwise we should run react to an attacker who is not really supposed to be attacking us...
|
||||
else
|
||||
%client.setDangerLocation(%client.player.position, 20);
|
||||
}
|
||||
|
||||
//no one has fired at us recently, see if we're near our objective target...
|
||||
else
|
||||
{
|
||||
//see if we still have sight of the current target
|
||||
%hasLOS = %client.hasLOSToClient(%client.objectiveTarget);
|
||||
%losTime = %client.getClientLOSTime(%client.objectiveTarget);
|
||||
if (%hasLOS || %losTime < %losTimeout)
|
||||
%client.shouldEngage = %client.objectiveTarget;
|
||||
else
|
||||
%client.shouldEngage = -1;
|
||||
}
|
||||
|
||||
//now set the weight
|
||||
if (%client.shouldEngage > 0)
|
||||
{
|
||||
//if we've been fired upon...
|
||||
if (%mustEngage)
|
||||
%task.setWeight($AIWeightReturnFire);
|
||||
|
||||
//see if we can allow the bot to use an inv station...
|
||||
else if (%client.spawnUseInv)
|
||||
{
|
||||
//see if there's an available inv station
|
||||
%result = AIFindClosestInventory(%client, false);
|
||||
%closestInv = getWord(%result, 0);
|
||||
%closestDist = getWord(%result, 1);
|
||||
if (isObject(%closestInv))
|
||||
{
|
||||
if (isObject(%client.shouldEngage.player))
|
||||
{
|
||||
%dist = %client.getPathDistance(%client.shouldEngage.player.position);
|
||||
if (%dist < 70 || %closestDist > 200)
|
||||
%task.setWeight($AIWeightReturnFire);
|
||||
else
|
||||
%task.setWeight($AIBountyWeightShouldEngage);
|
||||
}
|
||||
else
|
||||
%task.setWeight($AIBountyWeightShouldEngage);
|
||||
}
|
||||
else
|
||||
{
|
||||
%client.spawnUseInv = false;
|
||||
%task.setWeight($AIWeightReturnFire);
|
||||
}
|
||||
}
|
||||
else
|
||||
%task.setWeight($AIWeightReturnFire);
|
||||
}
|
||||
else
|
||||
%task.setWeight(0);
|
||||
}
|
||||
|
||||
function AIBountyEngageTask::monitor(%task, %client)
|
||||
{
|
||||
if (AIClientIsAlive(%client.shouldEngage))
|
||||
%client.stepEngage(%client.shouldEngage);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//AIPatrolTask used to wander around the map (DM and Hunters mainly) looking for something to do...
|
||||
|
||||
function AIBountyPatrolTask::init(%task, %client)
|
||||
{
|
||||
}
|
||||
|
||||
function AIBountyPatrolTask::assume(%task, %client)
|
||||
{
|
||||
%task.setWeightFreq(13);
|
||||
%task.setMonitorFreq(13);
|
||||
%task.findLocation = true;
|
||||
%task.patrolLocation = "0 0 0";
|
||||
%task.idleing = false;
|
||||
%task.idleEndTime = 0;
|
||||
}
|
||||
|
||||
function AIBountyPatrolTask::retire(%task, %client)
|
||||
{
|
||||
}
|
||||
|
||||
function AIBountyPatrolTask::weight(%task, %client)
|
||||
{
|
||||
%task.setWeight($AIWeightPatrolling);
|
||||
}
|
||||
|
||||
function AIBountyPatrolTask::monitor(%task, %client)
|
||||
{
|
||||
//this call works in conjunction with AIEngageTask
|
||||
%client.setEngageTarget(%client.shouldEngage);
|
||||
|
||||
//see if we're close enough to our patrol point
|
||||
if (%task.idleing)
|
||||
{
|
||||
if (getSimTime() > %task.idleEndTime)
|
||||
{
|
||||
%task.findLocation = true;
|
||||
%task.idleing = false;
|
||||
}
|
||||
}
|
||||
|
||||
//see if we need to find a place to go...
|
||||
else if (%task.findLocation)
|
||||
{
|
||||
//first, see if we're in need of either health, or ammo
|
||||
//note: normally, I'd be tempted to put this kind of "looking for health" code
|
||||
//into the AIPickupItemTask, however, that task will be used in CTF, where you
|
||||
//don't want people on AIDefendLocation to leave their post to hunt for health, etc...
|
||||
//AIPickupItemTask only deals with items within a 30m radius around the bot.
|
||||
//AIPatrolTask will move the bot to the vicinity of an item, then AIPickUpItemTask
|
||||
//will finish the job...
|
||||
%foundItemLocation = false;
|
||||
%damage = %client.player.getDamagePercent();
|
||||
if (%damage > 0.7)
|
||||
{
|
||||
//search for a health kit
|
||||
%closestHealth = AIFindSafeItem(%client, "Health");
|
||||
if (%closestHealth > 0)
|
||||
{
|
||||
%task.patrolLocation = %closestHealth.getWorldBoxCenter();
|
||||
%foundItemLocation = true;
|
||||
}
|
||||
}
|
||||
else if (AIEngageOutOfAmmo(%client))
|
||||
{
|
||||
//search for a Ammo or a weapon...
|
||||
%closestItem = AIFindSafeItem(%client, "Ammo");
|
||||
if (%closestItem > 0)
|
||||
{
|
||||
%task.patrolLocation = %closestItem.getWorldBoxCenter();
|
||||
%foundItemLocation = true;
|
||||
}
|
||||
}
|
||||
|
||||
//now see if we don't really have good equipment...
|
||||
if (!%foundItemLocation && AIEngageWeaponRating(%client) < 20)
|
||||
{
|
||||
//search for any useful item
|
||||
%closestItem = AIFindSafeItem(%client, "Any");
|
||||
if (%closestItem > 0)
|
||||
{
|
||||
%task.patrolLocation = %closestItem.getWorldBoxCenter();
|
||||
%foundItemLocation = true;
|
||||
}
|
||||
}
|
||||
//choose a randomish location only if we're not in need of health or ammo
|
||||
if (!%foundItemLocation)
|
||||
{
|
||||
//find a random item/inventory in the map, and pick a spawn point near it...
|
||||
%pickGraphNode = false;
|
||||
%chooseSet = 0;
|
||||
if ($AIInvStationSet.getCount() > 0)
|
||||
%chooseSet = $AIInvStationSet;
|
||||
else if ($AIWeaponSet.getCount() > 0)
|
||||
%chooseSet = $AIWeaponSet;
|
||||
else if ($AIItemSet.getCount() > 0)
|
||||
%chooseSet = $AIItemSet;
|
||||
|
||||
if (!%chooseSet)
|
||||
%pickGraphNode = true;
|
||||
|
||||
//here we pick whether we choose a random map point, or a point based on an item...
|
||||
if (getRandom() < 0.3)
|
||||
%pickGraphNode = true;
|
||||
|
||||
//here we decide whether we should choose a player location... a bit of a cheat but
|
||||
//it's scaled by the bot skill level
|
||||
%pickPlayerLocation = false;
|
||||
%skill = %client.getSkillLevel();
|
||||
if (%skill < 1.0)
|
||||
%skill = %skill / 2.0;
|
||||
if (getRandom() < (%skill * %skill) && AIClientIsAlive(%client.objectiveTarget))
|
||||
{
|
||||
%task.patrolLocation = %client.objectiveTarget.player.getWorldBoxCenter();
|
||||
%pickGraphNode = false;
|
||||
%pickPlayerLocation = true;
|
||||
}
|
||||
|
||||
if (!%pickGraphNode && !%pickPlayerLocation)
|
||||
{
|
||||
%itemCount = %chooseSet.getCount();
|
||||
%item = %chooseSet.getObject(getRandom() * (%itemCount - 0.1));
|
||||
%nodeIndex = navGraph.randNode(%item.getWorldBoxCenter(), 10, true, true);
|
||||
if (%nodeIndex <= 0)
|
||||
%pickGraphNode = true;
|
||||
else
|
||||
%task.patrolLocation = navGraph.randNodeLoc(%nodeIndex);
|
||||
}
|
||||
|
||||
//see if we failed above or have to pick just a random spot on the graph - use the spawn points...
|
||||
if (%pickGraphNode)
|
||||
{
|
||||
%task.patrolLocation = Game.pickPlayerSpawn(%client, true);
|
||||
if (%task.patrolLocation == -1)
|
||||
{
|
||||
%client.stepIdle(%client.player.getWorldBoxCenter());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//now that we have a new location - move towards it
|
||||
%task.findLocation = false;
|
||||
%client.stepMove(%task.patrolLocation, 8.0);
|
||||
}
|
||||
|
||||
//else we're on patrol - see if we're close to our destination
|
||||
else
|
||||
{
|
||||
%client.stepMove(%task.patrolLocation, 8.0);
|
||||
%distToDest = %client.getPathDistance(%task.patrolLocation);
|
||||
if (%distToDest > 0 && %distToDest < 10)
|
||||
{
|
||||
%task.idleing = true;
|
||||
%task.idleEndTime = 4000 + getSimTime() + (getRandom() * 6000);
|
||||
%client.stepIdle(%client.player.getWorldBoxCenter());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function aiB()
|
||||
{
|
||||
exec("scripts/aiBountyGame");
|
||||
}
|
||||
97
docs/base/@vl2/scripts.vl2/scripts/aiCTF.cs
Normal file
97
docs/base/@vl2/scripts.vl2/scripts/aiCTF.cs
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
//-----------------------------------------------
|
||||
// AI functions for CTF
|
||||
|
||||
function CTFGame::onAIRespawn(%game, %client)
|
||||
{
|
||||
//add the default task
|
||||
if (! %client.defaultTasksAdded)
|
||||
{
|
||||
%client.defaultTasksAdded = true;
|
||||
%client.addTask(AIEngageTask);
|
||||
%client.addTask(AIPickupItemTask);
|
||||
%client.addTask(AITauntCorpseTask);
|
||||
%client.addtask(AIEngageTurretTask);
|
||||
%client.addtask(AIDetectMineTask);
|
||||
}
|
||||
}
|
||||
|
||||
function CTFGame::AIInit(%game)
|
||||
{
|
||||
// load external objectives files
|
||||
loadObjectives();
|
||||
|
||||
for (%i = 1; %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);
|
||||
}
|
||||
|
||||
//call the default AIInit() function
|
||||
AIInit();
|
||||
}
|
||||
|
||||
function CTFGame::AIplayerCaptureFlipFlop(%game, %player, %flipFlop)
|
||||
{
|
||||
}
|
||||
|
||||
function CTFGame::AIplayerTouchEnemyFlag(%game, %player, %flag)
|
||||
{
|
||||
}
|
||||
|
||||
function CTFGame::AIplayerTouchOwnFlag(%game, %player, %flag)
|
||||
{
|
||||
}
|
||||
|
||||
function CTFGame::AIflagCap(%game, %player, %flag)
|
||||
{
|
||||
//signal the flag cap event
|
||||
AIRespondToEvent(%player.client, 'EnemyFlagCaptured', %player.client);
|
||||
// MES - changed above line - did not pass args in correct order
|
||||
}
|
||||
|
||||
function CTFGame::AIplayerDroppedFlag(%game, %player, %flag)
|
||||
{
|
||||
}
|
||||
|
||||
function CTFGame::AIflagReset(%game, %flag)
|
||||
{
|
||||
}
|
||||
|
||||
function CTFGame::onAIDamaged(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
function CTFGame::onAIKilledClient(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
if (%clVictim.team != %clAttacker.team)
|
||||
DefaultGame::onAIKilledClient(%game, %clVictim, %clAttacker, %damageType, %implement);
|
||||
}
|
||||
|
||||
function CTFGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
DefaultGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement);
|
||||
}
|
||||
|
||||
function CTFGame::onAIFriendlyFire(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
if (%clAttacker && %clAttacker.team == %clVictim.team && %clAttacker != %clVictim && !%clVictim.isAIControlled())
|
||||
{
|
||||
// The Bot is only a little sorry:
|
||||
if ( getRandom() > 0.9 )
|
||||
AIMessageThread("ChatSorry", %clAttacker, %clVictim);
|
||||
}
|
||||
}
|
||||
737
docs/base/@vl2/scripts.vl2/scripts/aiChat.cs
Normal file
737
docs/base/@vl2/scripts.vl2/scripts/aiChat.cs
Normal file
|
|
@ -0,0 +1,737 @@
|
|||
//------------------------------
|
||||
//AI Message functions
|
||||
|
||||
function AIFindCommanderAI(%omitClient)
|
||||
{
|
||||
%count = ClientGroup.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%client = ClientGroup.getObject(%i);
|
||||
if (%client != %omitClient && AIClientIsAlive(%client) && %client.isAIControlled())
|
||||
return %client;
|
||||
}
|
||||
|
||||
//didn't find anyone
|
||||
return -1;
|
||||
}
|
||||
|
||||
$AIMsgThreadId = 0;
|
||||
$AIMsgThreadActive = false;
|
||||
|
||||
$AIMsgThreadIndex = 0;
|
||||
$AIMsgThreadDelay = 0;
|
||||
$AIMsgThreadTable[0] = "";
|
||||
|
||||
function AIProcessMessageTable(%threadId)
|
||||
{
|
||||
//make sure we're still on the same thread
|
||||
if (%threadId != $AIMsgThreadId)
|
||||
return;
|
||||
|
||||
//get the speaker, the message, and the delay
|
||||
%speaker = getWord($AIMsgThreadTable[$AIMsgThreadIndex], 0);
|
||||
%msg = getWord($AIMsgThreadTable[$AIMsgThreadIndex], 1);
|
||||
%delay = getWord($AIMsgThreadTable[$AIMsgThreadIndex], 2);
|
||||
|
||||
//make sure the speaker is still alive
|
||||
if (%speaker $= "" || ! AIClientIsAlive(%speaker, $AIMsgThreadDelay))
|
||||
AIEndMessageThread(%threadId);
|
||||
else
|
||||
{
|
||||
//play the msg, schedule the next msg, and increment the index
|
||||
%tag = addTaggedString( %msg );
|
||||
serverCmdCannedChat(%speaker, %tag, true);
|
||||
removeTaggedString( %tag );
|
||||
schedule(%delay, 0, "AIProcessMessageTable", %threadId);
|
||||
$AIMsgThreadDelay = %delay;
|
||||
$AIMsgThreadIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
function AIEndMessageThread(%threadId)
|
||||
{
|
||||
if (%threadId == $AIMsgThreadId)
|
||||
$AIMsgThreadActive = false;
|
||||
}
|
||||
|
||||
function AIMessageThreadTemplate(%type, %msg, %clSpeaker, %clListener)
|
||||
{
|
||||
//abort if AI chat has been disabled
|
||||
if ($AIDisableChat)
|
||||
return;
|
||||
|
||||
//initialize the params
|
||||
if (%clListener $= "")
|
||||
%clListener = 0;
|
||||
|
||||
//abort if we're already in a thread
|
||||
if ($AIMsgThreadActive)
|
||||
return;
|
||||
|
||||
//initialize the new thread vars
|
||||
$AIMsgThreadId++;
|
||||
$AIMsgThreadActive = true;
|
||||
$AIMsgThreadIndex = 0;
|
||||
$AIMsgThreadTable[1] = "";
|
||||
|
||||
switch$ (%type)
|
||||
{
|
||||
case "DefendBase":
|
||||
if (%clListener < 0)
|
||||
%clListener = AIFindCommanderAI(%clSpeaker);
|
||||
|
||||
if (%clListener > 0)
|
||||
{
|
||||
//we have two people, create a semi-random conversation:
|
||||
%index = -1;
|
||||
|
||||
//see if we issue a command first
|
||||
if (getRandom() < 0.30)
|
||||
{
|
||||
//which version of "defend our base"?
|
||||
%randNum = getRandom();
|
||||
if (%randNum < 0.33)
|
||||
$AIMsgThreadTable[%index++] = %clListener @ " ChatCmdDefendBase " @ 1250;
|
||||
else if (%randNum < 0.66)
|
||||
$AIMsgThreadTable[%index++] = %clListener @ " ChatCmdDefendReinforce " @ 1500;
|
||||
else
|
||||
$AIMsgThreadTable[%index++] = %clListener @ " ChatCmdDefendEntrances " @ 1250;
|
||||
|
||||
//do we acknowledge the command first?
|
||||
if (getRandom() < 0.5)
|
||||
{
|
||||
if (getRandom() < 0.5)
|
||||
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatCmdAcknowledged " @ 1500;
|
||||
else
|
||||
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatTeamYes " @ 1500;
|
||||
}
|
||||
}
|
||||
|
||||
//the actual msg to be used
|
||||
$AIMsgThreadTable[%index++] = %clSpeaker @ " " @ %msg @ " " @ 1750;
|
||||
|
||||
//do we say "thanks"?
|
||||
if (getRandom() < 0.3)
|
||||
{
|
||||
$AIMsgThreadTable[%index++] = %clListener @ " ChatTeamThanks " @ 1000;
|
||||
|
||||
//do we say "you're welcom?"
|
||||
if (getRandom() < 0.5)
|
||||
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatWelcome " @ 1500;
|
||||
}
|
||||
|
||||
//end the thread
|
||||
$AIMsgThreadTable[%index++] = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
//just stick with the original
|
||||
$AIMsgThreadTable[0] = %clSpeaker @ " " @ %msg @ " " @ 1750;
|
||||
}
|
||||
|
||||
//now process the table
|
||||
AIProcessMessageTable($AIMsgThreadId);
|
||||
|
||||
case "AttackBase":
|
||||
if (%clListener < 0)
|
||||
%clListener = AIFindCommanderAI(%clSpeaker);
|
||||
|
||||
if (%clListener > 0)
|
||||
{
|
||||
//we have two people, create a semi-random conversation:
|
||||
%index = -1;
|
||||
|
||||
//see if we issue a command first
|
||||
if (getRandom() < 0.30)
|
||||
{
|
||||
//which version of "attack the enemy base"?
|
||||
%randNum = getRandom();
|
||||
if (%randNum < 0.33)
|
||||
$AIMsgThreadTable[%index++] = %clListener @ " ChatCmdAttack " @ 1250;
|
||||
else if (%randNum < 0.66)
|
||||
$AIMsgThreadTable[%index++] = %clListener @ " ChatCmdAttackBase " @ 1500;
|
||||
else
|
||||
$AIMsgThreadTable[%index++] = %clListener @ " ChatCmdAttackReinforce " @ 1250;
|
||||
|
||||
//do we acknowledge the command first?
|
||||
if (getRandom() < 0.5)
|
||||
{
|
||||
if (getRandom() < 0.5)
|
||||
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatCmdAcknowledged " @ 1500;
|
||||
else
|
||||
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatTeamYes " @ 1500;
|
||||
}
|
||||
}
|
||||
|
||||
//the actual msg to be used
|
||||
$AIMsgThreadTable[%index++] = %clSpeaker @ " " @ %msg @ " " @ 1750;
|
||||
|
||||
//do we say "thanks"?
|
||||
if (getRandom() < 0.3)
|
||||
{
|
||||
$AIMsgThreadTable[%index++] = %clListener @ " ChatTeamThanks " @ 1000;
|
||||
|
||||
//do we say "you're welcom?"
|
||||
if (getRandom() < 0.5)
|
||||
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatWelcome " @ 1500;
|
||||
}
|
||||
|
||||
//end the thread
|
||||
$AIMsgThreadTable[%index++] = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
//just stick with the original
|
||||
$AIMsgThreadTable[0] = %clSpeaker @ " " @ %msg @ " " @ 1750;
|
||||
}
|
||||
|
||||
//now process the table
|
||||
AIProcessMessageTable($AIMsgThreadId);
|
||||
|
||||
case "RepairBase":
|
||||
if (%clListener < 0)
|
||||
%clListener = AIFindCommanderAI(%clSpeaker);
|
||||
|
||||
if (%clListener > 0)
|
||||
{
|
||||
//we have two people, create a semi-random conversation:
|
||||
%index = -1;
|
||||
|
||||
//see if we issue a command first
|
||||
if (getRandom() < 0.30)
|
||||
{
|
||||
//which version of "repair"?
|
||||
$AIMsgThreadTable[%index++] = %clListener @ " ChatRepairBase " @ 1250;
|
||||
|
||||
//do we acknowledge the command first?
|
||||
if (getRandom() < 0.5)
|
||||
{
|
||||
if (getRandom() < 0.5)
|
||||
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatCmdAcknowledged " @ 1500;
|
||||
else
|
||||
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatTeamYes " @ 1500;
|
||||
}
|
||||
}
|
||||
|
||||
//the actual msg to be used
|
||||
$AIMsgThreadTable[%index++] = %clSpeaker @ " " @ %msg @ " " @ 1750;
|
||||
|
||||
//do we say "thanks"?
|
||||
if (getRandom() < 0.3)
|
||||
{
|
||||
$AIMsgThreadTable[%index++] = %clListener @ " ChatTeamThanks " @ 1000;
|
||||
|
||||
//do we say "you're welcom?"
|
||||
if (getRandom() < 0.5)
|
||||
$AIMsgThreadTable[%index++] = %clSpeaker @ " ChatWelcome " @ 1500;
|
||||
}
|
||||
|
||||
//end the thread
|
||||
$AIMsgThreadTable[%index++] = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
//just stick with the original
|
||||
$AIMsgThreadTable[0] = %clSpeaker @ " " @ %msg @ " " @ 1750;
|
||||
}
|
||||
|
||||
//now process the table
|
||||
AIProcessMessageTable($AIMsgThreadId);
|
||||
}
|
||||
}
|
||||
|
||||
function AIMessageThread(%msg, %clSpeaker, %clListener, %force, %index, %threadId)
|
||||
{
|
||||
//abort if AI chat has been disabled
|
||||
if ($AIDisableChat)
|
||||
return;
|
||||
|
||||
//initialize the params
|
||||
if (%index $= "")
|
||||
%index = 0;
|
||||
|
||||
if (%clListener $= "")
|
||||
%clListener = 0;
|
||||
|
||||
if (%force $= "")
|
||||
%force = false;
|
||||
|
||||
//if this is the initial call, see if we're already in a thread, and if we should force this one
|
||||
if (%index == 0 && $AIMsgThreadActive && !%force)
|
||||
{
|
||||
error("DEBUG msg thread already in progress - aborting: " @ %msg @ " from client: " @ %clSpeaker);
|
||||
return;
|
||||
}
|
||||
|
||||
//if this is an ongoing thread, make sure it wasn't pre-empted
|
||||
if (%index > 0 && %threadId != $AIMsgThreadId)
|
||||
return;
|
||||
|
||||
//if this is a new thread, set a new thread id
|
||||
if (%index == 0)
|
||||
{
|
||||
$AIMsgThreadId++;
|
||||
$AIMsgThreadActive = true;
|
||||
%threadId = $AIMsgThreadId;
|
||||
}
|
||||
switch$ (%msg)
|
||||
{
|
||||
//this is an example of how to use the chat system without using the table...
|
||||
case "ChatHi":
|
||||
serverCmdCannedChat(%clSpeaker, 'ChatHi', true);
|
||||
%responsePending = false;
|
||||
if (%index == 0)
|
||||
{
|
||||
if (%clListener < 0)
|
||||
%clListener = AIFindCommanderAI(%clSpeaker);
|
||||
if (%clListener > 0 && (getRandom() < 0.5))
|
||||
{
|
||||
%responsePending = true;
|
||||
schedule(1000, 0, "AIMessageThread", %msg, %clListener, 0, false, 1, %threadId);
|
||||
}
|
||||
}
|
||||
if (! %responsePending)
|
||||
schedule(1000, 0, "AIEndMessageThread", $AIMsgThreadId);
|
||||
|
||||
//this method of using the chat system sets up a table instead...
|
||||
//the equivalent is commented out below - same effect - table is much better.
|
||||
case "ChatSelfDefendGenerator":
|
||||
if (%index == 0)
|
||||
{
|
||||
//initialize the table
|
||||
$AIMsgThreadIndex = 0;
|
||||
$AIMsgThreadTable[1] = "";
|
||||
|
||||
%commander = AIFindCommanderAI(%clSpeaker);
|
||||
if (%commander > 0)
|
||||
{
|
||||
$AIMsgThreadTable[0] = %commander @ " ChatCmdDefendBase " @ 1000;
|
||||
$AIMsgThreadTable[1] = %clSpeaker @ " ChatCmdAcknowledged " @ 1250;
|
||||
$AIMsgThreadTable[2] = %clSpeaker @ " " @ %msg @ " " @ 1000;
|
||||
$AIMsgThreadTable[3] = "";
|
||||
}
|
||||
else
|
||||
$AIMsgThreadTable[0] = %clSpeaker @ " " @ %msg @ " " @ 1000;
|
||||
|
||||
//now process the table
|
||||
AIProcessMessageTable(%threadId);
|
||||
}
|
||||
|
||||
// case "ChatSelfDefendGenerator":
|
||||
// %responsePending = false;
|
||||
// if (%index == 0)
|
||||
// {
|
||||
// //find the commander
|
||||
// %commander = AIFindCommanderAI(%clSpeaker);
|
||||
// if (%commander > 0)
|
||||
// {
|
||||
// %responsePending = true;
|
||||
// serverCmdCannedChat(%commander, "ChatCmdDefendBase", true);
|
||||
// schedule("AIMessageThread(" @ %msg @ ", " @ %clSpeaker @ ", 0, 1, " @ %type @ ", false, " @ %threadId @ ");", 1000);
|
||||
// }
|
||||
// else
|
||||
// serverCmdCannedChat(%commander, "ChatSelfDefendGenerator", true);
|
||||
// }
|
||||
// else if (%index == 1)
|
||||
// {
|
||||
// //make sure the client is still alive
|
||||
// if (AIClientIsAlive(%clSpeaker, 1000))
|
||||
// {
|
||||
// %responsePending = true;
|
||||
// serverCmdCannedChat(%clSpeaker, "ChatCmdAcknowledged", true);
|
||||
// schedule("AIMessageThread(" @ %msg @ ", " @ %clSpeaker @ ", 0, 2, " @ %type @ ", false, " @ %threadId @ ");", 1000);
|
||||
// }
|
||||
// else
|
||||
// AIEndMessageThread($AIMsgThreadId);
|
||||
// }
|
||||
// else if (%index == 2)
|
||||
// {
|
||||
// //make sure the client is still alive
|
||||
// if (AIClientIsAlive(%clSpeaker, 1000))
|
||||
// serverCmdCannedChat(%clSpeaker, "ChatSelfDefendGenerator", true);
|
||||
// else
|
||||
// AIEndMessageThread($AIMsgThreadId);
|
||||
// }
|
||||
// if (! %responsePending)
|
||||
// schedule("AIEndMessageThread(" @ $AIMsgThreadId @ ");", 1000);
|
||||
|
||||
default:
|
||||
%tag = addTaggedString( %msg );
|
||||
serverCmdCannedChat( %clSpeaker, %tag, true );
|
||||
removeTaggedString( %tag ); // Don't keep incrementing the string ref count...
|
||||
schedule( 1500, 0, "AIEndMessageThread", $AIMsgThreadId );
|
||||
}
|
||||
}
|
||||
|
||||
function AIPlay3DSound(%client, %sound)
|
||||
{
|
||||
%player = %client.player;
|
||||
if (!isObject(%player))
|
||||
return;
|
||||
|
||||
playTargetAudio(%client.target, addTaggedString(%sound), AudioClosest3d, true);
|
||||
}
|
||||
|
||||
function AIPlayAnimSound(%client, %location, %sound, %minCel, %maxCel, %index)
|
||||
{
|
||||
//make sure the client is still alive
|
||||
if (! AIClientIsAlive(%client, 500))
|
||||
return;
|
||||
|
||||
switch (%index)
|
||||
{
|
||||
case 0:
|
||||
//if we can set the client's aim, we can also try the animation
|
||||
if (%client.aimAt(%location, 2500))
|
||||
schedule(250, %client, "AIPlayAnimSound", %client, %location, %sound, %minCel, %maxCel, 1);
|
||||
else
|
||||
schedule(750, %client, "AIPlay3DSound", %client, %sound);
|
||||
|
||||
case 1:
|
||||
//play the animation and schedule the next phase
|
||||
%randRange = %maxCel - %minCel + 1;
|
||||
%celNum = %minCel + mFloor(getRandom() * (%randRange - 0.1));
|
||||
if (%celNum > 0)
|
||||
%client.player.setActionThread("cel" @ %celNum);
|
||||
schedule(500, %client, "AIPlayAnimSound", %client, %location, %sound, %minCel, %maxCel, 2);
|
||||
|
||||
case 2:
|
||||
//say 'hi'
|
||||
AIPlay3DSound(%client, %sound);
|
||||
}
|
||||
}
|
||||
|
||||
$AIAnimSalute = 1;
|
||||
$AIAnimWave = 2;
|
||||
|
||||
function AIRespondToEvent(%client, %eventTag, %targetClient)
|
||||
{
|
||||
//record the event time
|
||||
$EventTagTimeArray[%eventTag] = getSimTime();
|
||||
|
||||
//abort if AI chat has been disabled
|
||||
if ($AIDisableChatResponse)
|
||||
return;
|
||||
|
||||
%clientPos = %client.player.getWorldBoxCenter();
|
||||
switch$ (%eventTag)
|
||||
{
|
||||
case 'ChatHi' or 'ChatAnimWave':
|
||||
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
|
||||
{
|
||||
%setHumanControl = false;
|
||||
if (!%client.isAIControlled() && %client.controlAI != %targetClient)
|
||||
%setHumanControl = aiAttemptHumanControl(%client, %targetClient);
|
||||
if (%setHumanControl)
|
||||
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.hi", $AIAnimSalute, $AIAnimSalute, 0);
|
||||
else
|
||||
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.hi", $AIAnimWave, $AIAnimWave, 0);
|
||||
}
|
||||
|
||||
case 'ChatBye' or 'ChatTeamDisembark' or 'ChatAnimBye':
|
||||
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
|
||||
{
|
||||
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.bye", $AIAnimWave, $AIAnimWave, 0);
|
||||
|
||||
//see if we need to release the bot
|
||||
if (aiHumanHasControl(%client, %targetClient))
|
||||
{
|
||||
%objective = %targetClient.objective;
|
||||
if (%objective.issuedByClientId == %client && %objective.targetClientId == %client && %objective.getName() $= "AIOEscortPlayer")
|
||||
{
|
||||
AIClearObjective(%objective);
|
||||
%objective.delete();
|
||||
}
|
||||
aiReleaseHumanControl(%client, %targetClient);
|
||||
}
|
||||
}
|
||||
|
||||
case 'ChatTeamYes' or 'ChatGlobalYes' or 'ChatCheer' or 'ChatAnimDance':
|
||||
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
|
||||
{
|
||||
//choose the animation range
|
||||
%minCel = 5;
|
||||
%maxCel = 8;
|
||||
if (getRandom() > 0.5)
|
||||
%sound = "gbl.thanks";
|
||||
else
|
||||
%sound = "gbl.awesome";
|
||||
schedule(500, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, %sound, %minCel, %maxCel, 0);
|
||||
}
|
||||
|
||||
case 'ChatAnimSalute':
|
||||
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
|
||||
schedule(500, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.thanks", $AIAnimSalute, $AIAnimSalute, 0);
|
||||
|
||||
case 'ChatAwesome' or 'ChatGoodGame' or 'ChatGreatShot' or 'ChatNice' or 'ChatYouRock' or 'ChatAnimSpec3':
|
||||
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
|
||||
{
|
||||
//choose the animation range
|
||||
%minCel = 5;
|
||||
%maxCel = 8;
|
||||
if (getRandom() > 0.5)
|
||||
%sound = "gbl.thanks";
|
||||
else
|
||||
%sound = "gbl.yes";
|
||||
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, %sound, %minCel, %maxCel, 0);
|
||||
}
|
||||
|
||||
case 'ChatAww' or 'ChatObnoxious' or 'ChatSarcasm' or 'ChatAnimSpec1' or 'ChatAnimSpec2':
|
||||
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
|
||||
{
|
||||
if (%targetClient.controlByHuman == %client)
|
||||
schedule(1500, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.oops", $AIAnimSalute, $AIAnimSalute, 0);
|
||||
else
|
||||
schedule(1500, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.quiet", -1, -1, 0);
|
||||
}
|
||||
|
||||
case 'ChatBrag' or 'ChatAnimGetSome':
|
||||
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
|
||||
{
|
||||
if (%targetClient.controlByHuman == %client)
|
||||
schedule(1500, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.yes", $AIAnimSalute, $AIAnimSalute, 0);
|
||||
else
|
||||
schedule(1500, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.no", -1, -1, 0);
|
||||
}
|
||||
|
||||
case 'ChatAnimAnnoyed' or 'ChatMove':
|
||||
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
|
||||
{
|
||||
if (%targetClient.controlByHuman == %client)
|
||||
{
|
||||
schedule(750, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "vqk.sorry", $AIAnimSalute, $AIAnimSalute, 0);
|
||||
%targetClient.schedule(2750, "setDangerLocation", %clientPos , 20);
|
||||
}
|
||||
else
|
||||
schedule(750, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.no", -1, -1, 0);
|
||||
}
|
||||
|
||||
case 'ChatQuiet':
|
||||
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
|
||||
{
|
||||
if (%targetClient.controlByHuman == %client)
|
||||
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.yes", $AIAnimSalute, $AIAnimSalute, 0);
|
||||
else
|
||||
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.no", -1, -1, 0);
|
||||
}
|
||||
|
||||
case 'ChatWait' or 'ChatShazbot':
|
||||
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
|
||||
{
|
||||
if (%targetClient.controlByHuman == %client)
|
||||
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.yes", $AIAnimSalute, $AIAnimSalute, 0);
|
||||
else
|
||||
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.no", -1, -1, 0);
|
||||
}
|
||||
|
||||
case 'ChatLearn' or 'ChatIsBaseSecure':
|
||||
schedule(750, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.dunno", -1, -1, 0);
|
||||
|
||||
case 'ChatWelcome' or 'ChatSorry' or 'ChatAnyTime':
|
||||
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.thanks", $AIAnimWave, $AIAnimWave, 0);
|
||||
|
||||
case 'ChatDunno' or 'ChatDontKnow':
|
||||
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.yes", -1, -1, 0);
|
||||
|
||||
case 'ChatTeamNo' or 'ChatOops' or 'ChatGlobalNo':
|
||||
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.shazbot", -1, -1, 0);
|
||||
|
||||
case 'ChatTeamThanks' or 'ChatThanks':
|
||||
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "vqk.anytime", $AIAnimWave, $AIAnimWave, 0);
|
||||
|
||||
case 'ChatWarnShoot':
|
||||
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "vqk.sorry", -1, -1, 0);
|
||||
|
||||
case 'ChatCmdWhat':
|
||||
//see if the weight for the escort is higher than what he might otherwise be doing
|
||||
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
|
||||
{
|
||||
//first, find the chat message
|
||||
%objective = %targetClient.objective;
|
||||
if (%objective > 0)
|
||||
{
|
||||
if (%objective.chat)
|
||||
%sound = getWord(%objective.chat, 0) @ "Sound";
|
||||
else
|
||||
{
|
||||
%type = %objective.getName();
|
||||
switch$ (%type)
|
||||
{
|
||||
case "AIOAttackLocation":
|
||||
%sound = "att.base";
|
||||
case "AIOAttackObject":
|
||||
if (%objective.targetObjectId > 0)
|
||||
{
|
||||
%objType = %objective.targetObjectId.getDataBlock().getName();
|
||||
switch$ (%objType)
|
||||
{
|
||||
case "GeneratorLarge":
|
||||
%sound = "slf.att.generator";
|
||||
case "SensorLargePulse":
|
||||
%sound = "slf.att.sensors";
|
||||
case "SensorMediumPulse":
|
||||
%sound = "slf.att.sensors";
|
||||
case "TurretBaseLarge":
|
||||
%sound = "slf.att.turrets";
|
||||
case "StationVehicle":
|
||||
%sound = "slf.att.vehicle";
|
||||
default:
|
||||
%sound = "slf.att.base";
|
||||
}
|
||||
}
|
||||
else
|
||||
%sound = "slf.att.base";
|
||||
case "AIODefendLocation":
|
||||
if (%objective.targetObjectId > 0)
|
||||
{
|
||||
%objType = %objective.targetObjectId.getDataBlock().getName();
|
||||
switch$ (%objType)
|
||||
{
|
||||
case "Flag":
|
||||
%sound = "slf.def.flag";
|
||||
case "GeneratorLarge":
|
||||
%sound = "slf.def.generator";
|
||||
case "SensorLargePulse":
|
||||
%sound = "slf.def.sensors";
|
||||
case "SensorMediumPulse":
|
||||
%sound = "slf.def.sensors";
|
||||
case "TurretBaseLarge":
|
||||
%sound = "slf.def.turrets";
|
||||
case "StationVehicle":
|
||||
%sound = "slf.def.vehicle";
|
||||
default:
|
||||
%sound = "slf.def.base";
|
||||
}
|
||||
}
|
||||
else
|
||||
%sound = "slf.def.defend";
|
||||
case "AIOAttackPlayer":
|
||||
%sound = "slf.att.attack";
|
||||
case "AIOEscortPlayer":
|
||||
%sound = "slf.def.defend";
|
||||
case "AIORepairObject":
|
||||
if (%objective.targetObjectId > 0)
|
||||
{
|
||||
%objType = %objective.targetObjectId.getDataBlock().getName();
|
||||
switch$ (%objType)
|
||||
{
|
||||
case "GeneratorLarge":
|
||||
%sound = "slf.rep.generator";
|
||||
case "SensorLargePulse":
|
||||
%sound = "slf.rep.sensors";
|
||||
case "SensorMediumPulse":
|
||||
%sound = "slf.rep.sensors";
|
||||
case "TurretBaseLarge":
|
||||
%sound = "slf.rep.turrets";
|
||||
case "StationVehicle":
|
||||
%sound = "slf.rep.vehicle";
|
||||
default:
|
||||
%sound = "slf.rep.equipment";
|
||||
}
|
||||
}
|
||||
else
|
||||
%sound = "slf.rep.base";
|
||||
case "AIOLazeObject":
|
||||
%sound = "slf.att.base";
|
||||
case "AIOMortarObject":
|
||||
if (%objective.targetObjectId > 0)
|
||||
{
|
||||
%objType = %objective.targetObjectId.getDataBlock().getName();
|
||||
switch$ (%objType)
|
||||
{
|
||||
case "GeneratorLarge":
|
||||
%sound = "slf.att.generator";
|
||||
case "SensorLargePulse":
|
||||
%sound = "slf.att.sensors";
|
||||
case "SensorMediumPulse":
|
||||
%sound = "slf.att.sensors";
|
||||
case "TurretBaseLarge":
|
||||
%sound = "slf.att.turrets";
|
||||
case "StationVehicle":
|
||||
%sound = "slf.att.vehicle";
|
||||
default:
|
||||
%sound = "slf.att.base";
|
||||
}
|
||||
}
|
||||
else
|
||||
%sound = "slf.att.base";
|
||||
case "AIOTouchObject":
|
||||
if (%objective.mode $= "FlagGrab")
|
||||
%sound = "slf.att.flag";
|
||||
else if (%objective.mode $= "FlagCapture")
|
||||
%sound = "flg.flag";
|
||||
else
|
||||
%sound = "slf.att.base";
|
||||
|
||||
case "AIODeployEquipment":
|
||||
%sound = "slf.tsk.defense";
|
||||
|
||||
default:
|
||||
%sound = "gbl.dunno";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
%sound = "gbl.dunno";
|
||||
|
||||
//now that we have a sound, play it with the salute animation
|
||||
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, %sound, 1, 1, 0);
|
||||
}
|
||||
|
||||
//these here are all "self" messages requiring a "thank you"
|
||||
case 'ChatRepairBase' or 'ChatSelfAttack' or 'ChatSelfAttackBase' or 'ChatSelfAttackFlag' or 'ChatSelfAttackGenerator' or 'ChatSelfAttackSensors' or 'ChatSelfAttackTurrets' or 'ChatSelfAttackVehicle':
|
||||
schedule(750, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.thanks", 1, 1, 0);
|
||||
|
||||
case 'ChatSelfDefendBase' or 'ChatSelfDefend' or 'ChatSelfDefendFlag' or 'ChatSelfDefendGenerator' or 'ChatSelfDefendNexus' or 'ChatSelfDefendSensors' or 'ChatSelfDefendTurrets' or 'ChatSelfDefendVehicle':
|
||||
schedule(750, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.thanks", 1, 1, 0);
|
||||
|
||||
case 'ChatSelfRepairBase' or 'ChatSelfRepairEquipment' or 'ChatSelfRepairGenerator' or 'ChatSelfRepair' or 'ChatSelfRepairSensors' or 'ChatSelfRepairTurrets' or 'ChatSelfRepairVehicle':
|
||||
schedule(750, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.thanks", 1, 1, 0);
|
||||
|
||||
case 'ChatTaskCover' or 'ChatTaskSetupD' or 'ChatTaskOnIt' or 'ChatTaskSetupRemote' or 'ChatTaskSetupSensors' or 'ChatTaskSetupTurrets' or 'ChatTaskVehicle':
|
||||
schedule(750, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "gbl.thanks", 1, 1, 0);
|
||||
|
||||
case 'EnemyFlagCaptured':
|
||||
//find all the clients within 100 m of the home flag, and get them all to cheer
|
||||
%flagPos = %client.player.getWorldBoxCenter();
|
||||
%count = ClientGroup.getCount();
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
|
||||
//make sure the client is alive, and on the same team
|
||||
if (%cl.isAIControlled() && %cl.team == %client.team && AIClientIsAlive(%cl))
|
||||
{
|
||||
//see if they're within 100 m
|
||||
%distance = %cl.getPathDistance(%flagPos);
|
||||
if (%distance > 0 && %distance < 100)
|
||||
{
|
||||
//choose the animation range
|
||||
%minCel = 5;
|
||||
%maxCel = 8;
|
||||
%randTime = mFloor(getRandom() * 1500) + 1;
|
||||
|
||||
//pick a random sound
|
||||
if (getRandom() > 0.25)
|
||||
%sound = "gbl.awesome";
|
||||
else if (getRandom() > 0.5)
|
||||
%sound = "gbl.thanks";
|
||||
else if (getRandom() > 0.75)
|
||||
%sound = "gbl.nice";
|
||||
else
|
||||
%sound = "gbl.rock";
|
||||
schedule(%randTime, %cl, "AIPlayAnimSound", %cl, %flagPos, %sound, %minCel, %maxCel, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case 'ChatCmdHunterGiveFlags' or 'ChatCmdGiveMeFlag':
|
||||
if (AIClientIsAlive(%targetClient) && %targetClient.isAIControlled())
|
||||
{
|
||||
schedule(250, %targetClient, "AIPlayAnimSound", %targetClient, %clientPos, "cmd.acknowledge", $AIAnimSalute, $AIAnimSalute, 0);
|
||||
schedule(750, %targetClient.player, "serverCmdThrowFlag", %targetClient);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
77
docs/base/@vl2/scripts.vl2/scripts/aiCnH.cs
Normal file
77
docs/base/@vl2/scripts.vl2/scripts/aiCnH.cs
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
//-----------------------------------------------
|
||||
// AI functions for Capture and Hold
|
||||
function aicnh()
|
||||
{
|
||||
exec("scripts/aiCnH.cs");
|
||||
}
|
||||
|
||||
function CnHGame::AIInit(%game)
|
||||
{
|
||||
for (%i = 1; %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);
|
||||
}
|
||||
|
||||
//call the default AIInit() function
|
||||
AIInit();
|
||||
}
|
||||
|
||||
function CnHGame::onAIRespawn(%game, %client)
|
||||
{
|
||||
//add the default tasks
|
||||
if (! %client.defaultTasksAdded)
|
||||
{
|
||||
%client.defaultTasksAdded = true;
|
||||
%client.addTask(AIEngageTask);
|
||||
%client.addTask(AIPickupItemTask);
|
||||
%client.addTask(AITauntCorpseTask);
|
||||
%client.addTask(AIPatrolTask);
|
||||
%client.addtask(AIEngageTurretTask);
|
||||
%client.addtask(AIDetectMineTask);
|
||||
}
|
||||
}
|
||||
|
||||
function CnHGame::onAIDamaged(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
function CnHGame::onAIKilledClient(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
if (%clVictim.team != %clAttacker.team)
|
||||
DefaultGame::onAIKilledClient(%game, %clVictim, %clAttacker, %damageType, %implement);
|
||||
}
|
||||
|
||||
function CnHGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
DefaultGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement);
|
||||
}
|
||||
|
||||
function CnHGame::onAIFriendlyFire(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
if (%clAttacker && %clAttacker.team == %clVictim.team && %clAttacker != %clVictim && !%clVictim.isAIControlled())
|
||||
{
|
||||
// The Bot is only a little sorry:
|
||||
if ( getRandom() > 0.9 )
|
||||
AIMessageThread("ChatSorry", %clAttacker, %clVictim);
|
||||
}
|
||||
}
|
||||
|
||||
function CnHGame::AIplayerCaptureFlipFlop(%game, %player, %flipFlop)
|
||||
{
|
||||
}
|
||||
|
||||
25
docs/base/@vl2/scripts.vl2/scripts/aiDeathMatch.cs
Normal file
25
docs/base/@vl2/scripts.vl2/scripts/aiDeathMatch.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
function DMGame::AIInit(%game)
|
||||
{
|
||||
//call the default AIInit() function
|
||||
AIInit();
|
||||
}
|
||||
|
||||
function DMGame::onAIRespawn(%game, %client)
|
||||
{
|
||||
//add the default task
|
||||
if (! %client.defaultTasksAdded)
|
||||
{
|
||||
%client.defaultTasksAdded = true;
|
||||
%client.addTask(AIEngageTask);
|
||||
%client.addTask(AIPickupItemTask);
|
||||
%client.addTask(AIUseInventoryTask);
|
||||
%client.addTask(AITauntCorpseTask);
|
||||
%client.addTask(AIEngageTurretTask);
|
||||
%client.addtask(AIDetectMineTask);
|
||||
%client.addTask(AIPatrolTask);
|
||||
}
|
||||
|
||||
//set the inv flag
|
||||
%client.spawnUseInv = true;
|
||||
}
|
||||
|
||||
1053
docs/base/@vl2/scripts.vl2/scripts/aiDebug.cs
Normal file
1053
docs/base/@vl2/scripts.vl2/scripts/aiDebug.cs
Normal file
File diff suppressed because it is too large
Load diff
1028
docs/base/@vl2/scripts.vl2/scripts/aiDefaultTasks.cs
Normal file
1028
docs/base/@vl2/scripts.vl2/scripts/aiDefaultTasks.cs
Normal file
File diff suppressed because it is too large
Load diff
72
docs/base/@vl2/scripts.vl2/scripts/aiDnD.cs
Normal file
72
docs/base/@vl2/scripts.vl2/scripts/aiDnD.cs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
//-----------------------------------------------
|
||||
// AI functions for Capture and Hold
|
||||
function aidnd()
|
||||
{
|
||||
exec("scripts/aiDnD.cs");
|
||||
}
|
||||
|
||||
function DnDGame::AIInit(%game)
|
||||
{
|
||||
for (%i = 1; %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);
|
||||
}
|
||||
|
||||
//call the default AIInit() function
|
||||
AIInit();
|
||||
}
|
||||
|
||||
function DnDGame::onAIRespawn(%game, %client)
|
||||
{
|
||||
//add the default tasks
|
||||
if (! %client.defaultTasksAdded)
|
||||
{
|
||||
%client.defaultTasksAdded = true;
|
||||
%client.addTask(AIEngageTask);
|
||||
%client.addTask(AIPickupItemTask);
|
||||
%client.addTask(AITauntCorpseTask);
|
||||
%client.addTask(AIPatrolTask);
|
||||
%client.addtask(AIEngageTurretTask);
|
||||
%client.addtask(AIDetectMineTask);
|
||||
}
|
||||
}
|
||||
|
||||
function DnDGame::onAIDamaged(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
function DnDGame::onAIKilledClient(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
if (%clVictim.team != %clAttacker.team)
|
||||
DefaultGame::onAIKilledClient(%game, %clVictim, %clAttacker, %damageType, %implement);
|
||||
}
|
||||
|
||||
function DnDGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
DefaultGame::onAIKilled(%game, %clVictim, %clAttacker, %damageType, %implement);
|
||||
}
|
||||
|
||||
function DnDGame::onAIFriendlyFire(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
if (%clAttacker && %clAttacker.team == %clVictim.team && %clAttacker != %clVictim)
|
||||
AIMessageThread("Sorry", %clAttacker, %clVictim);
|
||||
}
|
||||
|
||||
function DnDGame::AIplayerCaptureFlipFlop(%game, %player, %flipFlop)
|
||||
{
|
||||
}
|
||||
292
docs/base/@vl2/scripts.vl2/scripts/aiHumanTasks.cs
Normal file
292
docs/base/@vl2/scripts.vl2/scripts/aiHumanTasks.cs
Normal file
|
|
@ -0,0 +1,292 @@
|
|||
|
||||
function aiAddHumanObjective(%client, %objective, %targetClient, %fromCmdMap)
|
||||
{
|
||||
//first, make sure the objective Q for the given team exists
|
||||
if (!isObject($ObjectiveQ[%client.team]))
|
||||
return 0;
|
||||
|
||||
//if a target client is specified, create a link if we can...
|
||||
if (%targetClient > 0)
|
||||
{
|
||||
if (aiHumanHasControl(%client, %targetClient) || (%targetClient.isAIControlled() && !aiAlreadyControlled(%targetClient)))
|
||||
aiSetHumanControl(%client, %targetClient);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
//special (hacky) case here for AIOBombLocation objectives
|
||||
if (%objective.getName() $= "AIOBombLocation")
|
||||
{
|
||||
if (!isObject($AIBombLocationSet))
|
||||
return 0;
|
||||
|
||||
%objective.team = %client.team;
|
||||
$AIBombLocationSet.add(%objective);
|
||||
return %objective;
|
||||
}
|
||||
|
||||
//parse the type of objective, and see if it already exists...
|
||||
%useThisObjective = -1;
|
||||
%objQ = $ObjectiveQ[%client.team];
|
||||
if (%objective.getName() $= "AIOEscortPlayer" || %objective.getName() $= "AIOAttackPlayer")
|
||||
{
|
||||
//first, make sure the objective is legit
|
||||
if (!AIClientIsAlive(%objective.targetClientId))
|
||||
return 0;
|
||||
|
||||
//fill in the description:
|
||||
%objective.description = %objective.getName() SPC getTaggedString(%objective.targetClientId.name);
|
||||
|
||||
//now see if the objective already exists...
|
||||
%count = %objQ.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%obj = %objQ.getObject(%i);
|
||||
if (%obj.getName() $= %objective.getName())
|
||||
{
|
||||
//if we've found a previously existing version, use it instead of the new objective
|
||||
if (%obj.issuedByClientId == %client && %obj.targetClientId == %objective.targetClientId)
|
||||
{
|
||||
%useThisObjective = %obj;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (%objective.getName() $= "AIODefendLocation" || %objective.getName() $= "AIOAttackLocation")
|
||||
{
|
||||
//make sure it's a valid objective
|
||||
if (%objective.location $= "" || %objective.location $= "0 0 0")
|
||||
return 0;
|
||||
|
||||
//fill in the description:
|
||||
%objective.description = %objective.getName() @ " at" SPC %objective.location;
|
||||
|
||||
//look for a duplicate...
|
||||
%count = %objQ.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%obj = %objQ.getObject(%i);
|
||||
if (%obj.getName() $= %objective.getName())
|
||||
{
|
||||
if (%obj.issuedByClientId == %client && VectorDist(%objective.location, %obj.location) < 30)
|
||||
{
|
||||
%useThisObjective = %obj;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (%objective.getName() $= "AIOAttackObject" || %objective.getName() $= "AIORepairObject" ||
|
||||
%objective.getName() $= "AIOLazeObject" || %objective.getName() $= "AIOMortarObject" ||
|
||||
%objective.getName() $= "AIOTouchObject")
|
||||
{
|
||||
//make sure it's a valid objective
|
||||
if (!isObject(%objective.targetObjectId))
|
||||
return 0;
|
||||
|
||||
//fill in the description:
|
||||
%objective.description = %objective.getName() SPC %objective.targetObjectId.getDataBlock().getName();
|
||||
|
||||
//look for a duplicate...
|
||||
%count = %objQ.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%obj = %objQ.getObject(%i);
|
||||
if (%obj.getName() $= %objective.getName())
|
||||
{
|
||||
if (%obj.issuedByClientId == %client && %objective.targetObjectId == %obj.targetObjectId)
|
||||
{
|
||||
%useThisObjective = %obj;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (%objective.getName() $= "AIODeployEquipment")
|
||||
{
|
||||
//make sure it's a valid objective
|
||||
if (%objective.location $= "" || %objective.location $= "0 0 0" || %objective.equipment $= "")
|
||||
return 0;
|
||||
|
||||
//fill in the description:
|
||||
%objective.description = %objective.getName() SPC %objective.equipment SPC "at" SPC %objective.location;
|
||||
|
||||
//look for a duplicate...
|
||||
%count = %objQ.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%obj = %objQ.getObject(%i);
|
||||
if (%obj.getName() $= %objective.getName())
|
||||
{
|
||||
if (%obj.issuedByClientId == %client && VectorDist(%objective.location, %obj.location) < 8 && %objective.equipment == %obj.equipment)
|
||||
{
|
||||
%useThisObjective = %obj;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if we found a previously added objective, delete the submitted one
|
||||
if (%useThisObjective > 0)
|
||||
{
|
||||
%objective.delete();
|
||||
}
|
||||
|
||||
//otherwise add it to the objective Q
|
||||
else
|
||||
{
|
||||
%useThisObjective = %objective;
|
||||
$ObjectiveQ[%client.team].add(%useThisObjective);
|
||||
%objective.shouldAcknowledge = true;
|
||||
//now that it's been added, see if anyone picks it up within 10 seconds
|
||||
schedule(10000, %objective, "AIReassessHumanObjective", %objective);
|
||||
}
|
||||
|
||||
//now see if we're supposed to force the target to the objective
|
||||
//the link will have already been checked at the top...
|
||||
if (%targetClient > 0)
|
||||
{
|
||||
//if we were previously assigned to an objective which was forced on this client, we need to delete it...
|
||||
%prevObjective = %targetClient.objective;
|
||||
if (%prevObjective != %useThisObjective && %prevObjective.issuedByClientId == %targetClient.controlByHuman)
|
||||
{
|
||||
AIClearObjective(%prevObjective);
|
||||
%prevObjective.delete();
|
||||
}
|
||||
|
||||
//if the command is an escort command, issue it at the forced escort weight instead
|
||||
%forcedWeight = $AIWeightHumanIssuedCommand;
|
||||
if (%useThisObjective.getName() $= "AIOEscortPlayer")
|
||||
%forcedWeight = $AIWeightHumanIssuedEscort;
|
||||
|
||||
//reweight the client's objective
|
||||
%testWeight = 0;
|
||||
if (isObject(%client.objective))
|
||||
%testWeight = %client.objective.weight(%client, %client.objectiveLevel, 0, %inventoryStr);
|
||||
if (%testWeight <= 0 || %testWeight > %client.objectiveWeight)
|
||||
%client.objectiveWeight = %testWeight;
|
||||
|
||||
//see if we should force the objective
|
||||
if (%targetClient.objectiveWeight <= %forcedWeight)
|
||||
{
|
||||
AIForceObjective(%targetClient, %useThisObjective, %forcedWeight);
|
||||
|
||||
//clearing the prev objective will undo the link - re-do it here
|
||||
aiSetHumanControl(%client, %targetClient);
|
||||
|
||||
//send the "command accepted response"
|
||||
if (!%fromCmdMap)
|
||||
{
|
||||
if (isObject(%client.player) && VectorDist(%targetClient.player.position, %client.player.position) <= 40)
|
||||
schedule(250, %targetClient.player, "AIPlayAnimSound", %targetClient, %client.player.getWorldBoxCenter(), "cmd.acknowledge", 1, 1, 0);
|
||||
}
|
||||
else
|
||||
serverCmdAcceptTask(%targetClient, %client, -1, %useThisObjective.ackDescription);
|
||||
}
|
||||
else
|
||||
{
|
||||
//send the "command declined response"
|
||||
if (!%fromCmdMap)
|
||||
{
|
||||
if (isObject(%client.player) && VectorDist(%targetClient.player.position, %client.player.position) <= 40)
|
||||
{
|
||||
schedule(250, %targetClient.player, "AIPlayAnimSound", %targetClient, %client.player.getWorldBoxCenter(), "cmd.decline", -1, -1, 0);
|
||||
schedule(2000, %client.player, "AIRespondToEvent", %client, 'ChatCmdWhat', %targetClient);
|
||||
}
|
||||
}
|
||||
else
|
||||
serverCmdDeclineTask(%targetClient, %client, %useThisObjective.ackDescription);
|
||||
}
|
||||
}
|
||||
|
||||
//return the objective used, so the calling function can know whether to delete the parameter one...
|
||||
return %useThisObjective;
|
||||
}
|
||||
|
||||
function AIReassessHumanObjective(%objective)
|
||||
{
|
||||
if (%objective.issuedByHuman)
|
||||
{
|
||||
//see if there's anyone still assigned to this objective
|
||||
if (!AIClientIsAlive(%objective.clientLevel1) && !AIClientIsAlive(%objective.clientLevel2) && !AIClientIsAlive(%objective.clientLevel3))
|
||||
{
|
||||
AIClearObjective(%objective);
|
||||
%objective.delete();
|
||||
}
|
||||
|
||||
//else reassess this objective in another 10 seconds
|
||||
else
|
||||
schedule(10000, %objective, "AIReassessHumanObjective", %objective);
|
||||
}
|
||||
}
|
||||
|
||||
function aiAttemptHumanControl(%humanClient, %aiClient)
|
||||
{
|
||||
if (!aiAlreadyControlled(%aiClient))
|
||||
{
|
||||
aiSetHumanControl(%humanClient, %aiClient);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function aiHumanHasControl(%humanClient, %aiClient)
|
||||
{
|
||||
if (AIClientIsAlive(%humanClient) && AIClientIsAlive(%aiClient))
|
||||
if (%humanClient.controlAI == %aiClient && %aiClient.controlByHuman == %humanClient)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function aiAlreadyControlled(%aiClient)
|
||||
{
|
||||
if (AIClientIsAlive(%aiClient) && AIClientIsAlive(%aiClient.controlByHuman))
|
||||
if (%aiClient.controlByHuman.controlAI == %aiClient)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function aiReleaseHumanControl(%humanClient, %aiClient)
|
||||
{
|
||||
//make sure they were actually linked
|
||||
if (!aiHumanHasControl(%humanClient, %aiClient))
|
||||
return;
|
||||
|
||||
aiBreakHumanControl(%humanClient, %aiClient);
|
||||
}
|
||||
|
||||
function aiSetHumanControl(%humanClient, %aiClient)
|
||||
{
|
||||
//make sure it's from a human to an ai
|
||||
if (%humanClient.isAIControlled() || !%aiClient.isAIControlled())
|
||||
return;
|
||||
|
||||
//these checks should be redundant, but...
|
||||
if (%humanClient.controlAI > 0)
|
||||
aiBreakHumanControl(%humanClient, %humanClient.controlAI);
|
||||
|
||||
if (%aiClient.controlByHuman > 0)
|
||||
aiBreakHumanControl(%aiClient.controlByHuman, %aiClient);
|
||||
|
||||
//create the link
|
||||
%humanClient.controlAI = %aiClient;
|
||||
%aiClient.controlByHuman = %humanClient;
|
||||
}
|
||||
|
||||
function aiBreakHumanControl(%humanClient, %aiClient)
|
||||
{
|
||||
//make sure they were actually linked
|
||||
if (!aiHumanHasControl(%humanClient, %aiClient))
|
||||
return;
|
||||
|
||||
//for now, just break the link, and worry about unassigning objectives later...
|
||||
%humanClient.controlAI = "";
|
||||
%aiClient.controlByHuman = "";
|
||||
}
|
||||
524
docs/base/@vl2/scripts.vl2/scripts/aiHunters.cs
Normal file
524
docs/base/@vl2/scripts.vl2/scripts/aiHunters.cs
Normal file
|
|
@ -0,0 +1,524 @@
|
|||
//-----------------------------------------------
|
||||
// AI functions for Hunters
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// globals
|
||||
$AIHuntersFlagSearchRadius = 300;
|
||||
$AIHuntersCloseFlagDist = 40;
|
||||
$AIHuntersAttackClientFlagCount = 10;
|
||||
$AIHuntersMinFlagsToCap = 3;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
function HuntersGame::onAIRespawn(%game, %client)
|
||||
{
|
||||
//add the default task
|
||||
if (! %client.defaultTasksAdded)
|
||||
{
|
||||
%client.defaultTasksAdded = true;
|
||||
%client.addTask(AIEngageTask);
|
||||
%client.addTask(AIPickupItemTask);
|
||||
%client.addTask(AIUseInventoryTask);
|
||||
%client.addTask(AITauntCorpseTask);
|
||||
%client.addTask(AIEngageTurretTask);
|
||||
%client.addtask(AIDetectMineTask);
|
||||
%client.addTask(AIPatrolTask);
|
||||
%client.huntersTask = %client.addTask(AIHuntersTask);
|
||||
}
|
||||
|
||||
//set the inv flag
|
||||
%client.spawnUseInv = true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
function HuntersGame::AIInit(%game)
|
||||
{
|
||||
//call the default AIInit() function
|
||||
AIInit();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//AIHuntersTask functions
|
||||
//---------------------------------------------------------------------------
|
||||
function AIHuntersTask::init(%task, %client)
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
function AIHuntersTask::assume(%task, %client)
|
||||
{
|
||||
%task.setWeightFreq(10);
|
||||
%task.setMonitorFreq(10);
|
||||
%task.pickupFlag = -1;
|
||||
%task.engageTarget = -1;
|
||||
%task.getHealth = -1;
|
||||
%task.capFlags = false;
|
||||
}
|
||||
|
||||
function AIHuntersTask::retire(%task, %client)
|
||||
{
|
||||
%task.pickupFlag = -1;
|
||||
%task.engageTarget = -1;
|
||||
%task.getHealth = -1;
|
||||
%task.capFlags = false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
function AIHuntersTask::weight(%task, %client)
|
||||
{
|
||||
// init flag search vars
|
||||
%player = %client.player;
|
||||
if (!isObject(%player))
|
||||
return;
|
||||
|
||||
%clientPos = %player.getWorldBoxCenter();
|
||||
%task.pickupFlag = -1;
|
||||
%task.engageTarget = -1;
|
||||
%task.capFlags = false;
|
||||
|
||||
//find the closest flag
|
||||
%flagVars = AIFindClosestFlag(%client, $AIHuntersFlagSearchRadius);
|
||||
%closestFlag = getWord(%flagVars, 0);
|
||||
%closestFlagDist = getWord(%flagVars, 1);
|
||||
|
||||
//find the dist to the nexus
|
||||
%nexusPos = Game.Nexus.getId().getWorldBoxCenter();
|
||||
%nexusDist = %client.getPathDistance(%nexusPos);
|
||||
if (%nexusDist < 0)
|
||||
%nexusDist = 32767;
|
||||
|
||||
//validate the health item
|
||||
if (isObject(%task.getHealth))
|
||||
{
|
||||
if (%task.getHealth.isHidden())
|
||||
%task.getHealth = -1;
|
||||
else if ((%task.getHealth.getDataBlock().getName() $= "DeployedStationInventory") ||
|
||||
(%task.getHealth.getDataBlock().getName() $= "StationInventory"))
|
||||
{
|
||||
if (%task.getHealth.isDisabled() && !%task.getHealth.isPowered())
|
||||
%task.getHealth = -1;
|
||||
}
|
||||
}
|
||||
|
||||
//find the dist to the closest health
|
||||
%healthDist = 32767;
|
||||
%damage = %client.player.getDamagePercent();
|
||||
if (%client.flagCount < 5)
|
||||
%damageTolerance = 0.7;
|
||||
else
|
||||
%damageTolerance = 0.25 + ((%client.getSkillLevel() * %client.getSkillLevel()) * 0.35);
|
||||
if (%damage > %damageTolerance)
|
||||
{
|
||||
if (!isObject(%task.getHealth))
|
||||
{
|
||||
//search for a health kit
|
||||
%closestHealth = AIFindSafeItem(%client, "Health");
|
||||
if (isObject(%closestHealth))
|
||||
{
|
||||
%healthDist = %client.getPathDistance(%closestHealth.getWorldBoxCenter());
|
||||
if (%healthDist < 0)
|
||||
%healthDist = 32767;
|
||||
else
|
||||
%healthItem = %closestHealth;
|
||||
}
|
||||
|
||||
//else search for an inventory station
|
||||
else
|
||||
{
|
||||
%result = AIFindClosestInventory(%client, false);
|
||||
%closestInv = getWord(%result, 0);
|
||||
%closestDist = getWord(%result, 1);
|
||||
if (isObject(%closestInv))
|
||||
{
|
||||
%healthDist = %closestDist;
|
||||
%healthItem = %closestInv;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
%healthDist = %client.getPathDistance(%task.getHealth.getWorldBoxCenter());
|
||||
if (%healthDist < 0)
|
||||
{
|
||||
%healthDist = 32767;
|
||||
%task.getHealth = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
%task.getHealth = -1;
|
||||
|
||||
//see if we need to cap - make sure we're actually able first
|
||||
%mustCap = false;
|
||||
%shouldCap = false;
|
||||
%numToScore = %client.flagCount - 1;
|
||||
%hoardModeOn = Game.hoardModeActive();
|
||||
if ((!Game.greedMode || %numToScore >= Game.greedMinFlags) && !Game.hoardModeActive() && %numToScore >= $AIHuntersMinFlagsToCap)
|
||||
{
|
||||
//find out how many points would be scored
|
||||
%potentialScore = (%numToScore * (%numToScore + 1)) / 2;
|
||||
|
||||
//find out how many flags we need to take the lead...
|
||||
%needFlagsForLead = 0;
|
||||
%highestScore = 0;
|
||||
%clientIsInLead = false;
|
||||
if (Game.teamMode)
|
||||
{
|
||||
%teamCount = Game.numTeams;
|
||||
for (%i = 1; %i <= %teamCount; %i++)
|
||||
{
|
||||
if ($teamScore[%i] > %highestScore)
|
||||
%highestScore = $teamScore[%i];
|
||||
}
|
||||
|
||||
//see if we're in the lead...
|
||||
if (%highestScore == $teamScore[%client.team])
|
||||
%clientIsInLead = true;
|
||||
else
|
||||
{
|
||||
%tempScore = $teamScore[%client.team] + %potentialScore;
|
||||
%flagValue = %numToScore + 1;
|
||||
while (%tempScore < %highestScore)
|
||||
{
|
||||
%tempScore += %flagValue;
|
||||
%flagValue++;
|
||||
%needFlagsForLead++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
%clientCount = ClientGroup.getCount();
|
||||
for (%i = 0; %i < %clientCount; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl.score > %highestScore)
|
||||
%highestScore = %cl.score;
|
||||
}
|
||||
|
||||
//see if we're in the lead
|
||||
if (%highestScore == %client.score)
|
||||
%clientIsInLead = true;
|
||||
else
|
||||
{
|
||||
%tempScore = %client.score + %potentialScore;
|
||||
%flagValue = %numToScore + 1;
|
||||
while (%tempScore < %highestScore)
|
||||
{
|
||||
%tempScore += %flagValue;
|
||||
%flagValue++;
|
||||
%needFlagsForLead++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//the current target is more dangerous than the closest enemy
|
||||
%currentTarget = %client.getEngageTarget();
|
||||
if (AIClientIsAlive(%currentTarget))
|
||||
{
|
||||
%closestEnemy = %currentTarget;
|
||||
%closestEnemydist = %client.getPathDistance(%currentTarget.player.position);
|
||||
if (%closestEnemyDist < 0)
|
||||
%closestEnemyDist = 32767;
|
||||
}
|
||||
else
|
||||
{
|
||||
%losTimeout = $AIClientMinLOSTime + ($AIClientLOSTimeout * %client.getSkillLevel());
|
||||
%result = AIFindClosestEnemy(%client, $AIHuntersCloseFlagDist, %losTimeout);
|
||||
%closestEnemy = getWord(%result, 0);
|
||||
%closestEnemydist = getWord(%result, 1);
|
||||
}
|
||||
|
||||
//find out how much time is left...
|
||||
%curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) + $missionStartTime - getSimTime();
|
||||
|
||||
//If there's a tough or equal enemy nearby, or no flags, think about capping
|
||||
//ie. never cap if there are flags nearby and no enemies...
|
||||
if ((AICheckEnemyDanger(%client, 35) >= 3 && %damage > %damageTolerance) ||
|
||||
(!isObject(%closestFlag) || %closestFlagDist > $AIHuntersCloseFlagDist))
|
||||
{
|
||||
//if we've got enough to take the lead, and there are no flags in the vicinity
|
||||
if ((!%clientIsInLead && %needFlagsForLead == 0) || %highestScore == 0)
|
||||
%mustCap = true;
|
||||
|
||||
//else if we're about to get our butt kicked...
|
||||
else if (AIClientIsAlive(%closestEnemy) && AIEngageWhoWillWin(%closestEnemy, %client) == %closestEnemy)
|
||||
{
|
||||
%mustCap = true;
|
||||
}
|
||||
|
||||
//else if there's no time left in the mission, cap whatever we've got now...
|
||||
else if (%curTimeLeftMS <= 30000)
|
||||
%mustCap = true;
|
||||
|
||||
//else we don't need to cap - see if we should to play it smart
|
||||
else
|
||||
{
|
||||
//if we'd need more than just a couple to take the lead...
|
||||
%waitForFlagsTolerance = %client.getSkillLevel() * $AIHuntersMinFlagsToCap * 2;
|
||||
if (%needFlagsForLead == 0 || (%needFlagsForLead > %waitForFlagsTolerance))
|
||||
{
|
||||
%numEnemyFlags = 0;
|
||||
%clientCount = ClientGroup.getCount();
|
||||
for (%i = 0; %i < %clientCount; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl != %client && %cl.flagCount > %numEnemyFlags)
|
||||
%numEnemyFlags = %cl.flagCount;
|
||||
}
|
||||
|
||||
//if we're in the lead, or no one has the flags we need, or it's team mode,
|
||||
//decide whether to cap based on skill level
|
||||
if (%needFlagsForLead == 0 || %numEnemyFlags < %needFlagsForLead || Game.teamMode)
|
||||
{
|
||||
if (%numToScore >= $AIHuntersMinFlagsToCap + (%client.getSkillLevel() * %client.getSkillLevel() * 15))
|
||||
{
|
||||
%shouldCap = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//now that we've checked all the possibilities, see if we should or must cap
|
||||
if (%mustCap || %shouldCap)
|
||||
{
|
||||
if (%mustCap)
|
||||
%task.setWeight($AIHuntersWeightMustCap);
|
||||
else
|
||||
%task.setWeight($AIHuntersWeightShouldCap);
|
||||
|
||||
%task.capFlags = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
// if we've made it this far, we either can't cap, or there's no need to cap... //
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//see if we need health
|
||||
if (%damage > %damageTolerance && (isObject(%healthItem) || isObject(%task.getHealth)))
|
||||
{
|
||||
if (!isObject(%task.getHealth))
|
||||
%task.getHealth = %healthItem;
|
||||
|
||||
%task.setWeight($AIHuntersWeightNeedHealth);
|
||||
return;
|
||||
}
|
||||
|
||||
//find the closest player with the most flags (that we have los to)
|
||||
%losTimeout = $AIClientMinLOSTime + ($AIClientLOSTimeout * %client.getSkillLevel());
|
||||
%bestClientToEngage = findClientWithMostFlags(%client, %losTimeout);
|
||||
%bestClientDist = 32767;
|
||||
if (AIClientIsAlive(%bestClientToEngage))
|
||||
{
|
||||
%bestClientDist = %client.getPathDistance(%bestClientToEngage.player.position);
|
||||
if (%bestClientDist < 0)
|
||||
%bestClientDist = 32767;
|
||||
}
|
||||
|
||||
//see if there's a flag
|
||||
if (isObject(%closestFlag))
|
||||
{
|
||||
//see if there's a client to shoot
|
||||
if (AIClientIsAlive(%bestClientToEngage))
|
||||
{
|
||||
//calc weight base on closesness to the nearest flag vs. and number of flags the client has...
|
||||
%engageDistFactor = 30 + %bestClientDist - (%bestClientToEngage.flagCount * 5);
|
||||
if (%closestFlagDist < %engageDistFactor)
|
||||
{
|
||||
%task.pickupFlag = %closestFlag;
|
||||
%task.engageTarget = %bestClientToEngage;
|
||||
%task.setWeight($AIHuntersWeightPickupFlag);
|
||||
}
|
||||
|
||||
//otherwise, ignore the flag, and go for the client
|
||||
else
|
||||
{
|
||||
%task.pickupFlag = -1;
|
||||
%task.engageTarget = %bestClientToEngage;
|
||||
%task.setWeight($AIHuntersWeightMustEngage);
|
||||
}
|
||||
}
|
||||
|
||||
//else no one to attack
|
||||
else
|
||||
{
|
||||
%task.pickupFlag = %closestFlag;
|
||||
%task.engageTarget = -1;
|
||||
%task.setWeight($AIHuntersWeightPickupFlag);
|
||||
}
|
||||
}
|
||||
|
||||
//else no flag, see if we have someone to attack
|
||||
else if (AIClientIsAlive(%bestClientToEngage))
|
||||
{
|
||||
%task.pickupFlag = -1;
|
||||
%task.engageTarget = %bestClientToEngage;
|
||||
%task.setWeight($AIHuntersWeightShouldEngage);
|
||||
}
|
||||
|
||||
//nothing hunter's related to do...
|
||||
else
|
||||
{
|
||||
%task.pickupFlag = -1;
|
||||
%task.engageTarget = -1;
|
||||
%task.setWeight(0);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
function AIHuntersTask::monitor(%task, %client)
|
||||
{
|
||||
//see if we should cap
|
||||
if (%task.capFlags)
|
||||
{
|
||||
%nexusPos = Game.Nexus.getId().getWorldBoxCenter();
|
||||
%client.stepMove(%nexusPos, 0.25);
|
||||
}
|
||||
|
||||
//see if we've got a flag to pick up and/or someone to engage
|
||||
else if (isObject(%task.pickupFlag))
|
||||
{
|
||||
%client.stepMove(%task.pickupFlag.getWorldBoxCenter(), 0.25);
|
||||
|
||||
if (AIClientIsAlive(%task.engageTarget))
|
||||
%client.setEngageTarget(%task.engageTarget);
|
||||
}
|
||||
|
||||
//see if we've should go for health...
|
||||
else if (isObject(%task.getHealth))
|
||||
{
|
||||
%client.stepMove(%task.getHealth.getWorldBoxCenter(), 1);
|
||||
|
||||
if (AIClientIsAlive(%task.engageTarget))
|
||||
%client.setEngageTarget(%task.engageTarget);
|
||||
}
|
||||
|
||||
//else see if there's just someone to engage
|
||||
else if (AIClientIsAlive(%task.engageTarget))
|
||||
%client.stepEngage(%task.engageTarget);
|
||||
|
||||
//if we're not engaging someone related to the hunters task, engage whoever the AIEngageTask wants...
|
||||
else
|
||||
%client.setEngageTarget(%client.shouldEngage);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// AIHunters utility functions
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
//this function checks to make sure a bot isn't in a mosh pit of enemies
|
||||
//notice it cheats by not using LOS... )
|
||||
function AICheckEnemyDanger(%client, %radius)
|
||||
{
|
||||
%numEnemies = 0;
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (AIClientIsAlive(%cl) && %cl.team != %client.team)
|
||||
{
|
||||
%dist = %client.getPathDistance(%cl.player.position);
|
||||
if (%dist < %radius)
|
||||
{
|
||||
%winner = AIEngageWhoWillWin(%cl, %client);
|
||||
if (%winner == %cl)
|
||||
%numEnemies += 3;
|
||||
else if (%winner != %client)
|
||||
%numEnemies++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return %numEnemies;
|
||||
}
|
||||
|
||||
function AIFindClosestFlag(%client, %radius)
|
||||
{
|
||||
%closestFlag = -1;
|
||||
%closestDist = %radius;
|
||||
%flagCount = $FlagGroup.getCount();
|
||||
for (%i = 0; %i < %flagCount; %i++)
|
||||
{
|
||||
%flag = $FlagGroup.getObject(%i);
|
||||
%flagPos = %flag.getWorldBoxCenter();
|
||||
%dist = %client.getPathDistance(%flagPos);
|
||||
|
||||
if (%dist > 0 && %dist < %closestDist)
|
||||
{
|
||||
%closestDist = %dist;
|
||||
%closestFlag = %flag;
|
||||
}
|
||||
}
|
||||
return %closestFlag @ " " @ %closestDist;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
function findClientWithMostFlags(%srcClient, %losTimeout)
|
||||
{
|
||||
%clientCount = 0;
|
||||
%closestClient = -1;
|
||||
%highestFlagFactor = -1; //take both distance and flag count into consideration
|
||||
|
||||
%count = ClientGroup.getCount();
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
|
||||
//make sure we find someone who's alive, and on an opposing team
|
||||
if (AIClientIsAlive(%cl) && %cl.team != %srcClient.team)
|
||||
{
|
||||
%clIsCloaked = false;
|
||||
if (%cl.player.getInventory("CloakingPack") > 0 && %cl.player.getImageState($BackpackSlot) $= "activate")
|
||||
%clIsCloaked = true;
|
||||
|
||||
//make sure the client can see the enemy
|
||||
%hasLOS = %srcClient.hasLOSToClient(%cl);
|
||||
%losTime = %srcClient.getClientLOSTime(%cl);
|
||||
if (%hasLOS || (%losTime < %losTimeout && AIClientIsAlive(%cl, %losTime + 1000)))
|
||||
{
|
||||
%testPos = %cl.player.getWorldBoxCenter();
|
||||
%distance = %srcClient.getPathDistance(%testPos);
|
||||
if (%distance < 0)
|
||||
%distance = 32767;
|
||||
|
||||
//calculate the flag factor
|
||||
%flagFactor = (100 - %distance) + (%cl.flagCount * 5);
|
||||
|
||||
//see if it's the most suitable client...
|
||||
if (%flagFactor > %highestFlagFactor && (!%clIsCloaked || %distance < 8))
|
||||
{
|
||||
%closestClient = %cl;
|
||||
%highestFlagFactor = %flagFactor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return %closestClient;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
function aih()
|
||||
{
|
||||
exec("scripts/aiHunters.cs");
|
||||
}
|
||||
|
||||
function aiHlist()
|
||||
{
|
||||
%count = ClientGroup.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl.isAIControlled())
|
||||
error(%cl SPC getTaggedString(%cl.name) SPC "score:" SPC %cl.score SPC "flags:" SPC %cl.flagCount - 1 SPC "capFlags:" SPC %cl.huntersTask.capFlags);
|
||||
}
|
||||
}
|
||||
|
||||
1475
docs/base/@vl2/scripts.vl2/scripts/aiInventory.cs
Normal file
1475
docs/base/@vl2/scripts.vl2/scripts/aiInventory.cs
Normal file
File diff suppressed because it is too large
Load diff
645
docs/base/@vl2/scripts.vl2/scripts/aiObjectiveBuilder.cs
Normal file
645
docs/base/@vl2/scripts.vl2/scripts/aiObjectiveBuilder.cs
Normal file
|
|
@ -0,0 +1,645 @@
|
|||
// used to automatically create all objectives for a mission
|
||||
|
||||
function AIgeneratorObjectiveInit(%object)
|
||||
{
|
||||
if(%object.isUnderTerrain)
|
||||
return; // no objectives for generators that act as a simple power sources
|
||||
|
||||
if(%object.team > 0)
|
||||
{
|
||||
%homeTeam = %object.team;
|
||||
if(%homeTeam == 1)
|
||||
%enemyTeam = 2;
|
||||
else
|
||||
%enemyTeam = 1;
|
||||
|
||||
addAIObjective(%enemyTeam, createDefaultAttack(%object, $AIWeightAttackGenerator[1], $AIWeightAttackGenerator[2]));
|
||||
addAIObjective(%homeTeam, createDefaultRepair(%object, $AIWeightRepairGenerator[1], $AIWeightRepairGenerator[2]));
|
||||
addAIObjective(%homeTeam, createDefaultDefend(%object, $AIWeightDefendGenerator[1], $AIWeightDefendGenerator[2]));
|
||||
}
|
||||
else
|
||||
{
|
||||
addAIObjective(1, createDefaultRepair(%object, $AIWeightRepairGenerator[1], $AIWeightRepairGenerator[2]));
|
||||
addAIObjective(1, createDefaultAttack(%object, $AIWeightAttackGenerator[1], $AIWeightAttackGenerator[2]));
|
||||
addAIObjective(1, createDefaultDefend(%object, $AIWeightDefendGenerator[1], $AIWeightDefendGenerator[2]));
|
||||
addAIObjective(2, createDefaultRepair(%object, $AIWeightRepairGenerator[1], $AIWeightRepairGenerator[2]));
|
||||
addAIObjective(2, createDefaultAttack(%object, $AIWeightAttackGenerator[1], $AIWeightAttackGenerator[2]));
|
||||
addAIObjective(2, createDefaultDefend(%object, $AIWeightDefendGenerator[1], $AIWeightDefendGenerator[2]));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function AIsensorObjectiveInit(%object)
|
||||
{
|
||||
if(%object.team > 0)
|
||||
{
|
||||
%homeTeam = %object.team;
|
||||
if(%homeTeam == 1)
|
||||
%enemyTeam = 2;
|
||||
else
|
||||
%enemyTeam = 1;
|
||||
|
||||
addAIObjective(%homeTeam, createDefaultRepair(%object, $AIWeightRepairTurret[1], $AIWeightRepairTurret[2]));
|
||||
addAIObjective(%enemyTeam, createDefaultMortar(%object, $AIWeightMortarTurret[1], $AIWeightMortarTurret[2]));
|
||||
}
|
||||
else
|
||||
{
|
||||
addAIObjective(1, createDefaultRepair(%object, $AIWeightRepairTurret[1], $AIWeightRepairTurret[2]));
|
||||
addAIObjective(1, createDefaultMortar(%object, $AIWeightMortarTurret[1], $AIWeightMortarTurret[2]));
|
||||
addAIObjective(2, createDefaultRepair(%object, $AIWeightRepairTurret[1], $AIWeightRepairTurret[2]));
|
||||
addAIObjective(2, createDefaultMortar(%object, $AIWeightMortarTurret[1], $AIWeightMortarTurret[2]));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function AIflipflopObjectiveInit(%object)
|
||||
{
|
||||
// this will always start out neutral (Team 0)
|
||||
addAIObjective(1, createDefaultDefend(%object, $AIWeightDefendFlipFlop[1], $AIWeightDefendFlipFlop[2]));
|
||||
addAIObjective(1, createDefaultTouch(%object, $AIWeightCaptureFlipFlop[1], $AIWeightCaptureFlipFlop[2]));
|
||||
addAIObjective(2, createDefaultDefend(%object, $AIWeightDefendFlipFlop[1], $AIWeightDefendFlipFlop[2]));
|
||||
addAIObjective(2, createDefaultTouch(%object, $AIWeightCaptureFlipFlop[1], $AIWeightCaptureFlipFlop[2]));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function AIturretObjectiveInit(%object)
|
||||
{
|
||||
if(%object.team > 0)
|
||||
{
|
||||
%homeTeam = %object.team;
|
||||
if(%homeTeam == 1)
|
||||
%enemyTeam = 2;
|
||||
else
|
||||
%enemyTeam = 1;
|
||||
|
||||
addAIObjective(%homeTeam, createDefaultRepair(%object, $AIWeightRepairTurret[1], $AIWeightRepairTurret[2]));
|
||||
|
||||
// attack for indoor turrets, mortar for outside turrets
|
||||
if(%object.getDataBlock().getName() $= "SentryTurret")
|
||||
addAIObjective(%enemyTeam, createDefaultAttack(%object, $AIWeightAttackInventory[1], $AIWeightAttackInventory[2]));
|
||||
else
|
||||
addAIObjective(%enemyTeam, createDefaultMortar(%object, $AIWeightMortarTurret[1], $AIWeightMortarTurret[2]));
|
||||
}
|
||||
else
|
||||
{
|
||||
addAIObjective(1, createDefaultRepair(%object, $AIWeightRepairTurret[1], $AIWeightRepairTurret[2]));
|
||||
addAIObjective(1, createDefaultMortar(%object, $AIWeightMortarTurret[1], $AIWeightMortarTurret[2]));
|
||||
addAIObjective(2, createDefaultRepair(%object, $AIWeightRepairTurret[1], $AIWeightRepairTurret[2]));
|
||||
addAIObjective(2, createDefaultMortar(%object, $AIWeightMortarTurret[1], $AIWeightMortarTurret[2]));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function AIinventoryObjectiveInit(%object)
|
||||
{
|
||||
if(%object.team > 0)
|
||||
{
|
||||
%homeTeam = %object.team;
|
||||
if(%homeTeam == 1)
|
||||
%enemyTeam = 2;
|
||||
else
|
||||
%enemyTeam = 1;
|
||||
|
||||
addAIObjective(%homeTeam, createDefaultRepair(%object, $AIWeightRepairInventory[1], $AIWeightRepairInventory[2]));
|
||||
addAIObjective(%enemyTeam, createDefaultAttack(%object, $AIWeightAttackInventory[1], $AIWeightAttackInventory[2]));
|
||||
}
|
||||
else
|
||||
{
|
||||
addAIObjective(1, createDefaultRepair(%object, $AIWeightRepairInventory[1], $AIWeightRepairInventory[2]));
|
||||
addAIObjective(1, createDefaultAttack(%object, $AIWeightAttackInventory[1], $AIWeightAttackInventory[2]));
|
||||
addAIObjective(2, createDefaultRepair(%object, $AIWeightRepairInventory[1], $AIWeightRepairInventory[2]));
|
||||
addAIObjective(2, createDefaultAttack(%object, $AIWeightAttackInventory[1], $AIWeightAttackInventory[2]));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function createDefaultTouch(%object, %weight1, %weight2)
|
||||
{
|
||||
%objective = new AIObjective(AIOTouchObject)
|
||||
{
|
||||
dataBlock = "AIObjectiveMarker";
|
||||
description = "Capture the " @ %object.getName();
|
||||
weightLevel1 = %weight1;
|
||||
weightLevel2 = %weight2;
|
||||
mode = "TouchFlipFlop";
|
||||
targetObject = %object.getName();
|
||||
targetClientId = -1;
|
||||
targetObjectId = -1;
|
||||
offense = true;
|
||||
location = %object.getWorldBoxCenter();
|
||||
desiredEquipment = "Light EnergyPack";
|
||||
buyEquipmentSet = "LightEnergyDefault";
|
||||
};
|
||||
|
||||
if(%object.missionTypesList !$= "")
|
||||
%objective.gameType = %object.missionTypesList;
|
||||
|
||||
%objective.position = %objective.location;
|
||||
return %objective;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function createDefaultMortar(%object, %weight1, %weight2)
|
||||
{
|
||||
%objective = new AIObjective(AIOMortarObject)
|
||||
{
|
||||
dataBlock = "AIObjectiveMarker";
|
||||
description = "Mortar the " @ %object.getDataBlock().getName();
|
||||
targetObject = %object.getName();
|
||||
targetObjectId = %object;
|
||||
targetClientId = -1;
|
||||
weightLevel1 = %weight1;
|
||||
weightLevel2 = %weight2;
|
||||
location = %object.getWorldBoxCenter();
|
||||
offense = true;
|
||||
equipment = "Mortar MortarAmmo";
|
||||
buyEquipmentSet = "HeavyAmmoSet";
|
||||
};
|
||||
|
||||
if(%object.missionTypesList !$= "")
|
||||
%objective.gameType = %object.missionTypesList;
|
||||
|
||||
%objective.position = %objective.location;
|
||||
return %objective;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function createDefaultRepair(%object, %weight1, %weight2)
|
||||
{
|
||||
%objective = new AIObjective(AIORepairObject)
|
||||
{
|
||||
dataBlock = "AIObjectiveMarker";
|
||||
description = "Repair the " @ %object.getDataBlock().getName();
|
||||
targetObject = %object.getName();
|
||||
targetObjectId = %object;
|
||||
targetClientId = -1;
|
||||
weightLevel1 = %weight1;
|
||||
weightLevel2 = %weight2;
|
||||
location = %object.getWorldBoxCenter();
|
||||
defense = true;
|
||||
equipment = "RepairPack";
|
||||
buyEquipmentSet = "MediumRepairSet";
|
||||
};
|
||||
|
||||
if(%object.missionTypesList !$= "")
|
||||
%objective.gameType = %object.missionTypesList;
|
||||
|
||||
%objective.position = %objective.location;
|
||||
return %objective;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function createDefaultAttack(%object, %weight1, %weight2)
|
||||
{
|
||||
%objective = new AIObjective(AIOAttackObject)
|
||||
{
|
||||
dataBlock = "AIObjectiveMarker";
|
||||
description = "Attack the " @ %object.getDataBlock().getName();
|
||||
targetObject = %object.getName();
|
||||
targetObjectId = %object;
|
||||
targetClientId = -1;
|
||||
weightLevel1 = %weight1;
|
||||
weightLevel2 = %weight2;
|
||||
location = %object.getWorldBoxCenter();
|
||||
offense = true;
|
||||
desiredEquipment = "ShieldPack";
|
||||
buyEquipmentSet = "HeavyAmmoSet";
|
||||
};
|
||||
|
||||
if(%object.missionTypesList !$= "")
|
||||
%objective.gameType = %object.missionTypesList;
|
||||
|
||||
%objective.position = %objective.location;
|
||||
return %objective;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function createDefaultDefend(%object, %weight1, %weight2)
|
||||
{
|
||||
%objective = new AIObjective(AIODefendLocation)
|
||||
{
|
||||
dataBlock = "AIObjectiveMarker";
|
||||
description = "Defend the " @ %object.getDataBlock().getName();
|
||||
targetObject = %object.getName();
|
||||
targetObjectId = %object;
|
||||
targetClientId = -1;
|
||||
weightLevel1 = %weight1;
|
||||
weightLevel2 = %weight2;
|
||||
location = %object.getWorldBoxCenter();
|
||||
defense = true;
|
||||
desiredEquipment = "ShieldPack Plasma PlasmaAmmo";
|
||||
buyEquipmentSet = "HeavyShieldSet";
|
||||
};
|
||||
|
||||
if(%object.missionTypesList !$= "")
|
||||
%objective.gameType = %object.missionTypesList;
|
||||
|
||||
%objective.position = %objective.location;
|
||||
return %objective;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function AIflagObjectiveInit(%flag)
|
||||
{
|
||||
%homeTeam = %flag.team;
|
||||
|
||||
if(%homeTeam == 1)
|
||||
%enemyTeam = 2;
|
||||
else
|
||||
%enemyTeam = 1;
|
||||
|
||||
if(%flag.missionTypesList !$= "")
|
||||
{
|
||||
%missionSpecific = true;
|
||||
%misType = %flag.missionTypesList;
|
||||
}
|
||||
|
||||
%newObjective = new AIObjective(AIODefendLocation)
|
||||
{
|
||||
dataBlock = "AIObjectiveMarker";
|
||||
weightLevel1 = $AIWeightDefendFlag[1];
|
||||
weightLevel2 = $AIWeightDefendFlag[2];
|
||||
description = "Defend our flag";
|
||||
targetObject = %flag.getName();
|
||||
targetObjectId = %flag;
|
||||
targetClientId = -1;
|
||||
location = %flag.getWorldBoxCenter();
|
||||
defense = true;
|
||||
desiredEquipment = "ShieldPack Plasma PlasmaAmmo";
|
||||
buyEquipmentSet = "HeavyShieldSet";
|
||||
chat = "ChatSelfDefendFlag DefendBase";
|
||||
};
|
||||
|
||||
if(%missionSpecific)
|
||||
%newObjective.gameType = %misType;
|
||||
else
|
||||
%newObjective.gameType = "all";
|
||||
|
||||
%newObjective.position = %newObjective.location;
|
||||
addAIObjective(%homeTeam, %newObjective);
|
||||
|
||||
%newObjective = new AIObjective(AIOTouchObject)
|
||||
{
|
||||
dataBlock = "AIObjectiveMarker";
|
||||
weightLevel1 = $AIWeightGrabFlag[1];
|
||||
weightLevel2 = $AIWeightGrabFlag[2];
|
||||
description = "Grab the enemy flag";
|
||||
targetObject = %flag.getName();
|
||||
targetObjectId = %flag;
|
||||
targetClientId = -1;
|
||||
location = %flag.getWorldBoxCenter();
|
||||
mode = "FlagGrab";
|
||||
offense = true;
|
||||
desiredEquipment = "Light EnergyPack";
|
||||
buyEquipmentSet = "LightEnergyDefault";
|
||||
};
|
||||
|
||||
if(%missionSpecific)
|
||||
%newObjective.gameType = %misType;
|
||||
else
|
||||
%newObjective.gameType = "all";
|
||||
|
||||
%newObjective.position = %newObjective.location;
|
||||
addAIObjective(%enemyTeam, %newObjective);
|
||||
|
||||
//NOTE: for this objective, we need to fill in the targetClientId when the flag is taken
|
||||
%newObjective = new AIObjective(AIOAttackPlayer)
|
||||
{
|
||||
dataBlock = "AIObjectiveMarker";
|
||||
weightLevel1 = $AIWeightKillFlagCarrier[1];
|
||||
weightLevel2 = $AIWeightKillFlagCarrier[2];
|
||||
description = "Kill the enemy flag carrier";
|
||||
mode = "FlagCarrier";
|
||||
targetObject = %flag.getName();
|
||||
targetObjectId = -1;
|
||||
targetClientId = -1;
|
||||
offense = true;
|
||||
desiredEquipment = "Light EnergyPack";
|
||||
buyEquipmentSet = "LightEnergySniper";
|
||||
};
|
||||
|
||||
if(%missionSpecific)
|
||||
%newObjective.gameType = %misType;
|
||||
else
|
||||
%newObjective.gameType = "all";
|
||||
|
||||
%newObjective.position = %flag.getWorldBoxCenter();
|
||||
addAIObjective(%homeTeam, %newObjective);
|
||||
|
||||
//NOTE: for this objective, we need to fill in the location when the flag is grabbed
|
||||
%newObjective = new AIObjective(AIOTouchObject)
|
||||
{
|
||||
dataBlock = "AIObjectiveMarker";
|
||||
weightLevel1 = $AIWeightCapFlag[1];
|
||||
weightLevel2 = $AIWeightCapFlag[2];
|
||||
description = "Capture the flag!";
|
||||
targetObject = %flag.getName();
|
||||
targetObjectId = %flag;
|
||||
targetClientId = -1;
|
||||
mode = "FlagCapture";
|
||||
offense = true;
|
||||
defense = true;
|
||||
};
|
||||
|
||||
if(%missionSpecific)
|
||||
%newObjective.gameType = %misType;
|
||||
else
|
||||
%newObjective.gameType = "all";
|
||||
|
||||
%newObjective.position = %flag.getWorldBoxCenter();
|
||||
addAIObjective(%enemyTeam, %newObjective);
|
||||
|
||||
%newObjective = new AIObjective(AIOTouchObject)
|
||||
{
|
||||
dataBlock = "AIObjectiveMarker";
|
||||
weightLevel1 = $AIWeightReturnFlag[1];
|
||||
weightLevel2 = $AIWeightReturnFlag[2];
|
||||
description = "Return our flag";
|
||||
targetObject = %flag.getName();
|
||||
targetObjectId = %flag;
|
||||
targetClientId = -1;
|
||||
location = %flag.getWorldBoxCenter();
|
||||
mode = "FlagDropped";
|
||||
offense = true;
|
||||
defense = true;
|
||||
};
|
||||
|
||||
if(%missionSpecific)
|
||||
%newObjective.gameType = %misType;
|
||||
else
|
||||
%newObjective.gameType = "all";
|
||||
|
||||
%newObjective.position = %newObjective.location;
|
||||
addAIObjective(%homeTeam, %newObjective);
|
||||
|
||||
%newObjective = new AIObjective(AIOTouchObject)
|
||||
{
|
||||
dataBlock = "AIObjectiveMarker";
|
||||
weightLevel1 = $AIWeightReturnFlag[1];
|
||||
weightLevel2 = $AIWeightReturnFlag[2];
|
||||
description = "Grab the dropped enemy flag";
|
||||
targetObject = %flag.getName();
|
||||
targetObjectId = %flag;
|
||||
targetClientId = -1;
|
||||
mode = "FlagDropped";
|
||||
offense = true;
|
||||
defense = true;
|
||||
};
|
||||
|
||||
if(%missionSpecific)
|
||||
%newObjective.gameType = %misType;
|
||||
else
|
||||
%newObjective.gameType = "all";
|
||||
|
||||
%newObjective.position = %flag.getWorldBoxCenter();
|
||||
addAIObjective(%enemyTeam, %newObjective);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function addAIObjective(%team, %objective)
|
||||
{
|
||||
if(AIObjectiveExists(%objective, %team) == false)
|
||||
nameToId("MissionGroup/Teams/team" @ %team @ "/AIObjectives").add(%objective);
|
||||
else
|
||||
%objective.delete();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function AICreateObjectives()
|
||||
{
|
||||
messageBoxOkCancel("Build Objectives", "Are you sure you want to build all mission objectives?", "AIBuildObjectives();");
|
||||
}
|
||||
|
||||
function AIBuildObjectives()
|
||||
{
|
||||
// make sure there exists our objectives group
|
||||
for(%i = 0; %i <= Game.numTeams; %i++)
|
||||
{
|
||||
%objGroup = nameToId("MissionGroup/Teams/team" @ %i @ "/AIObjectives");
|
||||
%teamGroup = nameToID("MissionGroup/Teams/team" @ %i);
|
||||
|
||||
if(%objGroup <= 0)
|
||||
{
|
||||
%set = new SimGroup(AIObjectives);
|
||||
%teamGroup.add(%set);
|
||||
}
|
||||
else
|
||||
{
|
||||
// there already exists a folder for AIobjectives
|
||||
// remove any objectives that are not locked
|
||||
%count = 0;
|
||||
while(%objGroup.getCount() && (%count != %objGroup.getCount()))
|
||||
{
|
||||
%obj = %objGroup.getObject(%count);
|
||||
if(!%obj.locked)
|
||||
%objGroup.remove(%obj);
|
||||
else
|
||||
%count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(%k = 0; %k <= Game.numTeams; %k++)
|
||||
{
|
||||
%teamGroup = nameToID("MissionGroup/Teams/team" @ %k);
|
||||
%teamGroup.AIobjectiveInit(false);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function SimGroup::AIobjectiveInit(%this)
|
||||
{
|
||||
for(%i = 0; %i < %this.getCount(); %i++)
|
||||
%this.getObject(%i).AIobjectiveInit();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function GameBase::AIobjectiveInit(%this)
|
||||
{
|
||||
%this.getDataBlock().AIobjectiveInit(%this);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function AssignName(%object)
|
||||
{
|
||||
%root = %object.getDataBlock().getName();
|
||||
if (%root $= "")
|
||||
%root = "Unknown";
|
||||
|
||||
if (%object.team >= 0)
|
||||
%newName = "Team" @ %object.team @ %root;
|
||||
else
|
||||
%newName = "Unnamed" @ %root;
|
||||
%i = 1;
|
||||
while (isObject(%newName @ %i))
|
||||
%i++;
|
||||
%object.setName(%newName @ %i);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function StationInventory::AIobjectiveInit(%data, %object)
|
||||
{
|
||||
if(%object.getName() $= "")
|
||||
AssignName(%object);
|
||||
|
||||
AIinventoryObjectiveInit(%object);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function Generator::AIobjectiveInit(%data, %object)
|
||||
{
|
||||
if(%object.getName() $= "")
|
||||
AssignName(%object);
|
||||
|
||||
if(!%object.isUnderTerrain)
|
||||
AIgeneratorObjectiveInit(%object);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function TurretData::AIobjectiveInit(%data, %object)
|
||||
{
|
||||
if(%object.getName() $= "")
|
||||
AssignName(%object);
|
||||
|
||||
AIturretObjectiveInit(%object);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function Sensor::AIobjectiveInit(%data, %object)
|
||||
{
|
||||
if(%object.getName() $= "")
|
||||
AssignName(%object);
|
||||
|
||||
AIsensorObjectiveInit(%object);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function Flag::AIobjectiveInit(%data, %object)
|
||||
{
|
||||
if(%object.getName() $= "")
|
||||
AssignName(%object);
|
||||
|
||||
AIflagObjectiveInit(%object);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function FlipFlop::AIobjectiveInit(%data, %object)
|
||||
{
|
||||
if(%object.getName() $= "")
|
||||
AssignName(%object);
|
||||
|
||||
AIflipflopObjectiveInit(%object);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function saveObjectives()
|
||||
{
|
||||
for(%i = 1; %i <= 2; %i++)
|
||||
saveObjectives(%i);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function saveObjectiveFile(%team)
|
||||
{
|
||||
// check for read-only
|
||||
%fileName = $CurrentMission @ "team" @ %team @ ".cs";
|
||||
%file = "base/missions/" @ %fileName;
|
||||
|
||||
if(!isWriteableFileName(%file))
|
||||
{
|
||||
error("Objectives file '" @ %fileName @ "' is not writeable.");
|
||||
return;
|
||||
}
|
||||
|
||||
// ok, were good to save.
|
||||
%objectives = nameToId("MissionGroup/Teams/team" @ %team @ "/AIObjectives");
|
||||
%objectives.save("missions/" @ %fileName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function LoadObjectives(%numTeams)
|
||||
{
|
||||
for(%i = 1; %i <= %numTeams; %i++)
|
||||
loadObjectivesFile(%i);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function LoadObjectivesFile(%team)
|
||||
{
|
||||
%file = $CurrentMission @ "team" @ %team;
|
||||
exec("missions/" @ %file);
|
||||
%newObjSet = nameToId("MissionCleanup/AIObjectives");
|
||||
|
||||
if(%newObjSet > 0)
|
||||
{
|
||||
%group = NameToId("MissionGroup/Teams/team" @ %team);
|
||||
%oldObjSet = NameToId("MissionGroup/Teams/team" @ %team @ "/AIObjectives");
|
||||
|
||||
if(%oldObjSet > 0)
|
||||
{
|
||||
%oldObjSet.delete();
|
||||
%group.add(%newObjSet);
|
||||
}
|
||||
}
|
||||
else
|
||||
error("no objectives file for team" @ %team @ ". Loading defaults...");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function AIObjectiveExists(%newObjective, %team)
|
||||
{
|
||||
%objGroup = nameToId("MissionGroup/Teams/team" @ %team @ "/AIObjectives");
|
||||
%objCount = %objGroup.getCount();
|
||||
%exists = false;
|
||||
|
||||
for(%i = 0; %i < %objCount; %i++)
|
||||
{
|
||||
%obj = %objGroup.getObject(%i);
|
||||
|
||||
if(%obj.getName() $= %newObjective.getName())
|
||||
{
|
||||
if((%obj.getName() $= "AIOMortarObject") ||
|
||||
(%obj.getName() $= "AIORepairObject") ||
|
||||
(%obj.getName() $= "AIOAttackObject") ||
|
||||
(%obj.getName() $= "AIODefendLocation"))
|
||||
{
|
||||
if(%obj.targetObjectId == %newObjective.targetObjectId)
|
||||
%exists = true;
|
||||
}
|
||||
else if((%obj.getName() $= "AIOTouchObject") ||
|
||||
(%obj.getName() $= "AIOAttackPlayer"))
|
||||
{
|
||||
if(%obj.mode $= %newObjective.mode)
|
||||
if(%obj.description $= %newObjective.description)
|
||||
%exists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return %exists;
|
||||
}
|
||||
3809
docs/base/@vl2/scripts.vl2/scripts/aiObjectives.cs
Normal file
3809
docs/base/@vl2/scripts.vl2/scripts/aiObjectives.cs
Normal file
File diff suppressed because it is too large
Load diff
230
docs/base/@vl2/scripts.vl2/scripts/aiRabbit.cs
Normal file
230
docs/base/@vl2/scripts.vl2/scripts/aiRabbit.cs
Normal file
|
|
@ -0,0 +1,230 @@
|
|||
//-----------------------------------------------
|
||||
// AI functions for Rabbit
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
function RabbitGame::onAIRespawn(%game, %client)
|
||||
{
|
||||
//add the default task
|
||||
if (! %client.defaultTasksAdded)
|
||||
{
|
||||
%client.defaultTasksAdded = true;
|
||||
%client.addTask(AIPickupItemTask);
|
||||
%client.addTask(AIUseInventoryTask);
|
||||
%client.addTask(AITauntCorpseTask);
|
||||
%client.rabbitTask = %client.addTask(AIRabbitTask);
|
||||
}
|
||||
|
||||
//set the inv flag
|
||||
%client.spawnUseInv = true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
function RabbitGame::AIInit(%game)
|
||||
{
|
||||
//call the default AIInit() function
|
||||
AIInit();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//AIRabbitTask functions
|
||||
//---------------------------------------------------------------------------
|
||||
function AIRabbitTask::init(%task, %client)
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
function AIRabbitTask::assume(%task, %client)
|
||||
{
|
||||
%task.setWeightFreq(20);
|
||||
%task.setMonitorFreq(20);
|
||||
%task.findLocation = true;
|
||||
}
|
||||
|
||||
function AIRabbitTask::retire(%task, %client)
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
function AIRabbitTask::weight(%task, %client)
|
||||
{
|
||||
%player = %client.player;
|
||||
|
||||
//see if I have the flag
|
||||
if ($AIRabbitFlag.carrier == %player)
|
||||
%task.setWeight($AIRabbitWeightDefault);
|
||||
|
||||
//else see if I'm close to the flag
|
||||
else
|
||||
{
|
||||
if (isObject($AIRabbitFlag.carrier))
|
||||
%distToFlag = %client.getPathDistance($AIRabbitFlag.carrier.getWorldBoxCenter());
|
||||
else
|
||||
%distToFlag = %client.getPathDistance($AIRabbitFlag.getWorldBoxCenter());
|
||||
|
||||
//if the flag is pretty close, or the inv station is quite far...
|
||||
if (%distToFlag > 0 && %distToFlag < 50)
|
||||
%task.setWeight($AIRabbitWeightDefault);
|
||||
else
|
||||
%task.setWeight($AIRabbitWeightNeedInv);
|
||||
|
||||
//see if the spawnUseInv flag should be reset
|
||||
if (%client.spawnUseInv)
|
||||
{
|
||||
if (!isObject($AIRabbitFlag.carrier))
|
||||
{
|
||||
//see if there are any bots closer to a dropped flag
|
||||
%found = false;
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl != %client && %cl.isAIControlled() && isObject(%cl.player))
|
||||
{
|
||||
%dist = VectorDist(%cl.player.position, $AIRabbitFlag.position);
|
||||
if (%dist < %distToFlag)
|
||||
{
|
||||
%found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//reset the spawnUseInv flag if we're the closest
|
||||
if (!%found)
|
||||
%client.spawnUsInv = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
function AIRabbitTask::monitor(%task, %client)
|
||||
{
|
||||
%player = %client.player;
|
||||
|
||||
//if we have the flag - run
|
||||
if ($AIRabbitFlag.carrier == %player)
|
||||
{
|
||||
if (%task.findLocation)
|
||||
{
|
||||
%damage = %player.getDamagePercent();
|
||||
if (%damage > 0.3)
|
||||
{
|
||||
//search for a health kit
|
||||
%closestHealth = AIFindSafeItem(%client, "Health");
|
||||
if (%closestHealth > 0)
|
||||
{
|
||||
%task.seekLocation = %closestHealth.getWorldBoxCenter();
|
||||
%foundItemLocation = true;
|
||||
}
|
||||
}
|
||||
else if (!%foundItemLocation && AIEngageOutOfAmmo(%client))
|
||||
{
|
||||
//search for a Ammo or a weapon...
|
||||
%closestItem = AIFindSafeItem(%client, "Ammo");
|
||||
if (%closestItem > 0)
|
||||
{
|
||||
%task.seekLocation = %closestItem.getWorldBoxCenter();
|
||||
%foundItemLocation = true;
|
||||
}
|
||||
}
|
||||
|
||||
//now see if we don't really have good equipment...
|
||||
else if (!%foundItemLocation && AIEngageWeaponRating(%client) < 20)
|
||||
{
|
||||
//search for any useful item
|
||||
%closestItem = AIFindSafeItem(%client, "Any");
|
||||
if (%closestItem > 0)
|
||||
{
|
||||
%task.seekLocation = %closestItem.getWorldBoxCenter();
|
||||
%foundItemLocation = true;
|
||||
}
|
||||
}
|
||||
|
||||
//else, search for any spot on the map that isn't covered with enemies...
|
||||
else
|
||||
{
|
||||
//try 10 times
|
||||
%task.seekLocation = %player.position;
|
||||
%farthestLocation = "";
|
||||
%farthestDist = 0;
|
||||
%occupiedLocation = "";
|
||||
|
||||
for (%i = 0; %i < 10; %i++)
|
||||
{
|
||||
%testLocation = Game.pickPlayerSpawn(%client, true);
|
||||
if (%testLocation == -1)
|
||||
break;
|
||||
|
||||
%dist = %client.getPathDistance(%testLocation);
|
||||
if (%dist < 0 || %dist > %farthestDist)
|
||||
{
|
||||
//see if it's unoccupied...
|
||||
%result = AIFindClosestEnemyToLoc(%client, %task.location, 50, $AIClientLOSTimeout, true);
|
||||
%closestEnemy = getWord(%result, 0);
|
||||
%closestdist = getWord(%result, 1);
|
||||
|
||||
if (!AIClientIsAlive(%closestEnemy))
|
||||
%farthestLocation = %testLocation;
|
||||
else
|
||||
%occupiedLocation = %testLocation;
|
||||
}
|
||||
}
|
||||
|
||||
if (%farthestLocation $= "")
|
||||
%task.seekLocation = %occupiedLocation;
|
||||
else
|
||||
%task.seekLocation = %farthestLocation;
|
||||
}
|
||||
|
||||
//set the flag and go there
|
||||
%task.findLocation = false;
|
||||
%client.stepMove(%task.seekLocation, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
//keep going there...
|
||||
%client.stepMove(%task.seekLocation, 8);
|
||||
|
||||
//see if we've arrived
|
||||
%distToDest = %client.getPathDistance(%task.seekLocation);
|
||||
if (%distToDest > 0 && %distToDest < 10)
|
||||
{
|
||||
%task.findLocation = true;
|
||||
}
|
||||
}
|
||||
|
||||
//don't forget to shoot back at whoever shot me last
|
||||
if (%client.lastDamageClient != %client)
|
||||
%client.setEngageTarget(%client.lastDamageClient);
|
||||
}
|
||||
|
||||
//else if someone else has the flag - shoot them
|
||||
else if (isObject($AIRabbitFlag.carrier))
|
||||
{
|
||||
%client.clientDetected($AIRabbitFlag.carrier.client);
|
||||
%client.stepEngage($AIRabbitFlag.carrier.client);
|
||||
}
|
||||
|
||||
//else the flag has been dropped
|
||||
else
|
||||
{
|
||||
%client.stepMove($AIRabbitFlag.position, 0.25);
|
||||
%client.setEngageTarget(-1);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// AIRabbit utility functions
|
||||
//---------------------------------------------------------------------------
|
||||
function air()
|
||||
{
|
||||
exec("scripts/aiRabbit.cs");
|
||||
}
|
||||
|
||||
|
||||
89
docs/base/@vl2/scripts.vl2/scripts/aiSiege.cs
Normal file
89
docs/base/@vl2/scripts.vl2/scripts/aiSiege.cs
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
//
|
||||
// aiSiege.cs
|
||||
//
|
||||
|
||||
function SiegeGame::onAIRespawn(%game, %client)
|
||||
{
|
||||
//add the default tasks
|
||||
if (! %client.defaultTasksAdded)
|
||||
{
|
||||
%client.defaultTasksAdded = true;
|
||||
%client.addTask(AIEngageTask);
|
||||
%client.addTask(AIPickupItemTask);
|
||||
%client.addTask(AITauntCorpseTask);
|
||||
%client.addTask(AIEngageTurretTask);
|
||||
%client.addtask(AIDetectMineTask);
|
||||
}
|
||||
}
|
||||
|
||||
function SiegeGame::AIInit(%game)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
//call the default AIInit() function
|
||||
AIInit();
|
||||
}
|
||||
|
||||
function SiegeGame::AIChooseGameObjective(%game, %client)
|
||||
{
|
||||
//the objectives on team1 are all offense objectives, team2 has the defensive ones..
|
||||
if (%client.team == %game.offenseTeam)
|
||||
AIChooseObjective(%client, $ObjectiveQ[1]);
|
||||
else
|
||||
AIChooseObjective(%client, $ObjectiveQ[2]);
|
||||
}
|
||||
|
||||
function SiegeGame::AIHalfTime(%game)
|
||||
{
|
||||
//clear all the bots, and clean up all the sets, objective qs, etc...
|
||||
AIMissionEnd();
|
||||
|
||||
//reset everything from scratch
|
||||
%game.aiInit();
|
||||
|
||||
//respawn all the bots
|
||||
for (%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl.isAIControlled())
|
||||
onAIRespawn(%cl);
|
||||
}
|
||||
}
|
||||
|
||||
function SiegeGame::onAIDamaged(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
function SiegeGame::onAIKilledClient(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
if (%clVictim.team != %clAttacker.team)
|
||||
DefaultGame::onAIKilledClient(%game, %clVictim, %clAttacker, %damageType, %implement);
|
||||
}
|
||||
|
||||
function SiegeGame::onAIFriendlyFire(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
if (%clAttacker && %clAttacker.team == %clVictim.team && %clAttacker != %clVictim && !%clVictim.isAIControlled())
|
||||
{
|
||||
// The Bot is only a little sorry:
|
||||
if ( getRandom() > 0.9 )
|
||||
AIMessageThread("ChatSorry", %clAttacker, %clVictim);
|
||||
}
|
||||
}
|
||||
51
docs/base/@vl2/scripts.vl2/scripts/aiTeamHunters.cs
Normal file
51
docs/base/@vl2/scripts.vl2/scripts/aiTeamHunters.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
exec("scripts/aiHunters.cs");
|
||||
|
||||
//---------------------------------------------------------------------------//
|
||||
//AI functions for playing TEAM HUNTERS
|
||||
|
||||
function TeamHuntersGame::AIInit(%game)
|
||||
{
|
||||
for (%i = 1; %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);
|
||||
}
|
||||
|
||||
//call the default AIInit() function
|
||||
AIInit();
|
||||
}
|
||||
|
||||
function TeamHuntersGame::onAIRespawn(%game, %client)
|
||||
{
|
||||
HuntersGame::onAIRespawn(%game, %client);
|
||||
}
|
||||
|
||||
function TeamHuntersGame::onAIDamaged(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
function TeamHuntersGame::onAIFriendlyFire(%game, %clVictim, %clAttacker, %damageType, %implement)
|
||||
{
|
||||
if (%clAttacker && %clAttacker.team == %clVictim.team && %clAttacker != %clVictim && !%clVictim.isAIControlled())
|
||||
{
|
||||
// The Bot is only a little sorry:
|
||||
if ( getRandom() > 0.9 )
|
||||
AIMessageThread("ChatSorry", %clAttacker, %clVictim);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1
docs/base/@vl2/scripts.vl2/scripts/autoexec/scripts.txt
Normal file
1
docs/base/@vl2/scripts.vl2/scripts/autoexec/scripts.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
Any scripts (.cs files) placed in this folder will be loaded (exec'd) automatically.
|
||||
17
docs/base/@vl2/scripts.vl2/scripts/badlandsPropMap.cs
Normal file
17
docs/base/@vl2/scripts.vl2/scripts/badlandsPropMap.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
//-------------------------------------- Desert interior texture property mapping
|
||||
|
||||
addMaterialMapping("badlands/bd_ichute01", "environment: special/chuteTexture 0.25");
|
||||
addMaterialMapping("badlands/bd_ichute02a", "environment: special/chuteTexture 0.25");
|
||||
|
||||
//"Color: red green blue startAlpha endAlpha"
|
||||
//Soft sound = 0
|
||||
//Hard sound = 1
|
||||
//Metal sound = 2
|
||||
//Snow sound = 3
|
||||
addMaterialMapping("terrain/BadLands.DirtBumpy", "color: 0.5 0.36 0.16 0.4 0.0", "sound: 0");
|
||||
addMaterialMapping("terrain/BadLands.DirtChipped", "color: 0.5 0.36 0.16 0.4 0.0", "sound: 0");
|
||||
addMaterialMapping("terrain/BadLands.DirtYellow", "color: 0.5 0.36 0.16 0.4 0.0", "sound: 0");
|
||||
addMaterialMapping("terrain/BadLands.DirtYellowCracked", "color: 0.5 0.36 0.16 0.4 0.0", "sound: 0");
|
||||
addMaterialMapping("terrain/BadLands.RockBrown", "color: 0.5 0.36 0.16 0.4 0.0", "sound: 0");
|
||||
addMaterialMapping("terrain/BadLands.RockChipped", "color: 0.5 0.36 0.16 0.4 0.0", "sound: 0");
|
||||
addMaterialMapping("terrain/BadLands.RockCracked", "color: 0.5 0.36 0.16 0.4 0.0", "sound: 0");
|
||||
41
docs/base/@vl2/scripts.vl2/scripts/bioderm_heavy.cs
Normal file
41
docs/base/@vl2/scripts.vl2/scripts/bioderm_heavy.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
datablock TSShapeConstructor(BiodermHeavyDts)
|
||||
{
|
||||
baseShape = "bioderm_heavy.dts";
|
||||
sequence0 = "bioderm_heavy_root.dsq root";
|
||||
sequence1 = "bioderm_heavy_forward.dsq run";
|
||||
sequence2 = "bioderm_heavy_back.dsq back";
|
||||
sequence3 = "bioderm_heavy_side.dsq side";
|
||||
sequence4 = "bioderm_heavy_lookde.dsq look";
|
||||
sequence5 = "bioderm_heavy_lookms.dsq lookms";
|
||||
sequence6 = "bioderm_heavy_head.dsq head";
|
||||
sequence7 = "bioderm_heavy_headside.dsq headside";
|
||||
sequence8 = "bioderm_heavy_jet.dsq jet";
|
||||
sequence9 = "bioderm_heavy_land.dsq land";
|
||||
sequence10 = "bioderm_heavy_fall.dsq fall";
|
||||
sequence11 = "bioderm_heavy_jump.dsq jump";
|
||||
sequence12 = "bioderm_heavy_recoilde.dsq light_recoil";
|
||||
sequence13 = "bioderm_heavy_idlePDA.dsq idlePDA";
|
||||
sequence14 = "bioderm_heavy_diehead.dsq death1";
|
||||
sequence15 = "bioderm_heavy_diechest.dsq death2";
|
||||
sequence16 = "bioderm_heavy_dieback.dsq death3";
|
||||
sequence17 = "bioderm_heavy_dieknees.dsq death4";
|
||||
sequence18 = "bioderm_heavy_diesidelft.dsq death5";
|
||||
sequence19 = "bioderm_heavy_diesidert.dsq death6";
|
||||
sequence20 = "bioderm_heavy_dieleglft.dsq death7";
|
||||
sequence21 = "bioderm_heavy_dielegrt.dsq death8";
|
||||
sequence22 = "bioderm_heavy_dieslump.dsq death9";
|
||||
sequence23 = "bioderm_heavy_dieforward.dsq death10";
|
||||
sequence24 = "bioderm_heavy_diespin.dsq death11";
|
||||
sequence25 = "bioderm_heavy_celsalute.dsq cel1";
|
||||
sequence26 = "bioderm_heavy_celyeah.dsq cel2";
|
||||
sequence27 = "bioderm_heavy_tauntbest.dsq cel3";
|
||||
sequence28 = "bioderm_heavy_celroar.dsq cel4";
|
||||
sequence29 = "bioderm_heavy_tauntbull.dsq cel5";
|
||||
sequence30 = "bioderm_heavy_celflex2.dsq cel6";
|
||||
sequence31 = "bioderm_heavy_celgora.dsq cel7";
|
||||
sequence32 = "bioderm_heavy_celjump.dsq cel8";
|
||||
sequence33 = "bioderm_heavy_ski.dsq ski";
|
||||
sequence34 = "bioderm_heavy_standjump.dsq standjump";
|
||||
sequence35 = "bioderm_heavy_looknw.dsq looknw";
|
||||
};
|
||||
|
||||
42
docs/base/@vl2/scripts.vl2/scripts/bioderm_light.cs
Normal file
42
docs/base/@vl2/scripts.vl2/scripts/bioderm_light.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
datablock TSShapeConstructor(BiodermLightDts)
|
||||
{
|
||||
baseShape = "bioderm_light.dts";
|
||||
sequence0 = "bioderm_light_root.dsq root";
|
||||
sequence1 = "bioderm_light_forward.dsq run";
|
||||
sequence2 = "bioderm_light_back.dsq back";
|
||||
sequence3 = "bioderm_light_side.dsq side";
|
||||
sequence4 = "bioderm_light_lookde.dsq look";
|
||||
sequence5 = "bioderm_light_lookms.dsq lookms";
|
||||
sequence6 = "bioderm_light_head.dsq head";
|
||||
sequence7 = "bioderm_light_headside.dsq headSide";
|
||||
sequence8 = "bioderm_light_jet.dsq jet";
|
||||
sequence9 = "bioderm_light_land.dsq land";
|
||||
sequence10 = "bioderm_light_fall.dsq fall";
|
||||
sequence11 = "bioderm_light_jump.dsq jump";
|
||||
sequence12 = "bioderm_light_recoilde.dsq light_recoil";
|
||||
sequence13 = "bioderm_light_idlePDA.dsq idlePDA";
|
||||
sequence14 = "bioderm_light_scoutroot.dsq scoutroot";
|
||||
sequence15 = "bioderm_light_dieback.dsq death1";
|
||||
sequence16 = "bioderm_light_diespin.dsq death2";
|
||||
sequence17 = "bioderm_light_diechest.dsq death3";
|
||||
sequence18 = "bioderm_light_dieforward.dsq death4";
|
||||
sequence19 = "bioderm_light_diehead.dsq death5";
|
||||
sequence20 = "bioderm_light_dieknees.dsq death6";
|
||||
sequence21 = "bioderm_light_dieleglft.dsq death7";
|
||||
sequence22 = "bioderm_light_dielegrt.dsq death8";
|
||||
sequence23 = "bioderm_light_diesidelft.dsq death9";
|
||||
sequence24 = "bioderm_light_diesidert.dsq death10";
|
||||
sequence25 = "bioderm_light_dieslump.dsq death11";
|
||||
sequence26 = "bioderm_light_celsalute.dsq cel1";
|
||||
sequence27 = "bioderm_light_celyeah.dsq cel2";
|
||||
sequence28 = "bioderm_light_tauntbest.dsq cel3";
|
||||
sequence29 = "bioderm_light_celroar.dsq cel4";
|
||||
sequence30 = "bioderm_light_tauntbull.dsq cel5";
|
||||
sequence31 = "bioderm_light_celflex2.dsq cel6";
|
||||
sequence32 = "bioderm_light_celgora.dsq cel7";
|
||||
sequence33 = "bioderm_light_celjump.dsq cel8";
|
||||
sequence34 = "bioderm_light_sitting.dsq sitting";
|
||||
sequence35 = "bioderm_light_ski.dsq ski";
|
||||
sequence36 = "bioderm_light_standjump.dsq standjump";
|
||||
sequence37 = "bioderm_light_looknw.dsq looknw";
|
||||
};
|
||||
41
docs/base/@vl2/scripts.vl2/scripts/bioderm_medium.cs
Normal file
41
docs/base/@vl2/scripts.vl2/scripts/bioderm_medium.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
datablock TSShapeConstructor(BiodermMediumDts)
|
||||
{
|
||||
baseShape = "bioderm_medium.dts";
|
||||
sequence0 = "bioderm_medium_root.dsq root";
|
||||
sequence1 = "bioderm_medium_forward.dsq run";
|
||||
sequence2 = "bioderm_medium_back.dsq back";
|
||||
sequence3 = "bioderm_medium_side.dsq side";
|
||||
sequence4 = "bioderm_medium_lookde.dsq look";
|
||||
sequence5 = "bioderm_medium_head.dsq head";
|
||||
sequence6 = "bioderm_medium_headside.dsq headside";
|
||||
sequence7 = "bioderm_medium_jet.dsq jet";
|
||||
sequence8 = "bioderm_medium_land.dsq land";
|
||||
sequence9 = "bioderm_medium_fall.dsq fall";
|
||||
sequence10 = "bioderm_medium_jump.dsq jump";
|
||||
sequence11 = "bioderm_medium_idlePDA.dsq idlePDA";
|
||||
sequence12 = "bioderm_medium_lookms.dsq lookms";
|
||||
sequence13 = "bioderm_medium_sitting.dsq sitting";
|
||||
sequence14 = "bioderm_medium_recoilde.dsq light_recoil";
|
||||
sequence15 = "bioderm_medium_dieback.dsq death1";
|
||||
sequence16 = "bioderm_medium_diespin.dsq death2";
|
||||
sequence17 = "bioderm_medium_diehead.dsq death3";
|
||||
sequence18 = "bioderm_medium_diechest.dsq death4";
|
||||
sequence19 = "bioderm_medium_dieforward.dsq death5";
|
||||
sequence20 = "bioderm_medium_dieknees.dsq death6";
|
||||
sequence21 = "bioderm_medium_dieleglft.dsq death7";
|
||||
sequence22 = "bioderm_medium_dielegrt.dsq death8";
|
||||
sequence23 = "bioderm_medium_diesidelft.dsq death9";
|
||||
sequence24 = "bioderm_medium_diesidert.dsq death10";
|
||||
sequence25 = "bioderm_medium_dieslump.dsq death11";
|
||||
sequence26 = "bioderm_medium_celsalute.dsq cel1";
|
||||
sequence27 = "bioderm_medium_celyeah.dsq cel2";
|
||||
sequence28 = "bioderm_medium_tauntbest.dsq cel3";
|
||||
sequence29 = "bioderm_medium_celroar.dsq cel4";
|
||||
sequence30 = "bioderm_medium_tauntbull.dsq cel5";
|
||||
sequence31 = "bioderm_medium_celflex2.dsq cel6";
|
||||
sequence32 = "bioderm_medium_celgora.dsq cel7";
|
||||
sequence33 = "bioderm_medium_celjump.dsq cel8";
|
||||
sequence34 = "bioderm_medium_ski.dsq ski";
|
||||
sequence35 = "bioderm_medium_standjump.dsq standjump";
|
||||
sequence36 = "bioderm_medium_looknw.dsq looknw";
|
||||
};
|
||||
720
docs/base/@vl2/scripts.vl2/scripts/camera.cs
Normal file
720
docs/base/@vl2/scripts.vl2/scripts/camera.cs
Normal file
|
|
@ -0,0 +1,720 @@
|
|||
$Camera::movementSpeed = 40;
|
||||
|
||||
datablock CameraData(Observer)
|
||||
{
|
||||
mode = "observerStatic";
|
||||
firstPersonOnly = true;
|
||||
};
|
||||
|
||||
datablock CameraData(CommanderCamera)
|
||||
{
|
||||
mode = "observerStatic";
|
||||
firstPersonOnly = true;
|
||||
};
|
||||
|
||||
function CommanderCamera::onTrigger( %data, %obj, %trigger, %state )
|
||||
{
|
||||
// no need to do anything here.
|
||||
}
|
||||
|
||||
function Observer::onTrigger(%data,%obj,%trigger,%state)
|
||||
{
|
||||
// state = 0 means that a trigger key was released
|
||||
if (%state == 0)
|
||||
return;
|
||||
|
||||
//first, give the game the opportunity to prevent the observer action
|
||||
if (!Game.ObserverOnTrigger(%data, %obj, %trigger, %state))
|
||||
return;
|
||||
|
||||
//now observer functions if you press the "throw"
|
||||
if (%trigger >= 4)
|
||||
return;
|
||||
|
||||
//trigger types: 0:fire 1:altTrigger 2:jump 3:jet 4:throw
|
||||
%client = %obj.getControllingClient();
|
||||
if (%client == 0)
|
||||
return;
|
||||
|
||||
switch$ (%obj.mode)
|
||||
{
|
||||
case "justJoined":
|
||||
if (isDemo())
|
||||
clearCenterPrint(%client);
|
||||
|
||||
//press FIRE
|
||||
if (%trigger == 0)
|
||||
{
|
||||
// clear intro message
|
||||
clearBottomPrint( %client );
|
||||
|
||||
//spawn the player
|
||||
commandToClient(%client, 'setHudMode', 'Standard');
|
||||
Game.assignClientTeam(%client);
|
||||
Game.spawnPlayer( %client, $MatchStarted );
|
||||
|
||||
if( $MatchStarted )
|
||||
{
|
||||
%client.camera.setFlyMode();
|
||||
%client.setControlObject( %client.player );
|
||||
}
|
||||
else
|
||||
{
|
||||
%client.camera.getDataBlock().setMode( %client.camera, "pre-game", %client.player );
|
||||
%client.setControlObject( %client.camera );
|
||||
}
|
||||
}
|
||||
|
||||
//press JET
|
||||
else if (%trigger == 3)
|
||||
{
|
||||
//cycle throw the static observer spawn points
|
||||
%markerObj = Game.pickObserverSpawn(%client, true);
|
||||
%transform = %markerObj.getTransform();
|
||||
%obj.setTransform(%transform);
|
||||
%obj.setFlyMode();
|
||||
}
|
||||
|
||||
//press JUMP
|
||||
else if (%trigger == 2)
|
||||
{
|
||||
//switch the observer mode to observing clients
|
||||
if (isObject(%client.observeFlyClient))
|
||||
serverCmdObserveClient(%client, %client.observeFlyClient);
|
||||
else
|
||||
serverCmdObserveClient(%client, -1);
|
||||
|
||||
displayObserverHud(%client, %client.observeClient);
|
||||
messageClient(%client.observeClient, 'Observer', '\c1%1 is now observing you.', %client.name);
|
||||
}
|
||||
|
||||
case "playerDeath":
|
||||
// Attached to a dead player - spawn regardless of trigger type
|
||||
if(!%client.waitRespawn && getSimTime() > %client.suicideRespawnTime)
|
||||
{
|
||||
commandToClient(%client, 'setHudMode', 'Standard');
|
||||
Game.spawnPlayer( %client, true );
|
||||
%client.camera.setFlyMode();
|
||||
%client.setControlObject(%client.player);
|
||||
}
|
||||
|
||||
case "PreviewMode":
|
||||
if (%trigger == 0)
|
||||
{
|
||||
commandToClient(%client, 'setHudMode', 'Standard');
|
||||
if( %client.lastTeam )
|
||||
Game.clientJoinTeam( %client, %client.lastTeam );
|
||||
else
|
||||
{
|
||||
Game.assignClientTeam( %client, true );
|
||||
|
||||
// Spawn the player:
|
||||
Game.spawnPlayer( %client, false );
|
||||
}
|
||||
|
||||
%client.camera.setFlyMode();
|
||||
%client.setControlObject( %client.player );
|
||||
}
|
||||
|
||||
case "toggleCameraFly":
|
||||
// this is the default camera mode
|
||||
|
||||
case "observerFly":
|
||||
// Free-flying observer camera
|
||||
|
||||
if (%trigger == 0)
|
||||
{
|
||||
if( !$Host::TournamentMode && $MatchStarted )
|
||||
{
|
||||
// reset observer params
|
||||
clearBottomPrint(%client);
|
||||
commandToClient(%client, 'setHudMode', 'Standard');
|
||||
|
||||
if( %client.lastTeam !$= "" && %client.lastTeam != 0 && Game.numTeams > 1)
|
||||
{
|
||||
Game.clientJoinTeam( %client, %client.lastTeam, $MatchStarted );
|
||||
%client.camera.setFlyMode();
|
||||
%client.setControlObject( %client.player );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Game.assignClientTeam( %client );
|
||||
|
||||
// Spawn the player:
|
||||
Game.spawnPlayer( %client, true );
|
||||
%client.camera.setFlyMode();
|
||||
%client.setControlObject( %client.player );
|
||||
ClearBottomPrint( %client );
|
||||
}
|
||||
}
|
||||
else if( !$Host::TournamentMode )
|
||||
{
|
||||
|
||||
clearBottomPrint(%client);
|
||||
Game.assignClientTeam( %client );
|
||||
|
||||
// Spawn the player:
|
||||
Game.spawnPlayer( %client, false );
|
||||
%client.camera.getDataBlock().setMode( %client.camera, "pre-game", %client.player );
|
||||
%client.setControlObject( %client.camera );
|
||||
}
|
||||
}
|
||||
//press JET
|
||||
else if (%trigger == 3)
|
||||
{
|
||||
%markerObj = Game.pickObserverSpawn(%client, true);
|
||||
%transform = %markerObj.getTransform();
|
||||
%obj.setTransform(%transform);
|
||||
%obj.setFlyMode();
|
||||
}
|
||||
|
||||
//press JUMP
|
||||
else if (%trigger == 2)
|
||||
{
|
||||
//switch the observer mode to observing clients
|
||||
if (isObject(%client.observeFlyClient))
|
||||
serverCmdObserveClient(%client, %client.observeFlyClient);
|
||||
else
|
||||
serverCmdObserveClient(%client, -1);
|
||||
|
||||
observerFollowUpdate( %client, %client.observeClient, false );
|
||||
displayObserverHud(%client, %client.observeClient);
|
||||
messageClient(%client.observeClient, 'Observer', '\c1%1 is now observing you.', %client.name);
|
||||
}
|
||||
|
||||
case "observerStatic":
|
||||
// Non-moving observer camera
|
||||
%next = (%trigger == 3 ? true : false);
|
||||
%markerObj = Game.pickObserverSpawn(%client, %next);
|
||||
%transform = %markerObj.getTransform();
|
||||
%obj.setTransform(%transform);
|
||||
%obj.setFlyMode();
|
||||
|
||||
case "observerStaticNoNext":
|
||||
// Non-moving, non-cycling observer camera
|
||||
|
||||
case "observerTimeout":
|
||||
// Player didn't respawn quickly enough
|
||||
if (%trigger == 0)
|
||||
{
|
||||
clearBottomPrint(%client);
|
||||
commandToClient(%client, 'setHudMode', 'Standard');
|
||||
if( %client.lastTeam )
|
||||
Game.clientJoinTeam( %client, %client.lastTeam, true );
|
||||
else
|
||||
{
|
||||
Game.assignClientTeam( %client );
|
||||
|
||||
// Spawn the player:
|
||||
Game.spawnPlayer( %client, true );
|
||||
}
|
||||
|
||||
%client.camera.setFlyMode();
|
||||
%client.setControlObject( %client.player );
|
||||
}
|
||||
|
||||
//press JET
|
||||
else if (%trigger == 3)
|
||||
{
|
||||
%markerObj = Game.pickObserverSpawn(%client, true);
|
||||
%transform = %markerObj.getTransform();
|
||||
%obj.setTransform(%transform);
|
||||
%obj.setFlyMode();
|
||||
}
|
||||
|
||||
//press JUMP
|
||||
else if (%trigger == 2)
|
||||
{
|
||||
//switch the observer mode to observing clients
|
||||
if (isObject(%client.observeFlyClient))
|
||||
serverCmdObserveClient(%client, %client.observeFlyClient);
|
||||
else
|
||||
serverCmdObserveClient(%client, -1);
|
||||
|
||||
// update the observer list for this client
|
||||
observerFollowUpdate( %client, %client.observeClient, false );
|
||||
|
||||
displayObserverHud(%client, %client.observeClient);
|
||||
messageClient(%client.observeClient, 'Observer', '\c1%1 is now observing you.', %client.name);
|
||||
}
|
||||
|
||||
case "observerFollow":
|
||||
// Observer attached to a moving object (assume player for now...)
|
||||
//press FIRE - cycle to next client
|
||||
if (%trigger == 0)
|
||||
{
|
||||
%nextClient = findNextObserveClient(%client);
|
||||
%prevObsClient = %client.observeClient;
|
||||
if (%nextClient > 0 && %nextClient != %client.observeClient)
|
||||
{
|
||||
// update the observer list for this client
|
||||
observerFollowUpdate( %client, %nextClient, true );
|
||||
|
||||
//set the new object
|
||||
%transform = %nextClient.player.getTransform();
|
||||
if( !%nextClient.isMounted() )
|
||||
{
|
||||
%obj.setOrbitMode(%nextClient.player, %transform, 0.5, 4.5, 4.5);
|
||||
%client.observeClient = %nextClient;
|
||||
}
|
||||
else
|
||||
{
|
||||
%mount = %nextClient.player.getObjectMount();
|
||||
if( %mount.getDataBlock().observeParameters $= "" )
|
||||
%params = %transform;
|
||||
else
|
||||
%params = %mount.getDataBlock().observeParameters;
|
||||
|
||||
%obj.setOrbitMode(%mount, %mount.getTransform(), getWord( %params, 0 ), getWord( %params, 1 ), getWord( %params, 2 ));
|
||||
%client.observeClient = %nextClient;
|
||||
}
|
||||
|
||||
//send the message(s)
|
||||
displayObserverHud(%client, %nextClient);
|
||||
messageClient(%nextClient, 'Observer', '\c1%1 is now observing you.', %client.name);
|
||||
messageClient(%prevObsClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name);
|
||||
}
|
||||
}
|
||||
|
||||
//press JET - cycle to prev client
|
||||
else if (%trigger == 3)
|
||||
{
|
||||
%prevClient = findPrevObserveClient(%client);
|
||||
%prevObsClient = %client.observeClient;
|
||||
if (%prevClient > 0 && %prevClient != %client.observeClient)
|
||||
{
|
||||
// update the observer list for this client
|
||||
observerFollowUpdate( %client, %prevClient, true );
|
||||
|
||||
//set the new object
|
||||
%transform = %prevClient.player.getTransform();
|
||||
if( !%prevClient.isMounted() )
|
||||
{
|
||||
%obj.setOrbitMode(%prevClient.player, %transform, 0.5, 4.5, 4.5);
|
||||
%client.observeClient = %prevClient;
|
||||
}
|
||||
else
|
||||
{
|
||||
%mount = %prevClient.player.getObjectMount();
|
||||
if( %mount.getDataBlock().observeParameters $= "" )
|
||||
%params = %transform;
|
||||
else
|
||||
%params = %mount.getDataBlock().observeParameters;
|
||||
|
||||
%obj.setOrbitMode(%mount, %mount.getTransform(), getWord( %params, 0 ), getWord( %params, 1 ), getWord( %params, 2 ));
|
||||
%client.observeClient = %prevClient;
|
||||
}
|
||||
|
||||
//send the message(s)
|
||||
displayObserverHud(%client, %prevClient);
|
||||
messageClient(%prevClient, 'Observer', '\c1%1 is now observing you.', %client.name);
|
||||
messageClient(%prevObsClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name);
|
||||
}
|
||||
}
|
||||
|
||||
//press JUMP
|
||||
else if (%trigger == 2)
|
||||
{
|
||||
// update the observer list for this client
|
||||
observerFollowUpdate( %client, -1, false );
|
||||
|
||||
//toggle back to observer fly mode
|
||||
%obj.mode = "observerFly";
|
||||
%obj.setFlyMode();
|
||||
updateObserverFlyHud(%client);
|
||||
messageClient(%client.observeClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name);
|
||||
}
|
||||
|
||||
case "pre-game":
|
||||
if(!$Host::TournamentMode || $CountdownStarted)
|
||||
return;
|
||||
|
||||
if(%client.notReady)
|
||||
{
|
||||
%client.notReady = "";
|
||||
MessageAll( 0, '\c1%1 is READY.', %client.name );
|
||||
if(%client.notReadyCount < 3)
|
||||
centerprint( %client, "\nWaiting for match start (FIRE if not ready)", 0, 3);
|
||||
else
|
||||
centerprint( %client, "\nWaiting for match start", 0, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
%client.notReadyCount++;
|
||||
if(%client.notReadyCount < 4)
|
||||
{
|
||||
%client.notReady = true;
|
||||
MessageAll( 0, '\c1%1 is not READY.', %client.name );
|
||||
centerprint( %client, "\nPress FIRE when ready.", 0, 3 );
|
||||
}
|
||||
return;
|
||||
}
|
||||
CheckTourneyMatchStart();
|
||||
}
|
||||
}
|
||||
|
||||
function Observer::setMode(%data, %obj, %mode, %targetObj)
|
||||
{
|
||||
if(%mode $= "")
|
||||
return;
|
||||
%client = %obj.getControllingClient();
|
||||
switch$ (%mode) {
|
||||
case "justJoined":
|
||||
commandToClient(%client, 'setHudMode', 'Observer');
|
||||
%markerObj = Game.pickObserverSpawn(%client, true);
|
||||
%transform = %markerObj.getTransform();
|
||||
%obj.setTransform(%transform);
|
||||
%obj.setFlyMode();
|
||||
|
||||
case "pre-game":
|
||||
commandToClient(%client, 'setHudMode', 'Observer');
|
||||
%obj.setOrbitMode( %targetObj, %targetObj.getTransform(), 0.5, 4.5, 4.5);
|
||||
|
||||
case "observerFly":
|
||||
// Free-flying observer camera
|
||||
commandToClient(%client, 'setHudMode', 'Observer');
|
||||
%markerObj = Game.pickObserverSpawn(%client, true);
|
||||
%transform = %markerObj.getTransform();
|
||||
%obj.setTransform(%transform);
|
||||
%obj.setFlyMode();
|
||||
|
||||
case "observerStatic" or "observerStaticNoNext":
|
||||
// Non-moving observer camera
|
||||
%markerObj = Game.pickObserverSpawn(%client, true);
|
||||
%transform = %markerObj.getTransform();
|
||||
%obj.setTransform(%transform);
|
||||
|
||||
case "observerFollow":
|
||||
// Observer attached to a moving object (assume player for now...)
|
||||
%transform = %targetObj.getTransform();
|
||||
|
||||
if( !%targetObj.isMounted() )
|
||||
%obj.setOrbitMode(%targetObj, %transform, 0.5, 4.5, 4.5);
|
||||
else
|
||||
{
|
||||
%mount = %targetObj.getObjectMount();
|
||||
if( %mount.getDataBlock().observeParameters $= "" )
|
||||
%params = %transform;
|
||||
else
|
||||
%params = %mount.getDataBlock().observeParameters;
|
||||
|
||||
%obj.setOrbitMode(%mount, %mount.getTransform(), getWord( %params, 0 ), getWord( %params, 1 ), getWord( %params, 2 ));
|
||||
}
|
||||
|
||||
case "observerTimeout":
|
||||
commandToClient(%client, 'setHudMode', 'Observer');
|
||||
%markerObj = Game.pickObserverSpawn(%client, true);
|
||||
%transform = %markerObj.getTransform();
|
||||
%obj.setTransform(%transform);
|
||||
%obj.setFlyMode();
|
||||
}
|
||||
%obj.mode = %mode;
|
||||
}
|
||||
|
||||
function findNextObserveClient(%client)
|
||||
{
|
||||
%index = -1;
|
||||
%count = ClientGroup.getCount();
|
||||
if (%count <= 1)
|
||||
return -1;
|
||||
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl == %client.observeClient)
|
||||
{
|
||||
%index = %i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//now find the next client (note, if not found, %index still == -1)
|
||||
%index++;
|
||||
if (%index >= %count)
|
||||
%index = 0;
|
||||
|
||||
%newClient = -1;
|
||||
for (%i = %index; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl != %client && %cl.player > 0)
|
||||
{
|
||||
%newClient = %cl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//if we didn't find anyone, search from the beginning again
|
||||
if (%newClient < 0)
|
||||
{
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl != %client && %cl.player > 0)
|
||||
{
|
||||
%newClient = %cl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if we still haven't found anyone (new), give up..
|
||||
if (%newClient < 0 || %newClient.player == %player)
|
||||
return -1;
|
||||
}
|
||||
|
||||
function findPrevObserveClient(%client)
|
||||
{
|
||||
%index = -1;
|
||||
%count = ClientGroup.getCount();
|
||||
if (%count <= 1)
|
||||
return -1;
|
||||
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl == %client.observeClient)
|
||||
{
|
||||
%index = %i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//now find the prev client
|
||||
%index--;
|
||||
if (%index < 0)
|
||||
%index = %count - 1;
|
||||
|
||||
%newClient = -1;
|
||||
for (%i = %index; %i >= 0; %i--)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl != %client && %cl.player > 0)
|
||||
{
|
||||
%newClient = %cl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//if we didn't find anyone, search from the end again
|
||||
if (%newClient < 0)
|
||||
{
|
||||
for (%i = %count - 1; %i >= 0; %i--)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl != %client && %cl.player > 0)
|
||||
{
|
||||
%newClient = %cl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if we still haven't found anyone (new), give up..
|
||||
if (%newClient < 0 || %newClient.player == %player)
|
||||
return -1;
|
||||
}
|
||||
|
||||
function observeClient(%client)
|
||||
{
|
||||
if( $testcheats )
|
||||
{
|
||||
//pass in -1 to choose any client...
|
||||
commandToServer('observeClient', %client);
|
||||
}
|
||||
}
|
||||
|
||||
function serverCmdObserveClient(%client, %target)
|
||||
{
|
||||
//clear the observer fly mode var...
|
||||
%client.observeFlyClient = -1;
|
||||
|
||||
//cancel any scheduled update
|
||||
cancel(%client.obsHudSchedule);
|
||||
|
||||
// must be an observer when observing other clients
|
||||
if( %client.getControlObject() != %client.camera)
|
||||
return;
|
||||
|
||||
//can't observer yourself
|
||||
if (%client == %target)
|
||||
return;
|
||||
|
||||
%count = ClientGroup.getCount();
|
||||
|
||||
//can't go into observer mode if you're the only client
|
||||
if (%count <= 1)
|
||||
return;
|
||||
|
||||
//make sure the target actually exists
|
||||
if (%target > 0)
|
||||
{
|
||||
%found = false;
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl == %target)
|
||||
{
|
||||
%found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!%found)
|
||||
return;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
%client.observeClient = -1;
|
||||
%target = findNextObserveClient(%client);
|
||||
if (%target <= 0)
|
||||
return;
|
||||
}
|
||||
|
||||
//send the message
|
||||
if (%client.camera.mode !$= "observerFollow")
|
||||
{
|
||||
if (isObject(%client.player))
|
||||
%client.player.scriptKill(0);
|
||||
|
||||
//messageAllExcept(%client, -1, 'ClientNowObserver', '\c1%1 is now an observer.', %client.name);
|
||||
//messageClient(%client, 'YouNowObserver', '\c1You are now observing %1.', %target.name);
|
||||
}
|
||||
|
||||
%client.camera.getDataBlock().setMode(%client.camera, "observerFollow", %target.player);
|
||||
%client.setControlObject(%client.camera);
|
||||
|
||||
//tag is used if a client who is being observed dies...
|
||||
%client.observeClient = %target;
|
||||
}
|
||||
|
||||
function observerFollowUpdate( %client, %nextClient, %cycle )
|
||||
{
|
||||
%Oclient = %client.observeClient;
|
||||
if( %Oclient $= "" )
|
||||
return;
|
||||
|
||||
// changed to observer fly...
|
||||
if( %nextClient == -1 )
|
||||
{
|
||||
// find us in their observer list and remove, then reshuffle the list...
|
||||
for( %i = 0; %i < %Oclient.observeCount; %i++ )
|
||||
{
|
||||
if( %Oclient.observers[%i] == %client )
|
||||
{
|
||||
%Oclient.observeCount--;
|
||||
%Oclient.observers[%i] = %Oclient.observers[%Oclient.observeCount];
|
||||
%Oclient.observers[%Oclient.observeCount] = "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return; // were done..
|
||||
}
|
||||
|
||||
// changed from observer fly to observer follow...
|
||||
if( !%cycle && %nextClient != -1 )
|
||||
{
|
||||
// if nobody is observing this guy, initialize their observer count...
|
||||
if( %nextClient.observeCount $= "" )
|
||||
%nextClient.observeCount = 0;
|
||||
|
||||
// add us to their list of observers...
|
||||
%nextClient.observers[%nextClient.observeCount] = %client;
|
||||
%nextClient.observeCount++;
|
||||
return; // were done.
|
||||
}
|
||||
|
||||
if( %nextClient != -1 )
|
||||
{
|
||||
// cycling to the next client...
|
||||
for( %i = 0; %i < %Oclient.observeCount; %i++ )
|
||||
{
|
||||
// first remove us from our prev client's list...
|
||||
if( %Oclient.observers[%i] == %client )
|
||||
{
|
||||
%Oclient.observeCount--;
|
||||
%Oclient.observers[%i] = %Oclient.observers[%Oclient.observeCount];
|
||||
%Oclient.observers[%Oclient.observeCount] = "";
|
||||
break; // screw you guys, i'm goin home!
|
||||
}
|
||||
}
|
||||
|
||||
// if nobody is observing this guy, initialize their observer count...
|
||||
if( %nextClient.observeCount $= "" )
|
||||
%nextClient.observeCount = 0;
|
||||
|
||||
// now add us to the new clients list...
|
||||
%nextClient.observeCount++;
|
||||
%nextClient.observers[%nextClient.observeCount - 1] = %client;
|
||||
}
|
||||
}
|
||||
|
||||
function updateObserverFlyHud(%client)
|
||||
{
|
||||
//just in case there are two threads going...
|
||||
cancel(%client.obsHudSchedule);
|
||||
%client.observeFlyClient = -1;
|
||||
|
||||
//make sure the client is supposed to be in observer fly mode...
|
||||
if (!isObject(%client) || %client.team != 0 || %client.getControlObject() != %client.camera || %client.camera.mode $= "observerFollow")
|
||||
return;
|
||||
|
||||
//get various info about the player's eye
|
||||
%srcEyeTransform = %client.camera.getTransform();
|
||||
%srcEyePoint = firstWord(%srcEyeTransform) @ " " @ getWord(%srcEyeTransform, 1) @ " " @ getWord(%srcEyeTransform, 2);
|
||||
|
||||
%srcEyeVector = MatrixMulVector("0 0 0 " @ getWords(%srcEyeTransform, 3, 6), "0 1 0");
|
||||
%srcEyeVector = VectorNormalize(%srcEyeVector);
|
||||
|
||||
//see if there's an enemy near our defense location...
|
||||
%clientCount = 0;
|
||||
%count = ClientGroup.getCount();
|
||||
%viewedClient = -1;
|
||||
%clientDot = -1;
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
|
||||
//make sure we find an AI who's alive and not the client
|
||||
if (%cl != %client && isObject(%cl.player))
|
||||
{
|
||||
//make sure the player is within range
|
||||
%clPos = %cl.player.getWorldBoxCenter();
|
||||
%distance = VectorDist(%clPos, %srcEyePoint);
|
||||
if (%distance <= 30)
|
||||
{
|
||||
//create the vector from the client to the client
|
||||
%clVector = VectorNormalize(VectorSub(%clPos, %srcEyePoint));
|
||||
|
||||
//see if the dot product is greater than our current, and greater than 0.6
|
||||
%dot = VectorDot(%clVector, %srcEyeVector);
|
||||
|
||||
if (%dot > 0.6 && %dot > %clientDot)
|
||||
{
|
||||
//make sure we're not looking through walls...
|
||||
%mask = $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticShapeObjectType;
|
||||
%losResult = containerRayCast(%srcEyePoint, %clPos, %mask);
|
||||
%losObject = GetWord(%losResult, 0);
|
||||
if (!isObject(%losObject))
|
||||
{
|
||||
%viewedClient = %cl;
|
||||
%clientDot = %dot;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isObject(%viewedClient))
|
||||
displayObserverHud(%client, 0, %viewedClient);
|
||||
else
|
||||
displayObserverHud(%client, 0);
|
||||
|
||||
%client.observeFlyClient = %viewedClient;
|
||||
|
||||
//schedule the next...
|
||||
%client.obsHudSchedule = schedule(500, %client, updateObserverFlyHud, %client);
|
||||
}
|
||||
|
||||
277
docs/base/@vl2/scripts.vl2/scripts/cannedChatItems.cs
Normal file
277
docs/base/@vl2/scripts.vl2/scripts/cannedChatItems.cs
Normal file
|
|
@ -0,0 +1,277 @@
|
|||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// cannedChatItems.cs
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
$MinChatItemId = 0;
|
||||
$MaxChatItemId = 0;
|
||||
|
||||
if ( !isObject( CannedChatItems ) )
|
||||
new SimGroup( CannedChatItems );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
function installChatItem( %command, %text, %audioFile, %animCel, %teamOnly, %defaultkeys, %play3D )
|
||||
{
|
||||
%cmdId = getSubStr( %command, 1, strlen( %command ) - 1 );
|
||||
%name = getTaggedString(%command);
|
||||
//echo( "** cmdId = " @ %cmdId @ " **" );
|
||||
if ( !isObject( $ChatTable[%cmdId] ) )
|
||||
{
|
||||
if ( %animCel == 0 )
|
||||
%animation = "";
|
||||
else
|
||||
%animation = "cel" @ %animCel;
|
||||
|
||||
//error("defvoicebinds="@$defaultVoiceBinds@",keyPress="@%keyPress@",keyCmd="@%keyCmd);
|
||||
$ChatTable[%cmdId] = new CannedChatItem()
|
||||
{
|
||||
name = %name;
|
||||
text = %text;
|
||||
audioFile = %audioFile;
|
||||
animation = %animation;
|
||||
teamOnly = %teamOnly;
|
||||
defaultKeys = %defaultkeys;
|
||||
play3D = %play3D;
|
||||
};
|
||||
CannedChatItems.add( $ChatTable[%cmdId] );
|
||||
|
||||
if ( $MinChatItemId == 0 || %cmdId < $MinChatItemId )
|
||||
$MinChatItemId = %cmdId;
|
||||
if ( %cmdId > $MaxChatItemId )
|
||||
$MaxChatItemId = %cmdId;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
function installChatItemCallback( %command, %callback )
|
||||
{
|
||||
%cmdId = getSubStr( %command, 1, strlen( %command ) - 1 );
|
||||
|
||||
// make sure there is a chat item created
|
||||
if(isObject($ChatTable[%cmdId]))
|
||||
{
|
||||
for(%i = 0; (%aCallback = $ChatCallbacks[%cmdId, %i]) !$= ""; %i++)
|
||||
{
|
||||
// dont allow multiple instances
|
||||
if(%aCallback == %callback)
|
||||
return;
|
||||
}
|
||||
|
||||
$ChatCallbacks[%cmdId, %i] = %callback;
|
||||
}
|
||||
}
|
||||
|
||||
function processChatItemCallbacks( %command )
|
||||
{
|
||||
%cmdId = getSubStr( %command, 1, strlen( %command ) - 1 );
|
||||
|
||||
// make sure an actual chat item
|
||||
if(isObject($ChatTable[%cmdId]))
|
||||
for(%i = 0; (%callback = $ChatCallbacks[%cmdId, %i]) !$= ""; %i++)
|
||||
call(%callback, $ChatTable[%cmdId]);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// ANIMATIONS
|
||||
installChatItem( 'ChatAnimAnnoyed', "", "vqk.move", 4, false, "VGAA", true );
|
||||
installChatItem( 'ChatAnimGetSome', "", "gbl.brag", 3, false, "VGAG", true );
|
||||
installChatItem( 'ChatAnimDance', "", "gbl.woohoo", 5, false, "VGAD", true );
|
||||
installChatItem( 'ChatAnimSalute', "", "slf.tsk.generic", 1, false, "VGAS", true );
|
||||
installChatItem( 'ChatAnimWave', "", "gbl.hi", 2, false, "VGAW", true );
|
||||
installChatItem( 'ChatAnimSpec1', "", "gbl.obnoxious", 6, false, "VGAZ", true );
|
||||
installChatItem( 'ChatAnimSpec2', "", "gbl.aww", 7, false, "VGAX", true );
|
||||
installChatItem( 'ChatAnimSpec3', "", "gbl.awesome", 8, false, "VGAC", true );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// ATTACK
|
||||
installChatItem( 'ChatCmdAttack', "Attack!", "att.attack", 0, true, "VAA", false );
|
||||
installChatItem( 'ChatCmdAttackBase', "Attack the enemy base!", "att.base", 0, true, "VAB", false );
|
||||
installChatItem( 'ChatCmdAttackChase', "Recover our flag!", "att.chase", 0, true, "VAC", false );
|
||||
installChatItem( 'ChatCmdAttackDistract', "Disrupt the enemy defense!", "att.distract", 0, true, "VAD", false );
|
||||
installChatItem( 'ChatCmdAttackFlag', "Get the enemy flag!", "att.flag", 0, true, "VAF", false );
|
||||
installChatItem( 'ChatCmdAttackGenerator', "Destroy the enemy generator!", "att.generator", 0, true, "VAG", false );
|
||||
installChatItem( 'ChatCmdAttackObjective', "Attack the objective!", "att.objective", 0, true, "VAO", false );
|
||||
installChatItem( 'ChatCmdAttackReinforce', "Reinforce the offense!", "att.reinforcements", 0, true, "VAR", false );
|
||||
installChatItem( 'ChatCmdAttackSensors', "Destroy enemy sensors!", "att.sensors", 0, true, "VAS", false );
|
||||
installChatItem( 'ChatCmdAttackTurrets', "Destroy enemy turrets!", "att.turrets", 0, true, "VAT", false );
|
||||
installChatItem( 'ChatCmdAttackWait', "Wait for my signal before attacking!", "att.wait", 0, true, "VAW", false );
|
||||
installChatItem( 'ChatCmdAttackVehicle', "Destroy the enemy vehicle!", "att.vehicle", 0, true, "VAV", false );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// BASE
|
||||
installChatItem( 'ChatBaseTaken', "Our base is taken.", "bas.taken", 0, true, "VBT", false );
|
||||
installChatItem( 'ChatEnemyInBase', "The enemy's in our base.", "bas.enemy", 0, true, "VBE", false );
|
||||
installChatItem( 'ChatBaseClear', "Our base is clear.", "bas.clear", 0, true, "VBC", false );
|
||||
installChatItem( 'ChatCmdRetakeBase', "Retake our base!", "bas.retake", 0, true, "VBR", false );
|
||||
installChatItem( 'ChatBaseSecure', "Our base is secure.", "bas.secure", 0, true, "VBS", false );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// DEFENSE
|
||||
installChatItem( 'ChatCmdDefendBase', "Defend our base!", "def.base", 0, true, "VDB", false );
|
||||
installChatItem( 'ChatCmdDefendCarrier', "Cover our flag carrier!", "def.carrier", 0, true, "VDC", false );
|
||||
installChatItem( 'ChatCmdDefendEntrances', "Defend the entrances!", "def.entrances", 0, true, "VDE", false );
|
||||
installChatItem( 'ChatCmdDefendFlag', "Defend our flag!", "def.flag", 0, true, "VDF", false );
|
||||
installChatItem( 'ChatCmdDefendGenerator', "Protect the generator!", "def.generator", 0, true, "VDG", false );
|
||||
installChatItem( 'ChatCmdDefendMe', "Cover me!", "def.me", 0, true, "VDM", false );
|
||||
installChatItem( 'ChatCmdDefendObjective', "Defend the objective!", "def.objective", 0, true, "VDO", false );
|
||||
installChatItem( 'ChatCmdDefendReinforce', "Reinforce our defense!", "def.reinforce", 0, true, "VDR", false );
|
||||
installChatItem( 'ChatCmdDefendSensors', "Defend our sensors!", "def.sensors", 0, true, "VDS", false );
|
||||
installChatItem( 'ChatCmdDefendTurrets', "Defend our turrets!", "def.turrets", 0, true, "VDT", false );
|
||||
installChatItem( 'ChatCmdDefendVehicle', "Defend our vehicle!", "def.vehicle", 0, true, "VDV", false );
|
||||
installChatItem( 'ChatCmdDefendNexus', "Defend the nexus!", "def.nexus", 0, true, "VDN", false );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// COMMAND RESPONSE
|
||||
installChatItem( 'ChatCmdAcknowledged', "Command acknowledged.", "cmd.acknowledge", 0, true, "VCA", false );
|
||||
installChatItem( 'ChatCmdWhat', "What's your assignment?", "cmd.bot", 0, true, "VCW", false );
|
||||
installChatItem( 'ChatCmdCompleted', "Command completed.", "cmd.completed", 0, true, "VCC", false );
|
||||
installChatItem( 'ChatCmdDeclined', "Command declined.", "cmd.decline", 0, true, "VCD", false );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// ENEMY STATUS
|
||||
installChatItem( 'ChatEnemyBaseDisabled', "Enemy base is disabled.", "ene.base", 0, true, "VEB", false );
|
||||
installChatItem( 'ChatEnemyDisarray', "The enemy is disrupted. Attack!", "ene.disarray", 0, true, "VED", false );
|
||||
installChatItem( 'ChatEnemyGeneratorDestroyed', "Enemy generator destroyed.", "ene.generator", 0, true, "VEG", false );
|
||||
installChatItem( 'ChatEnemyRemotesDestroyed', "Enemy remote equipment destroyed.", "ene.remotes", 0, true, "VER", false );
|
||||
installChatItem( 'ChatEnemySensorsDestroyed', "Enemy sensors destroyed.", "ene.sensors", 0, true, "VES", false );
|
||||
installChatItem( 'ChatEnemyTurretsDestroyed', "Enemy turrets destroyed.", "ene.turrets", 0, true, "VET", false );
|
||||
installChatItem( 'ChatEnemyVehicleDestroyed', "Enemy vehicle station destroyed.", "ene.vehicle", 0, true, "VEV", false );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// FLAG
|
||||
installChatItem( 'ChatFlagGotIt', "I have the enemy flag!", "flg.flag", 0, true, "VFF", false );
|
||||
installChatItem( 'ChatCmdGiveMeFlag', "Give me the flag!", "flg.give", 0, true, "VFG", false );
|
||||
installChatItem( 'ChatCmdReturnFlag', "Retrieve our flag!", "flg.retrieve", 0, true, "VFR", false );
|
||||
installChatItem( 'ChatFlagSecure', "Our flag is secure.", "flg.secure", 0, true, "VFS", false );
|
||||
installChatItem( 'ChatCmdTakeFlag', "Take the flag from me!", "flg.take", 0, true, "VFT", false );
|
||||
installChatItem( 'ChatCmdHunterGiveFlags', "Give your flags to me!", "flg.huntergive", 0, true, "VFO", false );
|
||||
installChatItem( 'ChatCmdHunterTakeFlags', "Take my flags!", "flg.huntertake", 0, true, "VFP", false );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GLOBAL COMPLIMENTS
|
||||
installChatItem( 'ChatAwesome', "Awesome!", "gbl.awesome", 0, false, "VGCA", false );
|
||||
installChatItem( 'ChatGoodGame', "Good game!", "gbl.goodgame", 0, false, "VGCG", false );
|
||||
installChatItem( 'ChatNice', "Nice move!", "gbl.nice", 0, false, "VGCN", false );
|
||||
installChatItem( 'ChatYouRock', "You rock!", "gbl.rock", 0, false, "VGCR", false );
|
||||
installChatItem( 'ChatGreatShot', "Great shot!", "gbl.shooting", 0, false , "VGCS");
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GLOBAL
|
||||
installChatItem( 'ChatHi', "Hi.", "gbl.hi", 0, false, "VGH", false );
|
||||
installChatItem( 'ChatBye', "Bye.", "gbl.bye", 0, false, "VGB", false );
|
||||
installChatItem( 'ChatGlobalYes', "Yes.", "gbl.yes", 0, false, "VGY", false );
|
||||
installChatItem( 'ChatGlobalNo', "No.", "gbl.no", 0, false, "VGN", false );
|
||||
installChatItem( 'ChatAnyTime', "Any time.", "gbl.anytime", 0, false, "VGRA", false );
|
||||
installChatItem( 'ChatDontKnow', "I don't know.", "gbl.dunno", 0, false, "VGRD", false );
|
||||
installChatItem( 'ChatOops', "Oops!", "gbl.oops", 0, false, "VGO", false );
|
||||
installChatItem( 'ChatQuiet', "Quiet!", "gbl.quiet", 0, false, "VGQ", false );
|
||||
installChatItem( 'ChatShazbot', "Shazbot!", "gbl.shazbot", 0, false, "VGS", false );
|
||||
installChatItem( 'ChatCheer', "Woohoo!", "gbl.woohoo", 0, false, "VGW", false );
|
||||
installChatItem( 'ChatThanks', "Thanks.", "gbl.thanks", 0, false, "VGRT", false );
|
||||
installChatItem( 'ChatWait', "Wait a sec.", "gbl.wait", 0, false, "VGRW", false );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// TRASH TALK
|
||||
installChatItem( 'ChatAww', "Aww, that's too bad!", "gbl.aww", 0, false, "VGTA", false );
|
||||
installChatItem( 'ChatBrag', "I am the greatest!", "gbl.brag", 0, false, "VGTG", false );
|
||||
installChatItem( 'ChatObnoxious', "That's the best you can do?", "gbl.obnoxious", 0, false, "VGTB", false );
|
||||
installChatItem( 'ChatSarcasm', "THAT was graceful!", "gbl.sarcasm", 0, false, "VGTT", false );
|
||||
installChatItem( 'ChatLearn', "When ya gonna learn?", "gbl.when", 0, false, "VGTW", false );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// NEED
|
||||
installChatItem( 'ChatNeedBombardier', "Need a bombardier.", "need.bombardier", 0, true, "VNB", false );
|
||||
installChatItem( 'ChatNeedCover', "Need covering fire.", "need.cover", 0, true, "VNC", false );
|
||||
installChatItem( 'ChatNeedDriver', "Need driver for ground vehicle.", "need.driver", 0, true, "VND", false );
|
||||
installChatItem( 'ChatNeedEscort', "Vehicle needs escort.", "need.escort", 0, true, "VNE", false );
|
||||
installChatItem( 'ChatNeedPilot', "Need pilot for turbograv.", "need.flyer", 0, true, "VNP", false );
|
||||
installChatItem( 'ChatNeedPassengers', "Gunship ready! Need a ride?", "need.gunship", 0, true, "VNG", false );
|
||||
installChatItem( 'ChatNeedHold', "Hold that vehicle! I'm coming!", "need.hold", 0, true, "VNH", false );
|
||||
installChatItem( 'ChatNeedRide', "I need a ride!", "need.ride", 0, true, "VNR", false );
|
||||
installChatItem( 'ChatNeedSupport', "Need vehicle support!", "need.support", 0, true, "VNS", false );
|
||||
installChatItem( 'ChatNeedTailgunner', "Need a tailgunner.", "need.tailgunner", 0, true, "VNT", false );
|
||||
installChatItem( 'ChatNeedDestination', "Where to?", "need.where", 0, true, "VNW", false );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// REPAIR
|
||||
installChatItem( 'ChatRepairBase', "Repair our base!", "rep.base", 0, true, "VRB", false );
|
||||
installChatItem( 'ChatRepairGenerator', "Repair our generator!", "rep.generator", 0, true, "VRG", false );
|
||||
installChatItem( 'ChatRepairMe', "Repair me!", "rep.me", 0, true, "VRM", false );
|
||||
installChatItem( 'ChatRepairSensors', "Repair our sensors!", "rep.sensors", 0, true, "VRS", false );
|
||||
installChatItem( 'ChatRepairTurrets', "Repair our turrets!", "rep.turrets", 0, true, "VRT", false );
|
||||
installChatItem( 'ChatRepairVehicle', "Repair our vehicle station!", "rep.vehicle", 0, true, "VRV", false );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SELF ATTACK
|
||||
installChatItem( 'ChatSelfAttack', "I will attack.", "slf.att.attack", 0, true, "VSAA", false );
|
||||
installChatItem( 'ChatSelfAttackBase', "I'll attack the enemy base.", "slf.att.base", 0, true, "VSAB", false );
|
||||
installChatItem( 'ChatSelfAttackFlag', "I'll go for the enemy flag.", "slf.att.flag", 0, true, "VSAF", false );
|
||||
installChatItem( 'ChatSelfAttackGenerator', "I'll attack the enemy generator.", "slf.att.generator", 0, true, "VSAG", false );
|
||||
installChatItem( 'ChatSelfAttackSensors', "I'll attack the enemy sensors.", "slf.att.sensors", 0, true, "VSAS", false );
|
||||
installChatItem( 'ChatSelfAttackTurrets', "I'll attack the enemy turrets.", "slf.att.turrets", 0, true, "VSAT", false );
|
||||
installChatItem( 'ChatSelfAttackVehicle', "I'll attack the enemy vehicle station.", "slf.att.vehicle", 0, true, "VSAV", false );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SELF DEFEND
|
||||
installChatItem( 'ChatSelfDefendBase', "I'll defend our base.", "slf.def.base", 0, true, "VSDB", false );
|
||||
installChatItem( 'ChatSelfDefend', "I'm defending.", "slf.def.defend", 0, true, "VSDD", false );
|
||||
installChatItem( 'ChatSelfDefendFlag', "I'll defend our flag.", "slf.def.flag", 0, true, "VSDF", false );
|
||||
installChatItem( 'ChatSelfDefendGenerator', "I'll defend our generator.", "slf.def.generator", 0, true, "VSDG", false );
|
||||
installChatItem( 'ChatSelfDefendNexus', "I'll defend the nexus.", "slf.def.nexus", 0, true, "VSDN", false );
|
||||
installChatItem( 'ChatSelfDefendSensors', "I'll defend our sensors.", "slf.def.sensors", 0, true, "VSDS", false );
|
||||
installChatItem( 'ChatSelfDefendTurrets', "I'll defend our turrets.", "slf.def.turrets", 0, true, "VSDT", false );
|
||||
installChatItem( 'ChatSelfDefendVehicle', "I'll defend our vehicle bay.", "slf.def.vehicle", 0, true, "VSDV", false );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SELF REPAIR
|
||||
installChatItem( 'ChatSelfRepairBase', "I'll repair our base.", "slf.rep.base", 0, true, "VSRB", false );
|
||||
installChatItem( 'ChatSelfRepairEquipment', "I'll repair our equipment.", "slf.rep.equipment", 0, true, "VSRE", false );
|
||||
installChatItem( 'ChatSelfRepairGenerator', "I'll repair our generator.", "slf.rep.generator", 0, true, "VSRG", false );
|
||||
installChatItem( 'ChatSelfRepair', "I'm on repairs.", "slf.rep.repairing", 0, true, "VSRR", false );
|
||||
installChatItem( 'ChatSelfRepairSensors', "I'll repair our sensors.", "slf.rep.sensors", 0, true, "VSRS", false );
|
||||
installChatItem( 'ChatSelfRepairTurrets', "I'll repair our turrets.", "slf.rep.turrets", 0, true, "VSRT", false );
|
||||
installChatItem( 'ChatSelfRepairVehicle', "I'll repair our vehicle station.", "slf.rep.vehicle", 0, true, "VSRV", false );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SELF TASK
|
||||
installChatItem( 'ChatTaskCover', "I'll cover you.", "slf.tsk.cover", 0, true, "VSTC", false );
|
||||
installChatItem( 'ChatTaskSetupD', "I'll set up defenses.", "slf.tsk.defense", 0, true, "VSTD", false );
|
||||
installChatItem( 'ChatTaskOnIt', "I'm on it.", "slf.tsk.generic", 0, true, "VSTO", false );
|
||||
installChatItem( 'ChatTaskSetupRemote', "I'll deploy remote equipment.", "slf.tsk.remotes", 0, true, "VSTR", false );
|
||||
installChatItem( 'ChatTaskSetupSensors', "I'll deploy sensors.", "slf.tsk.sensors", 0, true, "VSTS", false );
|
||||
installChatItem( 'ChatTaskSetupTurrets', "I'll deploy turrets.", "slf.tsk.turrets", 0, true, "VSTT", false );
|
||||
installChatItem( 'ChatTaskVehicle', "I'll get a vehicle ready.", "slf.tsk.vehicle", 0, true, "VSTV", false );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// TARGET
|
||||
installChatItem( 'ChatTargetAcquired', "Target acquired.", "tgt.acquired", 0, true, "VTA", false );
|
||||
installChatItem( 'ChatCmdTargetBase', "Target the enemy base! I'm in position.", "tgt.base", 0, true, "VTB", false );
|
||||
installChatItem( 'ChatTargetDestroyed', "Target destroyed!", "tgt.destroyed", 0, true, "VTD", false );
|
||||
installChatItem( 'ChatCmdTargetFlag', "Target their flag! I'm in position.", "tgt.flag", 0, true, "VTF", false );
|
||||
installChatItem( 'ChatTargetFire', "Fire on my target!", "tgt.my", 0, true, "VTM", false );
|
||||
installChatItem( 'ChatTargetNeed', "Need a target painted!", "tgt.need", 0, true, "VTN", false );
|
||||
installChatItem( 'ChatCmdTargetSensors', "Target their sensors! I'm in position.", "tgt.sensors", 0, true, "VTS", false );
|
||||
installChatItem( 'ChatCmdTargetTurret', "Target their turret! I'm in position.", "tgt.turret", 0, true, "VTT", false );
|
||||
installChatItem( 'ChatCmdTargetWait', "Wait! I'll be in range soon.", "tgt.wait", 0, true, "VTW", false );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// WARNING
|
||||
installChatItem( 'ChatWarnBomber', "Incoming bomber!", "wrn.bomber", 0, true, "VWB", false );
|
||||
installChatItem( 'ChatWarnEnemies', "Incoming hostiles!", "wrn.enemy", 0, true, "VWE", false );
|
||||
installChatItem( 'ChatWarnVehicles', "Incoming vehicles!", "wrn.vehicles", 0, true, "VWV", false );
|
||||
installChatItem( 'ChatWarnShoot', "Watch where you're shooting!", "wrn.watchit", 0, true, "VWW", false );
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// VERY QUICK
|
||||
installChatItem( 'ChatWelcome', "Any time.", "vqk.anytime", 0, true, "VVA", false );
|
||||
installChatItem( 'ChatIsBaseSecure', "Is our base secure?", "vqk.base", 0, true, "VVB", false );
|
||||
installChatItem( 'ChatCeaseFire', "Cease fire!", "vqk.ceasefire", 0, true, "VVC", false );
|
||||
installChatItem( 'ChatDunno', "I don't know.", "vqk.dunno", 0, true, "VVD", false );
|
||||
installChatItem( 'ChatHelp', "HELP!", "vqk.help", 0, true, "VVH", false );
|
||||
installChatItem( 'ChatMove', "Move, please!", "vqk.move", 0, true, "VVM", false );
|
||||
installChatItem( 'ChatTeamNo', "No.", "vqk.no", 0, true, "VVN", false );
|
||||
installChatItem( 'ChatSorry', "Sorry.", "vqk.sorry", 0, true, "VVS", false );
|
||||
installChatItem( 'ChatTeamThanks', "Thanks.", "vqk.thanks", 0, true, "VVT", false );
|
||||
installChatItem( 'ChatTeamWait', "Wait, please.", "vqk.wait", 0, true, "VVW", false );
|
||||
installChatItem( 'ChatTeamYes', "Yes.", "vqk.yes", 0, true, "VVY", false );
|
||||
233
docs/base/@vl2/scripts.vl2/scripts/chatMenuHud.cs
Normal file
233
docs/base/@vl2/scripts.vl2/scripts/chatMenuHud.cs
Normal file
|
|
@ -0,0 +1,233 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// chatMenuHud.cs
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
if ( isFile( "prefs/customVoiceBinds.cs" ) )
|
||||
$defaultVoiceBinds = false;
|
||||
else
|
||||
$defaultVoiceBinds = true;
|
||||
|
||||
// Load in all of the installed chat items:
|
||||
exec( "scripts/cannedChatItems.cs" );
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Chat menu loading function:
|
||||
new SimSet( ChatMenuList ); // Store all of the chat menu maps here so that we can delete them later:
|
||||
function activateChatMenu( %filename )
|
||||
{
|
||||
if ( isFile( %filename ) || isFile( %filename @ ".dso" ) )
|
||||
{
|
||||
// Clear the old chat menu:
|
||||
ChatMenuList.clear();
|
||||
|
||||
// Create the root of the new menu:
|
||||
$RootChatMenu = new ActionMap();
|
||||
ChatMenuList.add( $RootChatMenu );
|
||||
$CurrentChatMenu = $RootChatMenu;
|
||||
$CurrentChatMenu.optionCount = 0;
|
||||
$CurrentChatMenu.bindCmd(keyboard, escape, "cancelChatMenu();", "");
|
||||
|
||||
// Build the new chat menu:
|
||||
exec( %filename );
|
||||
}
|
||||
else
|
||||
error( "Chat menu file \"" @ %filename @ "\" not found!" );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Chat menu building functions:
|
||||
function startChatMenu(%heading)
|
||||
{
|
||||
%key = firstWord(%heading);
|
||||
%text = restWords(%heading);
|
||||
%menu = new ActionMap();
|
||||
ChatMenuList.add( %menu );
|
||||
%cm = $CurrentChatMenu;
|
||||
%cm.bindCmd(keyboard, %key, "setChatMenu(\"" @ %text @ "\", " @ %menu @ ");", "");
|
||||
%cm.option[%cm.optionCount] = %key @ ": " @ %text;
|
||||
%cm.command[%cm.optionCount] = %menu; // Save this off here for later...
|
||||
%cm.isMenu[%cm.optionCount] = 1;
|
||||
%cm.optionCount++;
|
||||
%menu.parent = %cm;
|
||||
%menu.bindCmd(keyboard, escape, "cancelChatMenu();", "");
|
||||
%menu.optionCount = 0;
|
||||
$CurrentChatMenu = %menu;
|
||||
}
|
||||
|
||||
function endChatMenu()
|
||||
{
|
||||
$CurrentChatMenu = $CurrentChatMenu.parent;
|
||||
}
|
||||
|
||||
function addChat(%keyDesc, %command)
|
||||
{
|
||||
%key = firstWord(%keyDesc);
|
||||
%text = restWords(%keyDesc);
|
||||
%cm = $CurrentChatMenu;
|
||||
%cm.bindCmd(keyboard, %key, "issueChatCmd(" @ %cm @ "," @ %cm.optionCount @ ");", "");
|
||||
%cm.option[%cm.optionCount] = %key @ ": " @ %text;
|
||||
%cm.command[%cm.optionCount] = %command;
|
||||
%cm.isMenu[%cm.optionCount] = 0;
|
||||
%cm.optionCount++;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Chat menu hud functions:
|
||||
$ChatMenuHudLineCount = 0;
|
||||
function activateChatMenuHud( %make )
|
||||
{
|
||||
if(%make && !TaskHudDlg.isVisible())
|
||||
showChatMenuHud();
|
||||
}
|
||||
|
||||
function showChatMenuHud()
|
||||
{
|
||||
Canvas.pushDialog(ChatMenuHudDlg);
|
||||
ChatMenuHudDlg.setVisible(true);
|
||||
setChatMenu(Root, $RootChatMenu);
|
||||
}
|
||||
|
||||
function cancelChatMenu()
|
||||
{
|
||||
$CurrentChatMenu.pop();
|
||||
$CurrentChatMenu = $RootChatMenu;
|
||||
Canvas.popDialog(ChatMenuHudDlg);
|
||||
ChatMenuHudDlg.setVisible(false);
|
||||
}
|
||||
|
||||
function setChatMenu( %name, %menu )
|
||||
{
|
||||
for ( %i = 0; %i < $ChatMenuHudLineCount; %i++ )
|
||||
chatMenuHud.remove( $ChatMenuHudText[%i] );
|
||||
|
||||
$ChatMenuHudLineCount = %menu.optionCount + 1;
|
||||
chatMenuHud.extent = "170" SPC ( $ChatMenuHudLineCount * 15 ) + 8;
|
||||
|
||||
// First add the menu title line:
|
||||
$ChatMenuHudText[0] = new GuiTextCtrl()
|
||||
{
|
||||
profile = "GuiHudVoiceMenuProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "5 3";
|
||||
extent = "165 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
setFirstResponder = "0";
|
||||
modal = "1";
|
||||
helpTag = "0";
|
||||
text = "\c2" @ %name @ " Menu:";
|
||||
};
|
||||
chatMenuHud.add( $ChatMenuHudText[0] );
|
||||
|
||||
// Now add all of the menu options:
|
||||
for ( %option = 0; %option < %menu.optionCount; %option++ )
|
||||
{
|
||||
%yOffset = ( %option * 15 ) + 18;
|
||||
|
||||
if ( %menu.isMenu[%option] == 1 )
|
||||
{
|
||||
$ChatMenuHudText[%option + 1] = new GuiTextCtrl()
|
||||
{
|
||||
profile = "GuiHudVoiceMenuProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "5 " @ %yOffset;
|
||||
extent = "165 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
setFirstResponder = "0";
|
||||
modal = "1";
|
||||
helpTag = "0";
|
||||
text = " " @ %menu.option[%option];
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
$ChatMenuHudText[%option + 1] = new GuiTextCtrl()
|
||||
{
|
||||
profile = "GuiHudVoiceCommandProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
position = "5 " @ %yOffset;
|
||||
extent = "165 20";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
setFirstResponder = "0";
|
||||
modal = "1";
|
||||
helpTag = "0";
|
||||
text = " " @ %menu.option[%option];
|
||||
};
|
||||
}
|
||||
|
||||
chatMenuHud.add( $ChatMenuHudText[%option + 1] );
|
||||
}
|
||||
|
||||
//bind "anykey" to closing the chat menu, so if you press an invalid entry, you don't accidently
|
||||
//open the commander map or something...
|
||||
%menu.bindCmd(keyboard, "anykey", "cancelChatMenu();", "");
|
||||
|
||||
// Pop the old menu map and push the new menu's map:
|
||||
$CurrentChatMenu.pop();
|
||||
$CurrentChatMenu = %menu;
|
||||
%menu.push();
|
||||
}
|
||||
|
||||
function issueChatCmd( %menu, %index )
|
||||
{
|
||||
processChatItemCallbacks( %menu.command[%index] );
|
||||
commandToServer( 'CannedChat', %menu.command[%index], false );
|
||||
cancelChatMenu();
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Canned chat handler:
|
||||
function serverCmdCannedChat( %client, %command, %fromAI )
|
||||
{
|
||||
%cmdCode = getWord( %command, 0 );
|
||||
%cmdId = getSubStr( %cmdCode, 1, strlen( %command ) - 1 );
|
||||
%cmdString = getWord( %command, 1 );
|
||||
if ( %cmdString $= "" )
|
||||
%cmdString = getTaggedString( %cmdCode );
|
||||
|
||||
if ( !isObject( $ChatTable[%cmdId] ) )
|
||||
{
|
||||
error( %cmdString @ " is not a recognized canned chat command." );
|
||||
return;
|
||||
}
|
||||
|
||||
%chatItem = $ChatTable[%cmdId];
|
||||
|
||||
//if there is text
|
||||
if (%chatItem.text !$= "" || !%chatItem.play3D)
|
||||
{
|
||||
%message = %chatItem.text @ "~w" @ %chatItem.audioFile;
|
||||
|
||||
if ( %chatItem.teamOnly )
|
||||
cannedChatMessageTeam( %client, %client.team, '\c3%1: %2', %client.name, %message, %chatItem.defaultKeys );
|
||||
else
|
||||
cannedChatMessageAll( %client, '\c4%1: %2', %client.name, %message, %chatItem.defaultKeys );
|
||||
}
|
||||
|
||||
//if no text, see if the audio is to be played in 3D...
|
||||
else if ( %chatItem.play3D && %client.player )
|
||||
playTargetAudio(%client.target, addTaggedString(%chatItem.audioFile), AudioClosest3d, true);
|
||||
|
||||
if ( %chatItem.animation !$= "" )
|
||||
serverCmdPlayAnim(%client, %chatItem.animation);
|
||||
|
||||
// Let the AI respond to the canned chat messages (from humans only)
|
||||
if (!%fromAI)
|
||||
CreateVoiceServerTask(%client, %cmdCode);
|
||||
}
|
||||
|
||||
if ( $defaultVoiceBinds )
|
||||
activateChatMenu( "scripts/voiceBinds.cs" );
|
||||
else
|
||||
activateChatMenu( "prefs/customVoiceBinds.cs" );
|
||||
|
||||
2109
docs/base/@vl2/scripts.vl2/scripts/client.cs
Normal file
2109
docs/base/@vl2/scripts.vl2/scripts/client.cs
Normal file
File diff suppressed because it is too large
Load diff
508
docs/base/@vl2/scripts.vl2/scripts/clientAudio.cs
Normal file
508
docs/base/@vl2/scripts.vl2/scripts/clientAudio.cs
Normal file
|
|
@ -0,0 +1,508 @@
|
|||
//--------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock EffectProfile(BountyBellEffect)
|
||||
{
|
||||
effectname = "misc/bounty_bonus";
|
||||
minDistance = 2.5;
|
||||
maxDistance = 5.0;
|
||||
};
|
||||
|
||||
// ordered list of providers
|
||||
$AudioProviders[0, name] = "Creative Labs EAX 2 (TM)";
|
||||
$AudioProviders[0, isHardware] = true;
|
||||
$AudioProviders[0, enableEnvironment] = true;
|
||||
|
||||
$AudioProviders[1, name] = "Creative Labs EAX (TM)";
|
||||
$AudioProviders[1, isHardware] = true;
|
||||
$AudioProviders[1, enableEnvironment] = true;
|
||||
|
||||
$AudioProviders[2, name] = "DirectSound3D Hardware Support";
|
||||
$AudioProviders[2, isHardware] = true;
|
||||
$AudioProviders[2, enableEvironment] = false;
|
||||
|
||||
$AudioProviders[3, name] = "Miles Fast 2D Positional Audio";
|
||||
$AudioProviders[3, isHardware] = false;
|
||||
$AudioProviders[3, enableEvironment] = false;
|
||||
|
||||
// defaults
|
||||
$Audio::defaultDriver = "miles";
|
||||
$Audio::innerFalloffScale = "1.0";
|
||||
$Audio::dynamicMemorySize = (1 << 20);
|
||||
|
||||
function audioIsHardwareProvider(%provider)
|
||||
{
|
||||
for(%i = 0; $AudioProviders[%i, name] !$= ""; %i++)
|
||||
if(%provider $= $AudioProviders[%i, name])
|
||||
return($AudioProviders[%i, isHardware]);
|
||||
return(false);
|
||||
}
|
||||
|
||||
function audioIsEnvironmentProvider(%provider)
|
||||
{
|
||||
for(%i = 0; $AudioProviders[%i, name] !$= ""; %i++)
|
||||
if(%provider $= $AudioProviders[%i, name])
|
||||
return($AudioProviders[%i, enableEnvironment]);
|
||||
return(false);
|
||||
}
|
||||
|
||||
function audioUpdateProvider(%provider)
|
||||
{
|
||||
// check if should be using hardware settings by default
|
||||
alxDisableOuterFalloffs(false);
|
||||
for(%i = 0; $AudioProviders[%i, name] !$= ""; %i++)
|
||||
{
|
||||
if(%provider $= $AudioProviders[%i, name])
|
||||
{
|
||||
// hardware
|
||||
if($AudioProviders[%i, isHardware])
|
||||
{
|
||||
alxDisableOuterFalloffs(true);
|
||||
alxSetInnerFalloffScale(0.4);
|
||||
}
|
||||
|
||||
// environment
|
||||
%enable = $pref::Audio::environmentEnabled && audioIsEnvironmentProvider(%provider);
|
||||
alxEnableEnvironmental(%enable);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initAudio()
|
||||
{
|
||||
$Audio::originalProvider = alxGetContexti(ALC_PROVIDER);
|
||||
|
||||
%providerName = alxGetContextstr(ALC_PROVIDER_NAME, $Audio::originalProvider);
|
||||
audioUpdateProvider(%providerName);
|
||||
|
||||
// voice?
|
||||
if($pref::Audio::enableVoiceCapture)
|
||||
$Audio::captureInitialized = alxCaptureInit();
|
||||
|
||||
// Set volume based on prefs:
|
||||
alxListenerf( AL_GAIN_LINEAR, $pref::Audio::masterVolume );
|
||||
alxContexti( ALC_BUFFER_DYNAMIC_MEMORY_SIZE, $Audio::dynamicMemorySize );
|
||||
|
||||
alxSetChannelVolume( $EffectAudioType, $pref::Audio::effectsVolume );
|
||||
alxSetChannelVolume( $VoiceAudioType, $pref::Audio::voiceVolume );
|
||||
alxSetChannelVolume( $ChatAudioType, $pref::Audio::radioVolume );
|
||||
alxSetChannelVolume( $MusicAudioType, $pref::Audio::musicVolume );
|
||||
alxSetChannelVolume( $GuiAudioType, $pref::Audio::guiVolume );
|
||||
alxSetChannelVolume( $RadioAudioType, $pref::Audio::radioVolume );
|
||||
|
||||
alxSetCaptureGainScale( $pref::Audio::captureGainScale );
|
||||
|
||||
// cap the codec levels
|
||||
if( $platform $= "linux" )
|
||||
{
|
||||
if( $pref::Audio::encodingLevel != 3)
|
||||
$pref::Audio::encodingLevel = 3;
|
||||
$pref::Audio::decodingMask &= 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( $pref::Audio::encodingLevel > 2)
|
||||
$pref::Audio::encodingLevel = 2;
|
||||
$pref::Audio::decodingMask &= 7;
|
||||
}
|
||||
}
|
||||
|
||||
if($Audio::initialized)
|
||||
initAudio();
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// MP3-Music player
|
||||
new ScriptObject(MusicPlayer)
|
||||
{
|
||||
class = MP3Audio;
|
||||
currentTrack = "";
|
||||
repeat = true;
|
||||
};
|
||||
|
||||
function MP3Audio::stop(%this)
|
||||
{
|
||||
alxStopMusic();
|
||||
}
|
||||
|
||||
function getRandomTrack()
|
||||
{
|
||||
if ( isDemo() )
|
||||
return( "desert" );
|
||||
|
||||
%val = mFloor(getRandom(0, 4));
|
||||
switch(%val)
|
||||
{
|
||||
case 0:
|
||||
return "lush";
|
||||
case 1:
|
||||
return "volcanic";
|
||||
case 2:
|
||||
return "badlands";
|
||||
case 3:
|
||||
return "ice";
|
||||
case 4:
|
||||
return "desert";
|
||||
}
|
||||
}
|
||||
|
||||
function MP3Audio::play(%this)
|
||||
{
|
||||
if(%this.currentTrack $= "")
|
||||
%this.currentTrack = getRandomTrack();
|
||||
%this.playTrack(%this.currentTrack);
|
||||
}
|
||||
|
||||
function MP3Audio::playTrack(%this, %trackName)
|
||||
{
|
||||
%this.currentTrack = %trackName;
|
||||
if($pref::Audio::musicEnabled)
|
||||
{
|
||||
if ( isDemo() )
|
||||
alxPlayMusic("demo_base\\music\\" @ %trackName @ ".mp3");
|
||||
else
|
||||
alxPlayMusic("base\\music\\" @ %trackName @ ".mp3");
|
||||
}
|
||||
}
|
||||
|
||||
function finishedMusicStream(%stopped)
|
||||
{
|
||||
if(%stopped $= "true")
|
||||
return;
|
||||
|
||||
if(MusicPlayer.repeat)
|
||||
MusicPlayer.playTrack(MusicPlayer.currentTrack);
|
||||
}
|
||||
|
||||
function clientCmdPlayMusic(%trackname)
|
||||
{
|
||||
if(%trackname !$= "")
|
||||
MusicPlayer.playTrack(%trackName);
|
||||
}
|
||||
|
||||
function clientCmdStopMusic()
|
||||
{
|
||||
MusicPlayer.stop();
|
||||
}
|
||||
|
||||
//--------------------------------------
|
||||
// Audio Profiles
|
||||
//
|
||||
|
||||
new EffectProfile(eButtonDown)
|
||||
{
|
||||
effectname = "gui/buttonDown";
|
||||
minDistance = 10;
|
||||
};
|
||||
|
||||
new EffectProfile(eButtonOver)
|
||||
{
|
||||
effectname = "gui/buttonOver";
|
||||
minDistance = 10;
|
||||
};
|
||||
|
||||
new AudioDescription(AudioGui)
|
||||
{
|
||||
volume = 1.0;
|
||||
isLooping= false;
|
||||
is3D = false;
|
||||
type = $GuiAudioType;
|
||||
};
|
||||
|
||||
new AudioDescription(AudioChat)
|
||||
{
|
||||
volume = 1.0;
|
||||
isLooping= false;
|
||||
is3D = false;
|
||||
type = $ChatAudioType;
|
||||
};
|
||||
|
||||
new AudioDescription(AudioGuiLoop)
|
||||
{
|
||||
volume = 1.0;
|
||||
isLooping= true;
|
||||
is3D = false;
|
||||
type = $GuiAudioType;
|
||||
};
|
||||
|
||||
new AudioProfile(sButtonDown)
|
||||
{
|
||||
filename = "gui/buttonDown.wav";
|
||||
description = "audioGui";
|
||||
preload = true;
|
||||
effect = eButtonDown;
|
||||
};
|
||||
|
||||
new AudioProfile(sButtonOver)
|
||||
{
|
||||
filename = "gui/buttonOver.wav";
|
||||
description = "audioGui";
|
||||
preload = true;
|
||||
effect = eButtonOver;
|
||||
};
|
||||
|
||||
new AudioProfile(sGotMail)
|
||||
{
|
||||
filename = "gui/youvegotmail.wav";
|
||||
description = "audioGui";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new EffectProfile(eLaunchMenuOpen)
|
||||
{
|
||||
effectname = "gui/launchMenuOpen";
|
||||
minDistance = 10;
|
||||
};
|
||||
|
||||
new AudioProfile(sLaunchMenuOpen)
|
||||
{
|
||||
filename = "gui/launchMenuOpen.wav";
|
||||
description = "audioGui";
|
||||
preload = true;
|
||||
effect = eLaunchMenuOpen;
|
||||
};
|
||||
|
||||
new AudioProfile(sLaunchMenuOver)
|
||||
{
|
||||
filename = "gui/buttonOver.wav";
|
||||
description = "audioGui";
|
||||
preload = true;
|
||||
effect = eButtonOver;
|
||||
};
|
||||
|
||||
new AudioProfile(VoteForSound)
|
||||
{
|
||||
filename = "gui/buttonOver.wav";
|
||||
description = "audioGui";
|
||||
preload = true;
|
||||
};
|
||||
new AudioProfile(VoteAgainstSound)
|
||||
{
|
||||
filename = "gui/buttonOver.wav";
|
||||
description = "audioGui";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new AudioProfile(TaskAcceptedSound)
|
||||
{
|
||||
filename = "fx/misc/command_accept.wav";
|
||||
description = "audioGui";
|
||||
preload = true;
|
||||
};
|
||||
new AudioProfile(TaskDeclinedSound)
|
||||
{
|
||||
filename = "fx/misc/command_deny.wav";
|
||||
description = "audioGui";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new AudioProfile(TaskCompletedSound)
|
||||
{
|
||||
filename = "fx/misc/command_complete.wav";
|
||||
description = "audioGui";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new AudioProfile(InputDeniedSound)
|
||||
{
|
||||
filename = "fx/misc/diagnostic_beep.wav";
|
||||
description = "audioGui";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//-------------------------------------- Shapebase lock/homing tones...
|
||||
new AudioDescription(AudioLockTones)
|
||||
{
|
||||
volume = 1.0;
|
||||
isLooping= true;
|
||||
is3D = false;
|
||||
type = $EffectAudioType;
|
||||
};
|
||||
|
||||
new AudioProfile(sSearchingTone)
|
||||
// Sound that the FIRER hears when SEEKING a "hot" target
|
||||
{
|
||||
filename = "fx/weapons/missile_firer_search.wav";
|
||||
description = "audioLockTones";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new AudioProfile(sLockedTone)
|
||||
// Sound that the FIRER hears when a "hot" target is LOCKED
|
||||
{
|
||||
filename = "fx/weapons/missile_firer_lock.wav";
|
||||
description = "audioLockTones";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new AudioProfile(sMissileLockWarningTone)
|
||||
// Sound that the TARGET hears when a LOCK has been achieved
|
||||
{
|
||||
filename = "fx/weapons/missile_target_lock.wav";
|
||||
description = "audioLockTones";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new AudioProfile(sMissileHomingWarningTone)
|
||||
// Sound that the TARGET hears when a missile has been locked onto the target and is IN THE AIR
|
||||
{
|
||||
filename = "fx/weapons/missile_target_inbound.wav";
|
||||
description = "audioLockTones";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
new AudioProfile(HudInventoryHumSound)
|
||||
{
|
||||
filename = "gui/inventory_hum.wav";
|
||||
description = "AudioGuiLoop";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new EffectProfile(HudInventoryActivateEffect)
|
||||
{
|
||||
effectname = "gui/inventory_on";
|
||||
minDistance = 10;
|
||||
};
|
||||
|
||||
new AudioProfile(HudInventoryActivateSound)
|
||||
{
|
||||
filename = "gui/inventory_on.wav";
|
||||
description = "AudioGui";
|
||||
preload = true;
|
||||
effect = HudInventoryActivateEffect;
|
||||
};
|
||||
|
||||
new EffectProfile(HudInventoryDeactivateEffect)
|
||||
{
|
||||
effectname = "gui/inventory_off";
|
||||
minDistance = 10;
|
||||
};
|
||||
|
||||
new AudioProfile(HudInventoryDeactivateSound)
|
||||
{
|
||||
filename = "gui/inventory_off.wav";
|
||||
description = "AudioGui";
|
||||
preload = true;
|
||||
effect = HudInventoryDeactivateEffect;
|
||||
};
|
||||
|
||||
new AudioProfile(CommandMapHumSound)
|
||||
{
|
||||
filename = "gui/command_hum.wav";
|
||||
description = "AudioGuiLoop";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new EffectProfile(CommandMapActivateEffect)
|
||||
{
|
||||
effectname = "gui/command_on";
|
||||
minDistance = 10;
|
||||
};
|
||||
|
||||
new AudioProfile(CommandMapActivateSound)
|
||||
{
|
||||
filename = "gui/command_on.wav";
|
||||
description = "AudioGui";
|
||||
effect = CommandMapActivateEffect;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new EffectProfile(CommandMapDeactivateEffect)
|
||||
{
|
||||
effectname = "gui/command_off";
|
||||
minDistance = 10;
|
||||
};
|
||||
|
||||
new AudioProfile(CommandMapDeactivateSound)
|
||||
{
|
||||
filename = "gui/command_off.wav";
|
||||
description = "AudioGui";
|
||||
preload = true;
|
||||
effect = CommandMapDeactivateEffect;
|
||||
};
|
||||
|
||||
new AudioProfile(ShellScreenHumSound)
|
||||
{
|
||||
filename = "gui/shell_hum.wav";
|
||||
description = "AudioGuiLoop";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new AudioProfile(LoadingScreenSound)
|
||||
{
|
||||
filename = "gui/loading_hum.wav";
|
||||
description = "AudioGuiLoop";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new AudioProfile(VotePassSound)
|
||||
{
|
||||
filename = "fx/misc/vote_passes.wav";
|
||||
description = "AudioGui";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new AudioProfile(VoteNotPassSound)
|
||||
{
|
||||
filename = "fx/misc/vote_fails.wav";
|
||||
description = "AudioGui";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new AudioProfile(AdminForceSound)
|
||||
{
|
||||
filename = "fx/misc/bounty_completed.wav";
|
||||
description = "AudioGui";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new AudioProfile(VoteInitiatedSound)
|
||||
{
|
||||
filename = "fx/misc/vote_initiated.wav";
|
||||
description = "AudioGui";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
// Tinman - not being used anymore...
|
||||
// new AudioProfile(OutOfBoundsSound)
|
||||
// {
|
||||
// filename = "gui/vote_nopass.wav";
|
||||
// description = "AudioGuiLoop";
|
||||
// preload = true;
|
||||
// };
|
||||
|
||||
new AudioProfile(BountyBellSound)
|
||||
{
|
||||
filename = "fx/misc/bounty_bonus.wav";
|
||||
description = "AudioGui";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new AudioProfile(SiegeSwitchSides)
|
||||
{
|
||||
filename = "fx/misc/siege_switching.wav";
|
||||
description = "AudioGui";
|
||||
preload = true;
|
||||
};
|
||||
|
||||
new EffectProfile(ObjectiveCompletedEffect)
|
||||
{
|
||||
effectname = "misc/bounty_bonus";
|
||||
minDistance = 10;
|
||||
};
|
||||
|
||||
new AudioProfile(ObjectiveCompleted)
|
||||
{
|
||||
filename = "fx/misc/bounty_bonus.wav";
|
||||
description = "AudioGui";
|
||||
effect = ObjectiveCompletedEffect;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
174
docs/base/@vl2/scripts.vl2/scripts/clientDefaults.cs
Normal file
174
docs/base/@vl2/scripts.vl2/scripts/clientDefaults.cs
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
$JoinGamePort = 28000;
|
||||
$pref::Audio::activeDriver = "default";
|
||||
if ( $platform $= "linux" ) {
|
||||
$pref::Audio::drivers = "OpenAL";
|
||||
} else {
|
||||
$pref::Audio::drivers = "Miles";
|
||||
}
|
||||
$pref::Audio::frequency = 22050;
|
||||
$pref::Audio::sampleBits = 16;
|
||||
$pref::Audio::channels = 2;
|
||||
$pref::Audio::enableVoiceCapture = 1;
|
||||
$pref::Audio::voiceChannels = 1;
|
||||
if ( $platform $= "linux" ) {
|
||||
$pref::Audio::encodingLevel = 3;
|
||||
$pref::Audio::decodingMask = 8;
|
||||
} else {
|
||||
$pref::Audio::encodingLevel = 0;
|
||||
$pref::Audio::decodingMask = 1;
|
||||
}
|
||||
$pref::Audio::forceMaxDistanceUpdate = 0;
|
||||
$pref::Audio::environmentEnabled = 0;
|
||||
$pref::Audio::musicEnabled = 1;
|
||||
$pref::Audio::musicVolume = 0.8;
|
||||
$pref::Audio::masterVolume = 0.8;
|
||||
$pref::Audio::effectsVolume = 1.0;
|
||||
$pref::Audio::voiceVolume = 1.0;
|
||||
$pref::Audio::guiVolume = 0.8;
|
||||
$pref::Audio::radioVolume = 0.8;
|
||||
$pref::Audio::captureGainScale = 1.0;
|
||||
$pref::currentChatMenu = "defaultChatMenu";
|
||||
$pref::Email::Column0 = 30;
|
||||
$pref::Email::Column1 = 250;
|
||||
$pref::Email::Column2 = 250;
|
||||
$pref::Email::Column3 = 150;
|
||||
$pref::Email::ComposeWindowPos = "74 32";
|
||||
$pref::Email::ComposeWindowExtent = "500 408";
|
||||
$pref::Email::SortColumnKey = 3;
|
||||
$pref::Email::SortInc = 1;
|
||||
$pref::EnableBadWordFilter = 1;
|
||||
$pref::FavNames0 = "SCOUT SNIPER";
|
||||
$pref::FavNames1 = "SCOUT ASSASSIN";
|
||||
$pref::FavNames2 = "SCOUT DEFENSE";
|
||||
$pref::FavNames3 = "ASSAULT OFFENSE";
|
||||
$pref::FavNames4 = "ASSAULT DEPLOYER";
|
||||
$pref::FavNames5 = "ASSAULT DEFENSE";
|
||||
$pref::FavNames6 = "TAILGUNNER";
|
||||
$pref::FavNames7 = "JUGGERNAUT OFFENSE";
|
||||
$pref::FavNames8 = "JUGGERNAUT DEPLOYER";
|
||||
$pref::FavNames9 = "JUGGERNAUT DEFENSE";
|
||||
$pref::FavNames10 = "SCOUT FLAG CHASER";
|
||||
$pref::FavNames11 = "ASSAULT DESTROYER";
|
||||
$pref::FavNames12 = "LANDSPIKE DEPLOYER";
|
||||
$pref::FavNames13 = "INVENTORY DEPLOYER";
|
||||
$pref::FavNames14 = "FORWARD ASSAULT";
|
||||
$pref::FavNames15 = "EARLY WARNING";
|
||||
$pref::FavNames16 = "DECOY";
|
||||
$pref::FavNames17 = "HEAVY LOVE";
|
||||
$pref::FavNames18 = "FLAG DEFENDER";
|
||||
$pref::FavNames19 = "INFILTRATOR";
|
||||
$pref::Favorite0 = "armor\tScout\tweapon\tLaser Rifle\tweapon\tSpinfusor\tweapon\tGrenade Launcher\tpack\tEnergy Pack\tGrenade\tFlare Grenade\tMine\tMine";
|
||||
$pref::Favorite1 = "armor\tScout\tweapon\tPlasma Rifle\tweapon\tChaingun\tweapon\tShocklance\tpack\tCloak Pack\tGrenade\tWhiteout Grenade\tMine\tMine";
|
||||
$pref::Favorite2 = "armor\tScout\tweapon\tBlaster\tweapon\tSpinfusor\tweapon\tPlasma Rifle\tpack\tShield Pack\tGrenade\tGrenade\tMine\tMine";
|
||||
$pref::Favorite3 = "armor\tAssault\tweapon\tPlasma Rifle\tweapon\tSpinfusor\tweapon\tGrenade Launcher\tweapon\tChaingun\tpack\tShield Pack\tGrenade\tGrenade\tMine\tMine";
|
||||
$pref::Favorite4 = "armor\tAssault\tweapon\tPlasma Rifle\tweapon\tBlaster\tweapon\tSpinfusor\tweapon\tMissile Launcher\tpack\tInventory Station\tGrenade\tDeployable Camera\tMine\tMine";
|
||||
$pref::Favorite5 = "armor\tAssault\tweapon\tChaingun\tweapon\tSpinfusor\tweapon\tMissile Launcher\tweapon\tELF Projector\tpack\tShield Pack\tGrenade\tConcussion Grenade\tMine\tMine";
|
||||
$pref::Favorite6 = "armor\tAssault\tweapon\tChaingun\tweapon\tGrenade Launcher\tweapon\tBlaster\tweapon\tMissile Launcher\tpack\tAmmunition Pack\tGrenade\tFlare Grenade\tMine\tMine";
|
||||
$pref::Favorite7 = "armor\tJuggernaut\tweapon\tPlasma Rifle\tweapon\tSpinfusor\tweapon\tGrenade Launcher\tweapon\tFusion Mortar\tweapon\tMissile Launcher\tpack\tAmmunition Pack\tGrenade\tGrenade\tMine\tMine";
|
||||
$pref::Favorite8 = "armor\tJuggernaut\tweapon\tChaingun\tweapon\tMissile Launcher\tweapon\tFusion Mortar\tweapon\tPlasma Rifle\tweapon\tBlaster\tpack\tInventory Station\tGrenade\tDeployable Camera\tMine\tMine";
|
||||
$pref::Favorite9 = "armor\tJuggernaut\tweapon\tBlaster\tweapon\tPlasma Rifle\tweapon\tGrenade Launcher\tweapon\tMissile Launcher\tweapon\tFusion Mortar\tpack\tShield Pack\tGrenade\tConcussion Grenade\tMine\tMine";
|
||||
$pref::Favorite10 = "armor\tScout\tweapon\tChaingun\tweapon\tGrenade Launcher\tweapon\tELF Projector\tpack\tEnergy Pack\tGrenade\tConcussion Grenade\tMine\tMine";
|
||||
$pref::Favorite11 = "armor\tAssault\tweapon\tBlaster\tweapon\tPlasma Rifle\tweapon\tSpinfusor\tweapon\tGrenade Launcher\tpack\tShield Pack\tGrenade\tGrenade\tMine\tMine";
|
||||
$pref::Favorite12 = "armor\tAssault\tweapon\tChaingun\tweapon\tSpinfusor\tweapon\tPlasma Rifle\tweapon\tGrenade Launcher\tpack\tLandspike Turret\tGrenade\tGrenade\tMine\tMine";
|
||||
$pref::Favorite13 = "armor\tAssault\tweapon\tPlasma Rifle\tweapon\tSpinfusor\tweapon\tGrenade Launcher\tweapon\tChaingun\tpack\tInventory Station\tGrenade\tGrenade\tMine\tMine";
|
||||
$pref::Favorite14 = "armor\tAssault\tweapon\tELF Projector\tweapon\tGrenade Launcher\tweapon\tSpinfusor\tweapon\tMissile Launcher\tpack\tEnergy Pack\tGrenade\tWhiteout Grenade\tMine\tMine";
|
||||
$pref::Favorite15 = "armor\tAssault\tweapon\tChaingun\tweapon\tSpinfusor\tweapon\tGrenade Launcher\tweapon\tELF Projector\tpack\tPulse Sensor Pack\tGrenade\tConcussion Grenade\tMine\tMine";
|
||||
$pref::Favorite16 = "armor\tScout\tweapon\tChaingun\tweapon\tGrenade Launcher\tweapon\tSpinfusor\tpack\tSensor Jammer Pack\tGrenade\tWhiteout Grenade\tMine\tMine";
|
||||
$pref::Favorite17 = "armor\tJuggernaut\tweapon\tChaingun\tweapon\tSpinfusor\tweapon\tPlasma Rifle\tweapon\tFusion Mortar\tweapon\tMissile Launcher\tpack\tShield Pack\tGrenade\tConcussion Grenade\tMine\tMine";
|
||||
$pref::Favorite18 = "armor\tJuggernaut\tweapon\tSpinfusor\tweapon\tGrenade Launcher\tweapon\tFusion Mortar\tweapon\tPlasma Rifle\tweapon\tChaingun\tpack\tShield Pack\tGrenade\tGrenade\tMine\tMine";
|
||||
$pref::Favorite19 = "armor\tScout\tweapon\tChaingun\tweapon\tSpinfusor\tweapon\tShocklance\tpack\tSatchel Charge\tGrenade\tDeployable Camera\tMine\tMine";
|
||||
$pref::Forum::Column0 = 290;
|
||||
$pref::Forum::Column1 = 265;
|
||||
$pref::Forum::Column2 = 159;
|
||||
$pref::Forum::CacheSize = 100;
|
||||
$pref::Forum::PostWindowPos = "69 32";
|
||||
$pref::Forum::PostWindowExtent = "500 408";
|
||||
$pref::HudMessageLogSize = 40;
|
||||
$pref::Input::ActiveConfig = "MyConfig";
|
||||
$pref::Input::LinkMouseSensitivity = 1;
|
||||
$pref::Input::KeyboardTurnSpeed = 0.1;
|
||||
$pref::Interior::TexturedFog = 0;
|
||||
$pref::IRCClient::autoreconnect = 1;
|
||||
$pref::IRCClient::awaymsg = "Don't be alarmed. I'm going to step away from my computer.";
|
||||
$pref::IRCClient::banmsg = "Get out. And stay out!";
|
||||
$pref::IRCClient::kickmsg = "Alright, you're outta here!";
|
||||
$pref::IRCClient::hostmsg = "left to host a game.";
|
||||
$pref::IRCClient::showJoin = true;
|
||||
$pref::IRCClient::showLeave = true;
|
||||
$pref::Lobby::Column1 = 120;
|
||||
$pref::Lobby::Column2 = 120;
|
||||
$pref::Lobby::Column3 = 50;
|
||||
$pref::Lobby::Column4 = 50;
|
||||
$pref::Lobby::Column5 = 50;
|
||||
$pref::Lobby::SortColumnKey = 3;
|
||||
$pref::Lobby::SortInc = 0;
|
||||
$pref::Net::graphFields = 43;
|
||||
$pref::Net::simPacketLoss = 0;
|
||||
$pref::Net::simPing = 0;
|
||||
$pref::Net::DisplayOnMaster = "Always";
|
||||
$pref::Net::RegionMask = 2;
|
||||
$pref::Net::CheckEmail = 0;
|
||||
$pref::Net::DisconnectChat = 0;
|
||||
$pref::Net::LagThreshold = 400;
|
||||
$pref::Net::Preset = 1;
|
||||
$pref::Net::PacketRateToClient = 16;
|
||||
$pref::Net::PacketSize = 240;
|
||||
$pref::Net::PacketRateToServer = 20;
|
||||
$pref::News::PostWindowPos = "85 39";
|
||||
$pref::News::PostWindowExtent = "470 396";
|
||||
$pref::Player::Count = 0;
|
||||
$pref::Player::Current = 0;
|
||||
$pref::Player::defaultFov = 90;
|
||||
$pref::Player::zoomSpeed = 0;
|
||||
$pref::RememberPassword = 0;
|
||||
$pref::sceneLighting::cacheSize = 60000;
|
||||
$pref::sceneLighting::purgeMethod = "lastModified";
|
||||
$pref::sceneLighting::cacheLighting = 1;
|
||||
$pref::sceneLighting::terrainGenerateLevel = 1;
|
||||
$pref::ServerBrowser::activeFilter = 0;
|
||||
$pref::ServerBrowser::Column0 = "0 183";
|
||||
$pref::ServerBrowser::Column1 = "1 60";
|
||||
$pref::ServerBrowser::Column2 = "2 30";
|
||||
$pref::ServerBrowser::Column3 = "3 45";
|
||||
$pref::ServerBrowser::Column4 = "4 120";
|
||||
$pref::ServerBrowser::Column5 = "5 140";
|
||||
$pref::ServerBrowser::Column6 = "7 80";
|
||||
$pref::ServerBrowser::Column7 = "8 80";
|
||||
$pref::ServerBrowser::Column8 = "9 170";
|
||||
if ( !isDemo() )
|
||||
{
|
||||
$pref::ServerBrowser::Column9 = "6 74";
|
||||
$pref::ServerBrowser::Column10 = "10 70";
|
||||
$pref::ServerBrowser::Column11 = "11 100";
|
||||
}
|
||||
$pref::ServerBrowser::FavoriteCount = 0;
|
||||
$pref::ServerBrowser::SortColumnKey = 3;
|
||||
$pref::ServerBrowser::SortInc = 1;
|
||||
$pref::ServerBrowser::InfoWindowOpen = 0;
|
||||
$pref::ServerBrowser::InfoWindowPos = "145 105";
|
||||
$pref::ServerBrowser::InfoWindowExtent = "350 270";
|
||||
$pref::ServerBrowser::IgnoreCase = 1;
|
||||
$pref::Shell::lastBackground = 0;
|
||||
$pref::Terrain::DynamicLights = 1;
|
||||
$pref::toggleVehicleView = 0;
|
||||
$pref::Topics::Column0 = 245;
|
||||
$pref::Topics::Column1 = 50;
|
||||
$pref::Topics::Column2 = 125;
|
||||
$pref::Topics::Column3 = 134;
|
||||
$pref::Topics::SortColumnKey = 3;
|
||||
$pref::Topics::SortInc = 0;
|
||||
$pref::Video::displayDevice = "OpenGL";
|
||||
$pref::chatHudLength = 1;
|
||||
$pref::useImmersion = 1;
|
||||
$pref::Video::fullScreen = 1;
|
||||
$pref::Video::allowOpenGL = 1;
|
||||
$pref::Video::allowD3D = 1;
|
||||
$pref::Video::preferOpenGL = 1;
|
||||
$pref::Video::appliedPref = 0;
|
||||
$pref::Video::disableVerticalSync = 1;
|
||||
$pref::VisibleDistanceMod = 1.0;
|
||||
$pref::OpenGL::force16BitTexture = 0;
|
||||
$pref::OpenGL::forcePalettedTexture = 1;
|
||||
$pref::OpenGL::maxHardwareLights = 3;
|
||||
$pref::OpenGL::allowTexGen = 1;
|
||||
$pref::Vehicle::pilotTeleport = 1;
|
||||
342
docs/base/@vl2/scripts.vl2/scripts/clientTasks.cs
Normal file
342
docs/base/@vl2/scripts.vl2/scripts/clientTasks.cs
Normal file
|
|
@ -0,0 +1,342 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// Client tasks
|
||||
//------------------------------------------------------------------------------
|
||||
$MAX_OUTSTANDING_TASKS = 10;
|
||||
|
||||
function clientCmdResetTaskList()
|
||||
{
|
||||
if((TaskList.currentTask != -1) && isObject(TaskList.currentTask))
|
||||
{
|
||||
TaskList.currentTask.delete();
|
||||
TaskList.currentTask = -1;
|
||||
}
|
||||
TaskList.currentTask = -1;
|
||||
|
||||
TaskList.reset();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
function clientCmdTaskInfo(%client, %aiObjtive, %team, %description)
|
||||
{
|
||||
// copy the info
|
||||
TaskList.currentTaskClient = %client;
|
||||
TaskList.currentAIObjective = %aiObjective;
|
||||
TaskList.currentTaskIsTeam = %team;
|
||||
TaskList.currentTaskDescription = detag(%description);
|
||||
}
|
||||
|
||||
function clientAcceptTask(%task)
|
||||
{
|
||||
%task.sendToServer();
|
||||
|
||||
commandToServer('AcceptTask', %task.client, %task.AIObjective, %task.description);
|
||||
TaskList.removeTask(%task, true);
|
||||
|
||||
//play the audio
|
||||
alxPlay(TaskAcceptedSound, 0, 0, 0);
|
||||
}
|
||||
|
||||
function clientDeclineTask(%task)
|
||||
{
|
||||
commandToServer('DeclineTask', %task.client, %task.description, %task.team);
|
||||
TaskList.removeTask(%task, false);
|
||||
|
||||
//play the audio
|
||||
alxPlay(TaskDeclinedSound, 0, 0, 0);
|
||||
}
|
||||
|
||||
function clientTaskCompleted()
|
||||
{
|
||||
if((TaskList.currentTask != -1) && isObject(TaskList.currentTask))
|
||||
{
|
||||
commandToServer('CompletedTask', TaskList.currentTask.client, TaskList.currentTask.description);
|
||||
|
||||
TaskList.currentTask.delete();
|
||||
TaskList.currentTask = -1;
|
||||
|
||||
//play the audio
|
||||
alxPlay(TaskDeclinedSound, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// HUD information
|
||||
//------------------------------------------------------------------------------
|
||||
function clientCmdPotentialTeamTask(%description)
|
||||
{
|
||||
addMessageHudLine("\c2Team:\cr " @ detag(%description) @ ".");
|
||||
}
|
||||
|
||||
function clientCmdPotentialTask(%from, %description)
|
||||
{
|
||||
addMessageHudLine("\c3" @ detag(%from) @ ":\cr " @ detag(%description) @ ".");
|
||||
}
|
||||
|
||||
function clientCmdTaskDeclined(%from, %description)
|
||||
{
|
||||
addMessageHudLine(detag(%from) @ " refused your task '" @ detag(%description) @ "'.");
|
||||
}
|
||||
|
||||
function clientCmdTaskAccepted(%from, %description)
|
||||
{
|
||||
addMessageHudLine(detag(%from) @ " accepted your task '" @ detag(%description) @ "'.");
|
||||
}
|
||||
|
||||
function clientCmdTaskCompleted(%from, %description)
|
||||
{
|
||||
addMessageHudLine(detag(%from) @ " completed your task '" @ detag(%description) @ "'.");
|
||||
}
|
||||
|
||||
function clientCmdAcceptedTask(%description)
|
||||
{
|
||||
addMessageHudLine("\c3Your current task is:\cr " @ %description);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function clientAcceptCurrentTask()
|
||||
{
|
||||
%task = TaskList.getCurrentTask();
|
||||
if(%task != -1)
|
||||
clientAcceptTask(%task);
|
||||
}
|
||||
|
||||
function clientDeclineCurrentTask()
|
||||
{
|
||||
%task = TaskList.getCurrentTask();
|
||||
if(%task != -1)
|
||||
clientDeclineTask(%task);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// TaskList:
|
||||
//--------------------------------------------------------------------------
|
||||
function TaskList::onAdd(%this)
|
||||
{
|
||||
%this.ownedTasks = -1;
|
||||
%this.currentTask = -1;
|
||||
%this.reset();
|
||||
|
||||
// install some chat callbacks
|
||||
installChatItemCallback('ChatCmdAcknowledged', clientAcceptCurrentTask);
|
||||
installChatItemCallback('ChatCmdCompleted', clientTaskCompleted);
|
||||
installChatItemCallback('ChatCmdDeclined', clientDeclineCurrentTask);
|
||||
}
|
||||
|
||||
function TaskList::reset(%this)
|
||||
{
|
||||
%this.currentTaskClient = -1;
|
||||
%this.currentAIObjective = -1;
|
||||
%this.currentTaskIsTeam = false;
|
||||
%this.currentTaskDescription = "";
|
||||
|
||||
if((%this.ownedTasks != -1) && isObject(%this.ownedTasks))
|
||||
%this.ownedTasks.delete();
|
||||
|
||||
%this.ownedTasks = new SimGroup();
|
||||
|
||||
%this.currentIndex = 1;
|
||||
%this.clear();
|
||||
}
|
||||
|
||||
function TaskList::onRemove(%this)
|
||||
{
|
||||
if((%this.ownedTasks != -1) && isObject(%this.ownedTasks))
|
||||
%this.ownedTasks.delete();
|
||||
}
|
||||
|
||||
function TaskList::handleDyingTask(%this, %task)
|
||||
{
|
||||
%this.ownedTasks.add(%task);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
function TaskList::getLastTask(%this)
|
||||
{
|
||||
%count = %this.rowCount();
|
||||
if(%count == 0)
|
||||
return(-1);
|
||||
return(%this.getRowId(%count - 1));
|
||||
}
|
||||
|
||||
function TaskList::getCurrentTask(%this)
|
||||
{
|
||||
if(%this.isVisible())
|
||||
{
|
||||
%id = %this.getSelectedId();
|
||||
if(%id != -1)
|
||||
return(%id);
|
||||
}
|
||||
|
||||
return(%this.getLastTask());
|
||||
}
|
||||
|
||||
function TaskList::addTask(%this, %task)
|
||||
{
|
||||
// remove any duplicate...
|
||||
%count = %this.rowCount();
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%oldTask = %this.getRowId(%i);
|
||||
if((%oldTask.client == %task.client) && (detag(%oldTask.description) $= detag(%task.description)))
|
||||
{
|
||||
%this.removeTask(%oldTask, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// need to remove the oldest task?
|
||||
if(%this.rowCount() == $MAX_OUTSTANDING_TASKS)
|
||||
%this.removeTask(%this.getRowId(0), false);
|
||||
|
||||
%this.addRow(%task, %task.clientName @ "\t" @ detag(%task.description), %this.rowCount());
|
||||
}
|
||||
|
||||
function TaskList::removeTask(%this, %task, %close)
|
||||
{
|
||||
%row = %this.getRowNumById(%task);
|
||||
if(%row == -1)
|
||||
return;
|
||||
|
||||
%select = %this.getSelectedId() == %task;
|
||||
|
||||
if(isObject(%task))
|
||||
%task.delete();
|
||||
%this.removeRow(%row);
|
||||
|
||||
if(%select && (%this.rowCount() != 0))
|
||||
{
|
||||
if(%row == %this.rowCount())
|
||||
%row = %row - 1;
|
||||
%this.setSelectedRow(%row);
|
||||
}
|
||||
|
||||
if(%close && %this.isVisible())
|
||||
showTaskHudDlg(false);
|
||||
}
|
||||
|
||||
function TaskList::updateSelected(%this, %show)
|
||||
{
|
||||
%task = %this.getSelectedId();
|
||||
if(%task == -1)
|
||||
return;
|
||||
|
||||
if(%show)
|
||||
{
|
||||
%task.addPotentialTask();
|
||||
if(CommanderMapGui.open)
|
||||
CommanderMap.selectClientTarget(%task, true);
|
||||
else
|
||||
NavHud.keepClientTargetAlive(%task);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(CommanderMapGui.open)
|
||||
CommanderMap.selectClientTarget(%task, false);
|
||||
else
|
||||
NavHud.keepClientTargetAlive(0);
|
||||
}
|
||||
}
|
||||
|
||||
function TaskList::selectLatest(%this)
|
||||
{
|
||||
%this.setSelectedRow(-1);
|
||||
%id = %this.getLastTask();
|
||||
if(%id == -1)
|
||||
return;
|
||||
|
||||
%this.setSelectedById(%id);
|
||||
%this.updateSelected(true);
|
||||
}
|
||||
|
||||
function TaskList::selectPrevious(%this)
|
||||
{
|
||||
%id = %this.getSelectedId();
|
||||
if(%id == -1)
|
||||
{
|
||||
%this.selectLatest();
|
||||
return;
|
||||
}
|
||||
|
||||
%row = %this.getRowNumById(%id);
|
||||
if(%row == 0)
|
||||
%row = %this.rowCount() - 1;
|
||||
else
|
||||
%row -= 1;
|
||||
%this.setSelectedRow(%row);
|
||||
%this.updateSelected(true);
|
||||
}
|
||||
|
||||
function TaskList::selectNext(%this)
|
||||
{
|
||||
%id = %this.getSelectedId();
|
||||
if(%id == -1)
|
||||
{
|
||||
%this.selectLatest();
|
||||
return;
|
||||
}
|
||||
|
||||
%row = %this.getRowNumById(%id);
|
||||
if(%row == (%this.rowCount() - 1))
|
||||
%row = 0;
|
||||
else
|
||||
%row += 1;
|
||||
%this.setSelectedRow(%row);
|
||||
%this.updateSelected(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
function showTaskHudDlg(%show)
|
||||
{
|
||||
if(%show)
|
||||
{
|
||||
if(!TaskHudDlg.isVisible())
|
||||
{
|
||||
TaskHudDlg.setVisible(true);
|
||||
Canvas.pushDialog(TaskHudDlg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(TaskHudDlg.isVisible())
|
||||
{
|
||||
TaskHudDlg.setVisible(false);
|
||||
Canvas.popDialog(TaskHudDlg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// - toggle 'visible' so this, and other, controls can determine if it is up
|
||||
function toggleTaskListDlg(%val)
|
||||
{
|
||||
if(%val)
|
||||
{
|
||||
if(ChatMenuHudDlg.isVisible() || TaskHudDlg.isVisible())
|
||||
showTaskHudDlg(false);
|
||||
else
|
||||
showTaskHudDlg(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
new ActionMap(TaskHudMap);
|
||||
TaskHudMap.bindCmd(keyboard, "up", "TaskList.selectPrevious();", "");
|
||||
TaskHudMap.bindCmd(keyboard, "down", "TaskList.selectNext();", "");
|
||||
TaskHudMap.bindCmd(keyboard, "escape", "if(TaskHudDlg.isVisible()) showTaskHudDlg(false);", "");
|
||||
|
||||
function TaskHudDlg::onWake(%this)
|
||||
{
|
||||
TaskHudMap.push();
|
||||
TaskList.setVisible(true);
|
||||
TaskList.selectLatest();
|
||||
}
|
||||
|
||||
function TaskHudDlg::onSleep(%this)
|
||||
{
|
||||
TaskHudMap.pop();
|
||||
TaskList.setVisible(false);
|
||||
TaskList.updateSelected(false);
|
||||
|
||||
//make sure the action maps are still pushed in the correct order...
|
||||
updateActionMaps();
|
||||
}
|
||||
995
docs/base/@vl2/scripts.vl2/scripts/commanderMap.cs
Normal file
995
docs/base/@vl2/scripts.vl2/scripts/commanderMap.cs
Normal file
|
|
@ -0,0 +1,995 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// ActionMap:
|
||||
//--------------------------------------------------------------------------
|
||||
$CommanderMap::useMovementKeys = false;
|
||||
|
||||
// help overlay toggle
|
||||
function toggleCmdMapHelpGui( %val )
|
||||
{
|
||||
if ( %val)
|
||||
toggleCmdMapHelpText();
|
||||
}
|
||||
|
||||
// shortcuts to buttons: top buttons
|
||||
function toggleAction(%control)
|
||||
{
|
||||
%control.setValue(!%control.getValue());
|
||||
%control.onAction();
|
||||
}
|
||||
|
||||
function bindAction(%fromMap, %command, %bindCmd, %bind1, %bind2 )
|
||||
{
|
||||
if(!isObject(%fromMap))
|
||||
return(false);
|
||||
|
||||
%bind = %fromMap.getBinding(%command);
|
||||
if(%bind $= "")
|
||||
return(false);
|
||||
|
||||
// only allow keyboard
|
||||
%device = getField(%bind, 0);
|
||||
if(%device !$= "keyboard")
|
||||
return(false);
|
||||
|
||||
%action = getField(%bind, 1);
|
||||
|
||||
// bind or bindcmd?
|
||||
if(%bindCmd)
|
||||
CommanderKeyMap.bindCmd( %device, %action, %bind1, %bind2 );
|
||||
else
|
||||
CommanderKeyMap.bind( %device, %action, %bind1 );
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
function createCommanderKeyMap()
|
||||
{
|
||||
if(isObject(CommanderKeyMap))
|
||||
CommanderKeyMap.delete();
|
||||
|
||||
new ActionMap(CommanderKeyMap);
|
||||
|
||||
// copy in all the binds we want from the moveMap
|
||||
CommanderKeyMap.copyBind( moveMap, ToggleMessageHud );
|
||||
CommanderKeyMap.copyBind( moveMap, TeamMessageHud );
|
||||
CommanderKeyMap.copyBind( moveMap, resizeChatHud );
|
||||
CommanderKeyMap.copyBind( moveMap, pageMessageHudUp );
|
||||
CommanderKeyMap.copyBind( moveMap, pageMessageHudDown );
|
||||
CommanderKeyMap.copyBind( moveMap, activateChatMenuHud );
|
||||
|
||||
// Miscellaneous other binds:
|
||||
CommanderKeyMap.copyBind( moveMap, voteYes );
|
||||
CommanderKeyMap.copyBind( moveMap, voteNo );
|
||||
CommanderKeyMap.copyBind( moveMap, toggleCommanderMap );
|
||||
CommanderKeyMap.copyBind( moveMap, toggleHelpGui );
|
||||
CommanderKeyMap.copyBind( moveMap, toggleScoreScreen);
|
||||
CommanderKeyMap.copyBind( moveMap, startRecordingDemo );
|
||||
CommanderKeyMap.copyBind( moveMap, stopRecordingDemo );
|
||||
CommanderKeyMap.copyBind( moveMap, voiceCapture );
|
||||
CommanderKeyMap.bindCmd( keyboard, escape, "", "toggleCommanderMap( true );" );
|
||||
|
||||
// grab help key from movemap
|
||||
if(!bindAction( moveMap, toggleHelpGui, false, toggleCmdMapHelpGui ))
|
||||
CommanderKeyMap.bind( keyboard, F1, toggleCmdMapHelpGui );
|
||||
|
||||
// Bind the command assignment/response keys as well:
|
||||
CommanderKeyMap.copyBind( moveMap, toggleTaskListDlg );
|
||||
CommanderKeyMap.copyBind( moveMap, fnAcceptTask );
|
||||
CommanderKeyMap.copyBind( moveMap, fnDeclineTask );
|
||||
CommanderKeyMap.copyBind( moveMap, fnTaskCompleted );
|
||||
CommanderKeyMap.copyBind( moveMap, fnResetTaskList );
|
||||
|
||||
// button shortcuts
|
||||
CommanderKeyMap.bindCmd( keyboard, 1, "toggleAction(CMDPlayersButton);", "" );
|
||||
CommanderKeyMap.bindCmd( keyboard, 2, "toggleAction(CMDTacticalButton);", "" );
|
||||
CommanderKeyMap.bindCmd( keyboard, 3, "toggleAction(CMDDeployedTacticalButton);", "" );
|
||||
CommanderKeyMap.bindCmd( keyboard, 4, "toggleAction(CMDMiscButton);", "" );
|
||||
CommanderKeyMap.bindCmd( keyboard, 5, "toggleAction(CMDDeployedMiscButton);", "" );
|
||||
CommanderKeyMap.bindCmd( keyboard, 6, "toggleAction(CMDWaypointsButton);", "" );
|
||||
CommanderKeyMap.bindCmd( keyboard, 7, "toggleAction(CMDObjectivesButton);", "" );
|
||||
|
||||
// bottom buttons
|
||||
CommanderKeyMap.bindCmd( keyboard, w, "toggleAction(CMDShowSensorsButton);", "" );
|
||||
CommanderKeyMap.bindCmd( keyboard, space, "cycleMouseMode();", "" );
|
||||
CommanderKeyMap.bindCmd( keyboard, q, "toggleAction(CMDCenterButton);", "" );
|
||||
CommanderKeyMap.bindCmd( keyboard, t, "toggleAction(CMDTextButton);", "" );
|
||||
CommanderKeyMap.bindCmd( keyboard, b, "toggleAction(CMDCameraButton);", "" );
|
||||
|
||||
// camera control (always arrows)
|
||||
CommanderKeyMap.bindCmd( keyboard, left, "CommanderMap.cameraMove(left, true);", "commanderMap.cameraMove(left, false);" );
|
||||
CommanderKeyMap.bindCmd( keyboard, right, "CommanderMap.cameraMove(right, true);", "commanderMap.cameraMove(right, false);" );
|
||||
CommanderKeyMap.bindCmd( keyboard, up, "CommanderMap.cameraMove(up, true);", "commanderMap.cameraMove(up, false);" );
|
||||
CommanderKeyMap.bindCmd( keyboard, down, "CommanderMap.cameraMove(down, true);", "commanderMap.cameraMove(down, false);" );
|
||||
CommanderKeyMap.bindCmd( keyboard, numpadadd, "CommanderMap.cameraMove(in, true);", "commanderMap.cameraMove(in, false);" );
|
||||
CommanderKeyMap.bindCmd( keyboard, numpadminus, "CommanderMap.cameraMove(out, true);", "commanderMap.cameraMove(out, false);" );
|
||||
|
||||
CommanderKeyMap.bindCmd( keyboard, a, "CommanderMap.cameraMove(in, true);", "commanderMap.cameraMove(in, false);" );
|
||||
CommanderKeyMap.bindCmd( keyboard, z, "CommanderMap.cameraMove(out, true);", "commanderMap.cameraMove(out, false);" );
|
||||
|
||||
// steal the movement keys? (more likely than others to be a duplicate binding)
|
||||
if($CommanderMap::useMovementKeys)
|
||||
{
|
||||
bindAction( moveMap, moveleft, true, "CommanderMap.cameraMove(left, true);", "commanderMap.cameraMove(left, false);" );
|
||||
bindAction( moveMap, moveright, true, "CommanderMap.cameraMove(right, true);", "commanderMap.cameraMove(right, false);" );
|
||||
bindAction( moveMap, moveforward, true, "CommanderMap.cameraMove(up, true);", "commanderMap.cameraMove(up, false);" );
|
||||
bindAction( moveMap, movebackward, true, "CommanderMap.cameraMove(down, true);", "commanderMap.cameraMove(down, false);" );
|
||||
}
|
||||
else
|
||||
{
|
||||
CommanderKeyMap.bindCmd( keyboard, s, "CommanderMap.cameraMove(left, true);", "commanderMap.cameraMove(left, false);" );
|
||||
CommanderKeyMap.bindCmd( keyboard, f, "CommanderMap.cameraMove(right, true);", "commanderMap.cameraMove(right, false);" );
|
||||
CommanderKeyMap.bindCmd( keyboard, e, "CommanderMap.cameraMove(up, true);", "commanderMap.cameraMove(up, false);" );
|
||||
CommanderKeyMap.bindCmd( keyboard, d, "CommanderMap.cameraMove(down, true);", "commanderMap.cameraMove(down, false);" );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Default Icons:
|
||||
new CommanderIconData(CMDDefaultIcon)
|
||||
{
|
||||
selectImage = "animation base_select true true looping 100";
|
||||
hilightImage = "animation base_select true true flipflop 100";
|
||||
};
|
||||
|
||||
new CommanderIconData(CMDAssignedTaskIcon)
|
||||
{
|
||||
baseImage = "static diamond_not_selected true true";
|
||||
selectImage = "animation assigned_task_anim false true looping 100";
|
||||
hilightImage = "animation assigned_task_anim false true looping 100";
|
||||
};
|
||||
|
||||
new CommanderIconData(CMDPotentialTaskIcon)
|
||||
{
|
||||
baseImage = "static diamond_not_selected true true";
|
||||
selectImage = "animation assigned_task_anim false true looping 100";
|
||||
hilightImage = "animation assigned_task_anim false true looping 100";
|
||||
};
|
||||
|
||||
new CommanderIconData(CMDWaypointIcon)
|
||||
{
|
||||
baseImage = "animation waypoint_anim false false looping 100";
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// CommanderMapGui:
|
||||
//--------------------------------------------------------------------------
|
||||
function clientCmdResetCommandMap()
|
||||
{
|
||||
CommanderMapGui.reset();
|
||||
}
|
||||
|
||||
function clientCmdScopeCommanderMap(%scope)
|
||||
{
|
||||
if(!isPlayingDemo())
|
||||
return;
|
||||
|
||||
if(%scope)
|
||||
{
|
||||
CommanderMap.openAllCategories();
|
||||
CommanderMapGui.open();
|
||||
}
|
||||
else
|
||||
CommanderMapGui.close();
|
||||
}
|
||||
|
||||
function CommanderMapGui::onWake(%this)
|
||||
{
|
||||
clientCmdControlObjectReset();
|
||||
|
||||
commandToServer('ScopeCommanderMap', true);
|
||||
|
||||
createCommanderKeyMap();
|
||||
CommanderKeyMap.push();
|
||||
|
||||
if ( $HudHandle[CommandScreen] )
|
||||
alxStop( $HudHandle[CommandScreen] );
|
||||
alxPlay(CommandMapActivateSound, 0, 0, 0);
|
||||
$HudHandle[CommandScreen] = alxPlay(CommandMapHumSound, 0, 0, 0);
|
||||
|
||||
CMDTextButton.setValue(CommanderMap.renderText);
|
||||
|
||||
// follow the player the first time
|
||||
if(%this.firstWake)
|
||||
{
|
||||
CommanderMap.selectControlObject();
|
||||
CommanderMap.followLastSelected();
|
||||
%this.firstWake = false;
|
||||
}
|
||||
|
||||
if(CommanderTV.open)
|
||||
CommanderTV.watchTarget(CommanderTV.target);
|
||||
|
||||
// chat hud dialog
|
||||
Canvas.pushDialog(MainChatHud);
|
||||
chatHud.attach(HudMessageVector);
|
||||
|
||||
%this.open = true;
|
||||
}
|
||||
|
||||
function CommanderMapGui::onSleep(%this)
|
||||
{
|
||||
%this.open = false;
|
||||
|
||||
commandToServer('ScopeCommanderMap', false);
|
||||
|
||||
if(CMContextPopup.visible == true)
|
||||
CMContextPopup.reset();
|
||||
|
||||
CommanderKeyMap.pop();
|
||||
Canvas.popDialog(MainChatHud);
|
||||
|
||||
alxStop($HudHandle[CommandScreen]);
|
||||
alxPlay(CommandMapDeactivateSound, 0, 0, 0);
|
||||
$HudHandle[CommandScreen] = "";
|
||||
|
||||
// will reset the control object on this client.. should only be sent
|
||||
// if this gui is being removed outside of CommanderMapGui::close()
|
||||
if(CommanderTV.open && CommanderTV.attached)
|
||||
commandToServer('AttachCommanderCamera', -1);
|
||||
|
||||
//always set the cursor back to an arrow when you leave...
|
||||
Canvas.setCursor(CMDCursorArrow);
|
||||
}
|
||||
|
||||
function CommanderMapGui::open(%this)
|
||||
{
|
||||
if(%this.open)
|
||||
return;
|
||||
|
||||
commandToServer('SetPDAPose', true);
|
||||
Canvas.setContent(%this);
|
||||
}
|
||||
|
||||
function CommanderMapGui::close(%this)
|
||||
{
|
||||
if(!%this.open)
|
||||
return;
|
||||
|
||||
// only need to have control object reset if still attached to an object
|
||||
// if(CommanderTV.open && CommanderTV.attached)
|
||||
// {
|
||||
commandToServer('ResetControlObject');
|
||||
|
||||
// reset the attached state since we will not be getting an attached response
|
||||
CommanderTV.attached = false;
|
||||
// }
|
||||
// else
|
||||
// clientCmdControlObjectReset();
|
||||
|
||||
commandToServer('SetPDAPose', false);
|
||||
}
|
||||
|
||||
function CommanderMapGui::toggle(%this)
|
||||
{
|
||||
if(%this.open)
|
||||
%this.close();
|
||||
else
|
||||
%this.open();
|
||||
}
|
||||
|
||||
function CommanderMapGui::onAdd(%this)
|
||||
{
|
||||
%this.open = false;
|
||||
|
||||
new GuiControl(CMContextPopupDlg)
|
||||
{
|
||||
profile = "GuiModelessDialogProfile";
|
||||
horizSizing = "width";
|
||||
vertSizing = "height";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
setFirstResponder = "0";
|
||||
modal = "1";
|
||||
|
||||
new GuiCommanderMapPopupMenu(CMContextPopup)
|
||||
{
|
||||
profile = "CommanderPopupProfile";
|
||||
position = "0 0";
|
||||
extent = "0 0";
|
||||
minExtent = "0 0";
|
||||
maxPopupHeight = "200";
|
||||
};
|
||||
};
|
||||
|
||||
CMContextPopup.numEntries = 0;
|
||||
CMContextPopup.actionMap = -1;
|
||||
CMContextPopup.focusedEntry = -1;
|
||||
CMContextPopup.visible = false;
|
||||
CMContextPopup.target = -1;
|
||||
}
|
||||
|
||||
function CommanderMapGui::reset(%this)
|
||||
{
|
||||
clientCmdControlObjectReset();
|
||||
CommanderMap.openAllCategories();
|
||||
CommanderMap.resetCamera();
|
||||
CommanderTV.watchTarget(-1);
|
||||
|
||||
// remove all tasks and clean task list
|
||||
clientCmdResetTaskList();
|
||||
|
||||
// reset waypoints
|
||||
if(isObject($ClientWaypoints))
|
||||
$ClientWaypoints.delete();
|
||||
|
||||
// this can be called when not connected to a server
|
||||
if(isObject(ServerConnection))
|
||||
{
|
||||
$ClientWaypoints = new SimGroup();
|
||||
ServerConnection.add($ClientWaypoints);
|
||||
}
|
||||
|
||||
%this.firstWake = true;
|
||||
CommanderTree.currentWaypointID = 0;
|
||||
}
|
||||
|
||||
function CommanderMapGui::openCameraControl(%this, %open)
|
||||
{
|
||||
%step = getWord(CommanderTV.extent, 1);
|
||||
%x = getWord(CommanderTreeContainer.position, 0);
|
||||
%y = getWord(CommanderTreeContainer.position, 1);
|
||||
%w = getWord(CommanderTreeContainer.extent, 0);
|
||||
%h = getWord(CommanderTreeContainer.extent, 1);
|
||||
|
||||
if(%open)
|
||||
%h = %h - %step;
|
||||
else
|
||||
%h = %h + %step;
|
||||
|
||||
CommanderTreeContainer.resize(%x, %y, %w, %h);
|
||||
CommanderTV.setVisible(%open);
|
||||
|
||||
CommanderTV.open = %open;
|
||||
CommanderTV.watchTarget(CommanderTV.target);
|
||||
|
||||
if(!CommanderTV.open)
|
||||
commandToServer('AttachCommanderCamera', -1);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// CMContextPopup:
|
||||
//--------------------------------------------------------------------------
|
||||
function CMContextPopup::reset(%this)
|
||||
{
|
||||
if(%this.actionMap != -1)
|
||||
{
|
||||
%this.actionMap.pop();
|
||||
%this.actionMap.delete();
|
||||
}
|
||||
|
||||
for(%i = 0; %i < %this.numEntries; %i++)
|
||||
{
|
||||
%this.entryKeys[%i] = "";
|
||||
%this.entryCommands[%i] = "";
|
||||
}
|
||||
|
||||
%this.visible = false;
|
||||
%this.numEntries = 0;
|
||||
%this.actionMap = -1;
|
||||
if(%this.focusedEntry != -1)
|
||||
%this.focusedEntry.lockFocus(false);
|
||||
%this.focusedEntry = -1;
|
||||
|
||||
%this.forceClose();
|
||||
Canvas.popDialog(CMContextPopupDlg);
|
||||
|
||||
// need to delete the target if it was not used
|
||||
if(isObject(%this.target))
|
||||
{
|
||||
if(%this.target.getTargetId() != -1)
|
||||
%this.target.delete();
|
||||
%this.target = -1;
|
||||
}
|
||||
}
|
||||
|
||||
function CMContextPopup::display(%this)
|
||||
{
|
||||
if(%this.numEntries == 0)
|
||||
return;
|
||||
|
||||
%this.actionMap = new ActionMap();
|
||||
|
||||
for(%i = 0; %i < %this.numEntries; %i++)
|
||||
if(%this.entryKeys[%i] !$= "")
|
||||
%this.actionMap.bindCmd(keyboard, %this.entryKeys[%i], "", %this @ ".onKeySelect(" @ %i @ ");");
|
||||
|
||||
%this.actionMap.bindCmd(keyboard, escape, "", %this @ ".reset();");
|
||||
%this.actionMap.push();
|
||||
|
||||
if(%this.focusedEntry != -1)
|
||||
%this.focusedEntry.lockFocus(true);
|
||||
%this.visible = true;
|
||||
|
||||
Canvas.pushDialog(CMContextPopupDlg);
|
||||
%this.forceOnAction();
|
||||
}
|
||||
|
||||
function CMContextPopup::addEntry(%this, %key, %text, %command)
|
||||
{
|
||||
%idx = %this.numEntries;
|
||||
%this.entryKeys[%idx] = %key;
|
||||
%this.entryCommands[%idx] = %command;
|
||||
%this.numEntries++;
|
||||
|
||||
%this.add(%text, %idx);
|
||||
}
|
||||
|
||||
function CMContextPopup::onKeySelect(%this, %index)
|
||||
{
|
||||
%this.onSelect(%index, %this.getTextById(%index));
|
||||
}
|
||||
|
||||
function CMContextPopup::onSelect(%this, %index, %value)
|
||||
{
|
||||
CommanderTree.processCommand(%this.entryCommands[%index], %this.target, %this.typeTag);
|
||||
%this.reset();
|
||||
}
|
||||
|
||||
function CMContextPopup::onCancel( %this )
|
||||
{
|
||||
%this.reset();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// CommanderTree:
|
||||
//------------------------------------------------------------------------------
|
||||
function CommanderTree::onAdd(%this)
|
||||
{
|
||||
%this.headerHeight = 20;
|
||||
%this.entryHeight = 20;
|
||||
|
||||
%this.reset();
|
||||
|
||||
%this.addCategory("Clients", "Teammates", "clients");
|
||||
%this.addCategory("Tactical", "Tactical Assets", "targets");
|
||||
%this.addCategory("DTactical", "Deployed Tactical", "targets");
|
||||
%this.addCategory("Support", "Support Assets", "targets");
|
||||
%this.addCategory("DSupport", "Deployed Support", "targets");
|
||||
%this.addCategory("Waypoints", "Waypoints", "waypoints");
|
||||
%this.addCategory("Objectives", "Objectives", "targets");
|
||||
|
||||
// targetType entries use registered info if no ShapeBaseData exists
|
||||
%this.registerEntryType("Clients", getTag('_ClientConnection'), false, "commander/MiniIcons/com_player_grey", "255 255 255");
|
||||
%this.registerEntryType("Waypoints", $CMD_WAYPOINTTYPEID, false, "commander/MiniIcons/com_waypoint_grey", "0 255 0");
|
||||
%this.registerEntryType("Waypoints", $CMD_ASSIGNEDTASKTYPEID, false, "commander/MiniIcons/com_waypoint_grey", "0 0 255");
|
||||
|
||||
// %this.registerEntryType("Waypoints", $CMD_POTENTIALTASKTYPEID, false, "commander/MiniIcons/com_waypoint_grey", "255 255 0");
|
||||
}
|
||||
|
||||
function CommanderTree::onCategoryOpen(%this, %category, %open)
|
||||
{
|
||||
switch$ (%category)
|
||||
{
|
||||
case "Clients":
|
||||
CMDPlayersButton.setValue(%open);
|
||||
case "Tactical":
|
||||
CMDTacticalButton.setValue(%open);
|
||||
case "DTactical":
|
||||
CMDDeployedTacticalButton.setValue(%open);
|
||||
case "Support":
|
||||
CMDMiscButton.setValue(%open);
|
||||
case "DSupport":
|
||||
CMDDeployedMiscButton.setValue(%open);
|
||||
case "Waypoints":
|
||||
CMDWaypointsButton.setValue(%open);
|
||||
case "Objectives":
|
||||
CMDObjectivesButton.setValue(%open);
|
||||
}
|
||||
}
|
||||
|
||||
function CommanderTree::controlObject(%this, %targetId)
|
||||
{
|
||||
commandToServer('ControlObject', %targetId);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// CommanderMap:
|
||||
//------------------------------------------------------------------------------
|
||||
function GuiCommanderMap::onAdd(%this)
|
||||
{
|
||||
%this.setMouseMode(select);
|
||||
%this.setTargetTypeVisible($CMD_POTENTIALTASKTYPEID, true);
|
||||
%this.setTargetTypeVisible($CMD_ASSIGNEDTASKTYPEID, true);
|
||||
}
|
||||
|
||||
function GuiCommanderMap::onSelect(%this, %targetId, %nameTag, %typeTag, %select)
|
||||
{
|
||||
if(%select)
|
||||
{
|
||||
if(CommanderTV.target != %targetId)
|
||||
CommanderTV.watchTarget(%targetId);
|
||||
}
|
||||
else
|
||||
CommanderTV.watchTarget(-1);
|
||||
}
|
||||
|
||||
function GuiCommanderMap::openCategory(%this, %ctrl, %name, %open)
|
||||
{
|
||||
%ctrl.setValue(%open);
|
||||
CommanderTree.openCategory(%name, %open);
|
||||
}
|
||||
|
||||
function GuiCommanderMap::openAllCategories(%this)
|
||||
{
|
||||
%this.openCategory(CMDPlayersButton, "Clients", 1);
|
||||
%this.openCategory(CMDTacticalButton, "Tactical", 1);
|
||||
%this.openCategory(CMDDeployedTacticalButton, "DTactical", 1);
|
||||
%this.openCategory(CMDMiscButton, "Support", 1);
|
||||
%this.openCategory(CMDDeployedMiscButton, "DSupport", 1);
|
||||
%this.openCategory(CMDWaypointsButton, "Waypoints", 1);
|
||||
%this.openCategory(CMDObjectivesButton, "Objectives", 1);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Issuing commands
|
||||
//------------------------------------------------------------------------------
|
||||
// misc. tasks (sensor group -1 is considered friendly with these)
|
||||
$CommandTask['PotentialTask', 0, text] = "\c1A\crccept";
|
||||
$CommandTask['PotentialTask', 0, tag] = 'TaskAccepted';
|
||||
$CommandTask['PotentialTask', 0, hotkey] = "a";
|
||||
$CommandTask['PotentialTask', 1, text] = "\c1D\crecline";
|
||||
$CommandTask['PotentialTask', 1, tag] = 'TaskDeclined';
|
||||
$CommandTask['PotentialTask', 1, hotkey] = "d";
|
||||
|
||||
$CommandTask['AssignedTask', 0, text] = "\c1C\crompleted";
|
||||
$CommandTask['AssignedTask', 0, tag] = 'TaskCompleted';
|
||||
$CommandTask['AssignedTask', 0, hotkey] = "c";
|
||||
$CommandTask['AssignedTask', 1, text] = "\c1R\cremove";
|
||||
$CommandTask['AssignedTask', 1, tag] = 'TaskRemoved';
|
||||
$CommandTask['AssignedTask', 1, hotkey] = "d";
|
||||
|
||||
$CommandTask['Location', 0, text] = "\c1D\crefend";
|
||||
$CommandTask['Location', 0, tag] = 'DefendLocation';
|
||||
$CommandTask['Location', 0, hotkey] = "d";
|
||||
$CommandTask['Location', 1, text] = "\c1M\creet (at)";
|
||||
$CommandTask['Location', 1, tag] = 'MeetLocation';
|
||||
$CommandTask['Location', 1, hotkey] = "m";
|
||||
$CommandTask['Location', 2, text] = "\c1B\cromb (at)";
|
||||
$CommandTask['Location', 2, tag] = 'BombLocation';
|
||||
$CommandTask['Location', 2, hotkey] = "b";
|
||||
$CommandTask['Location', 3, text] = "\c1A\crttack";
|
||||
$CommandTask['Location', 3, tag] = 'AttackLocation';
|
||||
$CommandTask['Location', 3, hotkey] = "a";
|
||||
$CommandTask['Location', 4, text] = "Deploy \c1I\crnventory";
|
||||
$CommandTask['Location', 4, tag] = 'DeployEquipment';
|
||||
$CommandTask['Location', 4, hotkey] = "i";
|
||||
$CommandTask['Location', 5, text] = "Deploy \c1T\crurrets";
|
||||
$CommandTask['Location', 5, tag] = 'DeployTurret';
|
||||
$CommandTask['Location', 5, hotkey] = "t";
|
||||
$CommandTask['Location', 6, text] = "Deploy \c1S\crensors";
|
||||
$CommandTask['Location', 6, tag] = 'DeploySensor';
|
||||
$CommandTask['Location', 6, hotkey] = "s";
|
||||
$CommandTask['Location', 7, text] = "Create \c1W\craypoint";
|
||||
$CommandTask['Location', 7, tag] = 'CreateWayPoint';
|
||||
$CommandTask['Location', 7, hotkey] = "w";
|
||||
|
||||
$CommandTask['Waypoint', 0, text] = "\c1D\crelete waypoint";
|
||||
$CommandTask['Waypoint', 0, tag] = 'DeleteWayPoint';
|
||||
$CommandTask['Waypoint', 0, hotkey] = "d";
|
||||
|
||||
// object tasks
|
||||
$CommandTask['Player', 0, text] = "\c1E\crscort";
|
||||
$CommandTask['Player', 0, tag] = 'EscortPlayer';
|
||||
$CommandTask['Player', 0, hotkey] = "e";
|
||||
$CommandTask['Player', 1, text] = "\c1R\crepair";
|
||||
$CommandTask['Player', 1, tag] = 'RepairPlayer';
|
||||
$CommandTask['Player', 1, hotkey] = "r";
|
||||
$CommandTask['Player', 2, text] = "\c1A\crttack";
|
||||
$CommandTask['Player', 2, tag] = 'AttackPlayer';
|
||||
$CommandTask['Player', 2, hotkey] = "a";
|
||||
$CommandTask['Player', 2, enemy] = true;
|
||||
|
||||
$CommandTask['Flag', 0, text] = "\c1D\crefend";
|
||||
$CommandTask['Flag', 0, tag] = 'DefendFlag';
|
||||
$CommandTask['Flag', 0, hotkey] = "d";
|
||||
$CommandTask['Flag', 1, text] = "\c1R\creturn";
|
||||
$CommandTask['Flag', 1, tag] = 'ReturnFlag';
|
||||
$CommandTask['Flag', 1, hotkey] = "r";
|
||||
$CommandTask['Flag', 2, text] = "\c1C\crapture";
|
||||
$CommandTask['Flag', 2, tag] = 'CaptureFlag';
|
||||
$CommandTask['Flag', 2, hotkey] = "c";
|
||||
$CommandTask['Flag', 2, enemy] = true;
|
||||
|
||||
$CommandTask['Objective', 0, text] = "\c1C\crapture";
|
||||
$CommandTask['Objective', 0, tag] = 'CaptureObjective';
|
||||
$CommandTask['Objective', 0, hotkey] = "c";
|
||||
$CommandTask['Objective', 1, text] = "\c1D\crefend";
|
||||
$CommandTask['Objective', 1, tag] = 'DefendObjective';
|
||||
$CommandTask['Objective', 1, hotkey] = "d";
|
||||
|
||||
$CommandTask['Object', 0, text] = "\c1R\crepair";
|
||||
$CommandTask['Object', 0, tag] = 'RepairObject';
|
||||
$CommandTask['Object', 0, hotkey] = "r";
|
||||
$CommandTask['Object', 1, text] = "\c1D\crefend";
|
||||
$CommandTask['Object', 1, tag] = 'DefendObject';
|
||||
$CommandTask['Object', 1, hotkey] = "d";
|
||||
$CommandTask['Object', 2, text] = "\c1A\crttack";
|
||||
$CommandTask['Object', 2, tag] = 'AttackObject';
|
||||
$CommandTask['Object', 2, hotkey] = "a";
|
||||
$CommandTask['Object', 2, enemy] = true;
|
||||
$CommandTask['Object', 3, text] = "\c1L\craze";
|
||||
$CommandTask['Object', 3, tag] = 'LazeObject';
|
||||
$CommandTask['Object', 3, hotkey] = "l";
|
||||
$CommandTask['Object', 3, enemy] = true;
|
||||
$CommandTask['Object', 4, text] = "\c1M\crortar";
|
||||
$CommandTask['Object', 4, tag] = 'MortarObject';
|
||||
$CommandTask['Object', 4, hotkey] = "m";
|
||||
$CommandTask['Object', 4, enemy] = true;
|
||||
$CommandTask['Object', 5, text] = "\c1B\cromb";
|
||||
$CommandTask['Object', 5, tag] = 'BombObject';
|
||||
$CommandTask['Object', 5, hotkey] = "b";
|
||||
$CommandTask['Object', 5, enemy] = true;
|
||||
|
||||
function GuiCommanderMap::issueCommand(%this, %target, %typeTag, %nameTag, %sensorGroup, %mousePos)
|
||||
{
|
||||
CMContextPopup.position = %mousePos;
|
||||
CMContextPopup.clear();
|
||||
|
||||
CMContextPopup.target = %target;
|
||||
CMContextPopup.typeTag = %typeTag;
|
||||
CMContextPopup.nameTag = %nameTag;
|
||||
CMContextPopup.sensorGroup = %sensorGroup;
|
||||
|
||||
%taskType = %this.getCommandType(%typeTag);
|
||||
if(%taskType $= "")
|
||||
{
|
||||
// script created target?
|
||||
if(%target.getTargetId() == -1)
|
||||
%target.delete();
|
||||
CMDContextPopup.target = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
%this.buildPopupCommands(%taskType, %sensorGroup);
|
||||
CMContextPopup.display();
|
||||
}
|
||||
|
||||
function GuiCommanderMap::getCommandType(%this, %typeTag)
|
||||
{
|
||||
// special case (waypoints, location, tasks...)
|
||||
if(%typeTag == $CMD_LOCATIONTYPEID)
|
||||
return('Location');
|
||||
else if(%typeTag == $CMD_WAYPOINTTYPEID)
|
||||
return('Waypoint');
|
||||
else if(%typeTag == $CMD_POTENTIALTASKTYPEID)
|
||||
return('PotentialTask');
|
||||
else if(%typeTag == $CMD_ASSIGNEDTASKTYPEID)
|
||||
return('AssignedTask');
|
||||
|
||||
// the handled types here (default is 'Object')
|
||||
switch$(getTaggedString(%typeTag))
|
||||
{
|
||||
case "_ClientConnection":
|
||||
return('Player');
|
||||
case "Flag":
|
||||
return('Flag');
|
||||
case "Objective":
|
||||
return('Objective');
|
||||
}
|
||||
return('Object');
|
||||
}
|
||||
|
||||
function GuiCommanderMap::buildPopupCommands(%this, %taskType, %sensorGroup)
|
||||
{
|
||||
%enemy = (%sensorGroup != ServerConnection.getSensorGroup()) && (%sensorGroup != -1);
|
||||
for(%i = 0; $CommandTask[%taskType, %i, text] !$= ""; %i++)
|
||||
{
|
||||
if(%enemy == $CommandTask[%taskType, %i, enemy])
|
||||
{
|
||||
CMContextPopup.addEntry($CommandTask[%taskType, %i, hotkey],
|
||||
$CommandTask[%taskType, %i, text],
|
||||
$CommandTask[%taskType, %i, tag]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Command processing
|
||||
//--------------------------------------------------------------------------
|
||||
function CommanderTree::processCommand(%this, %command, %target, %typeTag)
|
||||
{
|
||||
switch$(getTaggedString(%command))
|
||||
{
|
||||
// waypoints: tree owns the waypoint targets
|
||||
case "CreateWayPoint":
|
||||
%name = "Waypoint " @ %this.currentWaypointID++;
|
||||
%target.createWaypoint(%name);
|
||||
%id = %target.getTargetId();
|
||||
if(%id != -1)
|
||||
{
|
||||
$ClientWaypoints.add(%target);
|
||||
CMContextPopup.target = -1;
|
||||
}
|
||||
return;
|
||||
|
||||
case "DeleteWayPoint":
|
||||
%target.delete();
|
||||
CMContextPopup.target = -1;
|
||||
return;
|
||||
|
||||
// tasks:
|
||||
case "TaskAccepted":
|
||||
clientAcceptTask(%target);
|
||||
return;
|
||||
|
||||
case "TaskDeclined":
|
||||
clientDeclineTask(%target);
|
||||
return;
|
||||
|
||||
case "TaskCompleted":
|
||||
clientTaskCompleted();
|
||||
return;
|
||||
|
||||
case "TaskRemoved":
|
||||
%target.delete();
|
||||
CMContextPopup.target = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
%numClients = %this.getNumTargets("Clients");
|
||||
%numSelected = %this.getNumSelectedTargets("Clients");
|
||||
|
||||
if((%numSelected == 0) || (%numSelected == %numClients))
|
||||
%team = true;
|
||||
else
|
||||
%team = false;
|
||||
|
||||
%target.sendToServer();
|
||||
commandToServer('BuildClientTask', %command, %team);
|
||||
|
||||
if(%team)
|
||||
{
|
||||
commandToServer('SendTaskToTeam');
|
||||
}
|
||||
else
|
||||
{
|
||||
for(%i = 0; %i < %numSelected; %i++)
|
||||
{
|
||||
%targetId = %this.getSelectedTarget("Clients", %i);
|
||||
commandToServer('SendTaskToClientTarget', %targetId);
|
||||
}
|
||||
}
|
||||
|
||||
// delete target?
|
||||
if(%target.getTargetId() == -1)
|
||||
{
|
||||
CMContextPopup.target = -1;
|
||||
%target.delete();
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function CommanderTV::watchTarget(%this, %targetId)
|
||||
{
|
||||
if(%targetId < 0)
|
||||
%targetId = -1;
|
||||
|
||||
if(%this.attached)
|
||||
commandToServer('AttachCommanderCamera', -1);
|
||||
|
||||
%this.target = %targetId;
|
||||
|
||||
if(%this.open && (%this.target != -1))
|
||||
commandToServer('AttachCommanderCamera', %this.target);
|
||||
}
|
||||
|
||||
function clientCmdCameraAttachResponse(%attached)
|
||||
{
|
||||
CommanderTV.attached = %attached;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// CommanderTV control
|
||||
//------------------------------------------------------------------------------
|
||||
new ActionMap(CommanderTVControl);
|
||||
CommanderTVControl.bind(mouse, xaxis, yaw);
|
||||
CommanderTVControl.bind(mouse, yaxis, pitch);
|
||||
|
||||
|
||||
function CommanderTV_ButtonPress(%val)
|
||||
{
|
||||
if(%val)
|
||||
{
|
||||
CommanderTVControl.push();
|
||||
CursorOff();
|
||||
}
|
||||
else
|
||||
{
|
||||
CommanderTVControl.pop();
|
||||
GlobalActionMap.unbind(mouse, button0);
|
||||
|
||||
if(CommanderMapGui.open)
|
||||
{
|
||||
CursorOn();
|
||||
Canvas.setCursor(CMDCursorArrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function CommanderTVScreen::onMouseEnter(%this, %mod, %pos, %count)
|
||||
{
|
||||
GlobalActionMap.bind(mouse, button0, CommanderTV_ButtonPress);
|
||||
}
|
||||
|
||||
function CommanderTVScreen::onMouseLeave(%this, %mod, %pos, %count)
|
||||
{
|
||||
GlobalActionMap.unbind(mouse, button0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Buttons: play button down sounds here so script onAction call plays sound as well
|
||||
//------------------------------------------------------------------------------
|
||||
// top buttons:
|
||||
function CMDPlayersButton::onAction(%this)
|
||||
{
|
||||
CommanderTree.openCategory("Clients", %this.getValue());
|
||||
alxPlay(sButtonDown, 0, 0, 0);
|
||||
}
|
||||
|
||||
function CMDTacticalButton::onAction(%this)
|
||||
{
|
||||
CommanderTree.openCategory("Tactical", %this.getValue());
|
||||
alxPlay(sButtonDown, 0, 0, 0);
|
||||
}
|
||||
|
||||
function CMDDeployedTacticalButton::onAction(%this)
|
||||
{
|
||||
CommanderTree.openCategory("DTactical", %this.getValue());
|
||||
alxPlay(sButtonDown, 0, 0, 0);
|
||||
}
|
||||
|
||||
function CMDMiscButton::onAction(%this)
|
||||
{
|
||||
CommanderTree.openCategory("Support", %this.getValue());
|
||||
alxPlay(sButtonDown, 0, 0, 0);
|
||||
}
|
||||
|
||||
function CMDDeployedMiscButton::onAction(%this)
|
||||
{
|
||||
CommanderTree.openCategory("DSupport", %this.getValue());
|
||||
alxPlay(sButtonDown, 0, 0, 0);
|
||||
}
|
||||
|
||||
function CMDWaypointsButton::onAction(%this)
|
||||
{
|
||||
CommanderTree.openCategory("Waypoints", %this.getValue());
|
||||
alxPlay(sButtonDown, 0, 0, 0);
|
||||
}
|
||||
|
||||
function CMDObjectivesButton::onAction(%this)
|
||||
{
|
||||
CommanderTree.openCategory("Objectives", %this.getValue());
|
||||
alxPlay(sButtonDown, 0, 0, 0);
|
||||
}
|
||||
|
||||
// bottom buttons:
|
||||
function CMDShowSensorsButton::onAction(%this)
|
||||
{
|
||||
CommanderMap.renderSensors = %this.getValue();
|
||||
alxPlay(sButtonDown, 0, 0, 0);
|
||||
}
|
||||
|
||||
// there should be, at most, one depressed mouse mode button
|
||||
function setMouseMode(%mode)
|
||||
{
|
||||
switch$(%mode)
|
||||
{
|
||||
case "select":
|
||||
CMDMoveSelectButton.setValue(false);
|
||||
CMDZoomButton.setValue(false);
|
||||
|
||||
case "move":
|
||||
CMDMoveSelectButton.setValue(true);
|
||||
CMDZoomButton.setValue(false);
|
||||
|
||||
case "zoom":
|
||||
CMDMoveSelectButton.setValue(false);
|
||||
CMDZoomButton.setValue(true);
|
||||
}
|
||||
|
||||
CommanderMap.setMouseMode(%mode);
|
||||
alxPlay(sButtonDown, 0, 0, 0);
|
||||
}
|
||||
|
||||
function cycleMouseMode()
|
||||
{
|
||||
switch$(CommanderMap.getMouseMode())
|
||||
{
|
||||
case "select":
|
||||
setMouseMode("move");
|
||||
case "move":
|
||||
setMouseMode("zoom");
|
||||
case "zoom":
|
||||
setMouseMode("select");
|
||||
}
|
||||
}
|
||||
|
||||
function CMDMoveSelectButton::onAction(%this)
|
||||
{
|
||||
if(%this.getValue())
|
||||
setMouseMode(move);
|
||||
else
|
||||
setMouseMode(select);
|
||||
}
|
||||
|
||||
function CMDZoomButton::onAction(%this)
|
||||
{
|
||||
if(%this.getValue())
|
||||
setMouseMode(zoom);
|
||||
else
|
||||
setMouseMode(select);
|
||||
}
|
||||
|
||||
function CMDCenterButton::onAction(%this)
|
||||
{
|
||||
CommanderMap.followLastSelected();
|
||||
alxPlay(sButtonDown, 0, 0, 0);
|
||||
}
|
||||
|
||||
function CMDTextButton::onAction(%this)
|
||||
{
|
||||
CommanderMap.renderText = %this.getValue();
|
||||
alxPlay(sButtonDown, 0, 0, 0);
|
||||
}
|
||||
|
||||
function CMDCameraButton::onAction(%this)
|
||||
{
|
||||
CommanderMapGui.openCameraControl(%this.getValue());
|
||||
alxPlay(sButtonDown, 0, 0, 0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// - the server may be down and client will not be able to get out of this object
|
||||
// by using the escape key; so, schedule a timeout period to reset
|
||||
$ServerResponseTimeout = 1500;
|
||||
|
||||
function processControlObjectEscape()
|
||||
{
|
||||
if($ScheduledEscapeTask)
|
||||
return;
|
||||
|
||||
$ScheduledEscapeTask = schedule($ServerResonseTimeout, 0, clientCmdControlObjectReset);
|
||||
commandToServer('ResetControlObject');
|
||||
}
|
||||
|
||||
function clientCmdControlObjectResponse(%ack, %info)
|
||||
{
|
||||
// if ack'd then %info is the tag for the object otherwise it is a decline message
|
||||
if(%ack == true)
|
||||
{
|
||||
new ActionMap(ControlActionMap);
|
||||
ControlActionMap.bindCmd(keyboard, escape, "processControlObjectEscape();", "");
|
||||
|
||||
$PlayerIsControllingObject = true;
|
||||
clientCmdSetHudMode("Object", %info);
|
||||
|
||||
// at this point, we are not attached to an object
|
||||
CommanderTV.attached = false;
|
||||
Canvas.setContent(PlayGui);
|
||||
}
|
||||
else
|
||||
addMessageHudLine("\c3Failed to control object: \cr" @ %info);
|
||||
}
|
||||
|
||||
function clientCmdControlObjectReset()
|
||||
{
|
||||
if($ScheduledEscapeTask)
|
||||
{
|
||||
cancel($ScheduledEscapeTask);
|
||||
$ScheduledEscapeTask = 0;
|
||||
}
|
||||
|
||||
if(isObject(ControlActionMap))
|
||||
ControlActionMap.delete();
|
||||
|
||||
if ($PlayerIsControllingObject)
|
||||
{
|
||||
$PlayerIsControllingObject = false;
|
||||
ClientCmdSetHudMode("Standard");
|
||||
}
|
||||
|
||||
if(CommanderMapGui.open)
|
||||
Canvas.setContent(PlayGui);
|
||||
}
|
||||
25
docs/base/@vl2/scripts.vl2/scripts/commanderMapHelpText.cs
Normal file
25
docs/base/@vl2/scripts.vl2/scripts/commanderMapHelpText.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
$cmdMapHelpTextShown = false;
|
||||
|
||||
function toggleCmdMapHelpText()
|
||||
{
|
||||
if(CmdMapHelpTextGui.visible)
|
||||
CmdMapHelpTextGui.setVisible(false);
|
||||
else {
|
||||
if(!$cmdMapHelpTextShown) {
|
||||
teamButtonText.setValue("Left click to select, right click to give commands.");
|
||||
tacticalButtonText.setValue("Turrets and friendly vehicles. Click the square after a turret's name to control it.");
|
||||
supportButtonText.setValue("Your team's stations, generators, cameras, and sensors.");
|
||||
waypointButtonText.setValue("All waypoints.");
|
||||
objectiveButtonText.setValue("All flags and switches.");
|
||||
handToolText.setValue("Toggles between hand (for moving the map) and pointer (for selecting objects and dragging selection).");
|
||||
zoomToolText.setValue("When this tool is on, left click to zoom in and right click to zoom out.");
|
||||
centerToolText.setValue("Centers your view on selected object. If nothing is selected, centers the view on mission area.");
|
||||
textToolText.setValue("Toggles map text labels on and off.");
|
||||
cameraToolText.setValue("Gives you a small camera view of the area around selected object. Waypoints and enemy objects can not be viewed.");
|
||||
sensorToolText.setValue("Toggles all sensor spheres on/off so you can check your team's sensor coverage.");
|
||||
generalHelpText.setValue("Right click any object to display commands. Click on the command or type the highlighted letter to issue it to your team. To command an individual, click on the player's name, then issue the command.");
|
||||
$cmdMapHelpTextShown = true;
|
||||
}
|
||||
CmdMapHelpTextGui.setVisible(true);
|
||||
}
|
||||
}
|
||||
112
docs/base/@vl2/scripts.vl2/scripts/commanderMapIcons.cs
Normal file
112
docs/base/@vl2/scripts.vl2/scripts/commanderMapIcons.cs
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
// "type image overlay modulate {anim flags} {anim speed}"
|
||||
datablock CommanderIconData(CMDPlayerIcon)
|
||||
{
|
||||
baseImage = "static com_player_grey_24x false true";
|
||||
selectImage = "static com_player_grey_24x_glow true true";
|
||||
hilightImage = "static com_player_grey_24x_glow true true";
|
||||
};
|
||||
|
||||
datablock CommanderIconData(CMDGeneratorIcon)
|
||||
{
|
||||
baseImage = "static com_icon_generator false true";
|
||||
selectImage = "static com_icon_generator_glow true true";
|
||||
hilightImage = "static com_icon_generator_glow true true";
|
||||
};
|
||||
|
||||
datablock CommanderIconData(CMDSolarGeneratorIcon)
|
||||
{
|
||||
baseImage = "static com_icon_solar_gen false true";
|
||||
selectImage = "static com_icon_solar_gen_glow true true";
|
||||
hilightImage = "static com_icon_solar_gen_glow true true";
|
||||
};
|
||||
|
||||
datablock CommanderIconData(CMDHoverScoutIcon)
|
||||
{
|
||||
baseImage = "static com_icon_landscout false true";
|
||||
selectImage = "static com_icon_landscout_glow true true";
|
||||
hilightImage = "static com_icon_landscout_glow true true";
|
||||
};
|
||||
|
||||
datablock CommanderIconData(CMDFlyingScoutIcon)
|
||||
{
|
||||
baseImage = "static com_icon_scout false true";
|
||||
selectImage = "static com_icon_scout_glow true true";
|
||||
hilightImage = "static com_icon_scout_glow true true";
|
||||
};
|
||||
|
||||
datablock CommanderIconData(CMDFlyingBomberIcon)
|
||||
{
|
||||
baseImage = "static com_icon_bomber false true";
|
||||
selectImage = "static com_icon_bomber_glow true true";
|
||||
hilightImage = "static com_icon_bomber_glow true true";
|
||||
};
|
||||
|
||||
datablock CommanderIconData(CMDFlyingHAPCIcon)
|
||||
{
|
||||
baseImage = "static com_icon_hapc false true";
|
||||
selectImage = "static com_icon_hapc_glow true true";
|
||||
hilightImage = "static com_icon_hapc_glow true true";
|
||||
};
|
||||
|
||||
datablock CommanderIconData(CMDGroundTankIcon)
|
||||
{
|
||||
baseImage = "static com_icon_tank false true";
|
||||
selectImage = "static com_icon_tank_glow true true";
|
||||
hilightImage = "static com_icon_tank_glow true true";
|
||||
};
|
||||
|
||||
datablock CommanderIconData(CMDTurretIcon)
|
||||
{
|
||||
baseImage = "static com_icon_turret false true";
|
||||
selectImage = "static com_icon_turret_glow true true";
|
||||
hilightImage = "static com_icon_turret_glow true true";
|
||||
};
|
||||
|
||||
datablock CommanderIconData(CMDCameraIcon)
|
||||
{
|
||||
baseImage = "static com_icon_camera false true";
|
||||
selectImage = "static com_icon_camera true true";
|
||||
hilightImage = "static com_icon_camera true true";
|
||||
};
|
||||
|
||||
datablock CommanderIconData(CMDFlagIcon)
|
||||
{
|
||||
baseImage = "static com_icon_flag_outside false true";
|
||||
selectImage = "static com_icon_flag_outside_glow true true";
|
||||
hilightImage = "static com_icon_flag_outside_glow true true";
|
||||
};
|
||||
|
||||
datablock CommanderIconData(CMDGroundMPBIcon)
|
||||
{
|
||||
baseImage = "static com_icon_mpb false true";
|
||||
selectImage = "static com_icon_mpb_glow true true";
|
||||
hilightImage = "static com_icon_mpb_glow true true";
|
||||
};
|
||||
|
||||
datablock CommanderIconData(CMDSwitchIcon)
|
||||
{
|
||||
baseImage = "static com_icon_genericswitch false true";
|
||||
selectImage = "static com_icon_genericswitch_glow true true";
|
||||
hilightImage = "static com_icon_genericswitch_glow true true";
|
||||
};
|
||||
|
||||
datablock CommanderIconData(CMDStationIcon)
|
||||
{
|
||||
baseImage = "static com_icon_inventory false true";
|
||||
selectImage = "static com_icon_inventory_glow true true";
|
||||
hilightImage = "static com_icon_inventory_glow true true";
|
||||
};
|
||||
|
||||
datablock CommanderIconData(CMDVehicleStationIcon)
|
||||
{
|
||||
baseImage = "static com_icon_vehicle_inventory false true";
|
||||
selectImage = "static com_icon_vehicle_inventory_glow true true";
|
||||
hilightImage = "static com_icon_vehicle_inventory_glow true true";
|
||||
};
|
||||
|
||||
datablock CommanderIconData(CMDSensorIcon)
|
||||
{
|
||||
baseImage = "static com_icon_sensor false true";
|
||||
selectImage = "static com_icon_sensor_glow true true";
|
||||
hilightImage = "static com_icon_sensor_glow true true";
|
||||
};
|
||||
120
docs/base/@vl2/scripts.vl2/scripts/commanderProfiles.cs
Normal file
120
docs/base/@vl2/scripts.vl2/scripts/commanderProfiles.cs
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// Cursors
|
||||
//------------------------------------------------------------------------------
|
||||
new GuiCursor(CMDCursorArrow)
|
||||
{
|
||||
hotSpot = "6 1";
|
||||
bitmapName = "commander/cursors/com_cursor_arrow_icon";
|
||||
};
|
||||
|
||||
new GuiCursor(CMDCursorHandOpen)
|
||||
{
|
||||
hotSpot = "13 14";
|
||||
bitmapName = "commander/cursors/com_handopen_icon";
|
||||
};
|
||||
|
||||
new GuiCursor(CMDCursorHandClosed)
|
||||
{
|
||||
hotSpot = "13 14";
|
||||
bitmapName = "commander/cursors/com_handclose_icon";
|
||||
};
|
||||
|
||||
new GuiCursor(CMDCursorZoom)
|
||||
{
|
||||
hotSpot = "8 7";
|
||||
bitmapName = "commander/cursors/com_maglass_icon";
|
||||
};
|
||||
|
||||
new GuiCursor(CMDCursorSelectAdd)
|
||||
{
|
||||
hotSpot = "11 11";
|
||||
bitmapName = "commander/cursors/com_pointer_pos_icon";
|
||||
};
|
||||
|
||||
new GuiCursor(CMDCursorSelectRemove)
|
||||
{
|
||||
hotSpot = "11 11";
|
||||
bitmapName = "commander/cursors/com_pointer_icon";
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Audio
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
new AudioDescription(AudioLoop2D)
|
||||
{
|
||||
volume = "1.0";
|
||||
isLooping = true;
|
||||
is3D = false;
|
||||
type = $GuiAudioType;
|
||||
};
|
||||
|
||||
new AudioProfile(sStatic)
|
||||
{
|
||||
filename = "fx/misc/static.wav";
|
||||
description = AudioLoop2D;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Profiles
|
||||
//------------------------------------------------------------------------------
|
||||
new GuiControlProfile("CommanderTreeContentProfile")
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = "140 140 140";
|
||||
border = false;
|
||||
};
|
||||
|
||||
new GuiControlProfile("CommanderScrollContentProfile")
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = "0 0 0";
|
||||
border = false;
|
||||
};
|
||||
|
||||
new GuiControlProfile("CommanderButtonProfile")
|
||||
{
|
||||
opaque = false;
|
||||
fontType = $ShellButtonFont;
|
||||
fontSize = $ShellButtonFontSize;
|
||||
fontColor = "8 19 6";
|
||||
fontColorHL = "25 68 56";
|
||||
fontColorNA = "98 98 98";
|
||||
fixedExtent = true;
|
||||
justify = "center";
|
||||
bitmap = "gui/shll_button";
|
||||
textOffset = "0 11";
|
||||
soundButtonOver = sButtonOver;
|
||||
tab = false;
|
||||
canKeyFocus = false;
|
||||
};
|
||||
|
||||
new GuiControlProfile("CommanderGuiProfile")
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = "0 0 0";
|
||||
};
|
||||
|
||||
new GuiControlProfile("CommanderPopupProfile")
|
||||
{
|
||||
fontType = "Arial Bold";
|
||||
fontSize = 14;
|
||||
opaque = true;
|
||||
fillColor = "65 141 148";
|
||||
border = true;
|
||||
borderColor= "105 181 188";
|
||||
justify = center;
|
||||
|
||||
fontColors[0] = "255 255 255"; // text color
|
||||
fontColors[1] = "255 255 0"; // hotkey color
|
||||
};
|
||||
|
||||
new GuiControlProfile("CommanderTreeProfile")
|
||||
{
|
||||
fontColors[0] = "220 220 220"; // CategoryNormal
|
||||
fontColors[1] = "230 169 0"; // CategoryHilight
|
||||
fontColors[2] = "170 170 170"; // CategoryEmpty
|
||||
fontColors[3] = "255 255 0"; // ClientNoneEntry
|
||||
fontColors[4] = "255 255 255"; // TargetEntry
|
||||
};
|
||||
208
docs/base/@vl2/scripts.vl2/scripts/commonDialogs.cs
Normal file
208
docs/base/@vl2/scripts.vl2/scripts/commonDialogs.cs
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// commonDialogs.cs
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// MessageBox OK dialog:
|
||||
//------------------------------------------------------------------------------
|
||||
function MessageBoxOK( %title, %message, %callback )
|
||||
{
|
||||
MBOKFrame.setTitle( %title );
|
||||
MBOKText.setText( "<just:center>" @ %message );
|
||||
//MessageBoxOKDlg.callback = %callback;
|
||||
MBOKButton.command = %callback SPC "Canvas.popDialog(MessageBoxOKDlg);";
|
||||
Canvas.pushDialog( MessageBoxOKDlg );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function MessageBoxOKDlg::onWake( %this )
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function MessageBoxOKDlg::onSleep( %this )
|
||||
{
|
||||
%this.callback = "";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// MessageBox OK/Cancel dialog:
|
||||
//------------------------------------------------------------------------------
|
||||
function MessageBoxOKCancel( %title, %message, %callback, %cancelCallback )
|
||||
{
|
||||
MBOKCancelFrame.setTitle( %title );
|
||||
MBOKCancelText.setText( "<just:center>" @ %message );
|
||||
//MessageBoxOKCancelDlg.callback = %callback;
|
||||
//MessageBoxOKCancelDlg.cancelCallback = %cancelCallback;
|
||||
MBOKCancelButtonOK.command = %callback SPC "Canvas.popDialog(MessageBoxOKCancelDlg);";
|
||||
MBOKCancelButtonCancel.command = %cancelCallback SPC "Canvas.popDialog(MessageBoxOKCancelDlg);";
|
||||
|
||||
Canvas.pushDialog( MessageBoxOKCancelDlg );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function MessageBoxOKCancelDlg::onWake( %this )
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function MessageBoxOKCancelDlg::onSleep( %this )
|
||||
{
|
||||
%this.callback = "";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// MessageBox Yes/No dialog:
|
||||
//------------------------------------------------------------------------------
|
||||
function MessageBoxYesNo( %title, %message, %yesCallback, %noCallback )
|
||||
{
|
||||
MBYesNoFrame.setTitle( %title );
|
||||
MBYesNoText.setText( "<just:center>" @ %message );
|
||||
|
||||
//MessageBoxYesNoDlg.yesCallBack = %yesCallback;
|
||||
//MessageBoxYesNoDlg.noCallback = %noCallBack;
|
||||
MBYesNoButtonYes.command = %yesCallback SPC "Canvas.popDialog(MessageBoxYesNoDlg);";
|
||||
MBYesNoButtonNo.command = %noCallback SPC "Canvas.popDialog(MessageBoxYesNoDlg);";
|
||||
Canvas.pushDialog( MessageBoxYesNoDlg );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function MessageBoxYesNoDlg::onWake( %this )
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function MessageBoxYesNoDlg::onSleep( %this )
|
||||
{
|
||||
%this.yesCallback = "";
|
||||
%this.noCallback = "";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Message popup dialog:
|
||||
//------------------------------------------------------------------------------
|
||||
function MessagePopup( %title, %message, %delay )
|
||||
{
|
||||
// Currently two lines max.
|
||||
MessagePopFrame.setTitle( %title );
|
||||
MessagePopText.setText( "<just:center>" @ %message );
|
||||
Canvas.pushDialog( MessagePopupDlg );
|
||||
if ( %delay !$= "" )
|
||||
schedule( %delay, 0, CloseMessagePopup );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function CloseMessagePopup()
|
||||
{
|
||||
Canvas.popDialog( MessagePopupDlg );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Pick Team dialog:
|
||||
//------------------------------------------------------------------------------
|
||||
function PickTeamDlg::onWake( %this )
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function PickTeamDlg::onSleep( %this )
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// ex: ShellGetLoadFilename( "stuff\*.*", isLoadable, loadStuff );
|
||||
// -- only adds files that pass isLoadable
|
||||
// -- calls 'loadStuff(%filename)' on dblclick or ok
|
||||
//------------------------------------------------------------------------------
|
||||
function ShellGetLoadFilename( %title, %fileSpec, %validate, %callback )
|
||||
{
|
||||
$loadFileCommand = %callback @ "( getField( LOAD_FileList.getValue(), 0 ) );";
|
||||
LOAD_FileList.altCommand = $loadFileCommand SPC "Canvas.popDialog(ShellLoadFileDlg);";
|
||||
LOAD_LoadBtn.command = $loadFileCommand SPC "Canvas.popDialog(ShellLoadFileDlg);";
|
||||
|
||||
if ( %title $= "" )
|
||||
LOAD_Title.setTitle( "LOAD FILE" );
|
||||
else
|
||||
LOAD_Title.setTitle( %title );
|
||||
LOAD_LoadBtn.setActive( false );
|
||||
Canvas.pushDialog( ShellLoadFileDlg );
|
||||
fillLoadSaveList( LOAD_FileList, %fileSpec, %validate, false );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function fillLoadSaveList( %ctrl, %fileSpec, %validate, %isSave )
|
||||
{
|
||||
%ctrl.clear();
|
||||
%id = 0;
|
||||
for ( %file = findFirstFile( %fileSpec ); %file !$= ""; %file = findNextFile( %fileSpec ) )
|
||||
{
|
||||
if ( %validate $= "" || call( %validate, %file ) )
|
||||
{
|
||||
%ctrl.addRow( %id, fileBase( %file ) TAB %file );
|
||||
if ( %isSave )
|
||||
{
|
||||
if ( !isWriteableFileName( "base/" @ %file ) )
|
||||
%ctrl.setRowActive( %id, false );
|
||||
}
|
||||
%id++;
|
||||
}
|
||||
}
|
||||
%ctrl.sort( 0 );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LOAD_FileList::onSelect( %this, %id, %text )
|
||||
{
|
||||
LOAD_LoadBtn.setActive( true );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// ex: ShellGetSaveFilename( "stuff\*.*", isLoadable, saveStuff, currentName );
|
||||
// -- only adds files to list that pass isLoadable
|
||||
// -- calls 'saveStuff(%filename)' on dblclick or ok
|
||||
//------------------------------------------------------------------------------
|
||||
function ShellGetSaveFilename( %title, %fileSpec, %validate, %callback, %current )
|
||||
{
|
||||
SAVE_FileName.setValue( %current );
|
||||
$saveFileCommand = "if ( SAVE_FileName.getValue() !$= \"\" ) " @ %callback @ "( SAVE_FileName.getValue() );";
|
||||
SAVE_FileName.altCommand = $saveFileCommand SPC "Canvas.popDialog(ShellSaveFileDlg);";
|
||||
SAVE_SaveBtn.command = $saveFileCommand SPC "Canvas.popDialog(ShellSaveFileDlg);";
|
||||
|
||||
if ( %title $= "" )
|
||||
SAVE_Title.setTitle( "SAVE FILE" );
|
||||
else
|
||||
SAVE_Title.setTitle( %title );
|
||||
|
||||
// Right now this validation stuff is worthless...
|
||||
//SAVE_SaveBtn.setActive( isWriteableFileName( "base/" @ %current @ $loadSaveExt ) );
|
||||
Canvas.pushDialog( ShellSaveFileDlg );
|
||||
fillLoadSaveList( SAVE_FileList, %fileSpec, %validate, true );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function SAVE_FileList::onSelect( %this, %id, %text )
|
||||
{
|
||||
if ( %this.isRowActive( %id ) )
|
||||
SAVE_FileName.setValue( getField( %this.getValue(), 0 ) );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function SAVE_FileList::onDoubleClick( %this )
|
||||
{
|
||||
%id = %this.getSelectedId();
|
||||
if ( %this.isRowActive( %id ) )
|
||||
{
|
||||
error("D'oh - double clicking is broken for PURE/DEMO executables");
|
||||
eval( $saveFileCommand );
|
||||
Canvas.popDialog( ShellSaveFileDlg );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function SAVE_FileName::checkValid( %this )
|
||||
{
|
||||
// Right now this validation stuff is worthless...
|
||||
//SAVE_SaveBtn.setActive( isWriteableFileName( "base/" @ %this.getValue() @ $loadSaveExt ) );
|
||||
}
|
||||
1379
docs/base/@vl2/scripts.vl2/scripts/controlDefaults.cs
Normal file
1379
docs/base/@vl2/scripts.vl2/scripts/controlDefaults.cs
Normal file
File diff suppressed because it is too large
Load diff
144
docs/base/@vl2/scripts.vl2/scripts/creditsGui.cs
Normal file
144
docs/base/@vl2/scripts.vl2/scripts/creditsGui.cs
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
function LaunchCredits()
|
||||
{
|
||||
Canvas.setContent(CreditsGui);
|
||||
}
|
||||
|
||||
function cancelCredits()
|
||||
{
|
||||
//delete the action map
|
||||
CreditsActionMap.pop();
|
||||
|
||||
//kill the schedules
|
||||
cancel($CreditsScrollSchedule);
|
||||
cancel($CreditsSlideShow);
|
||||
|
||||
//kill the music
|
||||
MusicPlayer.stop();
|
||||
|
||||
//load the launch gui back...
|
||||
Canvas.setContent(LaunchGui);
|
||||
|
||||
//delete the contents of the ML ctrl so as to free up memory...
|
||||
Credits_Text.setText("");
|
||||
}
|
||||
|
||||
function CreditsGui::onWake(%this)
|
||||
{
|
||||
//create an action map to use "esc" to exit the credits screen...
|
||||
if (!isObject(CreditsActionMap))
|
||||
{
|
||||
new ActionMap(CreditsActionMap);
|
||||
CreditsActionMap.bindCmd(keyboard, anykey, "cancelCredits();", "");
|
||||
CreditsActionMap.bindCmd(keyboard, space, "cancelCredits();", "");
|
||||
CreditsActionMap.bindCmd(keyboard, escape, "cancelCredits();", "");
|
||||
CreditsActionMap.bindCmd(mouse, button0, "$CreditsPaused = true;", "$CreditsPaused = false;");
|
||||
CreditsActionMap.bindCmd(mouse, button1, "$CreditsSpeedUp = true;", "$CreditsSpeedUp = false;");
|
||||
if (!isDemo())
|
||||
CreditsActionMap.bindCmd(mouse, button2, "creditsNextPic();", "");
|
||||
}
|
||||
CreditsActionMap.push();
|
||||
|
||||
//build the ML text ctrl...
|
||||
exec("scripts/creditsText.cs");
|
||||
if (!isDemo())
|
||||
{
|
||||
$CreditsPicIndex = 1;
|
||||
CREDITS_Pic.setBitmap("gui/Cred_" @ $CreditsPicIndex @ ".png");
|
||||
}
|
||||
else
|
||||
CREDITS_Pic.setBitmap("gui/Cred_1.bm8");
|
||||
|
||||
//music array
|
||||
if (!isDemo())
|
||||
{
|
||||
$CreditsMusic[0] = "badlands";
|
||||
$CreditsMusic[1] = "desert";
|
||||
$CreditsMusic[2] = "ice";
|
||||
$CreditsMusic[3] = "lush";
|
||||
$CreditsMusic[4] = "volcanic";
|
||||
}
|
||||
else
|
||||
{
|
||||
$CreditsMusic[0] = "lush";
|
||||
$CreditsMusic[1] = "desert";
|
||||
$CreditsMusic[2] = "desert";
|
||||
$CreditsMusic[3] = "lush";
|
||||
$CreditsMusic[4] = "desert";
|
||||
}
|
||||
|
||||
//start the credits from the beginning
|
||||
$CreditsOffset = 0.0;
|
||||
%screenHeight = getWord(getResolution(), 1);
|
||||
Credits_Text.resize(getWord(Credits_Text.position, 0),
|
||||
mFloor(%screenHeight / 2) - 125,
|
||||
getWord(Credits_Text.extent, 0),
|
||||
getWord(Credits_Text.extent, 1));
|
||||
|
||||
//start the scrolling
|
||||
$CreditsPaused = false;
|
||||
$CreditsSpeedUp = false;
|
||||
$CreditsScrollSchedule = schedule(3000, 0, scrollTheCredits);
|
||||
|
||||
//start cycling the bitmaps
|
||||
if (!isDemo())
|
||||
$CreditsSlideShow = schedule(5000, 0, creditsNextPic);
|
||||
|
||||
//start some music
|
||||
%chooseTrack = mFloor(getRandom() * 4.99);
|
||||
MusicPlayer.playTrack($CreditsMusic[%chooseTrack]);
|
||||
}
|
||||
|
||||
function addCreditsLine(%text, %lastLine)
|
||||
{
|
||||
CREDITS_Text.addText(%text @ "\n", %lastline);
|
||||
}
|
||||
|
||||
function scrollTheCredits()
|
||||
{
|
||||
//make sure we're not paused
|
||||
if (!$CreditsPaused)
|
||||
{
|
||||
//if we've scrolled off the top, set the position back down to the bottom
|
||||
%parentCtrl = CREDITS_Text.getGroup();
|
||||
if (getWord(Credits_Text.position, 1) + getWord(Credits_Text.extent, 1) < 0)
|
||||
{
|
||||
Credits_Text.position = getWord(Credits_Text.position, 0) SPC getWord(%parentCtrl.extent, 1);
|
||||
$CreditsOffset = getWord(Credits_Text.position, 1);
|
||||
}
|
||||
|
||||
if ($CreditsSpeedUp)
|
||||
%valueToScroll = 10;
|
||||
else
|
||||
%valueToScroll = 1;
|
||||
|
||||
//scroll the control up a bit
|
||||
Credits_Text.resize(getWord(Credits_Text.position, 0),
|
||||
getWord(Credits_Text.position, 1) - %valueToScroll,
|
||||
getWord(Credits_Text.extent, 0),
|
||||
getWord(Credits_Text.extent, 1));
|
||||
}
|
||||
|
||||
//schedule the next scroll...
|
||||
$CreditsScrollSchedule = schedule(10, 0, scrollTheCredits);
|
||||
}
|
||||
|
||||
function creditsNextPic()
|
||||
{
|
||||
//no slide show in the demo...
|
||||
if (isDemo())
|
||||
return;
|
||||
|
||||
cancel($CreditsSlideShow);
|
||||
if (!$CreditsPaused)
|
||||
{
|
||||
$CreditsPicIndex += 1;
|
||||
if ($CreditsPicIndex > 46)
|
||||
$CreditsPicindex = 1;
|
||||
|
||||
//set the bitmap
|
||||
CREDITS_Pic.setBitmap("gui/Cred_" @ $CreditsPicIndex @ ".png");
|
||||
}
|
||||
|
||||
//schedule the next bitmap
|
||||
$CreditsSlideShow = schedule(5000, 0, creditsNextPic);
|
||||
}
|
||||
1609
docs/base/@vl2/scripts.vl2/scripts/creditsText.cs
Normal file
1609
docs/base/@vl2/scripts.vl2/scripts/creditsText.cs
Normal file
File diff suppressed because it is too large
Load diff
63
docs/base/@vl2/scripts.vl2/scripts/cursors.cs
Normal file
63
docs/base/@vl2/scripts.vl2/scripts/cursors.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
//
|
||||
// Copyright (c) 2001 GarageGames.Com
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Editor Cursors
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
new GuiCursor(EditorHandCursor)
|
||||
{
|
||||
hotSpot = "7 0";
|
||||
bitmapName = "gui/CUR_hand.png";
|
||||
};
|
||||
|
||||
new GuiCursor(EditorRotateCursor)
|
||||
{
|
||||
hotSpot = "11 18";
|
||||
bitmapName = "gui/CUR_rotate.png";
|
||||
};
|
||||
|
||||
new GuiCursor(EditorMoveCursor)
|
||||
{
|
||||
hotSpot = "9 13";
|
||||
bitmapName = "gui/CUR_grab.png";
|
||||
};
|
||||
|
||||
new GuiCursor(EditorArrowCursor)
|
||||
{
|
||||
hotSpot = "0 0";
|
||||
bitmapName = "gui/CUR_3darrow.png";
|
||||
};
|
||||
|
||||
new GuiCursor(EditorUpDownCursor)
|
||||
{
|
||||
hotSpot = "5 10";
|
||||
bitmapName = "gui/CUR_3dupdown";
|
||||
};
|
||||
new GuiCursor(EditorLeftRightCursor)
|
||||
{
|
||||
hotSpot = "9 5";
|
||||
bitmapName = "gui/CUR_3dleftright";
|
||||
};
|
||||
|
||||
new GuiCursor(EditorDiagRightCursor)
|
||||
{
|
||||
hotSpot = "8 8";
|
||||
bitmapName = "gui/CUR_3ddiagright";
|
||||
};
|
||||
|
||||
new GuiCursor(EditorDiagLeftCursor)
|
||||
{
|
||||
hotSpot = "8 8";
|
||||
bitmapName = "gui/CUR_3ddiagleft";
|
||||
};
|
||||
|
||||
new GuiControl(EmptyControl)
|
||||
{
|
||||
profile = "GuiButtonProfile";
|
||||
};
|
||||
|
||||
|
||||
718
docs/base/@vl2/scripts.vl2/scripts/damageTypes.cs
Normal file
718
docs/base/@vl2/scripts.vl2/scripts/damageTypes.cs
Normal file
|
|
@ -0,0 +1,718 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// TYPES OF ALLOWED DAMAGE
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
$DamageType::Default = 0;
|
||||
$DamageType::Blaster = 1;
|
||||
$DamageType::Plasma = 2;
|
||||
$DamageType::Bullet = 3;
|
||||
$DamageType::Disc = 4;
|
||||
$DamageType::Grenade = 5;
|
||||
$DamageType::Laser = 6; // NOTE: This value is referenced directly in code. DO NOT CHANGE!
|
||||
$DamageType::ELF = 7;
|
||||
$DamageType::Mortar = 8;
|
||||
$DamageType::Missile = 9;
|
||||
$DamageType::ShockLance = 10;
|
||||
$DamageType::Mine = 11;
|
||||
$DamageType::Explosion = 12;
|
||||
$DamageType::Impact = 13; // Object to object collisions
|
||||
$DamageType::Ground = 14; // Object to ground collisions
|
||||
$DamageType::Turret = 15;
|
||||
|
||||
$DamageType::PlasmaTurret = 16;
|
||||
$DamageType::AATurret = 17;
|
||||
$DamageType::ElfTurret = 18;
|
||||
$DamageType::MortarTurret = 19;
|
||||
$DamageType::MissileTurret = 20;
|
||||
$DamageType::IndoorDepTurret = 21;
|
||||
$DamageType::OutdoorDepTurret = 22;
|
||||
$DamageType::SentryTurret = 23;
|
||||
|
||||
$DamageType::OutOfBounds = 24;
|
||||
$DamageType::Lava = 25;
|
||||
|
||||
$DamageType::ShrikeBlaster = 26;
|
||||
$DamageType::BellyTurret = 27;
|
||||
$DamageType::BomberBombs = 28;
|
||||
$DamageType::TankChaingun = 29;
|
||||
$DamageType::TankMortar = 30;
|
||||
$DamageType::SatchelCharge = 31;
|
||||
$DamageType::MPBMissile = 32;
|
||||
$DamageType::Lightning = 33;
|
||||
$DamageType::VehicleSpawn = 34;
|
||||
$DamageType::ForceFieldPowerup = 35;
|
||||
$DamageType::Crash = 36;
|
||||
|
||||
// DMM -- added so MPBs that blow up under water get a message
|
||||
$DamageType::Water = 97;
|
||||
|
||||
//Tinman - used in Hunters for cheap bastards ;)
|
||||
$DamageType::NexusCamping = 98;
|
||||
|
||||
// MES -- added so CTRL-K can get a distinctive message
|
||||
$DamageType::Suicide = 99;
|
||||
|
||||
// Etc, etc.
|
||||
|
||||
$DamageTypeText[0] = 'default';
|
||||
$DamageTypeText[1] = 'blaster';
|
||||
$DamageTypeText[2] = 'plasma';
|
||||
$DamageTypeText[3] = 'chaingun';
|
||||
$DamageTypeText[4] = 'disc';
|
||||
$DamageTypeText[5] = 'grenade';
|
||||
$DamageTypeText[6] = 'laser';
|
||||
$DamageTypeText[7] = 'ELF';
|
||||
$DamageTypeText[8] = 'mortar';
|
||||
$DamageTypeText[9] = 'missile';
|
||||
$DamageTypeText[10] = 'shocklance';
|
||||
$DamageTypeText[11] = 'mine';
|
||||
$DamageTypeText[12] = 'explosion';
|
||||
$DamageTypeText[13] = 'impact';
|
||||
$DamageTypeText[14] = 'ground';
|
||||
$DamageTypeText[15] = 'turret';
|
||||
$DamageTypeText[16] = 'plasma turret';
|
||||
$DamageTypeText[17] = 'AA turret';
|
||||
$DamageTypeText[18] = 'ELF turret';
|
||||
$DamageTypeText[19] = 'mortar turret';
|
||||
$DamageTypeText[20] = 'missile turret';
|
||||
$DamageTypeText[21] = 'clamp turret';
|
||||
$DamageTypeText[22] = 'spike turret';
|
||||
$DamageTypeText[23] = 'sentry turret';
|
||||
$DamageTypeText[24] = 'out of bounds';
|
||||
$DamageTypeText[25] = 'lava';
|
||||
$DamageTypeText[26] = 'shrike blaster';
|
||||
$DamageTypeText[27] = 'belly turret';
|
||||
$DamageTypeText[28] = 'bomber bomb';
|
||||
$DamageTypeText[29] = 'tank chaingun';
|
||||
$DamageTypeText[30] = 'tank mortar';
|
||||
$DamageTypeText[31] = 'satchel charge';
|
||||
$DamageTypeText[32] = 'MPB missile';
|
||||
$DamageTypeText[33] = 'lighting';
|
||||
$DamageTypeText[35] = 'ForceField';
|
||||
$DamageTypeText[36] = 'Crash';
|
||||
$DamageTypeText[98] = 'nexus camping';
|
||||
$DamageTypeText[99] = 'suicide';
|
||||
|
||||
|
||||
// ##### PLEASE DO NOT REORDER THE DAMAGE PROFILE TABLES BELOW #####
|
||||
// (They are set up in the same order as the "Weapons Matrix.xls" sheet for ease of reference when balancing)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// VEHICLE DAMAGE PROFILES
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//**** SHRIKE SCOUT FIGHTER ****
|
||||
datablock SimDataBlock(ShrikeDamageProfile)
|
||||
{
|
||||
shieldDamageScale[$DamageType::Blaster] = 1.75;
|
||||
shieldDamageScale[$DamageType::Bullet] = 1.75;
|
||||
shieldDamageScale[$DamageType::ELF] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShockLance] = 0.5;
|
||||
shieldDamageScale[$DamageType::Laser] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShrikeBlaster] = 4.0;
|
||||
shieldDamageScale[$DamageType::BellyTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::AATurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::IndoorDepTurret] = 2.5;
|
||||
shieldDamageScale[$DamageType::OutdoorDepTurret] = 2.5;
|
||||
shieldDamageScale[$DamageType::SentryTurret] = 2.5;
|
||||
shieldDamageScale[$DamageType::Disc] = 1.5;
|
||||
shieldDamageScale[$DamageType::Grenade] = 1.0;
|
||||
shieldDamageScale[$DamageType::Mine] = 3.0;
|
||||
shieldDamageScale[$DamageType::Missile] = 3.0;
|
||||
shieldDamageScale[$DamageType::Mortar] = 2.0;
|
||||
shieldDamageScale[$DamageType::Plasma] = 1.0;
|
||||
shieldDamageScale[$DamageType::BomberBombs] = 3.0;
|
||||
shieldDamageScale[$DamageType::TankChaingun] = 3.0;
|
||||
shieldDamageScale[$DamageType::TankMortar] = 2.0;
|
||||
shieldDamageScale[$DamageType::MissileTurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::MortarTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::SatchelCharge] = 3.5;
|
||||
shieldDamageScale[$DamageType::Default] = 1.0;
|
||||
shieldDamageScale[$DamageType::Impact] = 1.1;
|
||||
shieldDamageScale[$DamageType::Ground] = 1.0;
|
||||
shieldDamageScale[$DamageType::Explosion] = 3.0;
|
||||
shieldDamageScale[$DamageType::Lightning] = 10.0;
|
||||
|
||||
damageScale[$DamageType::Blaster] = 1.0;
|
||||
damageScale[$DamageType::Bullet] = 1.0;
|
||||
damageScale[$DamageType::ELF] = 0.0;
|
||||
damageScale[$DamageType::ShockLance] = 0.50;
|
||||
damageScale[$DamageType::Laser] = 1.0;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 3.5;
|
||||
damageScale[$DamageType::BellyTurret] = 1.2;
|
||||
damageScale[$DamageType::AATurret] = 1.5;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.5;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.5;
|
||||
damageScale[$DamageType::SentryTurret] = 1.5;
|
||||
damageScale[$DamageType::Disc] = 1.25;
|
||||
damageScale[$DamageType::Grenade] = 0.75;
|
||||
damageScale[$DamageType::Mine] = 4.0;
|
||||
damageScale[$DamageType::Missile] = 2.0;
|
||||
damageScale[$DamageType::Mortar] = 2.0;
|
||||
damageScale[$DamageType::Plasma] = 0.5;
|
||||
damageScale[$DamageType::BomberBombs] = 2.0;
|
||||
damageScale[$DamageType::TankChaingun] = 2.0;
|
||||
damageScale[$DamageType::TankMortar] = 2.0;
|
||||
damageScale[$DamageType::MissileTurret] = 1.5;
|
||||
damageScale[$DamageType::MortarTurret] = 2.0;
|
||||
damageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
damageScale[$DamageType::SatchelCharge] = 3.5;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 1.1;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 2.0;
|
||||
damageScale[$DamageType::Lightning] = 10.0;
|
||||
};
|
||||
|
||||
//**** THUNDERSWORD BOMBER ****
|
||||
datablock SimDataBlock(BomberDamageProfile)
|
||||
{
|
||||
shieldDamageScale[$DamageType::Blaster] = 1.0;
|
||||
shieldDamageScale[$DamageType::Bullet] = 1.0;
|
||||
shieldDamageScale[$DamageType::ELF] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShockLance] = 0.5;
|
||||
shieldDamageScale[$DamageType::Laser] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShrikeBlaster] = 3.5;
|
||||
shieldDamageScale[$DamageType::BellyTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::AATurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::IndoorDepTurret] = 2.25;
|
||||
shieldDamageScale[$DamageType::OutdoorDepTurret] = 2.25;
|
||||
shieldDamageScale[$DamageType::SentryTurret] = 2.25;
|
||||
shieldDamageScale[$DamageType::Disc] = 1.0;
|
||||
shieldDamageScale[$DamageType::Grenade] = 1.0;
|
||||
shieldDamageScale[$DamageType::Mine] = 3.0;
|
||||
shieldDamageScale[$DamageType::Missile] = 3.0;
|
||||
shieldDamageScale[$DamageType::Mortar] = 2.0;
|
||||
shieldDamageScale[$DamageType::Plasma] = 1.0;
|
||||
shieldDamageScale[$DamageType::BomberBombs] = 3.0;
|
||||
shieldDamageScale[$DamageType::TankChaingun] = 3.0;
|
||||
shieldDamageScale[$DamageType::TankMortar] = 2.0;
|
||||
shieldDamageScale[$DamageType::MissileTurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::MortarTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::SatchelCharge] = 3.5;
|
||||
shieldDamageScale[$DamageType::Default] = 1.0;
|
||||
shieldDamageScale[$DamageType::Impact] = 0.8;
|
||||
shieldDamageScale[$DamageType::Ground] = 1.0;
|
||||
shieldDamageScale[$DamageType::Explosion] = 3.0;
|
||||
shieldDamageScale[$DamageType::Lightning] = 10.0;
|
||||
|
||||
damageScale[$DamageType::Blaster] = 0.75;
|
||||
damageScale[$DamageType::Bullet] = 0.75;
|
||||
damageScale[$DamageType::ELF] = 0.0;
|
||||
damageScale[$DamageType::ShockLance] = 0.50;
|
||||
damageScale[$DamageType::Laser] = 1.0;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 2.5;
|
||||
damageScale[$DamageType::BellyTurret] = 1.2;
|
||||
damageScale[$DamageType::AATurret] = 1.5;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.25;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.25;
|
||||
damageScale[$DamageType::SentryTurret] = 1.25;
|
||||
damageScale[$DamageType::Disc] = 1.0;
|
||||
damageScale[$DamageType::Grenade] = 0.75;
|
||||
damageScale[$DamageType::Mine] = 4.0;
|
||||
damageScale[$DamageType::Missile] = 1.5;
|
||||
damageScale[$DamageType::Mortar] = 2.0;
|
||||
damageScale[$DamageType::Plasma] = 0.5;
|
||||
damageScale[$DamageType::BomberBombs] = 2.0;
|
||||
damageScale[$DamageType::TankChaingun] = 2.0;
|
||||
damageScale[$DamageType::TankMortar] = 2.0;
|
||||
damageScale[$DamageType::MissileTurret] = 1.5;
|
||||
damageScale[$DamageType::MortarTurret] = 2.0;
|
||||
damageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
damageScale[$DamageType::SatchelCharge] = 3.5;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 0.8;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 2.0;
|
||||
damageScale[$DamageType::Lightning] = 10.0;
|
||||
};
|
||||
|
||||
//**** HAVOC TRANSPORT ****
|
||||
datablock SimDataBlock(HavocDamageProfile)
|
||||
{
|
||||
shieldDamageScale[$DamageType::Blaster] = 1.0;
|
||||
shieldDamageScale[$DamageType::Bullet] = 1.0;
|
||||
shieldDamageScale[$DamageType::ELF] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShockLance] = 0.5;
|
||||
shieldDamageScale[$DamageType::Laser] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShrikeBlaster] = 3.5;
|
||||
shieldDamageScale[$DamageType::BellyTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::AATurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::IndoorDepTurret] = 2.25;
|
||||
shieldDamageScale[$DamageType::OutdoorDepTurret] = 2.25;
|
||||
shieldDamageScale[$DamageType::SentryTurret] = 2.25;
|
||||
shieldDamageScale[$DamageType::Disc] = 1.0;
|
||||
shieldDamageScale[$DamageType::Grenade] = 1.0;
|
||||
shieldDamageScale[$DamageType::Mine] = 3.0;
|
||||
shieldDamageScale[$DamageType::Missile] = 3.0;
|
||||
shieldDamageScale[$DamageType::Mortar] = 2.0;
|
||||
shieldDamageScale[$DamageType::Plasma] = 1.0;
|
||||
shieldDamageScale[$DamageType::BomberBombs] = 3.0;
|
||||
shieldDamageScale[$DamageType::TankChaingun] = 3.0;
|
||||
shieldDamageScale[$DamageType::TankMortar] = 2.0;
|
||||
shieldDamageScale[$DamageType::MissileTurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::MortarTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::SatchelCharge] = 3.5;
|
||||
shieldDamageScale[$DamageType::Default] = 1.0;
|
||||
shieldDamageScale[$DamageType::Impact] = 0.5;
|
||||
shieldDamageScale[$DamageType::Ground] = 1.0;
|
||||
shieldDamageScale[$DamageType::Explosion] = 3.0;
|
||||
shieldDamageScale[$DamageType::Lightning] = 10.0;
|
||||
|
||||
damageScale[$DamageType::Blaster] = 0.75;
|
||||
damageScale[$DamageType::Bullet] = 0.75;
|
||||
damageScale[$DamageType::ELF] = 0.0;
|
||||
damageScale[$DamageType::ShockLance] = 0.50;
|
||||
damageScale[$DamageType::Laser] = 1.0;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 2.5;
|
||||
damageScale[$DamageType::BellyTurret] = 1.2;
|
||||
damageScale[$DamageType::AATurret] = 1.5;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.25;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.25;
|
||||
damageScale[$DamageType::SentryTurret] = 1.25;
|
||||
damageScale[$DamageType::Disc] = 1.0;
|
||||
damageScale[$DamageType::Grenade] = 0.75;
|
||||
damageScale[$DamageType::Mine] = 4.0;
|
||||
damageScale[$DamageType::Missile] = 1.5;
|
||||
damageScale[$DamageType::Mortar] = 2.0;
|
||||
damageScale[$DamageType::Plasma] = 0.5;
|
||||
damageScale[$DamageType::BomberBombs] = 2.0;
|
||||
damageScale[$DamageType::TankChaingun] = 2.0;
|
||||
damageScale[$DamageType::TankMortar] = 2.0;
|
||||
damageScale[$DamageType::MissileTurret] = 1.5;
|
||||
damageScale[$DamageType::MortarTurret] = 2.0;
|
||||
damageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
damageScale[$DamageType::SatchelCharge] = 3.5;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 0.5;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 2.0;
|
||||
damageScale[$DamageType::Lightning] = 10.0;
|
||||
};
|
||||
|
||||
//**** WILDCAT GRAV CYCLE ****
|
||||
datablock SimDataBlock(WildcatDamageProfile)
|
||||
{
|
||||
shieldDamageScale[$DamageType::Blaster] = 2.0;
|
||||
shieldDamageScale[$DamageType::Bullet] = 2.5;
|
||||
shieldDamageScale[$DamageType::ELF] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShockLance] = 1.0;
|
||||
shieldDamageScale[$DamageType::Laser] = 4.0;
|
||||
shieldDamageScale[$DamageType::ShrikeBlaster] = 6.0;
|
||||
shieldDamageScale[$DamageType::BellyTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::AATurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::IndoorDepTurret] = 2.5;
|
||||
shieldDamageScale[$DamageType::OutdoorDepTurret] = 2.5;
|
||||
shieldDamageScale[$DamageType::Disc] = 2.5;
|
||||
shieldDamageScale[$DamageType::Grenade] = 2.0;
|
||||
shieldDamageScale[$DamageType::Mine] = 4.0;
|
||||
shieldDamageScale[$DamageType::Missile] = 4.0;
|
||||
shieldDamageScale[$DamageType::Mortar] = 2.0;
|
||||
shieldDamageScale[$DamageType::Plasma] = 2.0;
|
||||
shieldDamageScale[$DamageType::BomberBombs] = 2.5;
|
||||
shieldDamageScale[$DamageType::TankChaingun] = 3.0;
|
||||
shieldDamageScale[$DamageType::TankMortar] = 2.0;
|
||||
shieldDamageScale[$DamageType::MissileTurret] = 4.0;
|
||||
shieldDamageScale[$DamageType::MortarTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::SatchelCharge] = 3.0;
|
||||
shieldDamageScale[$DamageType::Default] = 1.0;
|
||||
shieldDamageScale[$DamageType::Impact] = 1.25;
|
||||
shieldDamageScale[$DamageType::Ground] = 1.0;
|
||||
shieldDamageScale[$DamageType::Explosion] = 2.0;
|
||||
shieldDamageScale[$DamageType::Lightning] = 5.0;
|
||||
|
||||
damageScale[$DamageType::Blaster] = 1.5;
|
||||
damageScale[$DamageType::Bullet] = 1.2;
|
||||
damageScale[$DamageType::ELF] = 0.0;
|
||||
damageScale[$DamageType::ShockLance] = 0.50;
|
||||
damageScale[$DamageType::Laser] = 2.0;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 4.0;
|
||||
damageScale[$DamageType::BellyTurret] = 1.5;
|
||||
damageScale[$DamageType::AATurret] = 1.0;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::Disc] = 1.25;
|
||||
damageScale[$DamageType::Grenade] = 1.0;
|
||||
damageScale[$DamageType::Mine] = 4.0;
|
||||
damageScale[$DamageType::Missile] = 1.2;
|
||||
damageScale[$DamageType::Mortar] = 1.0;
|
||||
damageScale[$DamageType::Plasma] = 1.5;
|
||||
damageScale[$DamageType::BomberBombs] = 2.0;
|
||||
damageScale[$DamageType::TankChaingun] = 2.0;
|
||||
damageScale[$DamageType::TankMortar] = 1.0;
|
||||
damageScale[$DamageType::MissileTurret] = 1.2;
|
||||
damageScale[$DamageType::MortarTurret] = 1.0;
|
||||
damageScale[$DamageType::PlasmaTurret] = 1.0;
|
||||
damageScale[$DamageType::SatchelCharge] = 2.2;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 1.25;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 1.0;
|
||||
damageScale[$DamageType::Lightning] = 5.0;
|
||||
};
|
||||
|
||||
//**** BEOWULF TANK ****
|
||||
datablock SimDataBlock(TankDamageProfile)
|
||||
{
|
||||
shieldDamageScale[$DamageType::Blaster] = 0.6;
|
||||
shieldDamageScale[$DamageType::Bullet] = 0.75;
|
||||
shieldDamageScale[$DamageType::ELF] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShockLance] = 0.5;
|
||||
shieldDamageScale[$DamageType::Laser] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShrikeBlaster] = 1.75;
|
||||
shieldDamageScale[$DamageType::BellyTurret] = 1.25;
|
||||
shieldDamageScale[$DamageType::AATurret] = 0.8;
|
||||
shieldDamageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::Disc] = 0.8;
|
||||
shieldDamageScale[$DamageType::Grenade] = 0.8;
|
||||
shieldDamageScale[$DamageType::Mine] = 3.25;
|
||||
shieldDamageScale[$DamageType::Missile] = 2.0;
|
||||
shieldDamageScale[$DamageType::Mortar] = 1.7;
|
||||
shieldDamageScale[$DamageType::Plasma] = 1.0;
|
||||
shieldDamageScale[$DamageType::BomberBombs] = 1.5;
|
||||
shieldDamageScale[$DamageType::TankChaingun] = 1.5;
|
||||
shieldDamageScale[$DamageType::TankMortar] = 1.8;
|
||||
shieldDamageScale[$DamageType::MissileTurret] = 1.25;
|
||||
shieldDamageScale[$DamageType::MortarTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::PlasmaTurret] = 1.25;
|
||||
shieldDamageScale[$DamageType::SatchelCharge] = 2.0;
|
||||
shieldDamageScale[$DamageType::Default] = 1.0;
|
||||
shieldDamageScale[$DamageType::Impact] = 0.75;
|
||||
shieldDamageScale[$DamageType::Ground] = 0.75;
|
||||
shieldDamageScale[$DamageType::Explosion] = 2.0;
|
||||
shieldDamageScale[$DamageType::Lightning] = 10.0;
|
||||
|
||||
damageScale[$DamageType::Blaster] = 0.75;
|
||||
damageScale[$DamageType::Bullet] = 0.75;
|
||||
damageScale[$DamageType::ELF] = 0.0;
|
||||
damageScale[$DamageType::ShockLance] = 0.50;
|
||||
damageScale[$DamageType::Laser] = 1.0;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 2.0;
|
||||
damageScale[$DamageType::BellyTurret] = 1.0;
|
||||
damageScale[$DamageType::AATurret] = 1.0;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::Disc] = 1.0;
|
||||
damageScale[$DamageType::Grenade] = 1.0;
|
||||
damageScale[$DamageType::Mine] = 2.25;
|
||||
damageScale[$DamageType::Missile] = 1.25;
|
||||
damageScale[$DamageType::Mortar] = 1.4;
|
||||
damageScale[$DamageType::Plasma] = 0.5;
|
||||
damageScale[$DamageType::BomberBombs] = 1.0;
|
||||
damageScale[$DamageType::TankChaingun] = 0.75;
|
||||
damageScale[$DamageType::TankMortar] = 1.6;
|
||||
damageScale[$DamageType::MissileTurret] = 1.25;
|
||||
damageScale[$DamageType::MortarTurret] = 1.0;
|
||||
damageScale[$DamageType::PlasmaTurret] = 1.0;
|
||||
damageScale[$DamageType::SatchelCharge] = 2.0;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 0.75;
|
||||
damageScale[$DamageType::Ground] = 0.75;
|
||||
damageScale[$DamageType::Explosion] = 1.0;
|
||||
damageScale[$DamageType::Lightning] = 10.0;
|
||||
};
|
||||
|
||||
//**** JERICHO MPB ****
|
||||
datablock SimDataBlock(MPBDamageProfile)
|
||||
{
|
||||
shieldDamageScale[$DamageType::Blaster] = 0.6;
|
||||
shieldDamageScale[$DamageType::Bullet] = 0.75;
|
||||
shieldDamageScale[$DamageType::ELF] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShockLance] = 0.5;
|
||||
shieldDamageScale[$DamageType::Laser] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShrikeBlaster] = 1.75;
|
||||
shieldDamageScale[$DamageType::BellyTurret] = 1.25;
|
||||
shieldDamageScale[$DamageType::AATurret] = 0.8;
|
||||
shieldDamageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::Disc] = 0.8;
|
||||
shieldDamageScale[$DamageType::Grenade] = 0.8;
|
||||
shieldDamageScale[$DamageType::Mine] = 3.25;
|
||||
shieldDamageScale[$DamageType::Missile] = 2.0;
|
||||
shieldDamageScale[$DamageType::Mortar] = 0.8;
|
||||
shieldDamageScale[$DamageType::Plasma] = 1.0;
|
||||
shieldDamageScale[$DamageType::BomberBombs] = 1.5;
|
||||
shieldDamageScale[$DamageType::TankChaingun] = 1.5;
|
||||
shieldDamageScale[$DamageType::TankMortar] = 1.4;
|
||||
shieldDamageScale[$DamageType::MissileTurret] = 1.25;
|
||||
shieldDamageScale[$DamageType::MortarTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::PlasmaTurret] = 1.25;
|
||||
shieldDamageScale[$DamageType::SatchelCharge] = 2.0;
|
||||
shieldDamageScale[$DamageType::Default] = 1.0;
|
||||
shieldDamageScale[$DamageType::Impact] = 0.5;
|
||||
shieldDamageScale[$DamageType::Ground] = 0.5;
|
||||
shieldDamageScale[$DamageType::Explosion] = 2.0;
|
||||
shieldDamageScale[$DamageType::Lightning] = 10.0;
|
||||
|
||||
damageScale[$DamageType::Blaster] = 0.75;
|
||||
damageScale[$DamageType::Bullet] = 0.75;
|
||||
damageScale[$DamageType::ELF] = 0.0;
|
||||
damageScale[$DamageType::ShockLance] = 0.50;
|
||||
damageScale[$DamageType::Laser] = 1.0;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 2.0;
|
||||
damageScale[$DamageType::BellyTurret] = 1.0;
|
||||
damageScale[$DamageType::AATurret] = 1.0;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::Disc] = 1.0;
|
||||
damageScale[$DamageType::Grenade] = 1.0;
|
||||
damageScale[$DamageType::Mine] = 2.25;
|
||||
damageScale[$DamageType::Missile] = 1.25;
|
||||
damageScale[$DamageType::Mortar] = 1.0;
|
||||
damageScale[$DamageType::Plasma] = 0.5;
|
||||
damageScale[$DamageType::BomberBombs] = 1.0;
|
||||
damageScale[$DamageType::TankChaingun] = 0.75;
|
||||
damageScale[$DamageType::TankMortar] = 1.0;
|
||||
damageScale[$DamageType::MissileTurret] = 1.25;
|
||||
damageScale[$DamageType::MortarTurret] = 1.0;
|
||||
damageScale[$DamageType::PlasmaTurret] = 1.0;
|
||||
damageScale[$DamageType::SatchelCharge] = 2.0;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 0.5;
|
||||
damageScale[$DamageType::Ground] = 0.5;
|
||||
damageScale[$DamageType::Explosion] = 1.0;
|
||||
damageScale[$DamageType::Lightning] = 10.0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// TURRET DAMAGE PROFILES
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
datablock SimDataBlock(TurretDamageProfile)
|
||||
{
|
||||
shieldDamageScale[$DamageType::Blaster] = 0.8;
|
||||
shieldDamageScale[$DamageType::Bullet] = 0.8;
|
||||
shieldDamageScale[$DamageType::ELF] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShockLance] = 0.5;
|
||||
shieldDamageScale[$DamageType::Laser] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShrikeBlaster] = 3.0;
|
||||
shieldDamageScale[$DamageType::BellyTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::AATurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::SentryTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::Disc] = 1.0;
|
||||
shieldDamageScale[$DamageType::Grenade] = 1.5;
|
||||
shieldDamageScale[$DamageType::Mine] = 3.0;
|
||||
shieldDamageScale[$DamageType::Missile] = 3.0;
|
||||
shieldDamageScale[$DamageType::Mortar] = 3.0;
|
||||
shieldDamageScale[$DamageType::Plasma] = 1.0;
|
||||
shieldDamageScale[$DamageType::BomberBombs] = 2.0;
|
||||
shieldDamageScale[$DamageType::TankChaingun] = 1.5;
|
||||
shieldDamageScale[$DamageType::TankMortar] = 3.0;
|
||||
shieldDamageScale[$DamageType::MissileTurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::MortarTurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::SatchelCharge] = 4.5;
|
||||
shieldDamageScale[$DamageType::Default] = 1.0;
|
||||
shieldDamageScale[$DamageType::Impact] = 1.0;
|
||||
shieldDamageScale[$DamageType::Ground] = 1.0;
|
||||
shieldDamageScale[$DamageType::Explosion] = 2.0;
|
||||
shieldDamageScale[$DamageType::Lightning] = 5.0;
|
||||
|
||||
damageScale[$DamageType::Blaster] = 0.8;
|
||||
damageScale[$DamageType::Bullet] = 0.9;
|
||||
damageScale[$DamageType::ELF] = 0.0;
|
||||
damageScale[$DamageType::ShockLance] = 0.50;
|
||||
damageScale[$DamageType::Laser] = 1.0;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 1.0;
|
||||
damageScale[$DamageType::BellyTurret] = 0.6;
|
||||
damageScale[$DamageType::AATurret] = 1.0;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::SentryTurret] = 1.0;
|
||||
damageScale[$DamageType::Disc] = 1.1;
|
||||
damageScale[$DamageType::Grenade] = 1.0;
|
||||
damageScale[$DamageType::Mine] = 1.5;
|
||||
damageScale[$DamageType::Missile] = 1.25;
|
||||
damageScale[$DamageType::Mortar] = 1.25;
|
||||
damageScale[$DamageType::Plasma] = 0.75;
|
||||
damageScale[$DamageType::BomberBombs] = 1.0;
|
||||
damageScale[$DamageType::TankChaingun] = 1.25;
|
||||
damageScale[$DamageType::TankMortar] = 1.25;
|
||||
damageScale[$DamageType::MissileTurret] = 1.25;
|
||||
damageScale[$DamageType::MortarTurret] = 1.25;
|
||||
damageScale[$DamageType::PlasmaTurret] = 1.25;
|
||||
damageScale[$DamageType::SatchelCharge] = 1.5;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 1.0;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 1.0;
|
||||
damageScale[$DamageType::Lightning] = 5.0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// STATIC SHAPE DAMAGE PROFILES
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
datablock SimDataBlock(StaticShapeDamageProfile)
|
||||
{
|
||||
shieldDamageScale[$DamageType::Blaster] = 0.8;
|
||||
shieldDamageScale[$DamageType::Bullet] = 1.0;
|
||||
shieldDamageScale[$DamageType::ELF] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShockLance] = 1.0;
|
||||
shieldDamageScale[$DamageType::Laser] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShrikeBlaster] = 2.0;
|
||||
shieldDamageScale[$DamageType::BellyTurret] = 1.5;
|
||||
shieldDamageScale[$DamageType::AATurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::Turret] = 1.0;
|
||||
shieldDamageScale[$DamageType::SentryTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::Disc] = 1.0;
|
||||
shieldDamageScale[$DamageType::Grenade] = 1.2;
|
||||
shieldDamageScale[$DamageType::Mine] = 2.0;
|
||||
shieldDamageScale[$DamageType::Missile] = 3.0;
|
||||
shieldDamageScale[$DamageType::Mortar] = 3.0;
|
||||
shieldDamageScale[$DamageType::Plasma] = 1.5;
|
||||
shieldDamageScale[$DamageType::BomberBombs] = 2.0;
|
||||
shieldDamageScale[$DamageType::TankChaingun] = 1.5;
|
||||
shieldDamageScale[$DamageType::TankMortar] = 3.0;
|
||||
shieldDamageScale[$DamageType::MissileTurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::MortarTurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::SatchelCharge] = 6.0;
|
||||
shieldDamageScale[$DamageType::Default] = 1.0;
|
||||
shieldDamageScale[$DamageType::Impact] = 1.25;
|
||||
shieldDamageScale[$DamageType::Ground] = 1.0;
|
||||
shieldDamageScale[$DamageType::Explosion] = 2.0;
|
||||
shieldDamageScale[$DamageType::Lightning] = 5.0;
|
||||
|
||||
damageScale[$DamageType::Blaster] = 1.0;
|
||||
damageScale[$DamageType::Bullet] = 1.0;
|
||||
damageScale[$DamageType::ELF] = 0.0;
|
||||
damageScale[$DamageType::ShockLance] = 1.0;
|
||||
damageScale[$DamageType::Laser] = 1.0;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 2.0;
|
||||
damageScale[$DamageType::BellyTurret] = 1.2;
|
||||
damageScale[$DamageType::AATurret] = 1.0;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::SentryTurret] = 1.0;
|
||||
damageScale[$DamageType::Disc] = 1.15;
|
||||
damageScale[$DamageType::Grenade] = 1.2;
|
||||
damageScale[$DamageType::Mine] = 2.0;
|
||||
damageScale[$DamageType::Missile] = 2.0;
|
||||
damageScale[$DamageType::Mortar] = 2.0;
|
||||
damageScale[$DamageType::Plasma] = 1.25;
|
||||
damageScale[$DamageType::BomberBombs] = 1.0;
|
||||
damageScale[$DamageType::TankChaingun] = 1.0;
|
||||
damageScale[$DamageType::TankMortar] = 2.0;
|
||||
damageScale[$DamageType::MissileTurret] = 2.0;
|
||||
damageScale[$DamageType::MortarTurret] = 2.0;
|
||||
damageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
damageScale[$DamageType::SatchelCharge] = 4.0;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 1.25;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 1.0;
|
||||
damageScale[$DamageType::Lightning] = 5.0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// PLAYER DAMAGE PROFILES
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
datablock SimDataBlock(LightPlayerDamageProfile)
|
||||
{
|
||||
damageScale[$DamageType::Blaster] = 1.3;
|
||||
damageScale[$DamageType::Bullet] = 1.2;
|
||||
damageScale[$DamageType::ELF] = 0.75;
|
||||
damageScale[$DamageType::ShockLance] = 1.0;
|
||||
damageScale[$DamageType::Laser] = 1.12;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 1.10;
|
||||
damageScale[$DamageType::BellyTurret] = 1.0;
|
||||
damageScale[$DamageType::AATurret] = 0.7;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.3;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.3;
|
||||
damageScale[$DamageType::SentryTurret] = 1.0;
|
||||
damageScale[$DamageType::Disc] = 1.0;
|
||||
damageScale[$DamageType::Grenade] = 1.2;
|
||||
damageScale[$DamageType::Mine] = 1.0;
|
||||
damageScale[$DamageType::Missile] = 1.0;
|
||||
damageScale[$DamageType::Mortar] = 1.3;
|
||||
damageScale[$DamageType::Plasma] = 1.0;
|
||||
damageScale[$DamageType::BomberBombs] = 3.0;
|
||||
damageScale[$DamageType::TankChaingun] = 1.7;
|
||||
damageScale[$DamageType::TankMortar] = 1.0;
|
||||
damageScale[$DamageType::MissileTurret] = 1.0;
|
||||
damageScale[$DamageType::MortarTurret] = 1.3;
|
||||
damageScale[$DamageType::PlasmaTurret] = 1.0;
|
||||
damageScale[$DamageType::SatchelCharge] = 3.0;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 1.2;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 1.0;
|
||||
damageScale[$DamageType::Lightning] = 1.0;
|
||||
};
|
||||
|
||||
datablock SimDataBlock(MediumPlayerDamageProfile)
|
||||
{
|
||||
damageScale[$DamageType::Blaster] = 1.0;
|
||||
damageScale[$DamageType::Bullet] = 1.0;
|
||||
damageScale[$DamageType::ELF] = 0.75;
|
||||
damageScale[$DamageType::ShockLance] = 1.0;
|
||||
damageScale[$DamageType::Laser] = 1.1;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 1.0;
|
||||
damageScale[$DamageType::BellyTurret] = 1.0;
|
||||
damageScale[$DamageType::AATurret] = 0.7;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::SentryTurret] = 1.0;
|
||||
damageScale[$DamageType::Disc] = 0.8;
|
||||
damageScale[$DamageType::Grenade] = 1.0;
|
||||
damageScale[$DamageType::Mine] = 0.9;
|
||||
damageScale[$DamageType::Missile] = 0.8;
|
||||
damageScale[$DamageType::Mortar] = 1.0;
|
||||
damageScale[$DamageType::Plasma] = 0.65;
|
||||
damageScale[$DamageType::BomberBombs] = 3.0;
|
||||
damageScale[$DamageType::TankChaingun] = 1.5;
|
||||
damageScale[$DamageType::TankMortar] = 0.85;
|
||||
damageScale[$DamageType::MissileTurret] = 0.8;
|
||||
damageScale[$DamageType::MortarTurret] = 1.0;
|
||||
damageScale[$DamageType::PlasmaTurret] = 0.65;
|
||||
damageScale[$DamageType::SatchelCharge] = 3.0;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 1.0;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 0.8;
|
||||
damageScale[$DamageType::Lightning] = 1.2;
|
||||
};
|
||||
|
||||
datablock SimDataBlock(HeavyPlayerDamageProfile)
|
||||
{
|
||||
damageScale[$DamageType::Blaster] = 0.7;
|
||||
damageScale[$DamageType::Bullet] = 0.6;
|
||||
damageScale[$DamageType::ELF] = 0.75;
|
||||
damageScale[$DamageType::ShockLance] = 1.0;
|
||||
damageScale[$DamageType::Laser] = 0.67;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 0.8;
|
||||
damageScale[$DamageType::BellyTurret] = 0.8;
|
||||
damageScale[$DamageType::AATurret] = 0.6;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 0.7;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 0.7;
|
||||
damageScale[$DamageType::SentryTurret] = 1.0;
|
||||
damageScale[$DamageType::Disc] = 0.6;
|
||||
damageScale[$DamageType::Grenade] = 0.8;
|
||||
damageScale[$DamageType::Mine] = 0.8;
|
||||
damageScale[$DamageType::Missile] = 0.6;
|
||||
damageScale[$DamageType::Mortar] = 0.7;
|
||||
damageScale[$DamageType::Plasma] = 0.4;
|
||||
damageScale[$DamageType::BomberBombs] = 3.0;
|
||||
damageScale[$DamageType::TankChaingun] = 1.3;
|
||||
damageScale[$DamageType::TankMortar] = 0.7;
|
||||
damageScale[$DamageType::MissileTurret] = 0.6;
|
||||
damageScale[$DamageType::MortarTurret] = 0.6;
|
||||
damageScale[$DamageType::PlasmaTurret] = 0.4;
|
||||
damageScale[$DamageType::SatchelCharge] = 3.0;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 0.8;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 0.6;
|
||||
damageScale[$DamageType::Lightning] = 1.4;
|
||||
};
|
||||
384
docs/base/@vl2/scripts.vl2/scripts/deathMessages.cs
Normal file
384
docs/base/@vl2/scripts.vl2/scripts/deathMessages.cs
Normal file
|
|
@ -0,0 +1,384 @@
|
|||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// %1 = Victim's name //
|
||||
// %2 = Victim's gender (value will be either "him" or "her") //
|
||||
// %3 = Victim's possessive gender (value will be either "his" or "her") //
|
||||
// %4 = Killer's name //
|
||||
// %5 = Killer's gender (value will be either "him" or "her") //
|
||||
// %6 = Killer's possessive gender (value will be either "his" or "her") //
|
||||
// %7 = implement that killed the victim (value is the object number of the bullet, disc, etc) //
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$DeathMessageCampingCount = 1;
|
||||
$DeathMessageCamping[0] = '\c0%1 was killed for camping near the Nexus.';
|
||||
|
||||
//Out of Bounds deaths
|
||||
$DeathMessageOOBCount = 1;
|
||||
$DeathMessageOOB[0] = '\c0%1 was killed for loitering outside the mission area.';
|
||||
|
||||
$DeathMessageLavaCount = 4;
|
||||
$DeathMessageLava[0] = '\c0%1\'s last thought before falling into the lava : \'Oops\'.';
|
||||
$DeathMessageLava[1] = '\c0%1 makes the supreme sacrifice to the lava gods.';
|
||||
$DeathMessageLava[2] = '\c0%1 looks surprised by the lava - but only briefly.';
|
||||
$DeathMessageLava[3] = '\c0%1 wimps out by jumping into the lava and trying to make it look like an accident.';
|
||||
|
||||
$DeathMessageLightningCount = 3;
|
||||
$DeathMessageLightning[0] = '\c0%1 was killed by lightning!';
|
||||
$DeathMessageLightning[1] = '\c0%1 caught a lightning bolt!';
|
||||
$DeathMessageLightning[2] = '\c0%1 stuck %3 finger in Mother Nature\'s light socket.';
|
||||
|
||||
//these used when a player presses ctrl-k
|
||||
$DeathMessageSuicideCount = 5;
|
||||
$DeathMessageSuicide[0] = '\c0%1 blows %3 own head off!';
|
||||
$DeathMessageSuicide[1] = '\c0%1 ends it all. Cue violin music.';
|
||||
$DeathMessageSuicide[2] = '\c0%1 kills %2self.';
|
||||
$DeathMessageSuicide[3] = '\c0%1 goes for the quick and dirty respawn.';
|
||||
$DeathMessageSuicide[4] = '\c0%1 self-destructs in a fit of ennui.';
|
||||
|
||||
$DeathMessageVehPadCount = 1;
|
||||
$DeathMessageVehPad[0] = '\c0%1 got caught in a vehicle\'s spawn field.';
|
||||
|
||||
$DeathMessageFFPowerupCount = 1;
|
||||
$DeathMessageFFPowerup[0] = '\c0%1 got caught up in a forcefield during power up.';
|
||||
|
||||
$DeathMessageRogueMineCount = 1;
|
||||
$DeathMessageRogueMine[$DamageType::Mine, 0] = '\c0%1 is all mine.';
|
||||
|
||||
//these used when a player kills himself (other than by using ctrl - k)
|
||||
$DeathMessageSelfKillCount = 5;
|
||||
$DeathMessageSelfKill[$DamageType::Blaster, 0] = '\c0%1 kills %2self with a blaster.';
|
||||
$DeathMessageSelfKill[$DamageType::Blaster, 1] = '\c0%1 makes a note to watch out for blaster ricochets.';
|
||||
$DeathMessageSelfKill[$DamageType::Blaster, 2] = '\c0%1\'s blaster kills its hapless owner.';
|
||||
$DeathMessageSelfKill[$DamageType::Blaster, 3] = '\c0%1 deftly guns %2self down with %3 own blaster.';
|
||||
$DeathMessageSelfKill[$DamageType::Blaster, 4] = '\c0%1 has a fatal encounter with %3 own blaster.';
|
||||
|
||||
$DeathMessageSelfKill[$DamageType::Plasma, 0] = '\c0%1 kills %2self with plasma.';
|
||||
$DeathMessageSelfKill[$DamageType::Plasma, 1] = '\c0%1 turns %2self into plasma-charred briquettes.';
|
||||
$DeathMessageSelfKill[$DamageType::Plasma, 2] = '\c0%1 swallows a white-hot mouthful of %3 own plasma.';
|
||||
$DeathMessageSelfKill[$DamageType::Plasma, 3] = '\c0%1 immolates %2self.';
|
||||
$DeathMessageSelfKill[$DamageType::Plasma, 4] = '\c0%1 experiences the joy of cooking %2self.';
|
||||
|
||||
$DeathMessageSelfKill[$DamageType::Disc, 0] = '\c0%1 kills %2self with a disc.';
|
||||
$DeathMessageSelfKill[$DamageType::Disc, 1] = '\c0%1 catches %3 own spinfusor disc.';
|
||||
$DeathMessageSelfKill[$DamageType::Disc, 2] = '\c0%1 heroically falls on %3 own disc.';
|
||||
$DeathMessageSelfKill[$DamageType::Disc, 3] = '\c0%1 helpfully jumps into %3 own disc\'s explosion.';
|
||||
$DeathMessageSelfKill[$DamageType::Disc, 4] = '\c0%1 plays Russian roulette with %3 spinfusor.';
|
||||
|
||||
$DeathMessageSelfKill[$DamageType::Grenade, 0] = '\c0%1 destroys %2self with a grenade!'; //applies to hand grenades *and* grenade launcher grenades
|
||||
$DeathMessageSelfKill[$DamageType::Grenade, 1] = '\c0%1 took a bad bounce from %3 own grenade!';
|
||||
$DeathMessageSelfKill[$DamageType::Grenade, 2] = '\c0%1 pulled the pin a shade early.';
|
||||
$DeathMessageSelfKill[$DamageType::Grenade, 3] = '\c0%1\'s own grenade turns on %2.';
|
||||
$DeathMessageSelfKill[$DamageType::Grenade, 4] = '\c0%1 blows %2self up real good.';
|
||||
|
||||
$DeathMessageSelfKill[$DamageType::Mortar, 0] = '\c0%1 kills %2self with a mortar!';
|
||||
$DeathMessageSelfKill[$DamageType::Mortar, 1] = '\c0%1 hugs %3 own big green boomie.';
|
||||
$DeathMessageSelfKill[$DamageType::Mortar, 2] = '\c0%1 mortars %2self all over the map.';
|
||||
$DeathMessageSelfKill[$DamageType::Mortar, 3] = '\c0%1 experiences %3 mortar\'s payload up close.';
|
||||
$DeathMessageSelfKill[$DamageType::Mortar, 4] = '\c0%1 suffered the wrath of %3 own mortar.';
|
||||
|
||||
$DeathMessageSelfKill[$DamageType::Missile, 0] = '\c0%1 kills %2self with a missile!';
|
||||
$DeathMessageSelfKill[$DamageType::Missile, 1] = '\c0%1 runs a missile up %3 own tailpipe.';
|
||||
$DeathMessageSelfKill[$DamageType::Missile, 2] = '\c0%1 tests the missile\'s shaped charge on %2self.';
|
||||
$DeathMessageSelfKill[$DamageType::Missile, 3] = '\c0%1 achieved missile lock on %2self.';
|
||||
$DeathMessageSelfKill[$DamageType::Missile, 4] = '\c0%1 gracefully smoked %2self with a missile!';
|
||||
|
||||
$DeathMessageSelfKill[$DamageType::Mine, 0] = '\c0%1 kills %2self with a mine!';
|
||||
$DeathMessageSelfKill[$DamageType::Mine, 1] = '\c0%1\'s mine violently reminds %2 of its existence.';
|
||||
$DeathMessageSelfKill[$DamageType::Mine, 2] = '\c0%1 plants a decisive foot on %3 own mine!';
|
||||
$DeathMessageSelfKill[$DamageType::Mine, 3] = '\c0%1 fatally trips on %3 own mine!';
|
||||
$DeathMessageSelfKill[$DamageType::Mine, 4] = '\c0%1 makes a note not to run over %3 own mines.';
|
||||
|
||||
$DeathMessageSelfKill[$DamageType::SatchelCharge, 0] = '\c0%1 goes out with a bang!'; //applies to most explosion types
|
||||
$DeathMessageSelfKill[$DamageType::SatchelCharge, 1] = '\c0%1 fall down...go boom.';
|
||||
$DeathMessageSelfKill[$DamageType::SatchelCharge, 2] = '\c0%1 explodes in that fatal kind of way.';
|
||||
$DeathMessageSelfKill[$DamageType::SatchelCharge, 3] = '\c0%1 experiences explosive decompression!';
|
||||
$DeathMessageSelfKill[$DamageType::SatchelCharge, 4] = '\c0%1 splashes all over the map.';
|
||||
|
||||
$DeathMessageSelfKill[$DamageType::Ground, 0] = '\c0%1 lands too hard.';
|
||||
$DeathMessageSelfKill[$DamageType::Ground, 1] = '\c0%1 finds gravity unforgiving.';
|
||||
$DeathMessageSelfKill[$DamageType::Ground, 2] = '\c0%1 craters on impact.';
|
||||
$DeathMessageSelfKill[$DamageType::Ground, 3] = '\c0%1 pancakes upon landing.';
|
||||
$DeathMessageSelfKill[$DamageType::Ground, 4] = '\c0%1 loses a game of chicken with the ground.';
|
||||
|
||||
|
||||
//used when a player is killed by a teammate
|
||||
$DeathMessageTeamKillCount = 1;
|
||||
$DeathMessageTeamKill[$DamageType::Blaster, 0] = '\c0%4 TEAMKILLED %1 with a blaster!';
|
||||
$DeathMessageTeamKill[$DamageType::Plasma, 0] = '\c0%4 TEAMKILLED %1 with a plasma rifle!';
|
||||
$DeathMessageTeamKill[$DamageType::Bullet, 0] = '\c0%4 TEAMKILLED %1 with a chaingun!';
|
||||
$DeathMessageTeamKill[$DamageType::Disc, 0] = '\c0%4 TEAMKILLED %1 with a spinfusor!';
|
||||
$DeathMessageTeamKill[$DamageType::Grenade, 0] = '\c0%4 TEAMKILLED %1 with a grenade!';
|
||||
$DeathMessageTeamKill[$DamageType::Laser, 0] = '\c0%4 TEAMKILLED %1 with a laser rifle!';
|
||||
$DeathMessageTeamKill[$DamageType::Elf, 0] = '\c0%4 TEAMKILLED %1 with an ELF projector!';
|
||||
$DeathMessageTeamKill[$DamageType::Mortar, 0] = '\c0%4 TEAMKILLED %1 with a mortar!';
|
||||
$DeathMessageTeamKill[$DamageType::Missile, 0] = '\c0%4 TEAMKILLED %1 with a missile!';
|
||||
$DeathMessageTeamKill[$DamageType::Shocklance, 0] = '\c0%4 TEAMKILLED %1 with a shocklance!';
|
||||
$DeathMessageTeamKill[$DamageType::Mine, 0] = '\c0%4 TEAMKILLED %1 with a mine!';
|
||||
$DeathMessageTeamKill[$DamageType::SatchelCharge, 0] = '\c0%4 blew up TEAMMATE %1!';
|
||||
$DeathMessageTeamKill[$DamageType::Impact, 0] = '\c0%4 runs down TEAMMATE %1!';
|
||||
|
||||
|
||||
|
||||
//these used when a player is killed by an enemy
|
||||
$DeathMessageCount = 5;
|
||||
$DeathMessage[$DamageType::Blaster, 0] = '\c0%4 kills %1 with a blaster.';
|
||||
$DeathMessage[$DamageType::Blaster, 1] = '\c0%4 pings %1 to death.';
|
||||
$DeathMessage[$DamageType::Blaster, 2] = '\c0%1 gets a pointer in blaster use from %4.';
|
||||
$DeathMessage[$DamageType::Blaster, 3] = '\c0%4 fatally embarrasses %1 with %6 pea shooter.';
|
||||
$DeathMessage[$DamageType::Blaster, 4] = '\c0%4 unleashes a terminal blaster barrage into %1.';
|
||||
|
||||
$DeathMessage[$DamageType::Plasma, 0] = '\c0%4 roasts %1 with the plasma rifle.';
|
||||
$DeathMessage[$DamageType::Plasma, 1] = '\c0%4 gooses %1 with an extra-friendly burst of plasma.';
|
||||
$DeathMessage[$DamageType::Plasma, 2] = '\c0%4 entices %1 to try a faceful of plasma.';
|
||||
$DeathMessage[$DamageType::Plasma, 3] = '\c0%4 introduces %1 to the plasma immolation dance.';
|
||||
$DeathMessage[$DamageType::Plasma, 4] = '\c0%4 slaps The Hot Kiss of Death on %1.';
|
||||
|
||||
$DeathMessage[$DamageType::Bullet, 0] = '\c0%4 rips %1 up with the chaingun.';
|
||||
$DeathMessage[$DamageType::Bullet, 1] = '\c0%4 happily chews %1 into pieces with %6 chaingun.';
|
||||
$DeathMessage[$DamageType::Bullet, 2] = '\c0%4 administers a dose of Vitamin Lead to %1.';
|
||||
$DeathMessage[$DamageType::Bullet, 3] = '\c0%1 suffers a serious hosing from %4\'s chaingun.';
|
||||
$DeathMessage[$DamageType::Bullet, 4] = '\c0%4 bestows the blessings of %6 chaingun on %1.';
|
||||
|
||||
$DeathMessage[$DamageType::Disc, 0] = '\c0%4 demolishes %1 with the spinfusor.';
|
||||
$DeathMessage[$DamageType::Disc, 1] = '\c0%4 serves %1 a blue plate special.';
|
||||
$DeathMessage[$DamageType::Disc, 2] = '\c0%4 shares a little blue friend with %1.';
|
||||
$DeathMessage[$DamageType::Disc, 3] = '\c0%4 puts a little spin into %1.';
|
||||
$DeathMessage[$DamageType::Disc, 4] = '\c0%1 becomes one of %4\'s greatest hits.';
|
||||
|
||||
$DeathMessage[$DamageType::Grenade, 0] = '\c0%4 eliminates %1 with a grenade.'; //applies to hand grenades *and* grenade launcher grenades
|
||||
$DeathMessage[$DamageType::Grenade, 1] = '\c0%4 blows up %1 real good!';
|
||||
$DeathMessage[$DamageType::Grenade, 2] = '\c0%1 gets annihilated by %4\'s grenade.';
|
||||
$DeathMessage[$DamageType::Grenade, 3] = '\c0%1 receives a kaboom lesson from %4.';
|
||||
$DeathMessage[$DamageType::Grenade, 4] = '\c0%4 turns %1 into grenade salad.';
|
||||
|
||||
$DeathMessage[$DamageType::Laser, 0] = '\c0%1 becomes %4\'s latest pincushion.';
|
||||
$DeathMessage[$DamageType::Laser, 1] = '\c0%4 picks off %1 with %6 laser rifle.';
|
||||
$DeathMessage[$DamageType::Laser, 2] = '\c0%4 uses %1 as the targeting dummy in a sniping demonstration.';
|
||||
$DeathMessage[$DamageType::Laser, 3] = '\c0%4 pokes a shiny new hole in %1 with %6 laser rifle.';
|
||||
$DeathMessage[$DamageType::Laser, 4] = '\c0%4 caresses %1 with a couple hundred megajoules of laser.';
|
||||
|
||||
$DeathMessage[$DamageType::Elf, 0] = '\c0%4 fries %1 with the ELF projector.';
|
||||
$DeathMessage[$DamageType::Elf, 1] = '\c0%4 bug zaps %1 with %6 ELF.';
|
||||
$DeathMessage[$DamageType::Elf, 2] = '\c0%1 learns the shocking truth about %4\'s ELF skills.';
|
||||
$DeathMessage[$DamageType::Elf, 3] = '\c0%4 electrocutes %1 without a sponge.';
|
||||
$DeathMessage[$DamageType::Elf, 4] = '\c0%4\'s ELF projector leaves %1 a crispy critter.';
|
||||
|
||||
$DeathMessage[$DamageType::Mortar, 0] = '\c0%4 obliterates %1 with the mortar.';
|
||||
$DeathMessage[$DamageType::Mortar, 1] = '\c0%4 drops a mortar round right in %1\'s lap.';
|
||||
$DeathMessage[$DamageType::Mortar, 2] = '\c0%4 delivers a mortar payload straight to %1.';
|
||||
$DeathMessage[$DamageType::Mortar, 3] = '\c0%4 offers a little "heavy love" to %1.';
|
||||
$DeathMessage[$DamageType::Mortar, 4] = '\c0%1 stumbles into %4\'s mortar reticle.';
|
||||
|
||||
$DeathMessage[$DamageType::Missile, 0] = '\c0%4 intercepts %1 with a missile.';
|
||||
$DeathMessage[$DamageType::Missile, 1] = '\c0%4 watches %6 missile touch %1 and go boom.';
|
||||
$DeathMessage[$DamageType::Missile, 2] = '\c0%4 got sweet tone on %1.';
|
||||
$DeathMessage[$DamageType::Missile, 3] = '\c0By now, %1 has realized %4\'s missile killed %2.';
|
||||
$DeathMessage[$DamageType::Missile, 4] = '\c0%4\'s missile rains little pieces of %1 all over the ground.';
|
||||
|
||||
$DeathMessage[$DamageType::Shocklance, 0] = '\c0%4 reaps a harvest of %1 with the shocklance.';
|
||||
$DeathMessage[$DamageType::Shocklance, 1] = '\c0%4 feeds %1 the business end of %6 shocklance.';
|
||||
$DeathMessage[$DamageType::Shocklance, 2] = '\c0%4 stops %1 dead with the shocklance.';
|
||||
$DeathMessage[$DamageType::Shocklance, 3] = '\c0%4 eliminates %1 in close combat.';
|
||||
$DeathMessage[$DamageType::Shocklance, 4] = '\c0%4 ruins %1\'s day with one zap of a shocklance.';
|
||||
|
||||
$DeathMessage[$DamageType::Mine, 0] = '\c0%4 kills %1 with a mine.';
|
||||
$DeathMessage[$DamageType::Mine, 1] = '\c0%1 doesn\'t see %4\'s mine in time.';
|
||||
$DeathMessage[$DamageType::Mine, 2] = '\c0%4 gets a sapper kill on %1.';
|
||||
$DeathMessage[$DamageType::Mine, 3] = '\c0%1 puts his foot on %4\'s mine.';
|
||||
$DeathMessage[$DamageType::Mine, 4] = '\c0One small step for %1, one giant mine kill for %4.';
|
||||
|
||||
$DeathMessage[$DamageType::SatchelCharge, 0] = '\c0%4 buys %1 a ticket to the moon.'; //satchel charge only
|
||||
$DeathMessage[$DamageType::SatchelCharge, 1] = '\c0%4 blows %1 into low orbit.';
|
||||
$DeathMessage[$DamageType::SatchelCharge, 2] = '\c0%4 makes %1 a hugely explosive offer.';
|
||||
$DeathMessage[$DamageType::SatchelCharge, 3] = '\c0%4 turns %1 into a cloud of satchel-vaporized armor.';
|
||||
$DeathMessage[$DamageType::SatchelCharge, 4] = '\c0%4\'s satchel charge leaves %1 nothin\' but smokin\' boots.';
|
||||
|
||||
$DeathMessageHeadshotCount = 3;
|
||||
$DeathMessageHeadshot[$DamageType::Laser, 0] = '\c0%4 drills right through %1\'s braincase with %6 laser.';
|
||||
$DeathMessageHeadshot[$DamageType::Laser, 1] = '\c0%4 pops %1\'s head like a cheap balloon.';
|
||||
$DeathMessageHeadshot[$DamageType::Laser, 2] = '\c0%1 loses %3 head over %4\'s laser skill.';
|
||||
|
||||
|
||||
//These used when a player is run over by a vehicle
|
||||
$DeathMessageVehicleCount = 5;
|
||||
$DeathMessageVehicle[0] = '\c0%4 runs down %1.';
|
||||
$DeathMessageVehicle[1] = '\c0%1 acquires that run-down feeling from %4.';
|
||||
$DeathMessageVehicle[2] = '\c0%4 transforms %1 into tribal roadkill.';
|
||||
$DeathMessageVehicle[3] = '\c0%1 makes a painfully close examination of %4\'s front bumper.';
|
||||
$DeathMessageVehicle[4] = '\c0%1\'s messy death leaves a mark on %4\'s vehicle finish.';
|
||||
|
||||
$DeathMessageVehicleCrashCount = 5;
|
||||
$DeathMessageVehicleCrash[ $DamageType::Crash, 0 ] = '\c0%1 fails to eject in time.';
|
||||
$DeathMessageVehicleCrash[ $DamageType::Crash, 1 ] = '\c0%1 becomes one with his vehicle dashboard.';
|
||||
$DeathMessageVehicleCrash[ $DamageType::Crash, 2 ] = '\c0%1 drives under the influence of death.';
|
||||
$DeathMessageVehicleCrash[ $DamageType::Crash, 3 ] = '\c0%1 makes a perfect three hundred point landing.';
|
||||
$DeathMessageVehicleCrash[ $DamageType::Crash, 4 ] = '\c0%1 heroically pilots his vehicle into something really, really hard.';
|
||||
|
||||
$DeathMessageVehicleFriendlyCount = 3;
|
||||
$DeathMessageVehicleFriendly[0] = '\c0%1 gets in the way of a friendly vehicle.';
|
||||
$DeathMessageVehicleFriendly[1] = '\c0Sadly, a friendly vehicle turns %1 into roadkill.';
|
||||
$DeathMessageVehicleFriendly[2] = '\c0%1 becomes an unsightly ornament on a team vehicle\'s hood.';
|
||||
|
||||
$DeathMessageVehicleUnmannedCount = 3;
|
||||
$DeathMessageVehicleUnmanned[0] = '\c0%1 gets in the way of a runaway vehicle.';
|
||||
$DeathMessageVehicleUnmanned[1] = '\c0An unmanned vehicle kills the pathetic %1.';
|
||||
$DeathMessageVehicleUnmanned[2] = '\c0%1 is struck down by an empty vehicle.';
|
||||
|
||||
//These used when a player is killed by a nearby equipment explosion
|
||||
$DeathMessageExplosionCount = 3;
|
||||
$DeathMessageExplosion[0] = '\c0%1 was killed by exploding equipment!';
|
||||
$DeathMessageExplosion[1] = '\c0%1 stood a little too close to the action!';
|
||||
$DeathMessageExplosion[2] = '\c0%1 learns how to be collateral damage.';
|
||||
|
||||
//These used when an automated turret kills an enemy player
|
||||
$DeathMessageTurretKillCount = 3;
|
||||
$DeathMessageTurretKill[$DamageType::PlasmaTurret, 0] = '\c0%1 is killed by a plasma turret.';
|
||||
$DeathMessageTurretKill[$DamageType::PlasmaTurret, 1] = '\c0%1\'s body now marks the location of a plasma turret.';
|
||||
$DeathMessageTurretKill[$DamageType::PlasmaTurret, 2] = '\c0%1 is fried by a plasma turret.';
|
||||
|
||||
$DeathMessageTurretKill[$DamageType::AATurret, 0] = '\c0%1 is killed by an AA turret.';
|
||||
$DeathMessageTurretKill[$DamageType::AATurret, 1] = '\c0%1 is shot down by an AA turret.';
|
||||
$DeathMessageTurretKill[$DamageType::AATurret, 2] = '\c0%1 takes fatal flak from an AA turret.';
|
||||
|
||||
$DeathMessageTurretKill[$DamageType::ElfTurret, 0] = '\c0%1 is killed by an ELF turret.';
|
||||
$DeathMessageTurretKill[$DamageType::ElfTurret, 1] = '\c0%1 is zapped by an ELF turret.';
|
||||
$DeathMessageTurretKill[$DamageType::ElfTurret, 2] = '\c0%1 is short-circuited by an ELF turret.';
|
||||
|
||||
$DeathMessageTurretKill[$DamageType::MortarTurret, 0] = '\c0%1 is killed by a mortar turret.';
|
||||
$DeathMessageTurretKill[$DamageType::MortarTurret, 1] = '\c0%1 enjoys a mortar turret\'s attention.';
|
||||
$DeathMessageTurretKill[$DamageType::MortarTurret, 2] = '\c0%1 is blown to kibble by a mortar turret.';
|
||||
|
||||
$DeathMessageTurretKill[$DamageType::MissileTurret, 0] = '\c0%1 is killed by a missile turret.';
|
||||
$DeathMessageTurretKill[$DamageType::MissileTurret, 1] = '\c0%1 is shot down by a missile turret.';
|
||||
$DeathMessageTurretKill[$DamageType::MissileTurret, 2] = '\c0%1 is blown away by a missile turret.';
|
||||
|
||||
$DeathMessageTurretKill[$DamageType::IndoorDepTurret, 0] = '\c0%1 is killed by a clamp turret.';
|
||||
$DeathMessageTurretKill[$DamageType::IndoorDepTurret, 1] = '\c0%1 gets burned by a clamp turret.';
|
||||
$DeathMessageTurretKill[$DamageType::IndoorDepTurret, 2] = '\c0A clamp turret eliminates %1.';
|
||||
|
||||
$DeathMessageTurretKill[$DamageType::OutdoorDepTurret, 0] = '\c0A spike turret neatly drills %1.';
|
||||
$DeathMessageTurretKill[$DamageType::OutdoorDepTurret, 1] = '\c0%1 gets taken out by a spike turret.';
|
||||
$DeathMessageTurretKill[$DamageType::OutdoorDepTurret, 2] = '\c0%1 dies under a spike turret\'s love.';
|
||||
|
||||
$DeathMessageTurretKill[$DamageType::SentryTurret, 0] = '\c0%1 didn\'t see that Sentry turret, but it saw %2...';
|
||||
$DeathMessageTurretKill[$DamageType::SentryTurret, 1] = '\c0%1 needs to watch for Sentry turrets.';
|
||||
$DeathMessageTurretKill[$DamageType::SentryTurret, 2] = '\c0%1 now understands how Sentry turrets work.';
|
||||
|
||||
|
||||
//used when a player is killed by a teammate controlling a turret
|
||||
$DeathMessageCTurretTeamKillCount = 1;
|
||||
$DeathMessageCTurretTeamKill[$DamageType::PlasmaTurret, 0] = '\c0%4 TEAMKILLED %1 with a plasma turret!';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::AATurret, 0] = '\c0%4 TEAMKILLED %1 with an AA turret!';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::ELFTurret, 0] = '\c0%4 TEAMKILLED %1 with an ELF turret!';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::MortarTurret, 0] = '\c0%4 TEAMKILLED %1 with a mortar turret!';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::MissileTurret, 0] = '\c0%4 TEAMKILLED %1 with a missile turret!';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::IndoorDepTurret, 0] = '\c0%4 TEAMKILLED %1 with a clamp turret!';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::OutdoorDepTurret, 0] = '\c0%4 TEAMKILLED %1 with a spike turret!';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::SentryTurret, 0] = '\c0%4 TEAMKILLED %1 with a sentry turret!';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::BomberBombs, 0] = '\c0%4 TEAMKILLED %1 in a bombastic explosion of raining death.';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::BellyTurret, 0] = '\c0%4 TEAMKILLED %1 by annihilating him from a belly turret.';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::TankChainGun, 0] = '\c0%4 TEAMKILLED %1 with his tank\'s chaingun.';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::TankMortar, 0] = '\c0%4 TEAMKILLED %1 by lobbing the BIG green death from a tank.';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::ShrikeBlaster, 0] = '\c0%4 TEAMKILLED %1 by strafing from a Shrike.';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::MPBMissile, 0] = '\c0%4 TEAMKILLED %1 when the MPB locked onto him.';
|
||||
|
||||
|
||||
|
||||
//used when a player is killed by an uncontrolled, friendly turret
|
||||
$DeathMessageCTurretAccdtlKillCount = 1;
|
||||
$DeathMessageCTurretAccdtlKill[$DamageType::PlasmaTurret, 0] = '\c0%1 got in the way of a plasma turret!';
|
||||
|
||||
$DeathMessageCTurretAccdtlKill[$DamageType::AATurret, 0] = '\c0%1 got in the way of an AA turret!';
|
||||
|
||||
$DeathMessageCTurretAccdtlKill[$DamageType::ELFTurret, 0] = '\c0%1 got in the way of an ELF turret!';
|
||||
|
||||
$DeathMessageCTurretAccdtlKill[$DamageType::MortarTurret, 0] = '\c0%1 got in the way of a mortar turret!';
|
||||
|
||||
$DeathMessageCTurretAccdtlKill[$DamageType::MissileTurret, 0] = '\c0%1 got in the way of a missile turret!';
|
||||
|
||||
$DeathMessageCTurretAccdtlKill[$DamageType::IndoorDepTurret, 0] = '\c0%1 got in the way of a clamp turret!';
|
||||
|
||||
$DeathMessageCTurretAccdtlKill[$DamageType::OutdoorDepTurret, 0] = '\c0%1 got in the way of a spike turret!';
|
||||
|
||||
$DeathMessageCTurretAccdtlKill[$DamageType::SentryTurret, 0] = '\c0%1 got in the way of a Sentry turret!';
|
||||
|
||||
|
||||
//these messages for owned or controlled turrets
|
||||
$DeathMessageCTurretKillCount = 3;
|
||||
$DeathMessageCTurretKill[$DamageType::PlasmaTurret, 0] = '\c0%4 torches %1 with a plasma turret!';
|
||||
$DeathMessageCTurretKill[$DamageType::PlasmaTurret, 1] = '\c0%4 fries %1 with a plasma turret!';
|
||||
$DeathMessageCTurretKill[$DamageType::PlasmaTurret, 2] = '\c0%4 lights up %1 with a plasma turret!';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::AATurret, 0] = '\c0%4 shoots down %1 with an AA turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::AATurret, 1] = '\c0%1 gets shot down by %1\'s AA turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::AATurret, 2] = '\c0%4 takes out %1 with an AA turret.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::ElfTurret, 0] = '\c0%1 gets zapped by ELF gunner %4.';
|
||||
$DeathMessageCTurretKill[$DamageType::ElfTurret, 1] = '\c0%1 gets barbecued by ELF gunner %4.';
|
||||
$DeathMessageCTurretKill[$DamageType::ElfTurret, 2] = '\c0%1 gets shocked by ELF gunner %4.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::MortarTurret, 0] = '\c0%1 is annihilated by %4\'s mortar turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::MortarTurret, 1] = '\c0%1 is blown away by %4\'s mortar turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::MortarTurret, 2] = '\c0%1 is pureed by %4\'s mortar turret.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::MissileTurret, 0] = '\c0%4 shows %1 a new world of pain with a missile turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::MissileTurret, 1] = '\c0%4 pops %1 with a missile turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::MissileTurret, 2] = '\c0%4\'s missile turret lights up %1\'s, uh, ex-life.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::IndoorDepTurret, 0] = '\c0%1 is chewed up and spat out by %4\'s clamp turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::IndoorDepTurret, 1] = '\c0%1 is knocked out by %4\'s clamp turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::IndoorDepTurret, 2] = '\c0%4\'s clamp turret drills %1 nicely.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::OutdoorDepTurret, 0] = '\c0%1 is chewed up by %4\'s spike turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::OutdoorDepTurret, 1] = '\c0%1 feels the burn from %4\'s spike turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::OutdoorDepTurret, 2] = '\c0%1 is nailed by %4\'s spike turret.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::SentryTurret, 0] = '\c0%4 caught %1 by surprise with a turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::SentryTurret, 1] = '\c0%4\'s turret took out %1.';
|
||||
$DeathMessageCTurretKill[$DamageType::SentryTurret, 2] = '\c0%4 blasted %1 with a turret.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::BomberBombs, 0] = '\c0%1 catches %4\'s bomb in both teeth.';
|
||||
$DeathMessageCTurretKill[$DamageType::BomberBombs, 1] = '\c0%4 leaves %1 a smoking bomb crater.';
|
||||
$DeathMessageCTurretKill[$DamageType::BomberBombs, 2] = '\c0%4 bombs %1 back to the 20th century.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::BellyTurret, 0] = '\c0%1 eats a big helping of %4\'s belly turret bolt.';
|
||||
$DeathMessageCTurretKill[$DamageType::BellyTurret, 1] = '\c0%4 plants a belly turret bolt in %1\'s belly.';
|
||||
$DeathMessageCTurretKill[$DamageType::BellyTurret, 2] = '\c0%1 fails to evade %4\'s deft bomber strafing.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::TankChainGun, 0] = '\c0%1 enjoys the rich, metallic taste of %4\'s tank slug.';
|
||||
$DeathMessageCTurretKill[$DamageType::TankChainGun, 1] = '\c0%4\'s tank chaingun plays sweet music all over %1.';
|
||||
$DeathMessageCTurretKill[$DamageType::TankChainGun, 2] = '\c0%1 receives a stellar exit wound from %4\'s tank slug.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::TankMortar, 0] = '\c0Whoops! %1 + %4\'s tank mortar = Dead %1.';
|
||||
$DeathMessageCTurretKill[$DamageType::TankMortar, 1] = '\c0%1 learns the happy explosion dance from %4\'s tank mortar.';
|
||||
$DeathMessageCTurretKill[$DamageType::TankMortar, 2] = '\c0%4\'s tank mortar has a blast with %1.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::ShrikeBlaster, 0] = '\c0%1 dines on a Shrike blaster sandwich, courtesy of %4.';
|
||||
$DeathMessageCTurretKill[$DamageType::ShrikeBlaster, 1] = '\c0The blaster of %4\'s Shrike turns %1 into finely shredded meat.';
|
||||
$DeathMessageCTurretKill[$DamageType::ShrikeBlaster, 2] = '\c0%1 gets drilled big-time by the blaster of %4\'s Shrike.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::MPBMissile, 0] = '\c0%1 intersects nicely with %4\'s MPB Missile.';
|
||||
$DeathMessageCTurretKill[$DamageType::MPBMissile, 1] = '\c0%4\'s MPB Missile makes armored chowder out of %1.';
|
||||
$DeathMessageCTurretKill[$DamageType::MPBMissile, 2] = '\c0%1 has a brief, explosive fling with %4\'s MPB Missile.';
|
||||
|
||||
$DeathMessageTurretSelfKillCount = 3;
|
||||
$DeathMessageTurretSelfKill[0] = '\c0%1 somehow kills %2self with a turret.';
|
||||
$DeathMessageTurretSelfKill[1] = '\c0%1 apparently didn\'t know the turret was loaded.';
|
||||
$DeathMessageTurretSelfKill[2] = '\c0%1 helps his team by killing himself with a turret.';
|
||||
|
||||
|
||||
|
||||
538
docs/base/@vl2/scripts.vl2/scripts/debuggerGui.cs
Normal file
538
docs/base/@vl2/scripts.vl2/scripts/debuggerGui.cs
Normal file
|
|
@ -0,0 +1,538 @@
|
|||
|
||||
// debugger is just a simple TCP object
|
||||
if (!isObject(TCPDebugger))
|
||||
new TCPObject(TCPDebugger);
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// TCP function defs
|
||||
//--------------------------------------------------------------
|
||||
|
||||
function DebuggerConsoleView::print(%this, %line)
|
||||
{
|
||||
%row = %this.addRow(0, %line);
|
||||
%this.scrollVisible(%row);
|
||||
}
|
||||
|
||||
function TCPDebugger::onLine(%this, %line)
|
||||
{
|
||||
echo("Got line=>" @ %line);
|
||||
%cmd = firstWord(%line);
|
||||
%rest = restWords(%line);
|
||||
|
||||
if(%cmd $= "PASS")
|
||||
%this.handlePass(%rest);
|
||||
else if(%cmd $= "COUT")
|
||||
%this.handleLineOut(%rest);
|
||||
else if(%cmd $= "FILELISTOUT")
|
||||
%this.handleFileList(%rest);
|
||||
else if(%cmd $= "BREAKLISTOUT")
|
||||
%this.handleBreakList(%rest);
|
||||
else if(%cmd $= "BREAK")
|
||||
%this.handleBreak(%rest);
|
||||
else if(%cmd $= "RUNNING")
|
||||
%this.handleRunning();
|
||||
else if(%cmd $= "EVALOUT")
|
||||
%this.handleEvalOut(%rest);
|
||||
else if(%cmd $= "OBJTAGLISTOUT")
|
||||
%this.handleObjTagList(%rest);
|
||||
else
|
||||
%this.handleError(%line);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// handlers for messages from the server
|
||||
//--------------------------------------------------------------
|
||||
|
||||
function TCPDebugger::handlePass(%this, %message)
|
||||
{
|
||||
if(%message $= "WrongPass")
|
||||
{
|
||||
DebuggerConsoleView.print("Disconnected - wrong password.");
|
||||
%this.disconnect();
|
||||
}
|
||||
else if(%message $= "Connected.")
|
||||
{
|
||||
DebuggerConsoleView.print("Connected.");
|
||||
DebuggerStatus.setValue("CONNECTED");
|
||||
%this.send("FILELIST\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
function TCPDebugger::handleLineOut(%this, %line)
|
||||
{
|
||||
DebuggerConsoleView.print(%line);
|
||||
}
|
||||
|
||||
function TCPDebugger::handleFileList(%this, %line)
|
||||
{
|
||||
DebuggerFilePopup.clear();
|
||||
%word = 0;
|
||||
while((%file = getWord(%line, %word)) !$= "")
|
||||
{
|
||||
%word++;
|
||||
DebuggerFilePopup.add(%file, %word);
|
||||
}
|
||||
}
|
||||
|
||||
function TCPDebugger::handleBreakList(%this, %line)
|
||||
{
|
||||
%file = getWord(%line, 0);
|
||||
if(%file != $DebuggerFile)
|
||||
return;
|
||||
%pairs = getWord(%line, 1);
|
||||
%curLine = 1;
|
||||
DebuggerFileView.clearBreakPositions();
|
||||
|
||||
//set the possible break positions
|
||||
for(%i = 0; %i < %pairs; %i++)
|
||||
{
|
||||
%skip = getWord(%line, %i * 2 + 2);
|
||||
%breaks = getWord(%line, %i * 2 + 3);
|
||||
%curLine += %skip;
|
||||
for(%j = 0; %j < %breaks; %j++)
|
||||
{
|
||||
DebuggerFileView.setBreakPosition(%curLine);
|
||||
%curLine++;
|
||||
}
|
||||
}
|
||||
|
||||
//now set the actual break points...
|
||||
for (%i = 0; %i < DebuggerBreakPoints.rowCount(); %i++)
|
||||
{
|
||||
%breakText = DebuggerBreakPoints.getRowText(%i);
|
||||
%breakLine = getField(%breakText, 0);
|
||||
%breakFile = getField(%breakText, 1);
|
||||
if (%breakFile == $DebuggerFile)
|
||||
DebuggerFileView.setBreak(%breakLine);
|
||||
}
|
||||
}
|
||||
|
||||
function TCPDebugger::handleBreak(%this, %line)
|
||||
{
|
||||
DebuggerStatus.setValue("BREAK");
|
||||
|
||||
// query all the watches
|
||||
for(%i = 0; %i < DebuggerWatchView.rowCount(); %i++)
|
||||
{
|
||||
%id = DebuggerWatchView.getRowId(%i);
|
||||
%row = DebuggerWatchView.getRowTextById(%id);
|
||||
%expr = getField(%row, 0);
|
||||
%this.send("EVAL " @ %id @ " 0 " @ %expr @ "\r\n");
|
||||
}
|
||||
|
||||
// update the call stack window
|
||||
DebuggerCallStack.clear();
|
||||
|
||||
%file = getWord(%line, 0);
|
||||
%lineNumber = getWord(%line, 1);
|
||||
%funcName = getWord(%line, 2);
|
||||
|
||||
DbgOpenFile(%file, %lineNumber, true);
|
||||
|
||||
%nextWord = 3;
|
||||
%rowId = 0;
|
||||
%id = 0;
|
||||
while(1)
|
||||
{
|
||||
DebuggerCallStack.setRowById(%id, %file @ "\t" @ %lineNumber @ "\t" @ %funcName);
|
||||
%id++;
|
||||
%file = getWord(%line, %nextWord);
|
||||
%lineNumber = getWord(%line, %nextWord + 1);
|
||||
%funcName = getWord(%line, %nextWord + 2);
|
||||
%nextWord += 3;
|
||||
if(%file $= "")
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function TCPDebugger::handleRunning(%this)
|
||||
{
|
||||
DebuggerFileView.setCurrentLine(-1, true);
|
||||
DebuggerCallStack.clear();
|
||||
DebuggerStatus.setValue("RUNNING...");
|
||||
}
|
||||
|
||||
function TCPDebugger::handleEvalOut(%this, %line)
|
||||
{
|
||||
%id = firstWord(%line);
|
||||
%value = restWords(%line);
|
||||
|
||||
//see if it's the cursor watch, or from the watch window
|
||||
if (%id < 0)
|
||||
DebuggerCursorWatch.setText(DebuggerCursorWatch.expr SPC "=" SPC %value);
|
||||
else
|
||||
{
|
||||
%row = DebuggerWatchView.getRowTextById(%id);
|
||||
if(%row $= "")
|
||||
return;
|
||||
%expr = getField(%row, 0);
|
||||
DebuggerWatchView.setRowById(%id, %expr @ "\t" @ %value);
|
||||
}
|
||||
}
|
||||
|
||||
function TCPDebugger::handleObjTagList(%this, %line)
|
||||
{
|
||||
}
|
||||
|
||||
function TCPDebugger::handleError(%this, %line)
|
||||
{
|
||||
DebuggerConsoleView.print("ERROR - bogus message: " @ %line);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// handlers for connection related functions
|
||||
//--------------------------------------------------------------
|
||||
|
||||
function TCPDebugger::onDNSResolve(%this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function TCPDebugger::onConnecting(%this)
|
||||
{
|
||||
}
|
||||
|
||||
function TCPDebugger::onConnected(%this)
|
||||
{
|
||||
// send the password on connect.
|
||||
// %this.send(%this.password @ "\r\n");
|
||||
// tinman - this function never get's called - instead
|
||||
// send the password immediately...
|
||||
}
|
||||
|
||||
function TCPDebugger::onConnectFailed(%this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function TCPDebugger::onDisconnect(%this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function DebuggerFilePopup::onSelect(%this, %id, %text)
|
||||
{
|
||||
DbgOpenFile(%text, 0, false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// Gui glue functions
|
||||
//--------------------------------------------------------------
|
||||
|
||||
$DbgWatchSeq = 1;
|
||||
function DbgWatchDialogAdd()
|
||||
{
|
||||
%expr = WatchDialogExpression.getValue();
|
||||
if (%expr !$= "")
|
||||
{
|
||||
DebuggerWatchView.setRowById($DbgWatchSeq, %expr @"\t(unknown)");
|
||||
TCPDebugger.send("EVAL " @ $DbgWatchSeq @ " 0 " @ %expr @ "\r\n");
|
||||
$DbgWatchSeq++;
|
||||
}
|
||||
//don't forget to close the dialog
|
||||
Canvas.popDialog(DebuggerWatchDlg);
|
||||
}
|
||||
|
||||
function DbgWatchDialogEdit()
|
||||
{
|
||||
%newValue = EditWatchDialogValue.getValue();
|
||||
%id = DebuggerWatchView.getSelectedId();
|
||||
if (%id >= 0)
|
||||
{
|
||||
%row = DebuggerWatchView.getRowTextById(%id);
|
||||
%expr = getField(%row, 0);
|
||||
if (%newValue $= "")
|
||||
%assignment = %expr @ " = \"\"";
|
||||
else
|
||||
%assignment = %expr @ " = " @ %newValue;
|
||||
TCPDebugger.send("EVAL " @ %id @ " 0 " @ %assignment @ "\r\n");
|
||||
}
|
||||
|
||||
//don't forget to close the dialog
|
||||
Canvas.popDialog(DebuggerEditWatchDlg);
|
||||
}
|
||||
|
||||
function DbgSetCursorWatch(%expr)
|
||||
{
|
||||
DebuggerCursorWatch.expr = %expr;
|
||||
if (DebuggerCursorWatch.expr $= "")
|
||||
DebuggerCursorWatch.setText("");
|
||||
else
|
||||
TCPDebugger.send("EVAL -1 0 " @ DebuggerCursorWatch.expr @ "\r\n");
|
||||
}
|
||||
|
||||
function DebuggerCallStack::onAction(%this)
|
||||
{
|
||||
%id = %this.getSelectedId();
|
||||
if(%id == -1)
|
||||
return;
|
||||
%text = %this.getRowTextById(%id);
|
||||
%file = getField(%text, 0);
|
||||
%line = getField(%text, 1);
|
||||
|
||||
DbgOpenFile(%file, %line, %id == 0);
|
||||
}
|
||||
|
||||
function DbgConnect()
|
||||
{
|
||||
%address = DebuggerConnectAddress.getValue();
|
||||
%port = DebuggerConnectPort.getValue();
|
||||
%password = DebuggerConnectPassword.getValue();
|
||||
|
||||
if ((%address !$= "" ) && (%port !$= "" ) && (%password !$= "" ))
|
||||
{
|
||||
TCPDebugger.connect(%address @ ":" @ %port);
|
||||
TCPDebugger.schedule(5000, send, %password @ "\r\n");
|
||||
TCPDebugger.password = %password;
|
||||
}
|
||||
|
||||
//don't forget to close the dialog
|
||||
Canvas.popDialog(DebuggerConnectDlg);
|
||||
}
|
||||
|
||||
function DbgBreakConditionSet()
|
||||
{
|
||||
%condition = BreakCondition.getValue();
|
||||
%passct = BreakPassCount.getValue();
|
||||
%clear = BreakClear.getValue();
|
||||
if (%condition $= "")
|
||||
%condition = "true";
|
||||
if (%passct $= "")
|
||||
%passct = "0";
|
||||
if (%clear $= "")
|
||||
%clear = "false";
|
||||
|
||||
//set the condition
|
||||
%id = DebuggerBreakPoints.getSelectedId();
|
||||
if(%id != -1)
|
||||
{
|
||||
%bkp = DebuggerBreakPoints.getRowTextById(%id);
|
||||
|
||||
DbgSetBreakPoint(getField(%bkp, 1), getField(%bkp, 0), %clear, %passct, %condition);
|
||||
}
|
||||
//don't forget to close the dialog
|
||||
Canvas.popDialog(DebuggerBreakConditionDlg);
|
||||
}
|
||||
|
||||
function DbgOpenFile(%file, %line, %selectLine)
|
||||
{
|
||||
if (%file !$= "")
|
||||
{
|
||||
//open the file in the file view
|
||||
if (DebuggerFileView.open(%file))
|
||||
{
|
||||
DebuggerFileView.setCurrentLine(%line, %selectLine);
|
||||
if (%file !$= $DebuggerFile)
|
||||
{
|
||||
TCPDebugger.send("BREAKLIST " @ %file @ "\r\n");
|
||||
$DebuggerFile = %file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function DbgFileViewFind()
|
||||
{
|
||||
%searchString = DebuggerFindStringText.getValue();
|
||||
%result = DebuggerFileView.findString(%searchString);
|
||||
|
||||
//don't forget to close the dialog
|
||||
Canvas.popDialog(DebuggerFindDlg);
|
||||
}
|
||||
|
||||
function DbgFileBreakPoints(%file, %points)
|
||||
{
|
||||
DebuggerFileView.breakPoints(%file, %points);
|
||||
}
|
||||
|
||||
// BRKSET:file line clear passct expr - set a breakpoint on the file,line
|
||||
function DbgSetBreakPoint(%file, %line, %clear, %passct, %expr)
|
||||
{
|
||||
if(!%clear)
|
||||
{
|
||||
if(%file == $DebuggerFile)
|
||||
DebuggerFileView.setBreak(%line);
|
||||
}
|
||||
DebuggerBreakPoints.addBreak(%file, %line, %clear, %passct, %expr);
|
||||
TCPDebugger.send("BRKSET " @ %file @ " " @ %line @ " " @ %clear @ " " @ %passct @ " " @ %expr @ "\r\n");
|
||||
}
|
||||
|
||||
function DbgRemoveBreakPoint(%file, %line)
|
||||
{
|
||||
if(%file == $DebuggerFile)
|
||||
DebuggerFileView.removeBreak(%line);
|
||||
TCPDebugger.send("BRKCLR " @ %file @ " " @ %line @ "\r\n");
|
||||
DebuggerBreakPoints.removeBreak(%file, %line);
|
||||
}
|
||||
|
||||
$DbgBreakId = 0;
|
||||
|
||||
function DebuggerBreakPoints::addBreak(%this, %file, %line, %clear, %passct, %expr)
|
||||
{
|
||||
// columns 0 = line, 1 = file, 2 = expr
|
||||
%textLine = %line @ "\t" @ %file @ "\t" @ %expr @ "\t" @ %passct @ "\t" @ %clear;
|
||||
%selId = %this.getSelectedId();
|
||||
%selText = %this.getRowTextById(%selId);
|
||||
if(getField(%selText, 0) $= %line && getField(%selText, 1) $= %file)
|
||||
{
|
||||
%this.setRowById(%selId, %textLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
%this.addRow($DbgBreakId, %textLine);
|
||||
$DbgBreakId++;
|
||||
}
|
||||
}
|
||||
|
||||
function DebuggerBreakPoints::removeBreak(%this, %file, %line)
|
||||
{
|
||||
for(%i = 0; %i < %this.rowCount(); %i++)
|
||||
{
|
||||
%id = %this.getRowId(%i);
|
||||
%text = %this.getRowTextById(%id);
|
||||
if(getField(%text, 0) $= %line && getField(%text, 1) $= %file)
|
||||
{
|
||||
%this.removeRowById(%id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function DbgDeleteSelectedBreak()
|
||||
{
|
||||
%selectedBreak = DebuggerBreakPoints.getSelectedId();
|
||||
%rowNum = DebuggerBreakPoints.getRowNumById(%selectedWatch);
|
||||
if (%rowNum >= 0)
|
||||
{
|
||||
%breakText = DebuggerBreakPoints.getRowText(%rowNum);
|
||||
%breakLine = getField(%breakText, 0);
|
||||
%breakFile = getField(%breakText, 1);
|
||||
DbgRemoveBreakPoint(%breakFile, %breakLine);
|
||||
}
|
||||
}
|
||||
|
||||
function DebuggerBreakPoints::clearBreaks(%this)
|
||||
{
|
||||
while(%this.rowCount())
|
||||
{
|
||||
%id = %this.getRowId(0);
|
||||
%text = %this.getRowTextById(%id);
|
||||
%file = getField(%text, 1);
|
||||
%line = getField(%text, 0);
|
||||
DbgRemoveBreakPoint(%file, %line);
|
||||
}
|
||||
}
|
||||
|
||||
function DebuggerBreakPoints::onAction(%this)
|
||||
{
|
||||
%id = %this.getSelectedId();
|
||||
if(%id == -1)
|
||||
return;
|
||||
%text = %this.getRowTextById(%id);
|
||||
%line = getField(%text, 0);
|
||||
%file = getField(%text, 1);
|
||||
|
||||
DbgOpenFile(%file, %line, 0);
|
||||
}
|
||||
|
||||
function DebuggerFileView::onRemoveBreakPoint(%this, %line)
|
||||
{
|
||||
%file = $DebuggerFile;
|
||||
DbgRemoveBreakPoint(%file, %line);
|
||||
}
|
||||
|
||||
function DebuggerFileView::onSetBreakPoint(%this, %line)
|
||||
{
|
||||
%file = $DebuggerFile;
|
||||
DbgSetBreakPoint(%file, %line, 0, 0, true);
|
||||
}
|
||||
|
||||
function DbgConsoleEntryReturn()
|
||||
{
|
||||
%msg = DbgConsoleEntry.getValue();
|
||||
if (%msg !$= "")
|
||||
{
|
||||
DebuggerConsoleView.print("%" @ %msg);
|
||||
if (DebuggerStatus.getValue() $= "NOT CONNECTED")
|
||||
DebuggerConsoleView.print("*** Not connected.");
|
||||
else if (DebuggerStatus.getValue() $= "BREAK")
|
||||
DebuggerConsoleView.print("*** Target is in BREAK mode.");
|
||||
else
|
||||
TCPDebugger.send("CEVAL " @ %msg @ "\r\n");
|
||||
|
||||
}
|
||||
DbgConsoleEntry.setValue("");
|
||||
}
|
||||
|
||||
function DbgConsolePrint(%status)
|
||||
{
|
||||
DebuggerConsoleView.print(%status);
|
||||
}
|
||||
|
||||
function DbgStackAddFrame(%file, %line, %funcName)
|
||||
{
|
||||
if ((%file !$= "") && (%line !$= "") && (%funcName !$= ""))
|
||||
DebuggerCallStack.add(%file, %line, %funcName);
|
||||
}
|
||||
|
||||
function DbgStackGetFrame()
|
||||
{
|
||||
return DebuggerCallStack.getFrame();
|
||||
}
|
||||
|
||||
function DbgStackClear()
|
||||
{
|
||||
DebuggerCallStack.clear();
|
||||
}
|
||||
|
||||
function DbgSetWatch(%expr)
|
||||
{
|
||||
if (%expr !$= "")
|
||||
DebuggerWatchView.set(%expr);
|
||||
}
|
||||
|
||||
function DbgDeleteSelectedWatch()
|
||||
{
|
||||
%selectedWatch = DebuggerWatchView.getSelectedId();
|
||||
%rowNum = DebuggerWatchView.getRowNumById(%selectedWatch);
|
||||
DebuggerWatchView.removeRow(%rowNum);
|
||||
}
|
||||
|
||||
function DbgRefreshWatches()
|
||||
{
|
||||
// query all the watches
|
||||
for(%i = 0; %i < DebuggerWatchView.rowCount(); %i++)
|
||||
{
|
||||
%id = DebuggerWatchView.getRowId(%i);
|
||||
%row = DebuggerWatchView.getRowTextById(%id);
|
||||
%expr = getField(%row, 0);
|
||||
TCPDebugger.send("EVAL " @ %id @ " 0 " @ %expr @ "\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
function DbgClearWatches()
|
||||
{
|
||||
DebuggerWatchView.clear();
|
||||
}
|
||||
|
||||
function dbgStepIn()
|
||||
{
|
||||
TCPDebugger.send("STEPIN\r\n");
|
||||
}
|
||||
|
||||
function dbgStepOut()
|
||||
{
|
||||
TCPDebugger.send("STEPOUT\r\n");
|
||||
}
|
||||
|
||||
function dbgStepOver()
|
||||
{
|
||||
TCPDebugger.send("STEPOVER\r\n");
|
||||
}
|
||||
|
||||
function dbgContinue()
|
||||
{
|
||||
TCPDebugger.send("CONTINUE\r\n");
|
||||
}
|
||||
|
||||
DebuggerConsoleView.setActive(false);
|
||||
3377
docs/base/@vl2/scripts.vl2/scripts/defaultGame.cs
Normal file
3377
docs/base/@vl2/scripts.vl2/scripts/defaultGame.cs
Normal file
File diff suppressed because it is too large
Load diff
1391
docs/base/@vl2/scripts.vl2/scripts/deployables.cs
Normal file
1391
docs/base/@vl2/scripts.vl2/scripts/deployables.cs
Normal file
File diff suppressed because it is too large
Load diff
64
docs/base/@vl2/scripts.vl2/scripts/depthSort.cs
Normal file
64
docs/base/@vl2/scripts.vl2/scripts/depthSort.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
|
||||
moveMap.bindCmd(keyboard,o,"","toggleDepthTest();");
|
||||
moveMap.bindCmd(keyboard,j,"","toggleDepthSort();");
|
||||
moveMap.bindCmd(keyboard,k,"","toggleRenderDepth();");
|
||||
moveMap.bindCmd(keyboard,l,"","toggleHoldDepthTest();");
|
||||
|
||||
function toggleDepthTest()
|
||||
{
|
||||
if ($Collision::testDepthSortList)
|
||||
{
|
||||
$Collision::testDepthSortList = false;
|
||||
echo("Turning OFF testing of DepthSortList");
|
||||
}
|
||||
else
|
||||
{
|
||||
$Collision::testDepthSortList = true;
|
||||
echo("Turning ON testing of DepthSortList");
|
||||
}
|
||||
}
|
||||
|
||||
function toggleDepthSort()
|
||||
{
|
||||
if ($Collision::depthSort)
|
||||
{
|
||||
$Collision::depthSort = false;
|
||||
echo("Turning OFF depth sort on depthSortList");
|
||||
}
|
||||
else
|
||||
{
|
||||
$Collision::depthSort = true;
|
||||
echo("Turning ON depth sort on depthSortList");
|
||||
}
|
||||
}
|
||||
|
||||
function toggleRenderDepth()
|
||||
{
|
||||
if ($Collision::depthRender)
|
||||
{
|
||||
$Collision::depthRender = false;
|
||||
echo("Turning OFF depth rendering on DepthSortList");
|
||||
}
|
||||
else
|
||||
{
|
||||
$Collision::depthRender = true;
|
||||
echo("Turning ON depth rendering on DepthSortList");
|
||||
}
|
||||
}
|
||||
|
||||
function toggleHoldDepthTest()
|
||||
{
|
||||
if ($Collision::renderAlways)
|
||||
{
|
||||
$Collision::renderAlways = false;
|
||||
$Collision::testDepthSortList = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$Collision::renderAlways = true;
|
||||
$Collision::testDepthSortList = false;
|
||||
}
|
||||
}
|
||||
|
||||
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- //
|
||||
|
||||
17
docs/base/@vl2/scripts.vl2/scripts/desertPropMap.cs
Normal file
17
docs/base/@vl2/scripts.vl2/scripts/desertPropMap.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
//-------------------------------------- Desert interior texture property mapping
|
||||
|
||||
addMaterialMapping("desert/cp_ichute01", "environment: special/chuteTexture 0.25");
|
||||
addMaterialMapping("desert/cp_ichute02", "environment: special/chuteTexture 0.25");
|
||||
|
||||
//"Color: red green blue startAlpha endAlpha"
|
||||
//Soft sound = 0
|
||||
//Hard sound = 1
|
||||
//Metal sound = 2
|
||||
//Snow sound = 3
|
||||
addMaterialMapping("terrain/DesertWorld.RockFractured", "color: 0.35 0.2 0.05 0.7 0.0", "sound: 0");
|
||||
addMaterialMapping("terrain/DesertWorld.RockSmooth", "color: 0.35 0.2 0.05 0.7 0.0", "sound: 0");
|
||||
addMaterialMapping("terrain/DesertWorld.Sand", "color: 0.35 0.2 0.05 0.7 0.0", "sound: 0");
|
||||
addMaterialMapping("terrain/DesertWorld.SandBrun", "color: 0.35 0.2 0.05 0.7 0.0", "sound: 0");
|
||||
addMaterialMapping("terrain/DesertWorld.SandDark", "color: 0.35 0.2 0.05 0.7 0.0", "sound: 0");
|
||||
addMaterialMapping("terrain/DesertWorld.SandOrange", "color: 0.35 0.2 0.05 0.7 0.0", "sound: 0");
|
||||
addMaterialMapping("terrain/DesertWorld.SandOxidized", "color: 0.35 0.2 0.05 0.7 0.0", "sound: 0");
|
||||
15
docs/base/@vl2/scripts.vl2/scripts/editor.bind.cs
Normal file
15
docs/base/@vl2/scripts.vl2/scripts/editor.bind.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
//
|
||||
// Copyright (c) 2001 GarageGames.Com
|
||||
// Portions Copyright (c) 2001 by Sierra Online, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Mission Editor Manager
|
||||
new ActionMap(EditorMap);
|
||||
|
||||
EditorMap.bindCmd(keyboard, "f1", "contextHelp();", "");
|
||||
EditorMap.bindCmd(keyboard, "escape", "editor.close();", "");
|
||||
EditorMap.bindCmd(keyboard, "i", "Canvas.pushDialog(interiorDebugDialog);", "");
|
||||
|
||||
113
docs/base/@vl2/scripts.vl2/scripts/editor.cs
Normal file
113
docs/base/@vl2/scripts.vl2/scripts/editor.cs
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
//
|
||||
// Copyright (c) 2001 GarageGames.Com
|
||||
// Portions Copyright (c) 2001 by Sierra Online, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Hard coded images referenced from C++ code
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// editor/SelectHandle.png
|
||||
// editor/DefaultHandle.png
|
||||
// editor/LockedHandle.png
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Mission Editor
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function Editor::create()
|
||||
{
|
||||
// Not much to do here, build it and they will come...
|
||||
// Only one thing... the editor is a gui control which
|
||||
// expect the Canvas to exist, so it must be constructed
|
||||
// before the editor.
|
||||
new EditManager(Editor)
|
||||
{
|
||||
profile = "GuiContentProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
setFirstResponder = "0";
|
||||
modal = "1";
|
||||
helpTag = "0";
|
||||
open = false;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function Editor::onAdd(%this)
|
||||
{
|
||||
// Basic stuff
|
||||
exec("scripts/cursors.cs");
|
||||
exec("scripts/EditorProfiles.cs");
|
||||
|
||||
// Tools
|
||||
exec("scripts/editor.bind.cs");
|
||||
exec("gui/ObjectBuilderGui.gui");
|
||||
|
||||
// New World Editor
|
||||
exec("gui/EditorGui.gui");
|
||||
exec("scripts/EditorGui.cs");
|
||||
exec("gui/AIEWorkingDlg.gui");
|
||||
|
||||
// World Editor
|
||||
exec("gui/WorldEditorSettingsDlg.gui");
|
||||
|
||||
// Terrain Editor
|
||||
exec("gui/TerrainEditorVSettingsGui.gui");
|
||||
exec("gui/HelpDlg.gui");
|
||||
exec("scripts/help.cs");
|
||||
|
||||
// do gui initialization...
|
||||
EditorGui.init();
|
||||
|
||||
//
|
||||
exec("scripts/editorRender.cs");
|
||||
}
|
||||
|
||||
function Editor::checkActiveLoadDone()
|
||||
{
|
||||
if(isObject(EditorGui) && EditorGui.loadingMission)
|
||||
{
|
||||
Canvas.setContent(EditorGui);
|
||||
EditorGui.loadingMission = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function toggleEditor(%make)
|
||||
{
|
||||
if (%make)
|
||||
{
|
||||
if (!$missionRunning)
|
||||
{
|
||||
MessageBoxOK("Mission Required", "You must load a mission before starting the Mission Editor.", "");
|
||||
return;
|
||||
}
|
||||
|
||||
$testcheats = 1;
|
||||
if (!isObject(Editor))
|
||||
{
|
||||
Editor::create();
|
||||
MissionCleanup.add(Editor);
|
||||
}
|
||||
if (Canvas.getContent() == EditorGui.getId())
|
||||
Editor.close();
|
||||
else
|
||||
Editor.open();
|
||||
}
|
||||
}
|
||||
|
||||
50
docs/base/@vl2/scripts.vl2/scripts/editorRender.cs
Normal file
50
docs/base/@vl2/scripts.vl2/scripts/editorRender.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// Console onEditorRender functions:
|
||||
//------------------------------------------------------------------------------
|
||||
// Functions:
|
||||
// - renderSphere([pos], [radius], <sphereLevel>);
|
||||
// - renderCircle([pos], [normal], [radius], <segments>);
|
||||
// - renderTriangle([pnt], [pnt], [pnt]);
|
||||
// - renderLine([start], [end], <thickness>);
|
||||
//
|
||||
// Variables:
|
||||
// - consoleFrameColor - line prims are rendered with this
|
||||
// - consoleFillColor
|
||||
// - consoleSphereLevel - level of polyhedron subdivision
|
||||
// - consoleCircleSegments
|
||||
// - consoleLineWidth
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function SpawnSphere::onEditorRender(%this, %editor, %selected, %expanded)
|
||||
{
|
||||
if(%selected $= "true")
|
||||
{
|
||||
%editor.consoleFrameColor = "255 0 0";
|
||||
%editor.consoleFillColor = "0 0 0 0";
|
||||
%editor.renderSphere(%this.getWorldBoxCenter(), %this.radius, 1);
|
||||
}
|
||||
}
|
||||
|
||||
function AudioEmitter::onEditorRender(%this, %editor, %selected, %expanded)
|
||||
{
|
||||
if(%selected $= "true" && %this.is3D && !%this.useProfileDescription)
|
||||
{
|
||||
%editor.consoleFillColor = "0 0 0 0";
|
||||
|
||||
%editor.consoleFrameColor = "255 0 0";
|
||||
%editor.renderSphere(%this.getTransform(), %this.minDistance, 1);
|
||||
|
||||
%editor.consoleFrameColor = "0 0 255";
|
||||
%editor.renderSphere(%this.getTransform(), %this.maxDistance, 1);
|
||||
}
|
||||
}
|
||||
|
||||
//function Item::onEditorRender(%this, %editor, %selected, %expanded)
|
||||
//{
|
||||
// if(%this.getDataBlock().getName() $= "MineDeployed")
|
||||
// {
|
||||
// %editor.consoleFillColor = "0 0 0 0";
|
||||
// %editor.consoleFrameColor = "255 0 0";
|
||||
// %editor.renderSphere(%this.getWorldBoxCenter(), 6, 1);
|
||||
// }
|
||||
//}
|
||||
53
docs/base/@vl2/scripts.vl2/scripts/environmentals.cs
Normal file
53
docs/base/@vl2/scripts.vl2/scripts/environmentals.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
// Used by interiors: ------------------------------------------------------
|
||||
datablock AudioProfile(Universal_Base_1)
|
||||
{
|
||||
filename = "fx/environment/base_1.wav";
|
||||
description = AudioLooping2d;
|
||||
};
|
||||
|
||||
datablock AudioProfile(Universal_Base_2)
|
||||
{
|
||||
filename = "fx/environment/base_2.wav";
|
||||
description = AudioLooping2d;
|
||||
};
|
||||
|
||||
datablock AudioProfile(Universal_Base_3)
|
||||
{
|
||||
filename = "fx/environment/base_3.wav";
|
||||
description = AudioLooping2d;
|
||||
};
|
||||
|
||||
datablock AudioProfile(Universal_Base_Pulse_1)
|
||||
{
|
||||
filename = "fx/environment/base_pulse_1.wav";
|
||||
description = AudioLooping2d;
|
||||
};
|
||||
|
||||
datablock AudioProfile(Universal_Base_Pulse_2)
|
||||
{
|
||||
filename = "fx/environment/base_pulse_2.wav";
|
||||
description = AudioLooping2d;
|
||||
};
|
||||
|
||||
datablock AudioProfile(sPowerUp)
|
||||
{
|
||||
filename = "fx/powered/base_power_on.wav";
|
||||
description = Audio2d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(sPowerDown)
|
||||
{
|
||||
filename = "fx/powered/base_power_off.wav";
|
||||
description = Audio2d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
256
docs/base/@vl2/scripts.vl2/scripts/forceField.cs
Normal file
256
docs/base/@vl2/scripts.vl2/scripts/forceField.cs
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Force fields:
|
||||
//
|
||||
// accept the following commands:
|
||||
// open()
|
||||
// close()
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
|
||||
datablock ForceFieldBareData(defaultForceFieldBare)
|
||||
{
|
||||
fadeMS = 1000;
|
||||
baseTranslucency = 0.30;
|
||||
powerOffTranslucency = 0.0;
|
||||
teamPermiable = false;
|
||||
otherPermiable = false;
|
||||
color = "0.0 0.55 0.99";
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
targetNameTag = 'Force Field';
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
datablock ForceFieldBareData(defaultTeamSlowFieldBare)
|
||||
{
|
||||
fadeMS = 1000;
|
||||
baseTranslucency = 0.3;
|
||||
powerOffTranslucency = 0.0;
|
||||
teamPermiable = true;
|
||||
otherPermiable = false;
|
||||
color = "0.28 0.89 0.31";
|
||||
powerOffColor = "0.0 0.0 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;
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(defaultAllSlowFieldBare)
|
||||
{
|
||||
fadeMS = 1000;
|
||||
baseTranslucency = 0.30;
|
||||
powerOffTranslucency = 0.0;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = "1.0 0.4 0.0";
|
||||
powerOffColor = "0.0 0.0 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;
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(defaultNoTeamSlowFieldBare)
|
||||
{
|
||||
fadeMS = 1000;
|
||||
baseTranslucency = 0.30;
|
||||
powerOffTranslucency = 0.0;
|
||||
teamPermiable = false;
|
||||
otherPermiable = true;
|
||||
color = "1.0 0.0 0.0";
|
||||
powerOffColor = "0.0 0.0 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;
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(defaultSolidFieldBare)
|
||||
{
|
||||
fadeMS = 1000;
|
||||
baseTranslucency = 0.30;
|
||||
powerOffTranslucency = 0.0;
|
||||
teamPermiable = false;
|
||||
otherPermiable = false;
|
||||
color = "1.0 0.0 0.0";
|
||||
powerOffColor = "0.0 0.0 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;
|
||||
};
|
||||
|
||||
|
||||
function ForceFieldBare::onTrigger(%this, %triggerId, %on)
|
||||
{
|
||||
// Default behavior for a field:
|
||||
// if triggered: go to open state (last waypoint)
|
||||
// if untriggered: go to closed state (first waypoint)
|
||||
|
||||
if (%on == 1) {
|
||||
%this.triggerCount++;
|
||||
} else {
|
||||
if (%this.triggerCount > 0)
|
||||
%this.triggerCount--;
|
||||
}
|
||||
|
||||
if (%this.triggerCount > 0) {
|
||||
%this.open();
|
||||
} else {
|
||||
%this.close();
|
||||
}
|
||||
}
|
||||
|
||||
function ForceFieldBareData::gainPower(%data, %obj)
|
||||
{
|
||||
Parent::gainPower(%data, %obj);
|
||||
%obj.close();
|
||||
// activate the field's physical zone
|
||||
%pzGroup = nameToID("MissionCleanup/PZones");
|
||||
if(%pzGroup > 0) {
|
||||
%ffp = -1;
|
||||
for(%i = 0; %i < %pzGroup.getCount(); %i++) {
|
||||
%pz = %pzGroup.getObject(%i);
|
||||
if(%pz.ffield == %obj) {
|
||||
%ffp = %pz;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(%ffp > 0) {
|
||||
%ffp.activate();
|
||||
if( %data.getName() $= "defaultForceFieldBare" )
|
||||
{
|
||||
killAllPlayersWithinZone( %data, %obj );
|
||||
}
|
||||
else if( %data.getName() $= "defaultTeamSlowFieldBare" )
|
||||
{
|
||||
%team = %obj.team;
|
||||
killAllPlayersWithinZone( %data, %obj, %team );
|
||||
}
|
||||
}
|
||||
}
|
||||
//else
|
||||
// error("No PZones group to search!");
|
||||
}
|
||||
|
||||
function killAllPlayersWithinZone( %data, %obj, %team )
|
||||
{
|
||||
for( %c = 0; %c < ClientGroup.getCount(); %c++ )
|
||||
{
|
||||
%client = ClientGroup.getObject(%c);
|
||||
if( isObject( %client.player ) )
|
||||
{
|
||||
if( %forceField = %client.player.isInForceField() )// isInForceField() will return the id of the ff or zero
|
||||
{
|
||||
if( %forceField == %obj )
|
||||
{
|
||||
if( %team !$= "" && %team == %client.team )
|
||||
return;
|
||||
else
|
||||
{
|
||||
%client.player.blowup(); // chunkOrama!
|
||||
%client.player.scriptkill($DamageType::ForceFieldPowerup);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ForceFieldBareData::losePower(%data, %obj)
|
||||
{
|
||||
Parent::losePower(%data, %obj);
|
||||
%obj.open();
|
||||
// deactivate the field's physical zone
|
||||
%pzGroup = nameToID("MissionCleanup/PZones");
|
||||
if(%pzGroup > 0) {
|
||||
%ffp = -1;
|
||||
for(%i = 0; %i < %pzGroup.getCount(); %i++) {
|
||||
%pz = %pzGroup.getObject(%i);
|
||||
if(%pz.ffield == %obj) {
|
||||
%ffp = %pz;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(%ffp > 0) {
|
||||
%ffp.deactivate();
|
||||
}
|
||||
}
|
||||
//else
|
||||
// error("<No PZones group to search!>");
|
||||
}
|
||||
|
||||
function ForceFieldBareData::onAdd(%data, %obj)
|
||||
{
|
||||
Parent::onAdd(%data, %obj);
|
||||
|
||||
%pz = new PhysicalZone() {
|
||||
position = %obj.position;
|
||||
rotation = %obj.rotation;
|
||||
scale = %obj.scale;
|
||||
polyhedron = "0.000000 1.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
|
||||
velocityMod = 0.1;
|
||||
gravityMod = 1.0;
|
||||
appliedForce = "0 0 0";
|
||||
ffield = %obj;
|
||||
};
|
||||
%pzGroup = nameToID("MissionCleanup/PZones");
|
||||
if(%pzGroup <= 0) {
|
||||
%pzGroup = new SimGroup("PZones");
|
||||
MissionCleanup.add(%pzGroup);
|
||||
}
|
||||
%pzGroup.add(%pz);
|
||||
//MissionCleanupGroup.add(%pz);
|
||||
}
|
||||
|
||||
|
||||
116
docs/base/@vl2/scripts.vl2/scripts/gameBase.cs
Normal file
116
docs/base/@vl2/scripts.vl2/scripts/gameBase.cs
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
|
||||
function GameBaseData::onAdd(%data, %obj)
|
||||
{
|
||||
if(%data.targetTypeTag !$= "")
|
||||
{
|
||||
// use the name given to the object in the mission file
|
||||
if(%obj.nameTag !$= "")
|
||||
{
|
||||
%obj.nameTag = addTaggedString(%obj.nameTag);
|
||||
%nameTag = %obj.nameTag;
|
||||
}
|
||||
else
|
||||
%nameTag = %data.targetNameTag;
|
||||
|
||||
%obj.target = createTarget(%obj, %nameTag, "", "", %data.targetTypeTag, 0, 0);
|
||||
}
|
||||
else
|
||||
%obj.target = -1;
|
||||
}
|
||||
|
||||
function GameBaseData::onRemove(%data, %obj)
|
||||
{
|
||||
%target = %obj.getTarget();
|
||||
|
||||
// first 32 targets are team targets
|
||||
if(%target >= 32)
|
||||
{
|
||||
if(%obj.nameTag !$= "")
|
||||
removeTaggedString(%obj.nameTag);
|
||||
freeTarget(%target);
|
||||
}
|
||||
}
|
||||
|
||||
function InteriorInstance::damage()
|
||||
{
|
||||
}
|
||||
|
||||
function TerrainBlock::damage()
|
||||
{
|
||||
}
|
||||
|
||||
function ForceFieldBare::damage()
|
||||
{
|
||||
}
|
||||
|
||||
function GameBaseData::shouldApplyImpulse(%data, %obj)
|
||||
{
|
||||
return %data.shouldApplyImpulse;
|
||||
}
|
||||
|
||||
|
||||
function ShapeBaseData::onAdd(%data, %obj)
|
||||
{
|
||||
Parent::onAdd(%data, %obj);
|
||||
// if it's a deployed object, schedule the ambient thread to play in a little while
|
||||
if(%data.deployAmbientThread)
|
||||
%obj.schedule(750, "playThread", $AmbientThread, "ambient");
|
||||
// check for ambient animation that should always be played
|
||||
if(%data.alwaysAmbient)
|
||||
%obj.playThread($AmbientThread, "ambient");
|
||||
}
|
||||
|
||||
function SimObject::setOwnerClient(%obj, %cl)
|
||||
{
|
||||
%obj.client = %cl;
|
||||
}
|
||||
|
||||
function SimObject::getOwnerClient(%obj)
|
||||
{
|
||||
if(isObject(%obj))
|
||||
return %obj.client;
|
||||
return 0;
|
||||
}
|
||||
// recursive objective init functions for mission group
|
||||
|
||||
function SimGroup::objectiveInit(%this)
|
||||
{
|
||||
for (%i = 0; %i < %this.getCount(); %i++)
|
||||
%this.getObject(%i).objectiveInit();
|
||||
}
|
||||
|
||||
function SimObject::objectiveInit(%this)
|
||||
{
|
||||
}
|
||||
|
||||
function GameBase::objectiveInit(%this)
|
||||
{
|
||||
//error("Initializing object " @ %this @ ", " @ %this.getDataBlock().getName());
|
||||
%this.getDataBlock().objectiveInit(%this);
|
||||
}
|
||||
|
||||
// tag strings are ignored if they start with an underscore
|
||||
function GameBase::getGameName(%this)
|
||||
{
|
||||
%name = "";
|
||||
|
||||
if(%this.nameTag !$= "")
|
||||
%name = %this.nameTag;
|
||||
else
|
||||
{
|
||||
%name = getTaggedString(%this.getDataBlock().targetNameTag);
|
||||
if((%name !$= "") && (getSubStr(%name, 0, 1) $= "_"))
|
||||
%name = "";
|
||||
}
|
||||
|
||||
%type = getTaggedString(%this.getDataBlock().targetTypeTag);
|
||||
if((%type !$= "") && (getSubStr(%type, 0, 1) !$= "_"))
|
||||
{
|
||||
if(%name !$= "")
|
||||
return(%name @ " " @ %type);
|
||||
else
|
||||
return(%type);
|
||||
}
|
||||
|
||||
return(%name);
|
||||
}
|
||||
47
docs/base/@vl2/scripts.vl2/scripts/gameCanvas.cs
Normal file
47
docs/base/@vl2/scripts.vl2/scripts/gameCanvas.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
function SimSet::removeStable(%this, %object)
|
||||
{
|
||||
if(%this.getCount() < 2)
|
||||
{
|
||||
%this.remove(%object);
|
||||
return;
|
||||
}
|
||||
%last = %this.getObject(%this.getCount() - 1);
|
||||
%this.remove(%object);
|
||||
%this.pushToBack(%last);
|
||||
}
|
||||
|
||||
if(!isObject(GameDialogSet))
|
||||
{
|
||||
new SimSet(GameDialogSet);
|
||||
RootGroup.add(GameDialogSet);
|
||||
}
|
||||
|
||||
function GuiCanvas::setGameMode(%this, %on)
|
||||
{
|
||||
if(%this.gameMode == %on)
|
||||
return;
|
||||
|
||||
%this.gameMode = %on;
|
||||
if(%this.gameMode)
|
||||
{
|
||||
%this.setContent(%this.gameContent);
|
||||
for(%i = 0; %i < GameDialogSet.getCount(); %i++)
|
||||
%this.pushDialog(GameDialogSet.getObject(%i));
|
||||
}
|
||||
else
|
||||
Canvas.setContent(LobbyGui);
|
||||
}
|
||||
|
||||
function GuiCanvas::pushGameDialog(%this, %dialog)
|
||||
{
|
||||
GameDialogSet.add(%dialog);
|
||||
if(%this.gameMode)
|
||||
%this.pushDialog(%dialog);
|
||||
}
|
||||
|
||||
function GuiCanvas::popGameDialog(%this, %dialog)
|
||||
{
|
||||
GameDialogSet.removeStable(%dialog);
|
||||
if(%this.gameMode)
|
||||
%this.popDialog(%dialog);
|
||||
}
|
||||
39
docs/base/@vl2/scripts.vl2/scripts/graphBuild.cs
Normal file
39
docs/base/@vl2/scripts.vl2/scripts/graphBuild.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// offline graph building
|
||||
|
||||
$MAXNODECOUNT = 5000;
|
||||
|
||||
function makeJettableGraphOffline(%NAVorSPAWN)
|
||||
{
|
||||
if (%NAVorSPAWN $= "Spawn")
|
||||
echo("--> Building Spawn Graph");
|
||||
else
|
||||
echo("--> Building Nav Graph");
|
||||
|
||||
// Inform what we're generating-
|
||||
navGraph.setGenMode(%NAVorSPAWN);
|
||||
|
||||
// Upload ground and floor data-
|
||||
navGraph::exteriorInspect();
|
||||
navGraph::generateInterior();
|
||||
|
||||
// navGraph.makeGraph();
|
||||
// navGraph.findBridges();
|
||||
// navGraph.pushBridges();
|
||||
|
||||
navGraph.assemble();
|
||||
navGraph.cullIslands();
|
||||
|
||||
navGraph.makeGraph();
|
||||
navGraph.pushBridges();
|
||||
navGraph.makeTables();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function doTablebuildOffline()
|
||||
{
|
||||
navGraph.prepLOS("0 0 0");
|
||||
while(navGraph.makeLOS())
|
||||
%percent++;
|
||||
}
|
||||
|
||||
41
docs/base/@vl2/scripts.vl2/scripts/heavy_male.cs
Normal file
41
docs/base/@vl2/scripts.vl2/scripts/heavy_male.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
datablock TSShapeConstructor(HeavyMaleDts)
|
||||
{
|
||||
baseShape = "heavy_male.dts";
|
||||
sequence0 = "heavy_male_root.dsq root";
|
||||
sequence1 = "heavy_male_forward.dsq run";
|
||||
sequence2 = "heavy_male_back.dsq back";
|
||||
sequence3 = "heavy_male_side.dsq side";
|
||||
sequence4 = "heavy_male_lookde.dsq look";
|
||||
sequence5 = "heavy_male_head.dsq head";
|
||||
sequence6 = "heavy_male_fall.dsq fall";
|
||||
sequence7 = "heavy_male_jet.dsq jet";
|
||||
sequence8 = "heavy_male_land.dsq land";
|
||||
sequence9 = "heavy_male_jump.dsq jump";
|
||||
sequence10 = "heavy_male_recoilde.dsq light_recoil";
|
||||
sequence11 = "heavy_male_idlepda.dsq pda";
|
||||
sequence12 = "heavy_male_headside.dsq headside";
|
||||
sequence13 = "heavy_male_lookms.dsq lookms";
|
||||
sequence14 = "heavy_male_diehead.dsq death1";
|
||||
sequence15 = "heavy_male_diechest.dsq death2";
|
||||
sequence16 = "heavy_male_dieback.dsq death3";
|
||||
sequence17 = "heavy_male_diesidelf.dsq death4";
|
||||
sequence18 = "heavy_male_diesidert.dsq death5";
|
||||
sequence19 = "heavy_male_dieforward.dsq death6"; // heavy_male_dieleglf
|
||||
sequence20 = "heavy_male_diechest.dsq death7"; // heavy_male_dielegrt
|
||||
sequence21 = "heavy_male_dieslump.dsq death8";
|
||||
sequence22 = "heavy_male_dieforward.dsq death9"; // heavy_male_dieknees
|
||||
sequence23 = "heavy_male_dieforward.dsq death10";
|
||||
sequence24 = "heavy_male_diespin.dsq death11";
|
||||
sequence25 = "heavy_male_celsalute.dsq cel1";
|
||||
sequence26 = "heavy_male_celwave.dsq cel2";
|
||||
sequence27 = "heavy_male_tauntbest.dsq cel3";
|
||||
sequence28 = "heavy_male_tauntimp.dsq cel4";
|
||||
sequence29 = "heavy_male_celdance.dsq cel5";
|
||||
sequence30 = "heavy_male_celflex.dsq cel6";
|
||||
sequence31 = "heavy_male_celtaunt.dsq cel7";
|
||||
sequence32 = "heavy_male_celjump.dsq cel8";
|
||||
sequence33 = "heavy_male_ski.dsq ski";
|
||||
sequence34 = "heavy_male_standjump.dsq standjump";
|
||||
sequence35 = "heavy_male_looknw.dsq looknw";
|
||||
};
|
||||
|
||||
72
docs/base/@vl2/scripts.vl2/scripts/help.cs
Normal file
72
docs/base/@vl2/scripts.vl2/scripts/help.cs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Torque Engine
|
||||
//
|
||||
// Copyright (c) 2001 GarageGames.Com
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function HelpDlg::onWake(%this)
|
||||
{
|
||||
HelpFileList.entryCount = 0;
|
||||
HelpFileList.clear();
|
||||
for(%file = findFirstFile("*.hfl"); %file !$= ""; %file = findNextFile("*.hfl"))
|
||||
{
|
||||
HelpFileList.fileName[HelpFileList.entryCount] = %file;
|
||||
HelpFileList.addRow(HelpFileList.entryCount, fileBase(%file));
|
||||
HelpFileList.entryCount++;
|
||||
}
|
||||
HelpFileList.sortNumerical(0);
|
||||
HelpFileList.setSelectedRow(0);
|
||||
}
|
||||
|
||||
function HelpFileList::onSelect(%this, %row)
|
||||
{
|
||||
%fo = new FileObject();
|
||||
%fo.openForRead(%this.fileName[%row]);
|
||||
%text = "<color:000000>";
|
||||
while(!%fo.isEOF())
|
||||
%text = %text @ %fo.readLine() @ "\n";
|
||||
|
||||
%fo.delete();
|
||||
HelpText.setText(%text);
|
||||
}
|
||||
|
||||
function getHelp(%helpName)
|
||||
{
|
||||
trace(1);
|
||||
Canvas.pushDialog(HelpDlg);
|
||||
if(%helpName !$= "")
|
||||
{
|
||||
%index = HelpFileList.findTextIndex(%helpName);
|
||||
HelpFileList.setSelectedRow(%index);
|
||||
}
|
||||
trace(0);
|
||||
}
|
||||
|
||||
function contextHelp()
|
||||
{
|
||||
for(%i = 0; %i < Canvas.getCount(); %i++)
|
||||
{
|
||||
if(Canvas.getObject(%i).getName() $= HelpDlg)
|
||||
{
|
||||
Canvas.popDialog(HelpDlg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
%content = Canvas.getContent();
|
||||
%helpPage = %content.getHelpPage();
|
||||
getHelp(%helpPage);
|
||||
}
|
||||
|
||||
function GuiControl::getHelpPage(%this)
|
||||
{
|
||||
return %this.helpPage;
|
||||
}
|
||||
|
||||
function GuiMLTextCtrl::onURL(%this, %url)
|
||||
{
|
||||
if(getSubStr(%url, 0, 5) $= "help/")
|
||||
getHelp(getSubStr(%url, 5, 100000));
|
||||
else
|
||||
gotoWebPage( %url );
|
||||
}
|
||||
|
||||
24
docs/base/@vl2/scripts.vl2/scripts/helpGuiText.cs
Normal file
24
docs/base/@vl2/scripts.vl2/scripts/helpGuiText.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
$helpTextShown = false;
|
||||
|
||||
function toggleHelpText()
|
||||
{
|
||||
// if HUD has been altered, do not show helpTextGui
|
||||
if(helpTextGui.visible)
|
||||
helpTextGui.setVisible(false);
|
||||
else
|
||||
{
|
||||
if(!$helpTextShown)
|
||||
{
|
||||
objHudText.setValue("Displays important information about the current mission.");
|
||||
chatHudText.setValue("Chat messages from other players are displayed here.");
|
||||
energyHudText.setValue("Your armor's available energy. Heat (the red bar) increases as you use jets.");
|
||||
compassHudText.setValue("Compass spins as you turn. Clock shows mission time. If the center is flashing red, you've been detected.");
|
||||
damageHudText.setValue("You are dead if this reaches zero.");
|
||||
reticleHudText.setValue("Your weapon fire hits approximately in the center of this.");
|
||||
inventoryHudText.setValue("Shows (left to right) number of grenades, mines, health kits and beacons.");
|
||||
weaponsHudText.setValue("Shows your available weapons, plus a targeting laser.");
|
||||
$helpTextShown = true;
|
||||
}
|
||||
helpTextGui.setVisible(true);
|
||||
}
|
||||
}
|
||||
1826
docs/base/@vl2/scripts.vl2/scripts/hud.cs
Normal file
1826
docs/base/@vl2/scripts.vl2/scripts/hud.cs
Normal file
File diff suppressed because it is too large
Load diff
15
docs/base/@vl2/scripts.vl2/scripts/icePropMap.cs
Normal file
15
docs/base/@vl2/scripts.vl2/scripts/icePropMap.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
//-------------------------------------- Desert interior texture property mapping
|
||||
|
||||
addMaterialMapping("ice/sw_ichute01", "environment: special/chuteTexture 0.25");
|
||||
addMaterialMapping("ice/sw_ichute02", "environment: special/chuteTexture 0.25");
|
||||
|
||||
//"Color: red green blue startAlpha endAlpha"
|
||||
//Soft sound = 0
|
||||
//Hard sound = 1
|
||||
//Metal sound = 2
|
||||
//Snow sound = 3
|
||||
addMaterialMapping("terrain/IceWorld.Ice", "color: 0.9 0.9 0.9 0.4 0.0", "sound: 3");
|
||||
addMaterialMapping("terrain/IceWorld.RockBlue", "color: 0.9 0.9 0.9 0.4 0.0", "sound: 3");
|
||||
addMaterialMapping("terrain/IceWorld.Snow", "color: 0.9 0.9 0.9 0.4 0.0", "sound: 3");
|
||||
addMaterialMapping("terrain/IceWorld.SnowIce", "color: 0.9 0.9 0.9 0.4 0.0", "sound: 3");
|
||||
addMaterialMapping("terrain/IceWorld.SnowRock", "color: 0.9 0.9 0.9 0.4 0.0", "sound: 3");
|
||||
567
docs/base/@vl2/scripts.vl2/scripts/inventory.cs
Normal file
567
docs/base/@vl2/scripts.vl2/scripts/inventory.cs
Normal file
|
|
@ -0,0 +1,567 @@
|
|||
//----------------------------------------------------------------------------
|
||||
|
||||
// Item Datablocks
|
||||
// image = Name of mounted image datablock
|
||||
// onUse(%this,%object)
|
||||
|
||||
// Item Image Datablocks
|
||||
// item = Name of item inventory datablock
|
||||
|
||||
// ShapeBase Datablocks
|
||||
// max[Item] = Maximum amount that can be caried
|
||||
|
||||
// ShapeBase Objects
|
||||
// inv[Item] = Count of item in inventory
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
$TestCheats = 0;
|
||||
|
||||
function serverCmdUse(%client,%data)
|
||||
{
|
||||
// Item names from the client must converted
|
||||
// into DataBlocks
|
||||
// %data = ItemDataBlock[%item];
|
||||
|
||||
%client.getControlObject().use(%data);
|
||||
}
|
||||
|
||||
function serverCmdThrow(%client,%data)
|
||||
{
|
||||
// Item names from the client must converted
|
||||
// into DataBlocks
|
||||
// %data = ItemDataBlock[%item];
|
||||
%client.getControlObject().throw(%data);
|
||||
}
|
||||
|
||||
function serverCmdThrowWeapon(%client,%data)
|
||||
{
|
||||
// Item names from the client must converted
|
||||
// into DataBlocks
|
||||
// %data = ItemDataBlock[%item];
|
||||
%client.getControlObject().throwWeapon();
|
||||
}
|
||||
|
||||
function serverCmdThrowPack(%client,%data)
|
||||
{
|
||||
%client.getControlObject().throwPack();
|
||||
}
|
||||
|
||||
function serverCmdTogglePack(%client,%data)
|
||||
{
|
||||
// this function is apparently never called
|
||||
%client.getControlObject().togglePack();
|
||||
}
|
||||
|
||||
function serverCmdThrowFlag(%client)
|
||||
{
|
||||
//Game.playerDroppedFlag(%client.player);
|
||||
Game.dropFlag(%client.player);
|
||||
}
|
||||
|
||||
function serverCmdSelectWeaponSlot( %client, %data )
|
||||
{
|
||||
%client.getControlObject().selectWeaponSlot( %data );
|
||||
}
|
||||
|
||||
function serverCmdCycleWeapon( %client, %data )
|
||||
{
|
||||
%client.getControlObject().cycleWeapon( %data );
|
||||
}
|
||||
|
||||
function serverCmdStartThrowCount(%client, %data)
|
||||
{
|
||||
%client.player.throwStart = getSimTime();
|
||||
}
|
||||
|
||||
function serverCmdEndThrowCount(%client, %data)
|
||||
{
|
||||
if(%client.player.throwStart == 0)
|
||||
return;
|
||||
|
||||
// throwStrength will be how many seconds the key was held
|
||||
%throwStrength = (getSimTime() - %client.player.throwStart) / 150;
|
||||
// trim the time to fit between 0.5 and 1.5
|
||||
if(%throwStrength > 1.5)
|
||||
%throwStrength = 1.5;
|
||||
else if(%throwStrength < 0.5)
|
||||
%throwStrength = 0.5;
|
||||
|
||||
%throwScale = %throwStrength / 2;
|
||||
%client.player.throwStrength = %throwScale;
|
||||
|
||||
%client.player.throwStart = 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function ShapeBase::throwWeapon(%this)
|
||||
{
|
||||
if(Game.shapeThrowWeapon(%this)) {
|
||||
%image = %this.getMountedImage($WeaponSlot);
|
||||
%this.throw(%image.item);
|
||||
%this.client.setWeaponsHudItem(%image.item, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
function ShapeBase::throwPack(%this)
|
||||
{
|
||||
%image = %this.getMountedImage($BackpackSlot);
|
||||
%this.throw(%image.item);
|
||||
%this.client.setBackpackHudItem(%image.item, 0);
|
||||
}
|
||||
|
||||
function ShapeBase::throw(%this,%data)
|
||||
{
|
||||
if(!isObject(%data))
|
||||
return false;
|
||||
|
||||
if (%this.inv[%data.getName()] > 0) {
|
||||
|
||||
// save off the ammo count on this item
|
||||
if( %this.getInventory( %data ) < $AmmoIncrement[%data.getName()] )
|
||||
%data.ammoStore = %this.getInventory( %data );
|
||||
else
|
||||
%data.ammoStore = $AmmoIncrement[%data.getName()];
|
||||
|
||||
// Throw item first...
|
||||
%this.throwItem(%data);
|
||||
if($AmmoIncrement[%data.getName()] !$= "")
|
||||
%this.decInventory(%data,$AmmoIncrement[%data.getName()]);
|
||||
else
|
||||
%this.decInventory(%data,1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function ShapeBase::use(%this, %data)
|
||||
{
|
||||
//if(%data.class $= "Weapon") {
|
||||
// error("ShapeBase::use " @ %data);
|
||||
//}
|
||||
if(%data $= Grenade)
|
||||
{
|
||||
// figure out which grenade type you're using
|
||||
for(%x = 0; $InvGrenade[%x] !$= ""; %x++) {
|
||||
if(%this.inv[$NameToInv[$InvGrenade[%x]]] > 0)
|
||||
{
|
||||
%data = $NameToInv[$InvGrenade[%x]];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(%data $= "Backpack") {
|
||||
%pack = %this.getMountedImage($BackpackSlot);
|
||||
// if you don't have a pack but have placed a satchel charge, detonate it
|
||||
if(!%pack && (%this.thrownChargeId > 0) && %this.thrownChargeId.armed )
|
||||
{
|
||||
%this.playAudio( 0, SatchelChargeExplosionSound );
|
||||
schedule( 800, %this, "detonateSatchelCharge", %this );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if(%data $= Beacon)
|
||||
{
|
||||
%data.onUse(%this);
|
||||
if (%this.inv[%data.getName()] > 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
// default case
|
||||
if (%this.inv[%data.getName()] > 0) {
|
||||
%data.onUse(%this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function ShapeBase::pickup(%this,%obj,%amount)
|
||||
{
|
||||
%data = %obj.getDatablock();
|
||||
%delta = %this.incInventory(%data,%amount);
|
||||
|
||||
if (%delta)
|
||||
%data.onPickup(%obj,%this,%delta);
|
||||
return %delta;
|
||||
}
|
||||
|
||||
function ShapeBase::hasInventory(%this, %data)
|
||||
{
|
||||
// changed because it was preventing weapons cycling correctly (MES)
|
||||
return (%this.inv[%data] > 0);
|
||||
}
|
||||
|
||||
function ShapeBase::maxInventory(%this,%data)
|
||||
{
|
||||
if($TestCheats)
|
||||
return 999;
|
||||
else
|
||||
return %this.getDatablock().max[%data.getName()];
|
||||
}
|
||||
|
||||
function ShapeBase::incInventory(%this,%data,%amount)
|
||||
{
|
||||
%max = %this.maxInventory(%data);
|
||||
%cv = %this.inv[%data.getName()];
|
||||
if (%cv < %max) {
|
||||
if (%cv + %amount > %max)
|
||||
%amount = %max - %cv;
|
||||
%this.setInventory(%data,%cv + %amount);
|
||||
%data.incCatagory(%this); // Inc the players weapon count
|
||||
return %amount;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function ShapeBase::decInventory(%this,%data,%amount)
|
||||
{
|
||||
%name = %data.getName();
|
||||
%cv = %this.inv[%name];
|
||||
if (%cv > 0) {
|
||||
if (%cv < %amount)
|
||||
%amount = %cv;
|
||||
%this.setInventory(%data,%cv - %amount, true);
|
||||
%data.decCatagory(%this); // Dec the players weapon count
|
||||
return %amount;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function SimObject::decCatagory(%this)
|
||||
{
|
||||
//function was added to reduce console err msg spam
|
||||
}
|
||||
|
||||
function SimObject::incCatagory(%this)
|
||||
{
|
||||
//function was added to reduce console err msg spam
|
||||
}
|
||||
|
||||
function ShapeBase::setInventory(%this,%data,%value,%force)
|
||||
{
|
||||
if (!isObject(%data))
|
||||
return;
|
||||
|
||||
%name = %data.getName();
|
||||
if (%value < 0)
|
||||
%value = 0;
|
||||
else
|
||||
{
|
||||
if (!%force)
|
||||
{
|
||||
// Impose inventory limits
|
||||
%max = %this.maxInventory(%data);
|
||||
if (%value > %max)
|
||||
%value = %max;
|
||||
}
|
||||
}
|
||||
if (%this.inv[%name] != %value)
|
||||
{
|
||||
%this.inv[%name] = %value;
|
||||
%data.onInventory(%this,%value);
|
||||
|
||||
if ( %data.className $= "Weapon" )
|
||||
{
|
||||
if ( %this.weaponSlotCount $= "" )
|
||||
%this.weaponSlotCount = 0;
|
||||
|
||||
%cur = -1;
|
||||
for ( %slot = 0; %slot < %this.weaponSlotCount; %slot++ )
|
||||
{
|
||||
if ( %this.weaponSlot[%slot] $= %name )
|
||||
{
|
||||
%cur = %slot;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( %cur == -1 )
|
||||
{
|
||||
// Put this weapon in the next weapon slot:
|
||||
if ( %this.weaponSlot[%this.weaponSlotCount - 1] $= "TargetingLaser" )
|
||||
{
|
||||
%this.weaponSlot[%this.weaponSlotCount - 1] = %name;
|
||||
%this.weaponSlot[%this.weaponSlotCount] = "TargetingLaser";
|
||||
}
|
||||
else
|
||||
%this.weaponSlot[%this.weaponSlotCount] = %name;
|
||||
%this.weaponSlotCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove the weapon from the weapon slot:
|
||||
for ( %i = %cur; %i < %this.weaponSlotCount - 1; %i++ )
|
||||
%this.weaponSlot[%i] = %this.weaponSlot[%i + 1];
|
||||
%this.weaponSlot[%i] = "";
|
||||
%this.weaponSlotCount--;
|
||||
}
|
||||
}
|
||||
|
||||
%this.getDataBlock().onInventory(%data,%value);
|
||||
}
|
||||
return %value;
|
||||
}
|
||||
|
||||
function ShapeBase::getInventory(%this,%data)
|
||||
{
|
||||
if ( isObject( %data ) )
|
||||
return( %this.inv[%data.getName()] );
|
||||
else
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
// z0dd - ZOD, 9/13/02. Streamlined.
|
||||
function ShapeBase::hasAmmo( %this, %weapon )
|
||||
{
|
||||
if(%weapon $= LaserRifle)
|
||||
return( %this.getInventory( EnergyPack ) );
|
||||
|
||||
if (%weapon.image.ammo $= "")
|
||||
{
|
||||
if (%weapon $= TargetingLaser)
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( true );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return( %this.getInventory( %weapon.image.ammo ) > 0 );
|
||||
}
|
||||
}
|
||||
|
||||
function SimObject::onInventory(%this, %obj)
|
||||
{
|
||||
//function was added to reduce console error msg spam
|
||||
}
|
||||
|
||||
function ShapeBase::throwItem(%this,%data)
|
||||
{
|
||||
%item = new Item() {
|
||||
dataBlock = %data;
|
||||
rotation = "0 0 1 " @ (getRandom() * 360);
|
||||
};
|
||||
|
||||
%item.ammoStore = %data.ammoStore;
|
||||
MissionCleanup.add(%item);
|
||||
%this.throwObject(%item);
|
||||
}
|
||||
|
||||
function ShapeBase::throwObject(%this,%obj)
|
||||
{
|
||||
//-------------------------------------------
|
||||
// z0dd - ZOD, 5/27/02. Fixes flags hovering
|
||||
// over friendly player when collision occurs
|
||||
if(%obj.getDataBlock().getName() $= "Flag")
|
||||
%obj.static = false;
|
||||
//-------------------------------------------
|
||||
|
||||
//if the object is being thrown by a corpse, use a random vector
|
||||
if (%this.getState() $= "Dead")
|
||||
{
|
||||
%vec = (-1.0 + getRandom() * 2.0) SPC (-1.0 + getRandom() * 2.0) SPC getRandom();
|
||||
%vec = vectorScale(%vec, 10);
|
||||
}
|
||||
|
||||
// else Initial vel based on the dir the player is looking
|
||||
else
|
||||
{
|
||||
%eye = %this.getEyeVector();
|
||||
%vec = vectorScale(%eye, 20);
|
||||
}
|
||||
|
||||
// Add a vertical component to give the item a better arc
|
||||
%dot = vectorDot("0 0 1",%eye);
|
||||
if (%dot < 0)
|
||||
%dot = -%dot;
|
||||
%vec = vectorAdd(%vec,vectorScale("0 0 8",1 - %dot));
|
||||
|
||||
// Add player's velocity
|
||||
%vec = vectorAdd(%vec,%this.getVelocity());
|
||||
%pos = getBoxCenter(%this.getWorldBox());
|
||||
|
||||
//since flags have a huge mass (so when you shoot them, they don't bounce too far)
|
||||
//we need to up the %vec so that you can still throw them...
|
||||
if (%obj.getDataBlock().getName() $= "Flag")
|
||||
%vec = vectorScale(%vec, 40);
|
||||
|
||||
//
|
||||
%obj.setTransform(%pos);
|
||||
%obj.applyImpulse(%pos,%vec);
|
||||
%obj.setCollisionTimeout(%this);
|
||||
%data = %obj.getDatablock();
|
||||
%data.onThrow(%obj,%this);
|
||||
|
||||
//call the AI hook
|
||||
AIThrowObject(%obj);
|
||||
}
|
||||
|
||||
function ShapeBase::clearInventory(%this)
|
||||
{
|
||||
%this.setInventory(RepairKit,0);
|
||||
|
||||
%this.setInventory(Mine,0);
|
||||
//%this.setInventory(MineAir,0);
|
||||
//%this.setInventory(MineLand,0);
|
||||
//%this.setInventory(MineSticky,0);
|
||||
|
||||
%this.setInventory(Grenade,0);
|
||||
%this.setInventory(FlashGrenade,0);
|
||||
%this.setInventory(ConcussionGrenade,0);
|
||||
%this.setInventory(FlareGrenade,0);
|
||||
%this.setInventory(CameraGrenade, 0);
|
||||
|
||||
%this.setInventory(Blaster,0);
|
||||
%this.setInventory(Plasma,0);
|
||||
%this.setInventory(Disc,0);
|
||||
%this.setInventory(Chaingun, 0);
|
||||
%this.setInventory(Mortar, 0);
|
||||
%this.setInventory(GrenadeLauncher, 0);
|
||||
%this.setInventory(MissileLauncher, 0);
|
||||
%this.setInventory(SniperRifle, 0);
|
||||
%this.setInventory(TargetingLaser, 0);
|
||||
%this.setInventory(ELFGun, 0);
|
||||
%this.setInventory(ShockLance, 0);
|
||||
|
||||
%this.setInventory(PlasmaAmmo,0);
|
||||
%this.setInventory(ChaingunAmmo, 0);
|
||||
%this.setInventory(DiscAmmo, 0);
|
||||
%this.setInventory(GrenadeLauncherAmmo, 0);
|
||||
%this.setInventory(MissileLauncherAmmo, 0);
|
||||
%this.setInventory(MortarAmmo, 0);
|
||||
%this.setInventory(Beacon, 0);
|
||||
|
||||
// take away any pack the player has
|
||||
%curPack = %this.getMountedImage($BackpackSlot);
|
||||
if(%curPack > 0)
|
||||
%this.setInventory(%curPack.item, 0);
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
function ShapeBase::cycleWeapon( %this, %data )
|
||||
{
|
||||
if ( %this.weaponSlotCount == 0 )
|
||||
return;
|
||||
|
||||
%slot = -1;
|
||||
if ( %this.getMountedImage($WeaponSlot) != 0 )
|
||||
{
|
||||
%curWeapon = %this.getMountedImage($WeaponSlot).item.getName();
|
||||
for ( %i = 0; %i < %this.weaponSlotCount; %i++ )
|
||||
{
|
||||
//error("curWeaponName == " @ %curWeaponName);
|
||||
if ( %curWeapon $= %this.weaponSlot[%i] )
|
||||
{
|
||||
%slot = %i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( %data $= "prev" )
|
||||
{
|
||||
// Previous weapon...
|
||||
if ( %slot == 0 || %slot == -1 )
|
||||
{
|
||||
%i = %this.weaponSlotCount - 1;
|
||||
%slot = 0;
|
||||
}
|
||||
else
|
||||
%i = %slot - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Next weapon...
|
||||
if ( %slot == ( %this.weaponSlotCount - 1 ) || %slot == -1 )
|
||||
{
|
||||
%i = 0;
|
||||
%slot = ( %this.weaponSlotCount - 1 );
|
||||
}
|
||||
else
|
||||
%i = %slot + 1;
|
||||
}
|
||||
|
||||
%newSlot = -1;
|
||||
while ( %i != %slot )
|
||||
{
|
||||
if ( %this.weaponSlot[%i] !$= ""
|
||||
&& %this.hasInventory( %this.weaponSlot[%i] )
|
||||
&& %this.hasAmmo( %this.weaponSlot[%i] ) )
|
||||
{
|
||||
// player has this weapon and it has ammo or doesn't need ammo
|
||||
%newSlot = %i;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( %data $= "prev" )
|
||||
{
|
||||
if ( %i == 0 )
|
||||
%i = %this.weaponSlotCount - 1;
|
||||
else
|
||||
%i--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( %i == ( %this.weaponSlotCount - 1 ) )
|
||||
%i = 0;
|
||||
else
|
||||
%i++;
|
||||
}
|
||||
}
|
||||
|
||||
if ( %newSlot != -1 )
|
||||
%this.use( %this.weaponSlot[%newSlot] );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
function ShapeBase::selectWeaponSlot( %this, %data )
|
||||
{
|
||||
if ( %data < 0 || %data > %this.weaponSlotCount
|
||||
|| %this.weaponSlot[%data] $= "" || %this.weaponSlot[%data] $= "TargetingLaser" )
|
||||
return;
|
||||
|
||||
%this.use( %this.weaponSlot[%data] );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function serverCmdGiveAll(%client)
|
||||
{
|
||||
if($TestCheats)
|
||||
{
|
||||
%player = %client.player;
|
||||
%player.setInventory(RepairKit,999);
|
||||
%player.setInventory(Mine,999);
|
||||
//%player.setInventory(MineAir,999);
|
||||
//%player.setInventory(MineLand,999);
|
||||
//%player.setInventory(MineSticky,999);
|
||||
%player.setInventory(Grenade,999);
|
||||
%player.setInventory(FlashGrenade,999);
|
||||
%player.setInventory(FlareGrenade,999);
|
||||
%player.setInventory(ConcussionGrenade,999);
|
||||
%player.setInventory(CameraGrenade, 999);
|
||||
%player.setInventory(Blaster,1);
|
||||
%player.setInventory(Plasma,1);
|
||||
%player.setInventory(Chaingun, 1);
|
||||
%player.setInventory(Disc,1);
|
||||
%player.setInventory(GrenadeLauncher, 1);
|
||||
%player.setInventory(SniperRifle, 1);
|
||||
%player.setInventory(ELFGun, 1);
|
||||
%player.setInventory(Mortar, 1);
|
||||
%player.setInventory(MissileLauncher, 1);
|
||||
%player.setInventory(ShockLance, 1);
|
||||
%player.setInventory(TargetingLaser, 1);
|
||||
%player.setInventory(MissileLauncherAmmo, 999);
|
||||
%player.setInventory(GrenadeLauncherAmmo, 999);
|
||||
%player.setInventory(MortarAmmo, 999);
|
||||
%player.setInventory(PlasmaAmmo,999);
|
||||
%player.setInventory(ChaingunAmmo, 999);
|
||||
%player.setInventory(DiscAmmo, 999);
|
||||
%player.setInventory(Beacon, 999);
|
||||
}
|
||||
}
|
||||
1100
docs/base/@vl2/scripts.vl2/scripts/inventoryHud.cs
Normal file
1100
docs/base/@vl2/scripts.vl2/scripts/inventoryHud.cs
Normal file
File diff suppressed because it is too large
Load diff
705
docs/base/@vl2/scripts.vl2/scripts/item.cs
Normal file
705
docs/base/@vl2/scripts.vl2/scripts/item.cs
Normal file
|
|
@ -0,0 +1,705 @@
|
|||
//----------------------------------------------------------------------------
|
||||
|
||||
// When first mounted (assuming there is ammo):
|
||||
// SingleShot activate -> ready
|
||||
// Spinning activate -> idle (spin 0)
|
||||
// Sustained activate -> ready
|
||||
// DiscLauncher activate -> reload -> spinup -> ready
|
||||
//
|
||||
// Normal operation:
|
||||
// SingleShot ready -> fire -> reload -> ready
|
||||
// Spinning idle (spin 0) -> spinup -> ready -> fire -> spindown -> idle
|
||||
// Sustained ready -> fire -> reload -> ready
|
||||
// DiscLauncher ready -> fire -> reload -> spinup -> ready
|
||||
|
||||
// Image properties
|
||||
// emap
|
||||
// preload
|
||||
// shapeFile
|
||||
// mountPoint
|
||||
// offset
|
||||
// rotation
|
||||
// firstPerson
|
||||
// mass
|
||||
// usesEnergy
|
||||
// minEnergy
|
||||
// accuFire
|
||||
// lightType
|
||||
// lightTime
|
||||
// lightRadius
|
||||
// lightColor
|
||||
|
||||
// Image state variables
|
||||
// stateName
|
||||
// stateTransitionOnLoaded
|
||||
// stateTransitionOnNotLoaded
|
||||
// stateTransitionOnAmmo
|
||||
// stateTransitionOnNoAmmo
|
||||
// stateTransitionOnTriggerUp
|
||||
// stateTransitionOnTriggerDown
|
||||
// stateTransitionOnTimeout
|
||||
// stateTimeoutValue
|
||||
// stateFire
|
||||
// stateEnergyDrain
|
||||
// stateAllowImageChange
|
||||
// stateScaleAnimation
|
||||
// stateDirection
|
||||
// stateLoadedFlag
|
||||
// stateSpinThread
|
||||
// stateRecoil
|
||||
// stateSequence
|
||||
// stateSound
|
||||
// stateScript
|
||||
// stateEmitter
|
||||
// stateEmitterTime
|
||||
// stateEmitterNode
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
$ItemRespawnTime = 30000;
|
||||
$ItemPopTime = 30 * 1000; // 30 seconds
|
||||
|
||||
$WeaponSlot = 0;
|
||||
$AuxiliarySlot = 1;
|
||||
$BackpackSlot = 2;
|
||||
$FlagSlot = 3;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
datablock EffectProfile(ItemPickupEffect)
|
||||
{
|
||||
effectname = "packs/packs.pickupPack";
|
||||
minDistance = 2.5;
|
||||
};
|
||||
|
||||
datablock AudioProfile(ItemPickupSound)
|
||||
{
|
||||
filename = "fx/packs/packs.pickuppack.wav";
|
||||
description = AudioClosest3d;
|
||||
effect = ItemPickupEffect;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock EffectProfile(ItemThrowEffect)
|
||||
{
|
||||
effectname = "packs/packs.throwpack";
|
||||
minDistance = 2.5;
|
||||
maxDistance = 2.5;
|
||||
};
|
||||
|
||||
datablock AudioProfile(ItemThrowSound)
|
||||
{
|
||||
filename = "fx/packs/packs.throwpack.wav";
|
||||
description = AudioClosest3d;
|
||||
effect = ItemThrowEffect;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(RepairPatchSound)
|
||||
{
|
||||
filename = "fx/misc/health_patch.wav";
|
||||
description = AudioClosest3d;
|
||||
preload = true;
|
||||
effect = ItemPickupEffect;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
function ItemData::create(%block)
|
||||
{
|
||||
if(%block $= "flag")
|
||||
%obj = new Item() {
|
||||
className = FlagObj;
|
||||
dataBlock = %block;
|
||||
static = false;
|
||||
rotate = false;
|
||||
};
|
||||
else
|
||||
%obj = new Item() {
|
||||
dataBlock = %block;
|
||||
static = true;
|
||||
//rotate = true;
|
||||
// don't make "placed items" rotate
|
||||
rotate = false;
|
||||
};
|
||||
return(%obj);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
function Item::schedulePop(%this)
|
||||
{
|
||||
%itemFadeTime = 1000; // items will take 1 second (1000 milliseconds) to fade out
|
||||
%this.startFade(%itemFadeTime, $ItemPopTime - %itemFadeTime, true);
|
||||
%this.schedule($ItemPopTime, "delete");
|
||||
}
|
||||
|
||||
function Item::respawn(%this)
|
||||
{
|
||||
%this.startFade(0, 0, true);
|
||||
%this.schedule($ItemRespawnTime + 100, "startFade", 1000, 0, false);
|
||||
%this.hide(true);
|
||||
%this.schedule($ItemRespawnTime, "hide", false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
function ItemData::onThrow(%data,%obj,%shape)
|
||||
{
|
||||
serverPlay3D(ItemThrowSound, %obj.getTransform());
|
||||
// don't schedule a delete for satchelCharges when they're deployed
|
||||
if(!%data.noTimeout)
|
||||
%obj.schedulePop();
|
||||
}
|
||||
|
||||
function ItemData::onInventory(%data,%shape,%value)
|
||||
{
|
||||
if (!%value) {
|
||||
// If we don't have any more of these items, make sure
|
||||
// we don't have an image mounted.
|
||||
%slot = %shape.getMountSlot(%data.image);
|
||||
if (%slot != -1)
|
||||
%shape.unmountImage(%slot);
|
||||
}
|
||||
}
|
||||
|
||||
function ItemData::onEnterLiquid(%data, %obj, %coverage, %type)
|
||||
{
|
||||
if(%data.isInvincible)
|
||||
return;
|
||||
|
||||
switch(%type)
|
||||
{
|
||||
case 0:
|
||||
//Water
|
||||
case 1:
|
||||
//Ocean Water
|
||||
case 2:
|
||||
//River Water
|
||||
case 3:
|
||||
//Stagnant Water
|
||||
case 4:
|
||||
//Lava
|
||||
%obj.delete();
|
||||
case 5:
|
||||
//Hot Lava
|
||||
%obj.delete();
|
||||
case 6:
|
||||
//Crusty Lava
|
||||
%obj.delete();
|
||||
case 7:
|
||||
//Quick Sand
|
||||
}
|
||||
}
|
||||
|
||||
function ItemData::onLeaveLiquid(%data, %obj, %type)
|
||||
{
|
||||
// dummy
|
||||
}
|
||||
|
||||
function ItemData::onCollision(%data,%obj,%col)
|
||||
{
|
||||
// Default behavior for items is to get picked
|
||||
// by the colliding object.
|
||||
if (%col.getDataBlock().className $= Armor && %col.getState() !$= "Dead")
|
||||
{
|
||||
if (%col.isMounted())
|
||||
return;
|
||||
|
||||
if (%col.pickup(%obj, 1))
|
||||
{
|
||||
if (%col.client)
|
||||
{
|
||||
messageClient(%col.client, 'MsgItemPickup', '\c0You picked up %1.', %data.pickUpName);
|
||||
serverPlay3D(ItemPickupSound, %col.getTransform());
|
||||
}
|
||||
if (%obj.isStatic())
|
||||
%obj.respawn();
|
||||
else
|
||||
%obj.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
datablock ItemData(RepairKit)
|
||||
{
|
||||
className = HandInventory;
|
||||
catagory = "Misc";
|
||||
shapeFile = "repair_kit.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2.0;
|
||||
pickUpName = "a repair kit";
|
||||
alwaysAmbient = true;
|
||||
|
||||
computeCRC = true;
|
||||
emap = true;
|
||||
|
||||
};
|
||||
|
||||
function RepairKit::onUse(%data,%obj)
|
||||
{
|
||||
// Don't use the kit unless we're damaged
|
||||
if (%obj.getDamageLevel() != 0) {
|
||||
%obj.decInventory(%data,1);
|
||||
%obj.applyRepair(0.2);
|
||||
messageClient(%obj.client, 'MsgRepairKitUsed', '\c2Repair Kit Used.');
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
datablock ItemData(RepairPatch)
|
||||
{
|
||||
catagory = "Misc";
|
||||
shapeFile = "repair_patch.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2.0;
|
||||
pickUpName = "a repair patch";
|
||||
alwaysAmbient = true;
|
||||
|
||||
computeCRC = true;
|
||||
emap = true;
|
||||
|
||||
};
|
||||
|
||||
function RepairPatch::onCollision(%data,%obj,%col)
|
||||
{
|
||||
if ( %col.getDataBlock().className $= Armor
|
||||
&& %col.getDamageLevel() != 0
|
||||
&& %col.getState() !$= "Dead" )
|
||||
{
|
||||
if (%col.isMounted())
|
||||
return;
|
||||
|
||||
%col.playAudio(0, RepairPatchSound);
|
||||
%col.applyRepair(0.125);
|
||||
%obj.respawn();
|
||||
if (%col.client > 0)
|
||||
messageClient(%col.client, 'MsgItemPickup', '\c0You picked up %1.', %data.pickUpName);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Flag:
|
||||
//----------------------------------------------------------------------------
|
||||
datablock ShapeBaseImageData(FlagImage)
|
||||
{
|
||||
shapeFile = "flag.dts";
|
||||
item = Flag;
|
||||
mountPoint = 2;
|
||||
offset = "0 0 0";
|
||||
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "0.5 0.5 0.5 1.0";
|
||||
lightTime = "1000";
|
||||
lightRadius = "3";
|
||||
cloakable = false;
|
||||
};
|
||||
|
||||
datablock ItemData(Flag)
|
||||
{
|
||||
catagory = "Objectives";
|
||||
shapefile = "flag.dts";
|
||||
mass = 55;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 3;
|
||||
pickUpName = "a flag";
|
||||
computeCRC = true;
|
||||
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "0.5 0.5 0.5 1.0";
|
||||
lightTime = "1000";
|
||||
lightRadius = "3";
|
||||
|
||||
isInvincible = true;
|
||||
cmdCategory = "Objectives";
|
||||
cmdIcon = CMDFlagIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_flag_grey";
|
||||
targetTypeTag = 'Flag';
|
||||
|
||||
//used in CTF to mark the flag during a stalemate...
|
||||
hudImageNameFriendly[1] = "commander/MiniIcons/com_flag_grey";
|
||||
hudImageNameEnemy[1] = "commander/MiniIcons/com_flag_grey";
|
||||
hudRenderModulated[1] = true;
|
||||
hudRenderAlways[1] = true;
|
||||
hudRenderCenter[1] = true;
|
||||
hudRenderDistance[1] = true;
|
||||
hudRenderName[1] = true;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
function Flag::onThrow(%data,%obj,%src)
|
||||
{
|
||||
Game.playerDroppedFlag(%src);
|
||||
}
|
||||
|
||||
function Flag::onAdd(%this, %obj)
|
||||
{
|
||||
// make sure flags play "flapping" ambient thread
|
||||
Parent::onAdd(%this, %obj);
|
||||
%obj.playThread($AmbientThread, "ambient");
|
||||
|
||||
%blocker = new VehicleBlocker()
|
||||
{
|
||||
position = %obj.position;
|
||||
rotation = %obj.rotation;
|
||||
dimensions = "2 2 4";
|
||||
};
|
||||
MissionCleanup.add(%blocker);
|
||||
}
|
||||
|
||||
function Flag::onCollision(%data,%obj,%col)
|
||||
{
|
||||
if (%col.getDataBlock().className $= Armor)
|
||||
{
|
||||
if (%col.isMounted())
|
||||
return;
|
||||
|
||||
// a player hit the flag
|
||||
Game.playerTouchFlag(%col, %obj);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// HuntersFlag:
|
||||
//----------------------------------------------------------------------------
|
||||
datablock ShapeBaseImageData(HuntersFlagImage)
|
||||
{
|
||||
shapeFile = "Huntersflag.dts";
|
||||
item = Flag;
|
||||
mountPoint = 2;
|
||||
offset = "0 0 0";
|
||||
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "0.5 0.5 0.5 1.0";
|
||||
lightTime = "1000";
|
||||
lightRadius = "3";
|
||||
};
|
||||
|
||||
// 1: red
|
||||
// 2: blue
|
||||
// 4: yellow
|
||||
// 8: green
|
||||
datablock ItemData(HuntersFlag1)
|
||||
{
|
||||
className = HuntersFlag;
|
||||
|
||||
shapefile = "Huntersflag.dts";
|
||||
mass = 75;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 3;
|
||||
isInvincible = true;
|
||||
pickUpName = "a flag";
|
||||
computeCRC = true;
|
||||
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "0.8 0.2 0.2 1.0";
|
||||
lightTime = "1000";
|
||||
lightRadius = "3";
|
||||
};
|
||||
|
||||
datablock ItemData(HuntersFlag2) : HuntersFlag1
|
||||
{
|
||||
lightColor = "0.2 0.2 0.8 1.0";
|
||||
};
|
||||
|
||||
datablock ItemData(HuntersFlag4) : HuntersFlag1
|
||||
{
|
||||
lightColor = "0.8 0.8 0.2 1.0";
|
||||
};
|
||||
|
||||
datablock ItemData(HuntersFlag8) : HuntersFlag1
|
||||
{
|
||||
lightColor = "0.2 0.8 0.2 1.0";
|
||||
};
|
||||
|
||||
function HuntersFlag::onRemove(%data, %obj)
|
||||
{
|
||||
// dont want target removed...
|
||||
}
|
||||
|
||||
function HuntersFlag::onThrow(%data,%obj,%src)
|
||||
{
|
||||
Game.playerDroppedFlag(%src);
|
||||
}
|
||||
|
||||
function HuntersFlag::onCollision(%data,%obj,%col)
|
||||
{
|
||||
if (%col.getDataBlock().className $= Armor)
|
||||
{
|
||||
if (%col.isMounted())
|
||||
return;
|
||||
|
||||
// a player hit the flag
|
||||
Game.playerTouchFlag(%col, %obj);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Nexus:
|
||||
//----------------------------------------------------------------------------
|
||||
datablock ItemData(Nexus)
|
||||
{
|
||||
catagory = "Objectives";
|
||||
shapefile = "nexus_effect.dts";
|
||||
mass = 10;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
icon = "CMDNexusIcon";
|
||||
targetTypeTag = 'Nexus';
|
||||
|
||||
computeCRC = true;
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleData(NexusParticleDenied)
|
||||
{
|
||||
dragCoeffiecient = 0.4;
|
||||
gravityCoefficient = 3.0;
|
||||
inheritedVelFactor = 0.0;
|
||||
|
||||
lifetimeMS = 1200;
|
||||
lifetimeVarianceMS = 400;
|
||||
|
||||
textureName = "particleTest";
|
||||
|
||||
useInvAlpha = false;
|
||||
spinRandomMin = -200.0;
|
||||
spinRandomMax = 200.0;
|
||||
|
||||
colors[0] = "0.3 0.0 0.0 1.0";
|
||||
colors[1] = "0.5 0.0 0.0 0.5";
|
||||
colors[2] = "0.7 0.0 0.0 0.0";
|
||||
sizes[0] = 0.2;
|
||||
sizes[1] = 0.1;
|
||||
sizes[2] = 0.0;
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.5;
|
||||
times[2] = 1.0;
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(NexusParticleDeniedEmitter)
|
||||
{
|
||||
ejectionPeriodMS = 2;
|
||||
ejectionOffset = 0.2;
|
||||
periodVarianceMS = 0.5;
|
||||
ejectionVelocity = 10.0;
|
||||
velocityVariance = 4.0;
|
||||
thetaMin = 0.0;
|
||||
thetaMax = 30.0;
|
||||
lifetimeMS = 0;
|
||||
|
||||
particles = "NexusParticleDenied";
|
||||
};
|
||||
|
||||
datablock ParticleData(NexusParticleCap)
|
||||
{
|
||||
dragCoeffiecient = 0.4;
|
||||
gravityCoefficient = 3.0;
|
||||
inheritedVelFactor = 0.0;
|
||||
|
||||
lifetimeMS = 1200;
|
||||
lifetimeVarianceMS = 400;
|
||||
|
||||
textureName = "particleTest";
|
||||
|
||||
useInvAlpha = false;
|
||||
spinRandomMin = -200.0;
|
||||
spinRandomMax = 200.0;
|
||||
|
||||
colors[0] = "0.5 0.8 0.2 1.0";
|
||||
colors[1] = "0.6 0.9 0.3 1.0";
|
||||
colors[2] = "0.7 1.0 0.4 1.0";
|
||||
sizes[0] = 0.2;
|
||||
sizes[1] = 0.1;
|
||||
sizes[2] = 0.0;
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.5;
|
||||
times[2] = 1.0;
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(NexusParticleCapEmitter)
|
||||
{
|
||||
ejectionPeriodMS = 2;
|
||||
ejectionOffset = 0.5;
|
||||
periodVarianceMS = 0.5;
|
||||
ejectionVelocity = 10.0;
|
||||
velocityVariance = 4.0;
|
||||
thetaMin = 0.0;
|
||||
thetaMax = 30.0;
|
||||
lifetimeMS = 0;
|
||||
|
||||
particles = "NexusParticleCap";
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function getVector(%string, %num)
|
||||
{
|
||||
%start = %num * 3;
|
||||
return getWords(%string,%start, %start + 2);
|
||||
}
|
||||
|
||||
// --------------------------------------------
|
||||
// explosion datablock
|
||||
// --------------------------------------------
|
||||
|
||||
datablock ExplosionData(DeployablesExplosion)
|
||||
{
|
||||
soundProfile = DeployablesExplosionSound;
|
||||
faceViewer = true;
|
||||
|
||||
explosionShape = "effect_plasma_explosion.dts";
|
||||
sizes[0] = "0.2 0.2 0.2";
|
||||
sizes[1] = "0.3 0.3 0.3";
|
||||
};
|
||||
|
||||
$TeamDeployableMax[TargetBeacon] = 10;
|
||||
$TeamDeployableMax[MarkerBeacon] = 20;
|
||||
|
||||
datablock ItemData(Beacon)
|
||||
{
|
||||
className = HandInventory;
|
||||
catagory = "Misc";
|
||||
shapeFile = "beacon.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.8;
|
||||
pickupRadius = 1;
|
||||
pickUpName = "a deployable beacon";
|
||||
|
||||
computeCRC = true;
|
||||
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedBeacon) : StaticShapeDamageProfile
|
||||
{
|
||||
shapeFile = "beacon.dts";
|
||||
explosion = DeployablesExplosion;
|
||||
maxDamage = 0.45;
|
||||
disabledLevel = 0.45;
|
||||
destroyedLevel = 0.45;
|
||||
targetNameTag = 'beacon';
|
||||
|
||||
deployedObject = true;
|
||||
|
||||
dynamicType = $TypeMasks::SensorObjectType;
|
||||
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = SmallShapeDebris;
|
||||
};
|
||||
|
||||
function DeployedBeacon::onDestroyed(%data, %obj, %prevState)
|
||||
{
|
||||
if(%obj.getBeaconType() $= "friend")
|
||||
%bType = "MarkerBeacon";
|
||||
else
|
||||
%bType = "TargetBeacon";
|
||||
$TeamDeployedCount[%obj.team, %bType]--;
|
||||
%obj.schedule(500, delete);
|
||||
}
|
||||
|
||||
function Beacon::onUse(%data, %obj)
|
||||
{
|
||||
// look for 3 meters along player's viewpoint for interior or terrain
|
||||
%searchRange = 3.0;
|
||||
%mask = $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType;
|
||||
// get the eye vector and eye transform of the player
|
||||
%eyeVec = %obj.getEyeVector();
|
||||
%eyeTrans = %obj.getEyeTransform();
|
||||
// extract the position of the player's camera from the eye transform (first 3 words)
|
||||
%eyePos = posFromTransform(%eyeTrans);
|
||||
// normalize the eye vector
|
||||
%nEyeVec = VectorNormalize(%eyeVec);
|
||||
// scale (lengthen) the normalized eye vector according to the search range
|
||||
%scEyeVec = VectorScale(%nEyeVec, %searchRange);
|
||||
// add the scaled & normalized eye vector to the position of the camera
|
||||
%eyeEnd = VectorAdd(%eyePos, %scEyeVec);
|
||||
// see if anything gets hit
|
||||
%searchResult = containerRayCast(%eyePos, %eyeEnd, %mask, 0);
|
||||
if(!%searchResult )
|
||||
{
|
||||
// no terrain/interior collision within search range
|
||||
if(%obj.inv[%data.getName()] > 0)
|
||||
messageClient(%obj.client, 'MsgBeaconNoSurface', '\c2Cannot place beacon. Too far from surface.');
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
%searchObj = GetWord(%searchResult, 0);
|
||||
if(%searchObj.getType() & ($TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType) )
|
||||
{
|
||||
// if there's already a beacon where player is aiming, switch its type
|
||||
// otherwise, player can't deploy a beacon there
|
||||
if(%searchObj.getDataBlock().getName() $= DeployedBeacon)
|
||||
switchBeaconType(%searchObj);
|
||||
else
|
||||
messageClient(%obj.client, 'MsgBeaconNoSurface', '\c2Cannot place beacon. Not a valid surface.');
|
||||
return 0;
|
||||
}
|
||||
else if(%obj.inv[%data.getName()] <= 0)
|
||||
return 0;
|
||||
}
|
||||
// newly deployed beacons default to "target" type
|
||||
if($TeamDeployedCount[%obj.team, TargetBeacon] >= $TeamDeployableMax[TargetBeacon])
|
||||
{
|
||||
messageClient(%obj.client, 'MsgDeployFailed', '\c2Your team\'s control network has reached its capacity for this item.~wfx/misc/misc.error.wav');
|
||||
return 0;
|
||||
}
|
||||
%terrPt = posFromRaycast(%searchResult);
|
||||
%terrNrm = normalFromRaycast(%searchResult);
|
||||
|
||||
%intAngle = getTerrainAngle(%terrNrm); // getTerrainAngle() function found in staticShape.cs
|
||||
%rotAxis = vectorNormalize(vectorCross(%terrNrm, "0 0 1"));
|
||||
if (getWord(%terrNrm, 2) == 1 || getWord(%terrNrm, 2) == -1)
|
||||
%rotAxis = vectorNormalize(vectorCross(%terrNrm, "0 1 0"));
|
||||
%rotation = %rotAxis @ " " @ %intAngle;
|
||||
|
||||
%obj.decInventory(%data, 1);
|
||||
%depBeac = new BeaconObject() {
|
||||
dataBlock = "DeployedBeacon";
|
||||
position = VectorAdd(%terrPt, VectorScale(%terrNrm, 0.05));
|
||||
rotation = %rotation;
|
||||
};
|
||||
$TeamDeployedCount[%obj.team, TargetBeacon]++;
|
||||
|
||||
%depBeac.playThread($AmbientThread, "ambient");
|
||||
%depBeac.team = %obj.team;
|
||||
%depBeac.sourceObject = %obj;
|
||||
|
||||
// give it a team target
|
||||
%depBeac.setTarget(%depBeac.team);
|
||||
MissionCleanup.add(%depBeac);
|
||||
}
|
||||
|
||||
function switchBeaconType(%beacon)
|
||||
{
|
||||
if(%beacon.getBeaconType() $= "friend")
|
||||
{
|
||||
// switch from marker beacon to target beacon
|
||||
if($TeamDeployedCount[%beacon.team, TargetBeacon] >= $TeamDeployableMax[TargetBeacon])
|
||||
{
|
||||
messageClient(%beacon.sourceObject.client, 'MsgDeployFailed', '\c2Your team\'s control network has reached its capacity for this item.~wfx/misc/misc.error.wav');
|
||||
return 0;
|
||||
}
|
||||
%beacon.setBeaconType(enemy);
|
||||
$TeamDeployedCount[%beacon.team, MarkerBeacon]--;
|
||||
$TeamDeployedCount[%beacon.team, TargetBeacon]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// switch from target beacon to marker beacon
|
||||
if($TeamDeployedCount[%beacon.team, MarkerBeacon] >= $TeamDeployableMax[MarkerBeacon])
|
||||
{
|
||||
messageClient(%beacon.sourceObject.client, 'MsgDeployFailed', '\c2Your team\'s control network has reached its capacity for this item.~wfx/misc/misc.error.wav');
|
||||
return 0;
|
||||
}
|
||||
%beacon.setBeaconType(friend);
|
||||
$TeamDeployedCount[%beacon.team, TargetBeacon]--;
|
||||
$TeamDeployedCount[%beacon.team, MarkerBeacon]++;
|
||||
}
|
||||
}
|
||||
28
docs/base/@vl2/scripts.vl2/scripts/joystickBind.cs
Normal file
28
docs/base/@vl2/scripts.vl2/scripts/joystickBind.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// joystickBind.cs
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// Joystick functions:
|
||||
function joystickMoveX(%val)
|
||||
{
|
||||
$mvLeftAction = ( %val < 0.0 );
|
||||
$mvRightAction = ( %val > 0.0 );
|
||||
}
|
||||
|
||||
function joystickMoveY(%val)
|
||||
{
|
||||
$mvForwardAction = ( %val < 0.0 );
|
||||
$mvBackwardAction = ( %val > 0.0 );
|
||||
}
|
||||
|
||||
function joyYaw(%val)
|
||||
{
|
||||
$mvYaw += getMouseAdjustAmount( %val );
|
||||
}
|
||||
|
||||
function joyPitch(%val)
|
||||
{
|
||||
$mvPitch += getMouseAdjustAmount( %val );
|
||||
}
|
||||
16
docs/base/@vl2/scripts.vl2/scripts/lavaPropMap.cs
Normal file
16
docs/base/@vl2/scripts.vl2/scripts/lavaPropMap.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
//-------------------------------------- Desert interior texture property mapping
|
||||
|
||||
addMaterialMapping("lava/ds_ichute01", "environment: special/chuteTexture 0.25");
|
||||
addMaterialMapping("lava/ds_ichute02", "environment: special/chuteTexture 0.25");
|
||||
addMaterialMapping("lava/ds_jet01", "environment: special/lavareflect 0.3");
|
||||
addMaterialMapping("lava/ds_jet02", "environment: special/lavareflect 0.3");
|
||||
|
||||
//"Color: red green blue startAlpha endAlpha"
|
||||
//Soft sound = 0
|
||||
//Hard sound = 1
|
||||
//Metal sound = 2
|
||||
//Snow sound = 3
|
||||
addMaterialMapping("terrain/LavaWorld.Crust", "color: 0.0 0.0 0.0 0.7 0.0", "sound: 0");
|
||||
addMaterialMapping("terrain/LavaWorld.LavaRockHot", "color: 0.0 0.0 0.0 0.7 0.0", "sound: 0");
|
||||
addMaterialMapping("terrain/LavaWorld.MuddyAsh", "color: 0.0 0.0 0.0 0.7 0.0", "sound: 0");
|
||||
addMaterialMapping("terrain/LavaWorld.RockBlack", "color: 0.0 0.0 0.0 0.7 0.0", "sound: 0");
|
||||
43
docs/base/@vl2/scripts.vl2/scripts/light_female.cs
Normal file
43
docs/base/@vl2/scripts.vl2/scripts/light_female.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
datablock TSShapeConstructor(LightFemaleDts)
|
||||
{
|
||||
baseShape = "light_female.dts";
|
||||
sequence0 = "light_female_root.dsq root";
|
||||
sequence1 = "light_female_forward.dsq run";
|
||||
sequence2 = "light_female_back.dsq back";
|
||||
sequence3 = "light_female_side.dsq side";
|
||||
sequence4 = "light_female_lookde.dsq look";
|
||||
sequence5 = "light_female_head.dsq head";
|
||||
sequence6 = "light_female_headside.dsq headside";
|
||||
sequence7 = "light_female_fall.dsq fall";
|
||||
sequence8 = "light_female_jet.dsq jet";
|
||||
sequence9 = "light_female_land.dsq land";
|
||||
sequence10 = "light_female_jump.dsq jump";
|
||||
sequence11 = "light_female_recoilde.dsq light_recoil";
|
||||
sequence12 = "light_female_scoutroot.dsq scoutroot";
|
||||
sequence13 = "light_female_looksn.dsq looksn";
|
||||
sequence14 = "light_female_lookms.dsq lookms";
|
||||
sequence15 = "light_female_sitting.dsq sitting";
|
||||
sequence16 = "light_female_idlepda.dsq pda";
|
||||
sequence17 = "light_female_diehead.dsq death1";
|
||||
sequence18 = "light_female_diechest.dsq death2";
|
||||
sequence19 = "light_female_dieback.dsq death3";
|
||||
sequence20 = "light_female_diesidelf.dsq death4";
|
||||
sequence21 = "light_female_diesidert.dsq death5";
|
||||
sequence22 = "light_female_dieleglf.dsq death6";
|
||||
sequence23 = "light_female_dielegrt.dsq death7";
|
||||
sequence24 = "light_female_dieslump.dsq death8";
|
||||
sequence25 = "light_female_dieknees.dsq death9";
|
||||
sequence26 = "light_female_dieforward.dsq death10";
|
||||
sequence27 = "light_female_diespin.dsq death11";
|
||||
sequence28 = "light_female_celsalute.dsq cel1";
|
||||
sequence29 = "light_female_celwave.dsq cel2";
|
||||
sequence30 = "light_female_tauntbest.dsq cel3";
|
||||
sequence31 = "light_female_tauntimp.dsq cel4";
|
||||
sequence32 = "light_female_celdance.dsq cel5";
|
||||
sequence33 = "light_female_tauntkiss.dsq cel6";
|
||||
sequence34 = "light_female_tauntbutt.dsq cel7";
|
||||
sequence35 = "light_female_celbow.dsq cel8";
|
||||
sequence36 = "light_female_ski.dsq ski";
|
||||
sequence37 = "light_female_standjump.dsq standjump";
|
||||
sequence38 = "light_female_looknw.dsq looknw";
|
||||
};
|
||||
43
docs/base/@vl2/scripts.vl2/scripts/light_male.cs
Normal file
43
docs/base/@vl2/scripts.vl2/scripts/light_male.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
datablock TSShapeConstructor(LightMaleDts)
|
||||
{
|
||||
baseShape = "light_male.dts";
|
||||
sequence0 = "light_male_root.dsq root";
|
||||
sequence1 = "light_male_forward.dsq run";
|
||||
sequence2 = "light_male_back.dsq back";
|
||||
sequence3 = "light_male_side.dsq side";
|
||||
sequence4 = "light_male_lookde.dsq look";
|
||||
sequence5 = "light_male_head.dsq head";
|
||||
sequence6 = "light_male_fall.dsq fall";
|
||||
sequence7 = "light_male_jet.dsq jet";
|
||||
sequence8 = "light_male_land.dsq land";
|
||||
sequence9 = "light_male_jump.dsq jump";
|
||||
sequence10 = "light_male_diehead.dsq death1";
|
||||
sequence11 = "light_male_diechest.dsq death2";
|
||||
sequence12 = "light_male_dieback.dsq death3";
|
||||
sequence13 = "light_male_diesidelf.dsq death4";
|
||||
sequence14 = "light_male_diesidert.dsq death5";
|
||||
sequence15 = "light_male_dieleglf.dsq death6";
|
||||
sequence16 = "light_male_dielegrt.dsq death7";
|
||||
sequence17 = "light_male_dieslump.dsq death8";
|
||||
sequence18 = "light_male_dieknees.dsq death9";
|
||||
sequence19 = "light_male_dieforward.dsq death10";
|
||||
sequence20 = "light_male_diespin.dsq death11";
|
||||
sequence21 = "light_male_idlepda.dsq pda";
|
||||
sequence22 = "light_male_looksn.dsq looksn";
|
||||
sequence23 = "light_male_lookms.dsq lookms";
|
||||
sequence24 = "light_male_scoutroot.dsq scoutroot";
|
||||
sequence25 = "light_male_headside.dsq headside";
|
||||
sequence26 = "light_male_recoilde.dsq light_recoil";
|
||||
sequence27 = "light_male_sitting.dsq sitting";
|
||||
sequence28 = "light_male_celsalute.dsq cel1";
|
||||
sequence29 = "light_male_celwave.dsq cel2";
|
||||
sequence30 = "light_male_tauntbest.dsq cel3";
|
||||
sequence31 = "light_male_tauntimp.dsq cel4";
|
||||
sequence32 = "light_male_celdisco.dsq cel5";
|
||||
sequence33 = "light_male_celflex.dsq cel6";
|
||||
sequence34 = "light_male_celtaunt.dsq cel7";
|
||||
sequence35 = "light_male_celrocky.dsq cel8";
|
||||
sequence36 = "light_male_ski.dsq ski";
|
||||
sequence37 = "light_male_standjump.dsq standjump";
|
||||
sequence38 = "light_male_looknw.dsq looknw";
|
||||
};
|
||||
80
docs/base/@vl2/scripts.vl2/scripts/lightning.cs
Normal file
80
docs/base/@vl2/scripts.vl2/scripts/lightning.cs
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
//--------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//-------------------------------------- Sounds
|
||||
//
|
||||
datablock AudioDescription(ThunderDescription)
|
||||
{
|
||||
volume = 1.0;
|
||||
isLooping= false;
|
||||
is3D = true;
|
||||
minDistance= 100.0;
|
||||
MaxDistance= 6400.0;
|
||||
type = $EffectAudioType;
|
||||
};
|
||||
|
||||
datablock AudioProfile(thunderCrash1)
|
||||
{
|
||||
filename = "fx/environment/ctmelody1.wav";
|
||||
description = ThunderDescription;
|
||||
};
|
||||
|
||||
datablock AudioProfile(thunderCrash2)
|
||||
{
|
||||
filename = "fx/environment/ctmelody2.wav";
|
||||
description = ThunderDescription;
|
||||
};
|
||||
|
||||
datablock AudioProfile(thunderCrash3)
|
||||
{
|
||||
filename = "fx/environment/ctmelody3.wav";
|
||||
description = ThunderDescription;
|
||||
};
|
||||
|
||||
datablock AudioProfile(thunderCrash4)
|
||||
{
|
||||
filename = "fx/environment/ctmelody4.wav";
|
||||
description = ThunderDescription;
|
||||
};
|
||||
|
||||
datablock AudioProfile(LightningHitSound)
|
||||
{
|
||||
filename = "fx/misc/lightning_impact.wav";
|
||||
description = AudioExplosion3d;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//-------------------------------------- Default storm...
|
||||
//
|
||||
// Note to datablock editors: The lightning will randomly choose from the arrays
|
||||
// to build a strike. There are 8 slots for thunder sounds. Make sure all 8 slots
|
||||
// are filled. If necessary, duplicate the sounds/textures into the extra slots.
|
||||
//
|
||||
|
||||
datablock LightningData(DefaultStorm)
|
||||
{
|
||||
directDamageType = $DamageType::Lightning;
|
||||
directDamage = 0.4;
|
||||
|
||||
strikeTextures[0] = "special/skyLightning";
|
||||
|
||||
strikeSound = LightningHitSound;
|
||||
|
||||
thunderSounds[0] = thunderCrash1;
|
||||
thunderSounds[1] = thunderCrash2;
|
||||
thunderSounds[2] = thunderCrash3;
|
||||
thunderSounds[3] = thunderCrash4;
|
||||
thunderSounds[4] = thunderCrash1;
|
||||
thunderSounds[5] = thunderCrash2;
|
||||
thunderSounds[6] = thunderCrash3;
|
||||
thunderSounds[7] = thunderCrash4;
|
||||
};
|
||||
|
||||
function LightningData::applyDamage(%data, %lightningObj, %targetObject, %position, %normal)
|
||||
{
|
||||
%targetObject.damage(%lightningObj, %position, %data.directDamage, %data.directDamageType);
|
||||
}
|
||||
330
docs/base/@vl2/scripts.vl2/scripts/liquidProfiles.cs
Normal file
330
docs/base/@vl2/scripts.vl2/scripts/liquidProfiles.cs
Normal file
|
|
@ -0,0 +1,330 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Liquid Texture Lists
|
||||
//
|
||||
new LiquidProfile(water)
|
||||
{
|
||||
liquidType = "water";
|
||||
viscosity = "6";
|
||||
density = "1";
|
||||
submergeColor = 2/10 @ " " @ 6/10 @ " " @ 6/10 @ " " @ 3/10;
|
||||
surfaceTextures = "4";
|
||||
surfaceTex0 = "liquidTiles/islandWater01.png";
|
||||
surfaceTex1 = "liquidTiles/islandWater02.png";
|
||||
surfaceTex2 = "liquidTiles/islandWater03.png";
|
||||
surfaceTex3 = "liquidTiles/islandWater04.png";
|
||||
surfaceTex4 = "";
|
||||
surfaceTex5 = "";
|
||||
surfaceTex6 = "";
|
||||
surfaceTex7 = "";
|
||||
effectTextures = "2";
|
||||
effectTex0 = "liquidTiles/modulation03.png";
|
||||
effectTex1 = "liquidTiles/modulation04.png";
|
||||
effectTex2 = "";
|
||||
effectTex3 = "";
|
||||
effectTex4 = "";
|
||||
effectTex5 = "";
|
||||
effectTex6 = "";
|
||||
effectTex7 = "";
|
||||
modulatorTextures = "2";
|
||||
modulatorTex0 = "liquidTiles/modulation03.png";
|
||||
modulatorTex1 = "liquidTiles/modulation04.png";
|
||||
modulatorTex2 = "";
|
||||
modulatorTex3 = "";
|
||||
waveAmplitude = ".75";
|
||||
surfacePattern = "serpentine";
|
||||
surfaceAngle = "30";
|
||||
surfaceScale = ".05 .05";
|
||||
effectPattern = "circular";
|
||||
effectAngle = "-60";
|
||||
effectScale = ".1 .1";
|
||||
modulatorPattern = "serpentine";
|
||||
modulatorAngle = "-30";
|
||||
modulatorScale = ".07 -.07";
|
||||
};
|
||||
|
||||
new LiquidProfile(oceanWater)
|
||||
{
|
||||
liquidType = "oceanWater";
|
||||
viscosity = "6";
|
||||
density = "1";
|
||||
submergeColor = 2/10 @ " " @ 6/10 @ " " @ 6/10 @ " " @ 3/10;
|
||||
surfaceTextures = "4";
|
||||
surfaceTex0 = "liquidTiles/islandWater01.png";
|
||||
surfaceTex1 = "liquidTiles/islandWater02.png";
|
||||
surfaceTex2 = "liquidTiles/islandWater03.png";
|
||||
surfaceTex3 = "liquidTiles/islandWater04.png";
|
||||
surfaceTex4 = "";
|
||||
surfaceTex5 = "";
|
||||
surfaceTex6 = "";
|
||||
surfaceTex7 = "";
|
||||
effectTextures = "2";
|
||||
effectTex0 = "liquidTiles/modulation03.png";
|
||||
effectTex1 = "liquidTiles/modulation04.png";
|
||||
effectTex2 = "";
|
||||
effectTex3 = "";
|
||||
effectTex4 = "";
|
||||
effectTex5 = "";
|
||||
effectTex6 = "";
|
||||
effectTex7 = "";
|
||||
modulatorTextures = "2";
|
||||
modulatorTex0 = "liquidTiles/modulation03.png";
|
||||
modulatorTex1 = "liquidTiles/modulation04.png";
|
||||
modulatorTex2 = "";
|
||||
modulatorTex3 = "";
|
||||
waveAmplitude = ".75";
|
||||
surfacePattern = "serpentine";
|
||||
surfaceAngle = "30";
|
||||
surfaceScale = ".05 .05";
|
||||
effectPattern = "circular";
|
||||
effectAngle = "-60";
|
||||
effectScale = ".1 .1";
|
||||
modulatorPattern = "serpentine";
|
||||
modulatorAngle = "-30";
|
||||
modulatorScale = ".07 -.07";
|
||||
};
|
||||
|
||||
new LiquidProfile(riverWater)
|
||||
{
|
||||
liquidType = "riverWater";
|
||||
viscosity = "6";
|
||||
density = "1";
|
||||
submergeColor = 2/10 @ " " @ 6/10 @ " " @ 6/10 @ " " @ 3/10;
|
||||
surfaceTextures = "4";
|
||||
surfaceTex0 = "liquidTiles/lushWater01.png";
|
||||
surfaceTex1 = "liquidTiles/lushWater02.png";
|
||||
surfaceTex2 = "liquidTiles/lushWater03.png";
|
||||
surfaceTex3 = "liquidTiles/lushWater04.png";
|
||||
surfaceTex4 = "";
|
||||
surfaceTex5 = "";
|
||||
surfaceTex6 = "";
|
||||
surfaceTex7 = "";
|
||||
effectTextures = "2";
|
||||
effectTex0 = "liquidTiles/modulation03.png";
|
||||
effectTex1 = "liquidTiles/modulation04.png";
|
||||
effectTex2 = "";
|
||||
effectTex3 = "";
|
||||
effectTex4 = "";
|
||||
effectTex5 = "";
|
||||
effectTex6 = "";
|
||||
effectTex7 = "";
|
||||
modulatorTextures = "2";
|
||||
modulatorTex0 = "liquidTiles/modulation03.png";
|
||||
modulatorTex1 = "liquidTiles/modulation04.png";
|
||||
modulatorTex2 = "";
|
||||
modulatorTex3 = "";
|
||||
waveAmplitude = ".5";
|
||||
surfacePattern = "serpentine";
|
||||
surfaceAngle = "30";
|
||||
surfaceScale = ".05 .05";
|
||||
effectPattern = "circular";
|
||||
effectAngle = "-60";
|
||||
effectScale = ".1 .1";
|
||||
modulatorPattern = "serpentine";
|
||||
modulatorAngle = "-30";
|
||||
modulatorScale = ".07 -.07";
|
||||
};
|
||||
|
||||
new LiquidProfile(stagnantWater)
|
||||
{
|
||||
liquidType = "stagnantWater";
|
||||
viscosity = "6";
|
||||
density = "1";
|
||||
submergeColor = 2/10 @ " " @ 6/10 @ " " @ 6/10 @ " " @ 3/10;
|
||||
surfaceTextures = "4";
|
||||
surfaceTex0 = "liquidTiles/lushWater01_algae.png";
|
||||
surfaceTex1 = "liquidTiles/lushWater02_algae.png";
|
||||
surfaceTex2 = "liquidTiles/lushWater03_algae.png";
|
||||
surfaceTex3 = "liquidTiles/lushWater04_algae.png";
|
||||
surfaceTex4 = "";
|
||||
surfaceTex5 = "";
|
||||
surfaceTex6 = "";
|
||||
surfaceTex7 = "";
|
||||
effectTextures = "2";
|
||||
effectTex0 = "liquidTiles/modulation03.png";
|
||||
effectTex1 = "liquidTiles/modulation04.png";
|
||||
effectTex2 = "";
|
||||
effectTex3 = "";
|
||||
effectTex4 = "";
|
||||
effectTex5 = "";
|
||||
effectTex6 = "";
|
||||
effectTex7 = "";
|
||||
modulatorTextures = "2";
|
||||
modulatorTex0 = "liquidTiles/modulation03.png";
|
||||
modulatorTex1 = "liquidTiles/modulation04.png";
|
||||
modulatorTex2 = "";
|
||||
modulatorTex3 = "";
|
||||
waveAmplitude = ".25";
|
||||
surfacePattern = "circular";
|
||||
surfaceAngle = "30";
|
||||
surfaceScale = ".05 .05";
|
||||
effectPattern = "circular";
|
||||
effectAngle = "-60";
|
||||
effectScale = ".1 .1";
|
||||
modulatorPattern = "serpentine";
|
||||
modulatorAngle = "-30";
|
||||
modulatorScale = ".07 -.07";
|
||||
};
|
||||
|
||||
new LiquidProfile(lava)
|
||||
{
|
||||
liquidType = "lava";
|
||||
viscosity = "15";
|
||||
density = "1";
|
||||
submergeColor = 2/10 @ " " @ 6/10 @ " " @ 6/10 @ " " @ 3/10;
|
||||
surfaceTextures = "4";
|
||||
surfaceTex0 = "terrainTiles/lavarockhot1.png";
|
||||
surfaceTex1 = "terrainTiles/lavarockhot2.png";
|
||||
surfaceTex2 = "terrainTiles/lavarockhot3.png";
|
||||
surfaceTex3 = "terrainTiles/lavarockhot4.png";
|
||||
surfaceTex4 = "";
|
||||
surfaceTex5 = "";
|
||||
surfaceTex6 = "";
|
||||
surfaceTex7 = "";
|
||||
effectTextures = "0";
|
||||
effectTex0 = "";
|
||||
effectTex1 = "";
|
||||
effectTex2 = "";
|
||||
effectTex3 = "";
|
||||
effectTex4 = "";
|
||||
effectTex5 = "";
|
||||
effectTex6 = "";
|
||||
effectTex7 = "";
|
||||
modulatorTextures = "0";
|
||||
modulatorTex0 = "";
|
||||
modulatorTex1 = "";
|
||||
modulatorTex2 = "";
|
||||
modulatorTex3 = "";
|
||||
waveAmplitude = ".15";
|
||||
surfacePattern = "circular";
|
||||
surfaceAngle = "30";
|
||||
surfaceScale = ".05 .05";
|
||||
effectPattern = "circular";
|
||||
effectAngle = "-60";
|
||||
effectScale = ".1 .1";
|
||||
modulatorPattern = "none";
|
||||
modulatorAngle = "0";
|
||||
modulatorScale = "0 0";
|
||||
};
|
||||
|
||||
new LiquidProfile(hotLava)
|
||||
{
|
||||
liquidType = "hotLava";
|
||||
viscosity = "15";
|
||||
density = "1";
|
||||
submergeColor = 2/10 @ " " @ 6/10 @ " " @ 6/10 @ " " @ 3/10;
|
||||
surfaceTextures = "4";
|
||||
surfaceTex0 = "terrainTiles/lavarockhot1.png";
|
||||
surfaceTex1 = "terrainTiles/lavarockhot2.png";
|
||||
surfaceTex2 = "terrainTiles/lavarockhot3.png";
|
||||
surfaceTex3 = "terrainTiles/lavarockhot4.png";
|
||||
surfaceTex4 = "";
|
||||
surfaceTex5 = "";
|
||||
surfaceTex6 = "";
|
||||
surfaceTex7 = "";
|
||||
effectTextures = "0";
|
||||
effectTex0 = "";
|
||||
effectTex1 = "";
|
||||
effectTex2 = "";
|
||||
effectTex3 = "";
|
||||
effectTex4 = "";
|
||||
effectTex5 = "";
|
||||
effectTex6 = "";
|
||||
effectTex7 = "";
|
||||
modulatorTextures = "0";
|
||||
modulatorTex0 = "";
|
||||
modulatorTex1 = "";
|
||||
modulatorTex2 = "";
|
||||
modulatorTex3 = "";
|
||||
waveAmplitude = ".15";
|
||||
surfacePattern = "circular";
|
||||
surfaceAngle = "30";
|
||||
surfaceScale = ".05 .05";
|
||||
effectPattern = "circular";
|
||||
effectAngle = "-60";
|
||||
effectScale = ".1 .1";
|
||||
modulatorPattern = "none";
|
||||
modulatorAngle = "0";
|
||||
modulatorScale = "0 0";
|
||||
};
|
||||
|
||||
new LiquidProfile(crustyLava)
|
||||
{
|
||||
liquidType = "lava";
|
||||
viscosity = "15";
|
||||
density = "1";
|
||||
submergeColor = 2/10 @ " " @ 6/10 @ " " @ 6/10 @ " " @ 3/10;
|
||||
surfaceTextures = "4";
|
||||
surfaceTex0 = "terrainTiles/muddyash1.png";
|
||||
surfaceTex1 = "terrainTiles/muddyash2.png";
|
||||
surfaceTex2 = "terrainTiles/muddyash3.png";
|
||||
surfaceTex3 = "terrainTiles/muddyash4.png";
|
||||
surfaceTex4 = "";
|
||||
surfaceTex5 = "";
|
||||
surfaceTex6 = "";
|
||||
surfaceTex7 = "";
|
||||
effectTextures = "0";
|
||||
effectTex0 = "";
|
||||
effectTex1 = "";
|
||||
effectTex2 = "";
|
||||
effectTex3 = "";
|
||||
effectTex4 = "";
|
||||
effectTex5 = "";
|
||||
effectTex6 = "";
|
||||
effectTex7 = "";
|
||||
modulatorTextures = "0";
|
||||
modulatorTex0 = "";
|
||||
modulatorTex1 = "";
|
||||
modulatorTex2 = "";
|
||||
modulatorTex3 = "";
|
||||
waveAmplitude = ".05";
|
||||
surfacePattern = "circular";
|
||||
surfaceAngle = "30";
|
||||
surfaceScale = ".05 .05";
|
||||
effectPattern = "circular";
|
||||
effectAngle = "-60";
|
||||
effectScale = ".02 .02";
|
||||
modulatorPattern = "none";
|
||||
modulatorAngle = "0";
|
||||
modulatorScale = "0 0";
|
||||
};
|
||||
|
||||
new LiquidProfile(quicksand)
|
||||
{
|
||||
liquidType = "quicksand";
|
||||
viscosity = "15";
|
||||
density = "1";
|
||||
submergeColor = 2/10 @ " " @ 6/10 @ " " @ 6/10 @ " " @ 3/10;
|
||||
surfaceTextures = "4";
|
||||
surfaceTex0 = "terrainTiles/mossDirt1.png";
|
||||
surfaceTex1 = "terrainTiles/mossDirt2.png";
|
||||
surfaceTex2 = "terrainTiles/mossDirt3.png";
|
||||
surfaceTex3 = "terrainTiles/mossDirt4.png";
|
||||
surfaceTex4 = "";
|
||||
surfaceTex5 = "";
|
||||
surfaceTex6 = "";
|
||||
surfaceTex7 = "";
|
||||
effectTextures = "0";
|
||||
effectTex0 = "";
|
||||
effectTex1 = "";
|
||||
effectTex2 = "";
|
||||
effectTex3 = "";
|
||||
effectTex4 = "";
|
||||
effectTex5 = "";
|
||||
effectTex6 = "";
|
||||
effectTex7 = "";
|
||||
modulatorTextures = "0";
|
||||
modulatorTex0 = "";
|
||||
modulatorTex1 = "";
|
||||
modulatorTex2 = "";
|
||||
modulatorTex3 = "";
|
||||
waveAmplitude = ".025";
|
||||
surfacePattern = "circular";
|
||||
surfaceAngle = "30";
|
||||
surfaceScale = ".02 .02";
|
||||
effectPattern = "circular";
|
||||
effectAngle = "-60";
|
||||
effectScale = ".01 .01";
|
||||
modulatorPattern = "none";
|
||||
modulatorAngle = "0";
|
||||
modulatorScale = "0 0";
|
||||
};
|
||||
345
docs/base/@vl2/scripts.vl2/scripts/loadingGui.cs
Normal file
345
docs/base/@vl2/scripts.vl2/scripts/loadingGui.cs
Normal file
|
|
@ -0,0 +1,345 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// LoadingGui.cs
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LoadingGui::onAdd(%this)
|
||||
{
|
||||
%this.qLineCount = 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LoadingGui::onWake(%this)
|
||||
{
|
||||
if ( $HudHandle[shellScreen] !$= "" )
|
||||
{
|
||||
alxStop($HudHandle[shellScreen]);
|
||||
$HudHandle[shellScreen] = "";
|
||||
}
|
||||
$HudHandle[loadingScreen] = alxPlay(LoadingScreenSound, 0, 0, 0);
|
||||
|
||||
CloseMessagePopup();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function LoadingGui::onSleep(%this)
|
||||
{
|
||||
// Clear the load info:
|
||||
if ( %this.qLineCount !$= "" )
|
||||
{
|
||||
for ( %line = 0; %line < %this.qLineCount; %line++ )
|
||||
%this.qLine[%line] = "";
|
||||
}
|
||||
%this.qLineCount = 0;
|
||||
|
||||
LOAD_MapPic.setBitmap( "gui/Loading" );
|
||||
LOAD_MapName.setText( "" );
|
||||
LOAD_MapText.setText( "" );
|
||||
LOAD_MissionType.setText( "" );
|
||||
LOAD_GameText.setText( "" );
|
||||
LoadingProgress.setValue( 0 );
|
||||
|
||||
alxStop($HudHandle[loadingScreen]);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function clearLoadInfo()
|
||||
{
|
||||
for ( %line = 0; %line < $LoadQuoteLineCount; %line++ )
|
||||
$LoadQuoteLine[%line] = "";
|
||||
$LoadQuoteLineCount = 0;
|
||||
|
||||
for ( %line = 0; %line < $LoadObjLineCount; %line++ )
|
||||
$LoadObjLine[%line] = "";
|
||||
$LoadObjLineCount = 0;
|
||||
|
||||
for ( %line = 0; %line < $LoadRuleLineCount; %line++ )
|
||||
$LoadRuleLine[%line] = "";
|
||||
$LoadRuleLineCount = 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function buildLoadInfo( %mission, %missionType )
|
||||
{
|
||||
clearLoadInfo();
|
||||
$CurrentMission = %mission;
|
||||
$MissionDisplayName = %mission;
|
||||
$MissionTypeDisplayName = %missionType;
|
||||
|
||||
// Extract the map quote and objectives from the .mis file:
|
||||
%mapFile = "missions/" @ %mission @ ".mis";
|
||||
%file = new FileObject();
|
||||
if ( %file.openForRead( %mapFile ) )
|
||||
{
|
||||
%state = "none";
|
||||
while ( !%file.isEOF() )
|
||||
{
|
||||
%line = %file.readLine();
|
||||
|
||||
if ( %state $= "none" )
|
||||
{
|
||||
if ( getSubStr( %line, 0, 17 ) $= "// DisplayName = " )
|
||||
$MissionDisplayName = getSubStr( %line, 17, 1000 );
|
||||
else if ( %line $= "//--- MISSION QUOTE BEGIN ---" )
|
||||
%state = "quote";
|
||||
else if ( %line $= "//--- MISSION STRING BEGIN ---" )
|
||||
%state = "objectives";
|
||||
else if ( %missionType $= "SinglePlayer" )
|
||||
{
|
||||
if ( getSubStr( %line, 0, 16 ) $= "// PlanetName = " )
|
||||
$MissionTypeDisplayName = getSubStr( %line, 16, 1000 );
|
||||
else if ( %line $= "//--- MISSION BLURB BEGIN ---" )
|
||||
%state = "blurb";
|
||||
}
|
||||
}
|
||||
else if ( %state $= "quote" )
|
||||
{
|
||||
if ( %line $= "//--- MISSION QUOTE END ---" )
|
||||
%state = "none";
|
||||
else
|
||||
{
|
||||
$LoadQuoteLine[$LoadQuoteLineCount] = getSubStr( %line, 2, 1000 );
|
||||
$LoadQuoteLineCount++;
|
||||
}
|
||||
}
|
||||
else if ( %state $= "objectives" )
|
||||
{
|
||||
if ( %line $= "//--- MISSION STRING END ---" )
|
||||
{
|
||||
if ( %missionType $= "SinglePlayer" )
|
||||
%state = "none";
|
||||
else
|
||||
{
|
||||
// Once we've got the end of the mission string, we are through.
|
||||
%state = "done";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
%pos = strstr( %line, "]" );
|
||||
if ( %pos == -1 )
|
||||
{
|
||||
$LoadObjLine[$LoadObjLineCount] = getSubStr( %line, 2, 1000 );
|
||||
$LoadObjLineCount++;
|
||||
}
|
||||
else if ( %pos > 3 )
|
||||
{
|
||||
// Filter objective lines by mission type:
|
||||
%typeList = getSubStr( %line, 3, %pos - 3 );
|
||||
if ( strstr( %typeList, %missionType ) != -1 )
|
||||
{
|
||||
$LoadObjLine[$LoadObjLineCount] = getSubStr( %line, %pos + 1, 1000 );
|
||||
$LoadObjLineCount++;
|
||||
}
|
||||
}
|
||||
else
|
||||
error( "Invalid mission objective line - \"" @ %line @ "\"" );
|
||||
}
|
||||
}
|
||||
else if ( %state $= "blurb" )
|
||||
{
|
||||
if ( %line $= "//--- MISSION BLURB END ---" )
|
||||
{
|
||||
%state = "done";
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
$LoadRuleLine[$LoadRuleLineCount] = getSubStr( %line, 2, 1000 );
|
||||
$LoadRuleLineCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
%file.close();
|
||||
}
|
||||
|
||||
// Extract the rules of engagement from the <mission type>Game.cs file:
|
||||
if ( %missionType !$= "SinglePlayer" )
|
||||
{
|
||||
%gameFile = "scripts/" @ %missionType @ "Game.cs";
|
||||
if ( %file.openForRead( %gameFile ) )
|
||||
{
|
||||
%state = "none";
|
||||
while ( !%file.isEOF() )
|
||||
{
|
||||
%line = %file.readLine();
|
||||
if ( %state $= "none" )
|
||||
{
|
||||
if ( getSubStr( %line, 0, 17 ) $= "// DisplayName = " )
|
||||
$MissionTypeDisplayName = getSubStr( %line, 17, 1000 );
|
||||
if ( %line $= "//--- GAME RULES BEGIN ---" )
|
||||
%state = "rules";
|
||||
}
|
||||
else if ( %state $= "rules" )
|
||||
{
|
||||
if ( %line $= "//--- GAME RULES END ---" )
|
||||
{
|
||||
%state = "done";
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
$LoadRuleLine[$LoadRuleLineCount] = getSubStr( %line, 2, 1000 );
|
||||
$LoadRuleLineCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
%file.close();
|
||||
}
|
||||
}
|
||||
|
||||
%file.delete();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function dumpLoadInfo()
|
||||
{
|
||||
echo( "Mission = \"" @ $MissionDisplayName @ "\", Mission Type = \"" @ $MissionTypeDisplayName @ "\"" );
|
||||
echo( "MISSION QUOTE: ( " @ $LoadQuoteLineCount @ " lines )" );
|
||||
for ( %line = 0; %line < $LoadQuoteLineCount; %line++ )
|
||||
echo( $LoadQuoteLine[%line] );
|
||||
|
||||
echo( " " );
|
||||
|
||||
echo( "MISSION STRING: ( " @ $LoadObjLineCount @ " lines )" );
|
||||
for ( %line = 0; %line < $LoadObjLineCount; %line++ )
|
||||
echo( $LoadObjLine[%line] );
|
||||
|
||||
echo( " " );
|
||||
|
||||
echo( "GAME RULES: ( " @ $LoadRuleLineCount @ " lines )" );
|
||||
for ( %line = 0; %line < $LoadRuleLineCount; %line++ )
|
||||
echo( $LoadRuleLine[%line] );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function sendLoadInfoToClient( %client )
|
||||
{
|
||||
//error( "** SENDING LOAD INFO TO CLIENT " @ %client @ "! **" );
|
||||
%singlePlayer = $CurrentMissionType $= "SinglePlayer";
|
||||
messageClient( %client, 'MsgLoadInfo', "", $CurrentMission, $MissionDisplayName, $MissionTypeDisplayName );
|
||||
|
||||
// Send map quote:
|
||||
for ( %line = 0; %line < $LoadQuoteLineCount; %line++ )
|
||||
{
|
||||
if ( $LoadQuoteLine[%line] !$= "" )
|
||||
messageClient( %client, 'MsgLoadQuoteLine', "", $LoadQuoteLine[%line] );
|
||||
}
|
||||
|
||||
// Send map objectives:
|
||||
if ( %singlePlayer )
|
||||
{
|
||||
switch ( $pref::TrainingDifficulty )
|
||||
{
|
||||
case 2: %diff = "Medium";
|
||||
case 3: %diff = "Hard";
|
||||
default: %diff = "Easy";
|
||||
}
|
||||
messageClient( %client, 'MsgLoadObjectiveLine', "", "<spush><font:" @ $ShellLabelFont @ ":" @ $ShellMediumFontSize @ ">DIFFICULTY: <spop>" @ %diff );
|
||||
}
|
||||
|
||||
for ( %line = 0; %line < $LoadObjLineCount; %line++ )
|
||||
{
|
||||
if ( $LoadObjLine[%line] !$= "" )
|
||||
messageClient( %client, 'MsgLoadObjectiveLine', "", $LoadObjLine[%line], !%singlePlayer );
|
||||
}
|
||||
|
||||
// Send rules of engagement:
|
||||
if ( !%singlePlayer )
|
||||
messageClient( %client, 'MsgLoadRulesLine', "", "<spush><font:Univers Condensed:18>RULES OF ENGAGEMENT:<spop>", false );
|
||||
|
||||
for ( %line = 0; %line < $LoadRuleLineCount; %line++ )
|
||||
{
|
||||
if ( $LoadRuleLine[%line] !$= "" )
|
||||
messageClient( %client, 'MsgLoadRulesLine', "", $LoadRuleLine[%line], !%singlePlayer );
|
||||
}
|
||||
|
||||
messageClient( %client, 'MsgLoadInfoDone' );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
addMessageCallback( 'MsgLoadInfo', handleLoadInfoMessage );
|
||||
addMessageCallback( 'MsgLoadQuoteLine', handleLoadQuoteLineMessage );
|
||||
addMessageCallback( 'MsgLoadObjectiveLine', handleLoadObjectiveLineMessage );
|
||||
addMessageCallback( 'MsgLoadRulesLine', handleLoadRulesLineMessage );
|
||||
addMessageCallback( 'MsgLoadInfoDone', handleLoadInfoDoneMessage );
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function handleLoadInfoMessage( %msgType, %msgString, %bitmapName, %mapName, %missionType )
|
||||
{
|
||||
// Clear all of the loading info lines:
|
||||
for ( %line = 0; %line < LoadingGui.qLineCount; %line++ )
|
||||
LoadingGui.qLine[%line] = "";
|
||||
LoadingGui.qLineCount = 0;
|
||||
|
||||
for ( %line = 0; %line < LobbyGui.objLineCount; %line++ )
|
||||
LobbyGui.objLine[%line] = "";
|
||||
LobbyGui.objLineCount = 0;
|
||||
|
||||
if (!isDemo())
|
||||
%loadBmp = "gui/load_" @ %bitmapName @ ".png";
|
||||
else
|
||||
%loadBmp = "gui/load_" @ %bitmapName @ ".bm8";
|
||||
if ( !isFile( "textures/" @ %loadBmp ) )
|
||||
%loadBmp = "gui/loading";
|
||||
LOAD_MapPic.setBitmap( %loadBmp );
|
||||
LOAD_MapName.setText( %mapName );
|
||||
LOAD_MissionType.setText( %missionType );
|
||||
LOAD_MapText.setText( "" );
|
||||
LOAD_GameText.setText( "" );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function handleLoadQuoteLineMessage( %msgType, %msgString, %line )
|
||||
{
|
||||
LoadingGui.qLine[LoadingGui.qLineCount] = %line;
|
||||
LoadingGui.qLineCount++;
|
||||
|
||||
%text = "<spush><color:dcdcdc><spush><font:Univers italic:16>";
|
||||
for ( %line = 0; %line < LoadingGui.qLineCount - 1; %line++ )
|
||||
%text = %text @ LoadingGui.qLine[%line] @ "\n";
|
||||
%text = %text @ "<spop><spush><font:" @ $ShellLabelFont @ ":" @ $ShellFontSize @ ">";
|
||||
%text = %text @ LoadingGui.qLine[%line] @ "<spop><spop>\n"; // tag line
|
||||
|
||||
LOAD_MapText.setText( %text );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function handleLoadObjectiveLineMessage( %msgType, %msgString, %line, %bulletStyle )
|
||||
{
|
||||
LobbyGui.objLine[LobbyGui.objLineCount] = %line;
|
||||
LobbyGui.objLineCount++;
|
||||
|
||||
if ( %bulletStyle )
|
||||
%line = "<bitmap:bullet_2><lmargin:24>" @ %line @ "<lmargin:0>";
|
||||
|
||||
%newText = LOAD_MapText.getText();
|
||||
if ( %newText $= "" ) // In case there's no quote
|
||||
%newText = %line;
|
||||
else
|
||||
%newText = %newText NL %line;
|
||||
LOAD_MapText.setText( %newText );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function handleLoadRulesLineMessage( %msgType, %msgString, %line, %bulletStyle )
|
||||
{
|
||||
if ( %bulletStyle )
|
||||
%line = "<bitmap:bullet_2><lmargin:24>" @ %line @ "<lmargin:0>";
|
||||
|
||||
%newText = LOAD_GameText.getText();
|
||||
if ( %newText $= "" )
|
||||
%newText = %line;
|
||||
else
|
||||
%newText = %newText NL %line;
|
||||
LOAD_GameText.setText( %newText );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function handleLoadInfoDoneMessage( %msgType, %msgString )
|
||||
{
|
||||
LoadingGui.gotLoadInfo = true;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue