The Exiled

Shunned by Man, Accepted by Gods
* FAQ    * Search   * Members
* Login   * Register
It is currently Thu Mar 28, 2024 4:54 pm 

 View unanswered posts | View active topics


 Board index » General Area » Mapping
Post new topic Reply to topic Users browsing this forum: No registered users and 2 guests
Author
Message
TE-Krogoth


User avatar
Joined: Tue Jun 07, 2005 8:01 am
Posts: 2092
Location: Texas
Post Posted: Wed Jan 04, 2006 8:58 am    Post subject: Territories/Zones Code
Reply with quote
 
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.



Image
Image
 Top Offline
Profile WWWYIM
Display posts from previous:  Sort by  
Post new topic Reply to topic Board index » General Area » Mapping
Previous topic :: Next topic  
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group