Page 1 of 1

Only one class can enter a map

PostPosted: Thu Jul 29, 2021 6:50 am
by KeaganH
So for my mod, there are these seperate classes but I only want one to enter a specific map/episode. Is there a method for this?

Re: Only one class can enter a map

PostPosted: Thu Jul 29, 2021 8:09 am
by Logan MTM
I think It is.
Take a look in this page: https://zdoom.org/wiki/Creating_new_player_classes

Re: Only one class can enter a map

PostPosted: Fri Jul 30, 2021 5:38 am
by KeaganH
What exactly am I supposed to being looking at?

Re: Only one class can enter a map

PostPosted: Fri Jul 30, 2021 7:00 am
by ramon.dexter
Well, this is more than simple player class. You have to also define which class start in which map, and that is probably done in MAPINFO or GAMEINFO - I'm not 100% sure about it, since I've never made a multi-class mod.

https://zdoom.org/wiki/MAPINFO

Re: Only one class can enter a map

PostPosted: Fri Jul 30, 2021 7:22 am
by Jarewill
KeaganH wrote:So for my mod, there are these seperate classes but I only want one to enter a specific map/episode. Is there a method for this?

So you want each class to start at a different map in an episode? That can be done using a combination of ACS functions.
You can check the current class using PlayerClass and change the map using ChangeLevel.
PlayerClass returns a number based on the player's class, which are in turn based on how they were entered in MAPINFO, so for example:
Code: Select allExpand view
GameInfo
{
    PlayerClasses = "Player1", "Player2", "Player3"
} //Player1 will return 0, Player2 will return 1, Player3 will return 2  

Using that you can create a dummy map as the beginning of an episode and in that map's scripts include something like this:
Code: Select allExpand view
Script 1 ENTER
{
    int class = PlayerClass(PlayerNumber()); //Get the current class number
    If(class==0){ChangeLevel("MAP05",0,CHANGELEVEL_NOINTERMISSION,-1);} //If the player plays as Player1 class, jump to MAP05
    Else If(class==1){ChangeLevel("MAP12",0,CHANGELEVEL_NOINTERMISSION,-1);} //If the player plays as Player2 class, jump to MAP12
    Else If(class==2){ChangeLevel("MAP20",0,CHANGELEVEL_NOINTERMISSION,-1);} //If the player plays as Player3 class, jump to MAP20

Re: Only one class can enter a map

PostPosted: Sun Aug 08, 2021 7:27 am
by KeaganH
Okay so now, I have a new problem. Sometimes a map won't load up because it says No Player 1 Start

Re: Only one class can enter a map

PostPosted: Sun Aug 08, 2021 7:55 am
by Enjay
That usually happens because you have set the arguments on the player start spot.

Most of the time, player start spots do not need their arguments set. The arguments are typically used to identify which ones should be used in cases where there are several start spots on the same map. e.g. a hub map which can be accessed from several other levels (which would have exit lines/scripts with exit specials that have arguments corresponding to the appropriate map spot).

Even if you need map spots with arguments, you can also add a map spot without arguments that will be used when warping to the map e.g. for testing purposes.