Post by Gaspatcho on Jul 28, 2022 19:20:43 GMT
This is only for people with at least intermediate coding knowledge as you need to be at least able to code the mode logic on your own or understand how the current mode works.
First, you import your needed includes:
Second, you add variables and constants and define whatever you want.
Honestly fuck it, since this is meant for intermediate I will assume you are able to edit an existing game mode and start from here till you make it something different.
Let's play with multiple infections and make some shit out of it
First, once you open the .sma file you will rename the mode. you can't have 2 modes with the same name.
You may as well import your needed libraries
Second, cvar names need to be edited if you don't want a fiasco, you could remove what you don't want as well.
You don't edit the variable, just edit its name under register_cvar and it's good to go
For my epic mode, I have nothing concerning last human spawn so I may delete anything related to it as well.
now to our mode logic, let's say I want a fuck feast of zombie bosses and a respawn count for humans equal to how many bosses are there
zp_fw_gamemodes_start is what concerns you here, that's where you set up stuff.
For this, I'm doing 1 nemesis & 1 assassin with 2 respawns for humans
Now I've done my 2 bosses, 2 spawns for humans could be done in more than one way, I will just do the ham method
You may want to reset the respawn counts on a new round start, I'd just do it in the mode start through a for loop or through the existing one
That's pretty much all, it depends on you for most of what you want and how you want it done.
#include <amxmodx>
#include <amxmisc>
#include <zp50_gamemodes>
Second, you add variables and constants and define whatever you want.
[s]// Settings file, you don't have to name it zombieplague actually but we do since all modes that come with zp 5.0 do the same so you have one ini file.
new const ZP_SETTINGS_FILE[] = "zombieplague.ini"
// Default sounds (
new const sound_assassin[][] = { "zombie_plague/nemesis1.wav" , "zombie_plague/nemesis2.wav" }[/s]
Honestly fuck it, since this is meant for intermediate I will assume you are able to edit an existing game mode and start from here till you make it something different.
Let's play with multiple infections and make some shit out of it
First, once you open the .sma file you will rename the mode. you can't have 2 modes with the same name.
You may as well import your needed libraries
zp_gamemodes_register("MyEpic Mode")
Second, cvar names need to be edited if you don't want a fiasco, you could remove what you don't want as well.
You don't edit the variable, just edit its name under register_cvar and it's good to go
cvar_multi_chance = register_cvar("zp_myepic_chance", "20")
For my epic mode, I have nothing concerning last human spawn so I may delete anything related to it as well.
new cvar_multi_allow_respawn//, cvar_respawn_after_last_human
//cvar_respawn_after_last_human = register_cvar("zp_respawn_after_last_human", "1")
// Respawn if only the last human is left?
//if (!get_pcvar_num(cvar_respawn_after_last_human) && zp_core_get_human_count() == 1)
//return PLUGIN_HANDLED;
now to our mode logic, let's say I want a fuck feast of zombie bosses and a respawn count for humans equal to how many bosses are there
zp_fw_gamemodes_start is what concerns you here, that's where you set up stuff.
For this, I'm doing 1 nemesis & 1 assassin with 2 respawns for humans
public zp_fw_gamemodes_start()
{
// Allow infection for this game mode | Your mode isn't about infection so you don't this at all, unless it's about infection you just keep it
//zp_gamemodes_set_allow_infect()
//In this case you have a loop already that you can use. add your need variables (if it's meant to be global you add it outside obviously)
new iZombies, id, IsNem, alive_count = GetAliveCount()
[s] new iMaxZombies = floatround(alive_count * get_pcvar_float(cvar_multi_ratio), floatround_ceil)
[/s]
// Randomly turn iMaxZombies players into zombies
while (iZombies < 2)
{
// Choose random guy
id = GetRandomAlive(random_num(1, alive_count))
// Dead or already a zombie
if (!is_user_alive(id) || zp_core_is_zombie(id))
continue;
// [s]Turn into a zombie[/s] already have nemesis?
if(IsNem) //Ya?
{
zp_class_assassin_set(id)
iZombies++
}
else //No?
{
zp_class_nemesis_set(id)
iZombies++
IsNem = 1 //or true if you go with a bool
}
}
Now I've done my 2 bosses, 2 spawns for humans could be done in more than one way, I will just do the ham method
new MyRespawns[33]
//in plugin_init
RegisterHam(Ham_Killed, "player", "my_client_death", 1)// after kill.
//new function
public my_client_death(victim, killer)
{
if(killer == victim || zp_core_is_zombie(victim) || MyRespawns[victim] > 2)
return HAM_IGNORED;
//Only respawn if a human dies and has no respawns
ExecuteHamB(Ham_CS_RoundRespawn, id);
MyRespawns[victim]++
}
You may want to reset the respawn counts on a new round start, I'd just do it in the mode start through a for loop or through the existing one
// Turn the remaining players into humans
for (id = 1; id <= g_MaxPlayers; id++)
{
// Only those of them who aren't zombies
if (!is_user_alive(id) || zp_core_is_zombie(id))
continue;
// Switch to CT
cs_set_player_team(id, CS_TEAM_CT)
MyRespawns[id] = 0
}
That's pretty much all, it depends on you for most of what you want and how you want it done.