Only one class can enter a map

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
KeaganH
Posts: 33
Joined: Fri Sep 25, 2020 4:54 pm

Only one class can enter a map

Post 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?
User avatar
Logan MTM
Posts: 678
Joined: Mon Jan 16, 2006 8:53 pm
Location: Rio de Janeiro - Brazil

Re: Only one class can enter a map

Post by Logan MTM »

I think It is.
Take a look in this page: https://zdoom.org/wiki/Creating_new_player_classes
KeaganH
Posts: 33
Joined: Fri Sep 25, 2020 4:54 pm

Re: Only one class can enter a map

Post by KeaganH »

What exactly am I supposed to being looking at?
User avatar
ramon.dexter
Posts: 1562
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Only one class can enter a map

Post 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
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: Only one class can enter a map

Post 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 all

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 all

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
} 
KeaganH
Posts: 33
Joined: Fri Sep 25, 2020 4:54 pm

Re: Only one class can enter a map

Post by KeaganH »

Okay so now, I have a new problem. Sometimes a map won't load up because it says No Player 1 Start
User avatar
Enjay
 
 
Posts: 26975
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Only one class can enter a map

Post 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.
Post Reply

Return to “Scripting”