Author Topic: Return Island/District, Set positions etc..  (Read 440 times)

TurboGrafx

  • Full Member
  • ***
  • Posts: 233
  • Karma: +32/-33
    • View Profile
Return Island/District, Set positions etc..
« on: November 24, 2016, 04:18:42 pm »
This is something I have been working on for a game system I have been building.

I plan to use this differently, But I figured I should upload it while it's still in a debug state.

You can really do a lot with this script, From setting random spawns in the players district to maybe setting hospital positions for that players Island, Good for roleplay servers, To much more.

I hope someone finds use of this script. I see many ideas from this and I hope your able to do something with it  ;).

Please notify me if there are any bugs, Only bugs I have seen is district names are named differently, GetDistrictName does not always return the same text as story mode example the airport..


#Code Updated
Code: [Select]
District_ID <- array(120, 0);
District_Name <- array(120, "");

function SetPlayersDistrict(Name, player)
{
    switch(Name)
    {
        /* Portland */
        case "Harwood":                                return District_ID[player.ID] = 1;
        case "Portland Beach":                         return District_ID[player.ID] = 2;
        case "Hepburn Heights":                        return District_ID[player.ID] = 3;
        case "Saint Marks":                            return District_ID[player.ID] = 4;
        case "Red Light District":                     return District_ID[player.ID] = 5;
        case "Chinatown":                              return District_ID[player.ID] = 6;
        case "Portland View":                          return District_ID[player.ID] = 7;
        case "Trenton":                                return District_ID[player.ID] = 8;
        case "Portland Harbor":                        return District_ID[player.ID] = 9;
        case "Atlantic Quays":                         return District_ID[player.ID] = 10;
        case "Callahan Point":                         return District_ID[player.ID] = 11;

        /* To Staunton Island */
        case "Callahan Bridge":                        return District_ID[player.ID] = 12;


        case "Torrington":                             return District_ID[player.ID] = 13;
        case "Bedford Point":                          return District_ID[player.ID] = 14;
        case "Belleville Park":                        return District_ID[player.ID] = 15;
        case "Liberty Campus":                         return District_ID[player.ID] = 16;
        case "Fort Staunton":                          return District_ID[player.ID] = 17;
        case "Rockford":                               return District_ID[player.ID] = 18;
        case "Aspatria":                               return District_ID[player.ID] = 19;

        /* To Shoreside Island */
        case "Francis International Airport":          return District_ID[player.ID] = 20;
        case "Pike Creek":                             return District_ID[player.ID] = 21;
        case "Wichita Gardens":                        return District_ID[player.ID] = 22;
        case "Cedar Grove":                            return District_ID[player.ID] = 23;
        case "Cochrane Dam":                           return District_ID[player.ID] = 24;

        /* Typically in the ocean */
        case "Liberty City":                           return District_ID[player.ID] = 25;
        case "Portland":                               return District_ID[player.ID] = 26;
        case "Staunton Island":                        return District_ID[player.ID] = 27;
        default:                                       return District_ID[player.ID] = 0;
}
}

function onPlayerDeath(player, reason)
{
    District_Name[player.ID] = GetDistrictName(player.Pos.x, player.Pos.y);
   
    SetPlayersDistrict(District_Name[player.ID], player); //Do not remove player, LOL..
}

function onPlayerSpawn(player, spawn)
{
    if ( ( District_ID[player.ID] >= 1 ) && ( District_ID[player.ID] <= 12 ) && (player.Island == 1) )
    {
        Message("Portland Island")
    }

    if ( ( District_ID[player.ID] >= 12 ) && ( District_ID[player.ID] <= 19 ) && (player.Island == 2) )
    {
        Message("Staunton Island")
    }

    if ( ( District_ID[player.ID] >= 20 ) && ( District_ID[player.ID] <= 24 ) && (player.Island == 3) )
    {
        Message("Shoreside Island")
    }

    if ( ( District_ID[player.ID] >= 25 ) && ( District_ID[player.ID] <= 27 ))
    {
         if (player.Island == 1 ) Message("Portland Island/ Lost island")
         if (player.Island == 2 ) Message("Staunton Island/ Lost island")
         if (player.Island == 3 ) Message("Shoreside Island/ Lost island")

    }
}

function onPlayerPart(player, reason)
{
    District_ID[player.ID] = 0;
    District_Name[player.ID] = "";
}
« Last Edit: November 24, 2016, 05:17:00 pm by Mötley »

JamesConway

  • Newbie
  • *
  • Posts: 38
  • Karma: +9/-3
    • View Profile
Re: Return Island/District, Set positions etc..
« Reply #1 on: November 24, 2016, 04:39:50 pm »
Thank you, this is useful.

TurboGrafx

  • Full Member
  • ***
  • Posts: 233
  • Karma: +32/-33
    • View Profile
Re: Return Island/District, Set positions etc..
« Reply #2 on: November 24, 2016, 04:53:42 pm »
Your welcome  :)

 

© Liberty Unleashed Team.