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.

Only one class can enter a map

Postby KeaganH » Thu Jul 29, 2021 6:50 am

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?
KeaganH
 
Joined: 25 Sep 2020

Re: Only one class can enter a map

Postby Logan MTM » Thu Jul 29, 2021 8:09 am

I think It is.
Take a look in this page: https://zdoom.org/wiki/Creating_new_player_classes
User avatar
Logan MTM
I can see you...
 
Joined: 16 Jan 2006
Location: Rio de Janeiro - Brazil

Re: Only one class can enter a map

Postby KeaganH » Fri Jul 30, 2021 5:38 am

What exactly am I supposed to being looking at?
KeaganH
 
Joined: 25 Sep 2020

Re: Only one class can enter a map

Postby ramon.dexter » Fri Jul 30, 2021 7:00 am

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
User avatar
ramon.dexter
rudebwoy
 
Joined: 20 Oct 2015
Location: Kozolupy, Bohemia
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Only one class can enter a map

Postby Jarewill » Fri Jul 30, 2021 7:22 am

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
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Only one class can enter a map

Postby KeaganH » Sun Aug 08, 2021 7:27 am

Okay so now, I have a new problem. Sometimes a map won't load up because it says No Player 1 Start
KeaganH
 
Joined: 25 Sep 2020

Re: Only one class can enter a map

Postby Enjay » Sun Aug 08, 2021 7:55 am

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.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland


Return to Scripting

Who is online

Users browsing this forum: [_ilystra_] and 0 guests