Raised This Month: $ Target: $400
 0% 

[ES][TUT] Crear modo Armageddon [ZP-4.3]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Javivi
AlliedModders Donor
Join Date: Dec 2008
Old 12-18-2009 , 16:46   [ES][TUT] Crear modo Armageddon [ZP-4.3]
#1

Bien, antes de nada, decir que esto lo hago de memoria, puesto que estoy sin CS y no lo puedo testear, pero supongo que todo este bien .

Empezemos pues...

Como añadir el modo Armageddon al ZP 4.3

Ire diciendo que hay que crear y explicandolo (de arriba a abajo del plugin).


En Game Modes
añadiremos el nuestro el MODE_ARMAGEDDON

PHP Code:
// Game modes
enum
{
    
MODE_NONE 0
    
MODE_INFECTION
    
MODE_NEMESIS
    
MODE_SURVIVOR
    
MODE_SWARM
    
MODE_MULTI
    
MODE_PLAGUE// Importante ponerle la coma
    
MODE_ARMAGEDDON // Modo armageddon

En Game vars añadiremos la ronda armageddon
PHP Code:
// Game vars
g_armageddonround 
En CVARs pointers añadiremos las cvars del modo
PHP Code:
// CVAR pointers
new cvar_armageddoncvar_armageddonchancecvar_armageddonminplayers // Modo armageddon 
En plugin_init() registraremos las cvars y añadiremos el comando para comenzar el modo
PHP Code:
    // Modo armageddon !
    
register_concmd("zp_arma""cmd_armageddon"_" - Comenzar el Modo Armageddon"0)
// ..................
    // CVARS - Armageddon Mode
    
cvar_armageddon register_cvar("zp_arma_enabled""1"// On/Off
    
cvar_armageddonchance register_cvar("zp_arma_chance""15"// Chance
    
cvar_armageddonminplayers register_cvar("zp_arma_min_players""14"// Min Players 
En event_round_start() setearemos la ronda armageddon en false
PHP Code:
g_armageddonround false // Armageddon round 
Tambien tenemos que añadir este public
PHP Code:
// zp_armageddon
public cmd_armageddon(idlevelcid)
{
    
// Check for access flag - Mode Swarm
    
if (!cmd_access(idg_access_flag[ACCESS_MODE_SWARM], cid2))
        return 
PLUGIN_HANDLED;
    
    
// Swarm mode not allowed
    
if (!allowed_armageddon())
    {
        
client_print(idprint_console"[ZP] %L"id"CMD_NOT")
        return 
PLUGIN_HANDLED;
    }
    
    
command_armageddon(id)
    
    return 
PLUGIN_HANDLED;

Ahora añadiremos la funcion principal... la añadiremos justo debajo del } de abajo de ExecuteForward(g_fwRoundStart, g_fwDummyResult, MODE_PLAGUE, 0);
PHP Code:
    else if ((mode == MODE_NONE && (!get_pcvar_num(cvar_preventconsecutive) || g_lastmode != MODE_ARMAGEDDON) && random_num(1get_pcvar_num(cvar_armageddonchance)) == get_pcvar_num(cvar_armageddon) && iPlayersnum >= get_pcvar_num(cvar_armageddonminplayers)) || mode == MODE_ARMAGEDDON/*Enserionotefuncionaquitatodoestojuntoynocopiesypeges )*/
    
{        
        
// Armageddon Mode
        
g_armageddonround true
        g_lastmode 
MODE_ARMAGEDDON
                
        
// Turn all players into Nemesis/Survivors
        
for (id 1id <= g_maxplayersid++)
        {
            
// Si no esta vivo lo ignoramos
            
if (!g_isalive[id])
                continue
            
            
// Nemesis o Survivor?
            
switch(random_num(1,2))
            {
                case 
:
                {
                    
// Nemesis
                    
zombieme(id0100)
                    
// Health /3
                    
fm_set_user_health(idpev(idpev_health) / 3)
                }
                case 
:
                {
                    
// Survivor
                    
humanme(id10)        
                    
// Health *2
                    
fm_set_user_health(idpev(idpev_health) * 2)
                }
            }
        }
        
        
// Play swarm sound
        
ArrayGetString(sound_swarmrandom_num(0ArraySize(sound_swarm) - 1), soundcharsmax(sound))
        
PlaySound(sound);
        
        
// Show Swarm HUD notice
        
set_hudmessage(2025520HUD_EVENT_XHUD_EVENT_Y10.05.01.01.0, -1)
        
ShowSyncHudMsg(0g_MsgSync"Modo Armageddon!!")
        
        
// Mode fully started!
        
g_modestarted true
        
        
// Round start forward
        
ExecuteForward(g_fwRoundStartg_fwDummyResultMODE_ARMAGEDDON0);
    } 
Y luego, hace falta otra funcion (no es requerida, pero es por si alguien quiere poner mas condiciones o algo asi o.o)
PHP Code:
allowed_armageddon()
{
    if (
g_endround || !g_newround || task_exists(TASK_WELCOMEMSG))
        return 
false;
    
    return 
true;

Y otra mas que hace falta
PHP Code:
command_armageddon(id)
{
    
// Show activity?
    
switch (get_pcvar_num(cvar_showactivity))
    {
        case 
1client_print(0print_chat"ADMIN - Comenzar Modo Armageddon")
        case 
2client_print(0print_chat"ADMIN %s - Comenzar Modo Armageddon"g_playername[id])
    }
    
    
// Log to Zombie Plague log file?
    
if (get_pcvar_num(cvar_logcommands))
    {
        static 
logdata[100], authid[32], ip[16]
        
get_user_authid(idauthidcharsmax(authid))
        
get_user_ip(idipcharsmax(ip), 1)
        
formatex(logdatacharsmax(logdata), "ADMIN %s <%s><%s> - Comenzar Modo Armageddon (Jugadores: %d/%d)"g_playername[id], authidipfnGetPlaying(), g_maxplayers)
        
log_to_file("zombieplague.log"logdata)
    }
    
    
// Call Armageddon Mode
    
remove_task(TASK_MAKEZOMBIE)
    
make_a_zombie(MODE_ARMAGEDDON0)

Y BUENO, CREO QUE NO ME OLVIDO DE NADA ! Si me falto algo diganmelo y lo arreglo ^^.



Y, un problema que me surgio con este modo (y eso que lo juge en lan contra los PodBot) es que me bajaban los fps a 5 de tanto glow y aura (tanto de nemesis como de survivor)



Como reducir el lag del modo armageddon

Primero busquemos por nemglow, una vez lo encontremos, asegurarse de que editais que hay tras el else y no el que esta en el if (g_handle_models_on_separate_ent).

Y quedaria asi
PHP Code:
        // Nemesis glow / remove glow, unless frozen
        
if (!g_frozen[id])
        {
            if (
g_nemesis[id] && get_pcvar_num(cvar_nemglow) && !g_armageddonround)
                
fm_set_rendering(idkRenderFxGlowShell25500kRenderNormal25)
            else
                
fm_set_rendering(id)
        } 
Luego buscamos otra vez nemglow, y veremos algo asi
PHP Code:
    // Restore rendering
    
if (g_handle_models_on_separate_ent
Pues justo en el else
PHP Code:
    // Restore rendering
    
if (g_handle_models_on_separate_ent// ESTE NO SE TOCA, CACA!!
    
{
        
// Nemesis or Survivor glow / remove glow on player model entity
        
if (g_nemesis[id] && get_pcvar_num(cvar_nemglow))
            
fm_set_rendering(g_ent_playermodel[id], kRenderFxGlowShell25500kRenderNormal25)
        else if (
g_survivor[id] && get_pcvar_num(cvar_survglow))
            
fm_set_rendering(g_ent_playermodel[id], kRenderFxGlowShell00255kRenderNormal25)
        else
            
fm_set_rendering(g_ent_playermodel[id])
    }
    else 
// ESTE SI SE TOCA
    
{
        
// Nemesis or Survivor glow / remove glow
        
if (g_nemesis[id] && get_pcvar_num(cvar_nemglow) && !g_armageddonround)
            
fm_set_rendering(idkRenderFxGlowShell25500kRenderNormal25)
        else if (
g_survivor[id] && get_pcvar_num(cvar_survglow))
            
fm_set_rendering(idkRenderFxGlowShell00255kRenderNormal25)
        else
            
fm_set_rendering(id)
    } 
Y para nuestra suerte, si lo volvemos a buscar, nos llevara al principio, asi que, ya acabamos con el glow del nemesis

Ahora el del survivor, lo mismo pero cambiando nemglow por survglow o.o


Ahora le quitaremos el aura al survivor

(Esto es muy facil, porque es una linea sola)
Y quedaria asi
PHP Code:
        // Give the survivor a bright light
        
if (get_pcvar_num(cvar_survaura) && !g_armageddonroundset_pev(idpev_effectspev(idpev_effects) | EF_BRIGHTLIGHT
Y ahora, el razonamiento del millón. ¿Y como mierda ven los survivors si no tienen aura y no pueden usar la linterna !?!?

Fácil, editemos la parte de la linterna

Busquemos el public de fw_CmdStart

Y veremos algo asi
PHP Code:
    // Should human's custom flashlight be turned on?
    
if (!g_zombie[id] && !g_survivor[id] && g_flashbattery[id] > && get_gametime() - g_lastflashtime[id] > 1.2
Lo cual deberemos dejar asi

PHP Code:
// (g_survivor[id] && g_armageddonround) Esto quiere decir que si es survivor y ademas es ronda armageddon la podra usar. Si es survivor y NO es ronda armageddon, no podra :)
    // Should human's custom flashlight be turned on?
    
if (!g_zombie[id] && (g_survivor[id] && g_armageddonround) && g_flashbattery[id] > && get_gametime() - g_lastflashtime[id] > 1.2
ET VOILÀ !



Saludos,


Javivi.
Attached Files
File Type: sma Get Plugin or Get Source (zombie_plague43.sma - 2170 views - 324.6 KB)
__________________
Javivi is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:05.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode