TE-Krogoth
Joined: Tue Jun 07, 2005 8:01 am Posts: 2092 Location: Texas
|
Posted: Wed Jan 04, 2006 8:58 am Post subject: Territories/Zones Code
|
|
|
All credit for this goes to Braveskin.
Code: | // Territory/Zone Map Code created by Braveskin
$teamScoreLimit = 1337;
function CheckOwnedTowers(%team) { if($OwnsPushSwitch == %team && $OwnsWARSwitch == %team && $OwnsTESwitch == %team) { teammessages(3,gamebase::getteam(%client),"Your team has won!"); messageall(1,"The "@getTeamName(%team)@" has won!"); $TeamScore[%team] = 1337; ObjectiveMission::checkScoreLimit(); } }
function TESwitch::onCollision(%this,%object) { %tower = %this;// Confusion, Be gone! -Braveskin %firstTeam = gamebase::getteam(%tower); if(getObjectType(%object) == "Player") { %client = player::getclient(%object); if(gamebase::getteam(%client)!=gamebase::getteam(%tower)) { teammessages(3,gamebase::getteam(%client),"Your team is now in control of the TE Switch.~wCapturedTower.wav"); } if(%firstteam != -1) { teammessages(3,%firstteam,client::getname@" has stolen the TE Switch from your team!"); } messageall(0,"The "@getTeamName(gamebase::getteam(%client))@" team is now in control of the TE Switch."); gamebase::setteam(%tower,gamebase::getteam(%client)); $OwnsTESwitch = gamebase::getteam(%client);
if($OwnsPushSwitch == gamebase::getteam(%client) && $OwnsWarSwitch == gamebase::getteam(%client)) { messageall(1,"The "@getTeamName(gamebase::getteam(%client))@" team has 20 seconds to win! Take those towers!"); %team = gamebase::getteam(%client); schedule("CheckOwnedTowers("@%team@");",20); } } }
function WARSwitch::onCollision(%this,%object) { %tower = %this;// Confusion, Be gone! -Braveskin %firstTeam = gamebase::getteam(%tower);
if(getObjectType(%object) == "Player") { %client = player::getclient(%object);
if(gamebase::getteam(%client)!=gamebase::getteam(%tower)) { teammessages(3,gamebase::getteam(%client),"Your team is now in control of the |WAR| Switch.~wCapturedTower.wav"); } if(%firstteam != -1) { teammessages(3,%firstteam,client::getname@" has stolen the |WAR| Switch from your team!"); } messageall(0,"The "@getTeamName(gamebase::getteam(%client))@" team is now in control of the |WAR| Switch."); gamebase::setteam(%tower,gamebase::getteam(%client)); $OwnsWARSwitch = gamebase::getteam(%client);
if($OwnsPushSwitch == gamebase::getteam(%client) && $OwnsTESwitch == gamebase::getteam(%client)) { messageall(1,"The "@getTeamName(gamebase::getteam(%client))@" team has 20 seconds to win! Take those towers!"); %team = gamebase::getteam(%client); schedule("CheckOwnedTowers("@%team@");",20); } } }
function PushSwitch::onCollision(%this,%object) { %tower = %this;// Confusion, Be gone! -Braveskin %firstTeam = gamebase::getteam(%tower); if(getObjectType(%object) == "Player") { %client = player::getclient(%object); if(gamebase::getteam(%client)!=gamebase::getteam(%tower)) { teammessages(3,gamebase::getteam(%client),"Your team is now in control of the <!> Switch.~wCapturedTower.wav"); }
if(%firstteam != -1) { teammessages(3,%firstteam,client::getname@" has stolen the <!> Switch from your team!"); }
messageall(0,"The "@getTeamName(gamebase::getteam(%client))@" team is now in control of the <!> Switch."); gamebase::setteam(%tower,gamebase::getteam(%client)); $OwnsPushSwitch = gamebase::getteam(%client);
if($OwnsTESwitch == gamebase::getteam(%client) && $OwnsWARSwitch == gamebase::getteam(%client)) { messageall(1,"The "@getTeamName(gamebase::getteam(%client))@" team has 20 seconds to win! Take those towers!"); %team = gamebase::getteam(%client); schedule("CheckOwnedTowers("@%team@");",20); } } } |
Just put this at the very bottom of your .mis file and change up the Switch names and it should work for you. If it doesn't, just post here.
|
|