home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Classic Fond 54
/
ClassicFond54.iso
/
games
/
stars.rar
/
multiplayer
/
Starsiege_Football.cs
< prev
next >
Wrap
Text File
|
1999-02-20
|
28KB
|
846 lines
// FILENAME: Starsiege_Football.cs
//
// AUTHORS: Brother Youth in Asia of the clan NHMK
//
// READER'S NOTE: Someone was in an awful good mood when this script was made...
// -- Boss Hogg
//
//------------------------------------------------------------------------------
$missionName = "Starsiege_Football";
exec("multiplayerStdLib.cs");
$BlueScore = 0;
$RedScore = 0;
$PointInterval = 7;
$WinScore = $PointInterval * 6;
$BallCarrierKillValue = 7;
$FumbleTakeUpsValue = 5;
$FumblesValue = 4;
$TouchDownValue = 7;
$MaxFouls = 3;
$PenaltyTime = 60;
$GameOver = "false";
$GoalMade = "false";
//--------------------------------------------------------------------------------
function setRules(){
echo("function setRules()");
// compose a big "rich text" string of the rules to be displayed in the
// game info panel
%rules = "<tIDMULT_FOOTBALL_GAMETYPE>" @
"<tIDMULT_FOOTBALL_MAPNAME>" @
$missionName @
"<tIDMULT_FOOTBALL_OBJECTIVES>" @
"<tIDMULT_FOOTBALL_SCORING_1>" @
"<tIDMULT_FOOTBALL_SCORING_2>" @
$TouchDownValue @
"<tIDMULT_FOOTBALL_SCORING_3>" @
"<tIDMULT_FOOTBALL_SCORING_4>" @
$WinScore @
"<tIDMULT_FOOTBALL_SCORING_5>" @
"<tIDMULT_STD_ITEMS>" @
"<tIDMULT_FOOTBALL_ENDZONE>" @
"<tIDMULT_FOOTBALL_GLOW>" @
"<tIDMULT_FOOTBALL_PENALTY_1>" @
$MaxFouls @
"<tIDMULT_FOOTBALL_PENALTY_2>" @
timeDifference($PenaltyTime, 0) @
"<tIDMULT_FOOTBALL_PENALTY_3>" @
"<tIDMULT_FOOTBALL_MARKERS>";
// display this string in the panel
setGameInfo(%rules);
}
// anything that redefines the rules needs to do this
// get the rules panel up and running
// this has to be called after the definition of setRules
setRules();
//----------------------------------------------
function setDefaultMissionOptions()
{
echo("function setDefaultMissionOptions()");
$server::AllowTeamRed = true;
$server::AllowTeamBlue = true;
$server::AllowTeamYellow = false;
$server::AllowTeamPurple = false;
$server::TeamPlay = true;
$server::AllowDeathmatch = false;
$server::AllowTeamPlay = true;
$server::disableTeamRed = false;
$server::disableTeamBlue = false;
$server::disableTeamYellow = true;
$server::disableTeamPurple = true;
}
function onMissionStart(%playerNum)
{
echo("function onMissionStart(%playerNum)");
cls();
//reinitialize scores of players who were in previous game
%count = playerManager::getPlayerCount();
for(%i = 0; %i < %count; %i = %i + 1) {
%curPlayerNum = playerManager::getPlayerNum(%i);
initStats(%curPlayerNum);
}
}
function onMissionLoad()
{
echo("function onMissionLoad()");
cdAudioCycle("Yougot", "Terror", "Cloudburst", "Mechsoul");
}
function initStats(%playerNum){
echo("function initStats(%playerNum)");
dataStore(%playerNum, "ballCarrierKills", 0);
dataStore(%playerNum, "fumbleTakeUps", 0);
dataStore(%playerNum, "fumbles", 0);
dataStore(%playerNum, "touchDowns", 0);
dataStore(%playerNum, "fouls", 0);
}
//-------------------------------------------------------------
function player::onAdd(%playerNum){
echo("function player::onAdd(%playerNum)");
dataStore(%playerNum, "onField", 0);
initStats(%playerNum);
say(%playerNum, 0, *IDMULT_FOOTBALL_WELCOME);
}
//-------------------------------------------------------------
function vehicle::onAdd(%vehicleId){
echo("function vehicle::onAdd(%vehicleId)");
%playerNum = playerManager::vehicleIdToPlayerNum(%vehicleId);
// Check to make sure this person isn't cheating to get out of the foul box
%playersTeam = getTeam(%playerNum);
if(%playersTeam == *IDSTR_TEAM_YELLOW || %playersTeam == *IDSTR_TEAM_PURPLE){
sendToPenaltyBox(%vehicleId);
return;
}
// Drop them at a point on their ten yard line
dropAtTenYardLine(%vehicleId);
// Remember that this player is currently on the field
dataStore(%playerNum, "onField", 1);
%ballCarrier = getItNum();
// If the other team made a touchdown &&
// no one has the ball &&
// this person isn't going to the foul box &&
// this person teams is to get the ball, give them the ball
if(($GoalMade == *IDSTR_TEAM_BLUE || $GoalMade == *IDSTR_TEAM_RED) && getTeam(%playerNum) != $GoalMade){
schedule("$GoalMade = \"false\";", 7);
giveBall(%playerNum, "true");
}
// Else this herc is the first in the game, give them the ball...
else if($GoalMade == "false" && %ballCarrier == "false"){
schedule("$GoalMade = \"false\";", 7);
giveBall(%playerNum, "true");
}
// Else no one has the ball and someone should at least get it!!!
}
// AREN"T SURE IF WE WANT THIS SINCE THE FLAG IS GIVEN TO HERCS, NOT PLAYERS????
// --------------------------------------------------------------------------
function player::onRemove(%playerNum){
echo("function player::onRemove(%playerNum)");
// Are they carrying the ball? Give it to someone on the opposing team
// and if no one else is on their team, give it to the other team...
if(getItNum() == %playerNum){
giveBallToOtherTeam("true", "true");
}
}
// A vehicle is destroyed
// Is it a team kill?
// Is it a flag carrier?
// --------------------------------------------------------------------------
function vehicle::onDestroyed(%destroyed, %destroyer){
echo("function vehicle::onDestroyed(%destroyed, %destroyer)");
// Who is this player?
%playerNum = playerManager::vehicleIdToPlayerNum(%destroyed);
// Who destroyed them?
%playerDestroyerNum = playerManager::vehicleIdToPlayerNum(%destroyer);
// K. They're off the field!
dataStore(%playerNum, "onField", 0);
// If the destroyer is in the penalty box then give ball to the other team...
if((getTeam(%playerDestroyerNum) == *IDSTR_TEAM_YELLOW) || (getTeam(%playerDestroyerNum) == *IDSTR_TEAM_PURPLE)){
giveBallToOtherTeam("true", "true");
return;
}
// A touchdown was made. But does this person have the ball? Tell them to drop it
if($GoalMade != "false"){
if(%playerNum == getItNum())
dropBall(%playerNum);
}
// If this player didn't kill themselves...
if(%destroyed != %destroyer){
// Throw this team killer in the penalty box
if(getTeam(%playerNum) == getTeam(%playerDestroyerNum)){
// destroyThisPlayer(%playerDestroyerNum);
dataStore(%playerDestroyerNum, "fouls", 2);
Say(0, 0, getName(%playerDestroyerNum) @ *IDMULT_FOOTY_ENTER_PENALTY_BOX);
addFoul(%playerDestroyerNum);
}
// Return if the player killed wasn't it!!!!!!!!!!!!!!!!!!!!!!!!
if(%playerNum != getItNum())
return;
// The player killed WAS IT; now check the following conditions!!!!!!!!!!!!!!!1
// Give the destroyer points for stopping the ball carrier IF they are on opposing teams
if(getTeam(%playerNum) != getTeam(%playerDestroyerNum)){
dataStore(%playerDestroyerNum, "ballCarrierKills", getBallCarrierKills(%playerNum) + 1);
}
// Return if the game's over
if($GameOver == "true")
return;
// Give ball to the destroyer if this person had the ball and destroyer on opposite team & destroyer isOnField
else if(getTeam(%playerDestroyerNum) != getTeam(%playerNum) && isOnField(%playerDestroyerNum) != 0){
// Give the ball to the person who killed the ball carrier
giveBall(%playerDestroyerNum, "true");
}
// Destroyer isn't on the field! Give ball to other team!!! Doesn't count if the destroyer is a team killer
else if(getTeam(%playerDestroyerNum) != getTeam(%playerNum)){
giveBallToOtherTeam("true", "true");
}
else{
giveBallToOtherTeam("false", "true");
}
}
// What if this person did kill themselves by running into the sideline (o