[Tutorial] Map Change System
#1

Map Change System By [Kitten]

Well i had many PM's and friends requesting how to make a MapChangechange system without making a new gamemode.

Basically this tutorial will help you with have more than 20+ Maps in 1 gamemode with only some timers and callbacks

Lets get started?.

You will need these callbacks to forward just to get you started first

pawn Код:
forward StartedNewRound();                        // On top of your script.
forward NewMapTimer(playerid);                    // On top of your script also these are basically the forwards the callback like Public Callback
-Setting Up variables
pawn Код:
new MapChange;                                    // What this variable does you will need this for the MapChangechange part further in the tutorial
-Setting Up timers || First Variable Use for MapChange
-Must be OnGameModeInit
pawn Код:
SetTimer("NewMapTimer",180000,true);              // this is 2 min timer for MapChangechange basically has to be on true for it to change the other MapChangewhen timer is over OnPlayerSpawn Further in the tutorial you will know why
MapChange= 0;                                     // This will make it first MapChangeon the list onplayerspawn callback further in the tutorial you will know
OnPlayerSpawn Callback Setup for MapChangechange

pawn Код:
public OnPlayerSpawn(playerid)                    // OnPlayerSpawn Callback
{
    switch ( MapChange  ) {                       // you must have a case for the mapchange to get the list going
        case 0:                                   // MapChange1 this is the part for MapChange = 0; Which basically starts of the first MapChangein the list
        {
            SetPlayerPos(playerid, X,Y,Z);        // XYZ Co-rds of the first map
            SetPlayerFacingAngle(playerid,0.0);   // Facing Angle of the first map
        }
        case 1:                                   // MapChange2 same settings on top
        {
            SetPlayerPos(playerid, X,Y,Z);
            SetPlayerFacingAngle(playerid,0.0);
        }
        case 2:                                   // blah blah next MapChangestuff here
        {

        }
    }
    return 1;
}
-This part is basically from the timer ongamemodeinit we added once that timer is over this changes the MapChangethrough this callback

pawn Код:
public NewMapTimer(playerid)                      // The callback we forwarded on the beginning of the tutorial
{
    MapChange++;                                  // this makes it to go to the second MapChange++ part basically does it
                                                  // Sends everyone in server a gametext
    GameTextForAll("~b~ Loading new ~w~MAP",4000,3);
    SetTimer("StartedNewRound",4000,false);       // Starts a new timer for the MapChangechange 4 seconds this basically starts the new MapChangeand always must be in false
    return 1;
}
- This part is for the StartedNewRound Callback as the timer bring it here in NewMapTimer Callback

pawn Код:
public StartedNewRound()                          // The callback we forwarded in the beginning of this tutorial
{
    for(new i = 0; i < MAX_PLAYERS; i++) {        // this loops everyone in the server also you can use foreach include for this part
        SpawnPlayer ( i ) ;                       // Re Spawns everyone in the server which then gets OnPlayerSpawn Callback called
        switch ( MapChange ) {                    // This part is basically for your new MapChangesettings like giving them weapons
            case 0:
            {
                SendClientMessage(i,COLOR,"New MapChangeLoad");
            }
            case 1:
            {
                SendClientMessage(i,COLOR,"New MapChangeLoad");
            }
            case 2:                               // Next Spawn Settings
            {

            }
        }
    }
    return 1;
}
Congratulation you are all done if need any help please PM me do not post it in here thanks.
Reply
#2

this is way easier then the other tutorial on here thanks
Reply
#3

well done mate
Reply
#4

This is a static map changing system and you cannot create other maps without modifying your gamemode to add extra lines of code, if you have a dynamic one, you wouldn't need as much code stated here, but anyway. Cool tutorial kitten, great for beginners

Tutorials are for explaining things aswell, this sorta reveals false information, mind editing some lines of code?
The indentation is disgusting! fix it up!!!
Reply
#5

hey i follow the way and made it but its not setting player position to the next map why?
Reply
#6

The topic says here how:
pawn Код:
public OnPlayerSpawn(playerid) { // OnPlayerSpawn Callback  
    switch ( MapChange  ) { // you must have a case for the mapchange to get the list going
          case 0: { // MapChange1 this is the part for MapChange = 0; Which basically starts of the first MapChangein the list
        SetPlayerPos(playerid, X,Y,Z); // XYZ Co-rds of the first map
            SetPlayerFacingAngle(playerid,0.0); // Facing Angle of the first map
      }
      case 1: { // MapChange2 same settings on top
        SetPlayerPos(playerid, X,Y,Z);
            SetPlayerFacingAngle(playerid,0.0);
      }
          case 2: { // blah blah next MapChangestuff here
         
          }
     }
     return
Reply
#7

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
Tutorials are for explaining things aswell, this sorta reveals false information, mind editing some lines of code? The indentation is disgusting! fix it up!!!
This tutorial tells us how to create a Map Changing system but doesnt explain that why are we using a particular function or why have we defined anything or incremented any variable. Please explain it more for beginner's.

- Ballu Miaa
Reply
#8

It's a good tutorial but your identation is terrible (in my opinion)
Reply
#9

Nice, it help'd me Alot
+Rep
Reply
#10

Quote:
Originally Posted by vassilis
Посмотреть сообщение
hey i follow the way and made it but its not setting player position to the next map why?
pawn Код:
public OnPlayerSpawn(playerid)                    // OnPlayerSpawn Callback
{
    switch ( MapChange  ) {                       // you must have a case for the mapchange to get the list going
        case 0:                                   // MapChange1 this is the part for MapChange = 0; Which basically starts of the first MapChangein the list
        {
            SetPlayerPos(playerid, X,Y,Z);        // You have to set the cordinates where the player should spawn on the next map.
            SetPlayerFacingAngle(playerid,0.0);   // Facing Angle of the first map
        }
        case 1:                                   // MapChange2 same settings on top
        {
            SetPlayerPos(playerid, X,Y,Z); // You have to set the cordinates where the player should spawn on the next map.
            SetPlayerFacingAngle(playerid,0.0);
        }
        case 2:                                   // blah blah next MapChangestuff here
        {

        }
    }
    return 1;
}
Reply
#11

so awesome sir
Reply
#12

Quote:
Originally Posted by Kitten
View Post
Map Change System By [Kitten]

Well i had many PM's and friends requesting how to make a MapChangechange system without making a new gamemode.

Basically this tutorial will help you with have more than 20+ Maps in 1 gamemode with only some timers and callbacks

Lets get started?.

You will need these callbacks to forward just to get you started first

pawn Code:
forward StartedNewRound();                        // On top of your script.
forward NewMapTimer(playerid);                    // On top of your script also these are basically the forwards the callback like Public Callback
-Setting Up variables
pawn Code:
new MapChange;                                    // What this variable does you will need this for the MapChangechange part further in the tutorial
-Setting Up timers || First Variable Use for MapChange
-Must be OnGameModeInit
pawn Code:
SetTimer("NewMapTimer",180000,true);              // this is 2 min timer for MapChangechange basically has to be on true for it to change the other MapChangewhen timer is over OnPlayerSpawn Further in the tutorial you will know why
MapChange= 0;                                     // This will make it first MapChangeon the list onplayerspawn callback further in the tutorial you will know
OnPlayerSpawn Callback Setup for MapChangechange

pawn Code:
public OnPlayerSpawn(playerid)                    // OnPlayerSpawn Callback
{
    switch ( MapChange  ) {                       // you must have a case for the mapchange to get the list going
        case 0:                                   // MapChange1 this is the part for MapChange = 0; Which basically starts of the first MapChangein the list
        {
            SetPlayerPos(playerid, X,Y,Z);        // XYZ Co-rds of the first map
            SetPlayerFacingAngle(playerid,0.0);   // Facing Angle of the first map
        }
        case 1:                                   // MapChange2 same settings on top
        {
            SetPlayerPos(playerid, X,Y,Z);
            SetPlayerFacingAngle(playerid,0.0);
        }
        case 2:                                   // blah blah next MapChangestuff here
        {

        }
    }
    return 1;
}
-This part is basically from the timer ongamemodeinit we added once that timer is over this changes the MapChangethrough this callback

pawn Code:
public NewMapTimer(playerid)                      // The callback we forwarded on the beginning of the tutorial
{
    MapChange++;                                  // this makes it to go to the second MapChange++ part basically does it
                                                  // Sends everyone in server a gametext
    GameTextForAll("~b~ Loading new ~w~MAP",4000,3);
    SetTimer("StartedNewRound",4000,false);       // Starts a new timer for the MapChangechange 4 seconds this basically starts the new MapChangeand always must be in false
    return 1;
}
- This part is for the StartedNewRound Callback as the timer bring it here in NewMapTimer Callback

pawn Code:
public StartedNewRound()                          // The callback we forwarded in the beginning of this tutorial
{
    for(new i = 0; i < MAX_PLAYERS; i++) {        // this loops everyone in the server also you can use foreach include for this part
        SpawnPlayer ( i ) ;                       // Re Spawns everyone in the server which then gets OnPlayerSpawn Callback called
        switch ( MapChange ) {                    // This part is basically for your new MapChangesettings like giving them weapons
            case 0:
            {
                SendClientMessage(i,COLOR,"New MapChangeLoad");
            }
            case 1:
            {
                SendClientMessage(i,COLOR,"New MapChangeLoad");
            }
            case 2:                               // Next Spawn Settings
            {

            }
        }
    }
    return 1;
}
Congratulation you are all done if need any help please PM me do not post it in here thanks.
When all maps finish... start agin or i need restart server? D:
Reply
#13

Nice tutorial
Reply
#14

Hi I need players when entering a round already started spectating to stay that are within the map and when the round ends and they can join can you help me? thanks
Reply
#15

Good work
Reply
#16

Thanks for this kitten! I'm using it for my next project :P
Reply
#17

Well done it very simple and easy to follow
Reply
#18

Thanks for the tutorial Kitten, its very good
Reply
#19

Thanks, Helped alot!
Reply
#20

Well thats -Nice-
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)