Raised This Month: $51 Target: $400
 12% 

[ZP] Sistema de combo


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
SkiGz
BANNED
Join Date: Aug 2010
Location: Venezuela
Old 10-08-2011 , 01:20   [ZP] Sistema de combo
#1

Descripcion: Es un sistema para hacer ammopacks mientras dispares a los zombies mediante un hud que dirá el damage hecho por el jugador y el combo que llevas por ciertos hits (disparos), si el combo sube más, más ammopacks ganarás.

Nota: Este code fue hecho por L//, no es mio, solo me doy la molestia de hacer la guia para los que buscan tanto este code.

L//: Si molesta que haya hecho como tutorial el sistema de combos, hecho o que se yo modificado por tí, mensaje para quitarlo.

Versiones de zombie plague: Sirve para la versión 4.2 & la versión 4.3 !!!

1 PASO:
Abrimos el .sma y buscamos la línea "// Task offsets"

En el task
PHP Code:
"TASK_AMBIENCESOUNDS" 
ponemos una coma "," quedaría:
PHP Code:
"TASK_AMBIENCESOUNDS," 
y abajo de
PHP Code:
"TASK_AMBIENCESOUNDS," 
agregamos:
PHP Code:
TASK_INFO_COMBO// el task muestra información de combo
TASK_FINISH_COMBO// el task hace finalización de combo
TASK_RESET_COMBO // el task restablece el combo 
quedaría:
PHP Code:
// Task offsets
enum (+= 100)
{
    
TASK_MODEL 2000,
    
TASK_TEAM,
    
TASK_SPAWN,
    
TASK_BLOOD,
    
TASK_AURA,
    
TASK_BURN,
    
TASK_NVISION,
    
TASK_FLASH,
    
TASK_CHARGE,
    
TASK_SHOWHUD,
    
TASK_MAKEZOMBIE,
    
TASK_WELCOMEMSG,
    
TASK_THUNDER_PRE,
    
TASK_THUNDER,
    
TASK_AMBIENCESOUNDS,
    
TASK_INFO_COMBO,
    
TASK_FINISH_COMBO,
    
TASK_RESET_COMBO

2 PASO:
Buscamos la línea "// IDs inside tasks"

y abajo de
PHP Code:
#define ID_SHOWHUD (taskid - TASK_SHOWHUD) 
agregamos
PHP Code:
#define ID_INFO_COMBO (taskid - TASK_INFO_COMBO) // definimos la información del combo
#define ID_FINISH_COMBO (taskid - TASK_FINISH_COMBO) // definimos el finalizado del combo
#define ID_RESET_COMBO (taskid - TASK_RESET_COMBO) // definimos el restablecimiento del combo 
quedaría:
PHP Code:
// IDs inside tasks
#define ID_MODEL (taskid - TASK_MODEL)
#define ID_TEAM (taskid - TASK_TEAM)
#define ID_SPAWN (taskid - TASK_SPAWN)
#define ID_BLOOD (taskid - TASK_BLOOD)
#define ID_AURA (taskid - TASK_AURA)
#define ID_BURN (taskid - TASK_BURN)
#define ID_NVISION (taskid - TASK_NVISION)
#define ID_FLASH (taskid - TASK_FLASH)
#define ID_CHARGE (taskid - TASK_CHARGE)
#define ID_SHOWHUD (taskid - TASK_SHOWHUD)
#define ID_INFO_COMBO (taskid - TASK_INFO_COMBO)
#define ID_FINISH_COMBO (taskid - TASK_FINISH_COMBO)
#define ID_RESET_COMBO (taskid - TASK_RESET_COMBO) 
3 PASO:
Ahora buscamos la línea "// Player vars"
y agregamos
PHP Code:
// creamos las variables
new g_damagecombo[33// variable del damage causado por el player
new g_damagehits[33// variable de los hits provocados por el damage
new g_combo[33// variable del combo
new g_info_combo[33][64// variable de la información de combo
#define ammount_damage(%1)    (%1 + 1) * 300 // determinamos porcentaje en una ecuación matemática 
quedaría:
PHP Code:
// Player vars
new g_zombie[33// is zombie
new g_nemesis[33// is nemesis
new g_survivor[33// is survivor
new g_firstzombie[33// is first zombie
new g_lastzombie[33// is last zombie
new g_lasthuman[33// is last human
new g_frozen[33// is frozen (can't move)
new g_nodamage[33// has spawn protection/zombie madness
new g_respawn_as_zombie[33// should respawn as zombie
new g_nvision[33// has night vision
new g_nvisionenabled[33// has night vision turned on
new g_zombieclass[33// zombie class
new g_zombieclassnext[33// zombie class for next infection
new g_flashlight[33// has custom flashlight turned on
new g_flashbattery[33] = { 100, ... } // custom flashlight battery
new g_canbuy[33// is allowed to buy a new weapon through the menu
new g_ammopacks[33// ammo pack count
new g_damagedealt[33// damage dealt to zombies (used to calculate ammo packs reward)
new Float:g_lastleaptime[33// time leap was last used
new Float:g_lastflashtime[33// time flashlight was last toggled
new g_playermodel[33][32// current model's short name [player][model]
new g_menu_data[33][5// data for some menu handlers
new g_ent_playermodel[33// player model entity
new g_ent_weaponmodel[33// weapon model entity
new g_burning_duration[33// burning task duration
new g_damagecombo[33]
new 
g_damagehits[33]
new 
g_combo[33]
new 
g_info_combo[33][64]
#define ammount_damage(%1)    (%1 + 1) * 300 
y más abajo buscamos la variable
PHP Code:
new g_MsgSyncg_MsgSync2 
agregamos
PHP Code:
g_MsgSync3 // variable para que registremos el hud de nuestro combo 
quedaría:
PHP Code:
new g_MsgSyncg_MsgSync2g_MsgSync3 // message sync objects 
4 PASO:
Buscamos la línea "// Ham Take Damage Forward" y dentro del takedamage
buscamos la otra línea "// Reward ammo packs"

y abajo de
PHP Code:
// Store damage dealt
g_damagedealt[attacker] += floatround(damage
agregamos
PHP Code:
new bool:up 
quedaría:
PHP Code:
// Store damage dealt
g_damagedealt[attacker] += floatround(damage)
new 
bool:up // agregamos una variable con boolean la que aumentará el combo durante más hits hagamos 
despues abajo de
PHP Code:
new bool:up 
agregamos
PHP Code:
// Almacenamos daño por combo
            
g_damagecombo[attacker] += floatround(damage// le asignamos el damage
            
g_damagehits[attacker]++ // acumula los hits hecho por el player
            
            
show_current_combo(attackerfloatround(damage)) // llamamos el task al atacante
            
            
remove_task(attacker+TASK_RESET_COMBO)
            
            if (
g_damagehits[attacker] > 5//  creamos la condición
            
{
                while (
g_damagecombo[attacker] >= ammount_damage(g_combo[attacker])) //hacemos un while para detectar la subida del damage en el combo
                
{
                    
g_combo[attacker]++ // sumamos 1 combo más
                    
up true // verifica si el combo fue sumado
                
}
                
                if (
up// condición para seguir el combo
                
{
                    
formatex(g_info_combo[attacker], 63"Combo %d completado!"g_combo[attacker]) // completamos el combo
                    
                    
remove_task(attacker+TASK_INFO_COMBO// removemos el task
                    
set_task(3.0"info_combo"attacker+TASK_INFO_COMBO// task en 0,3 segundos para finalizar el combo
                
}
                
                
remove_task(attacker+TASK_FINISH_COMBO// removemos el task
                
set_task(3.0"finish_combo"attacker+TASK_FINISH_COMBO// finaliza el combo y nos dará los ammopacks correspondientes
            
}
            else
            {
                
set_task(1.0"reset_combo"attacker+TASK_RESET_COMBO// task en 0,1 segundo para reiniciar el combo en cero
            

quedaría:
PHP Code:
        // Reward ammo packs
        
if (!g_survivor[attacker] || !get_pcvar_num(cvar_survignoreammo))
        {
            
// Store damage dealt
            
g_damagedealt[attacker] += floatround(damage)
            new 
bool:up
            
            
// Almacenamos daño por combo
            
g_damagecombo[attacker] += floatround(damage)
            
g_damagehits[attacker]++
            
            
show_current_combo(attackerfloatround(damage))
            
            
remove_task(attacker+TASK_RESET_COMBO)
            
            if (
g_damagehits[attacker] > 5)
            {
                while (
g_damagecombo[attacker] >= ammount_damage(g_combo[attacker]))
                {
                    
g_combo[attacker]++
                    
up true
                
}
                
                if (
up)
                {
                    
formatex(g_info_combo[attacker], 63"Combo %d completado!"g_combo[attacker])
                    
                    
remove_task(attacker+TASK_INFO_COMBO)
                    
set_task(3.0"info_combo"attacker+TASK_INFO_COMBO)
                }
                
                
remove_task(attacker+TASK_FINISH_COMBO)
                
set_task(3.0"finish_combo"attacker+TASK_FINISH_COMBO)
            }
            else
            {
                
set_task(1.0"reset_combo"attacker+TASK_RESET_COMBO)
            }

            
// Reward ammo packs for every [ammo damage] dealt
            
while (g_damagedealt[attacker] > get_pcvar_num(cvar_ammodamage))
            {
                
g_ammopacks[attacker]++
                
g_damagedealt[attacker] -= get_pcvar_num(cvar_ammodamage)
            }
        }
        
        return 
HAM_IGNORED;
    }
    
    
// Attacker is zombie... 
5 PASO:
Buscamos la línea "// Client leaving" o "public fw_ClientDisconnect(id)"

y abajo de la línea
PHP Code:
remove_task(id+TASK_SHOWHUD
agregamos
PHP Code:
remove_task(id+TASK_INFO_COMBO// remueve el task del combo
remove_task(id+TASK_FINISH_COMBO// remueve el task que indica que finalizó el combo
remove_task(id+TASK_RESET_COMBO// remueve el combo & lo reinicia 
quedaría:
PHP Code:
remove_task(id+TASK_TEAM)
remove_task(id+TASK_MODEL)
remove_task(id+TASK_FLASH)
remove_task(id+TASK_CHARGE)
remove_task(id+TASK_SPAWN)
remove_task(id+TASK_BLOOD)
remove_task(id+TASK_AURA)
remove_task(id+TASK_BURN)
remove_task(id+TASK_NVISION)
remove_task(id+TASK_SHOWHUD)
remove_task(id+TASK_INFO_COMBO)
remove_task(id+TASK_FINISH_COMBO)
remove_task(id+TASK_RESET_COMBO
6 PASO:
Ahora son libres de agregar los publics:
PHP Code:
public show_current_combo(ididamage// public para el combo ocurrido funcione
{
    static 
combocombo g_combo[id]
    
    
set_hudmessage(25500, -1.00.613.03.00.010.01)
    
    if (!
combo)
    {
        
ShowSyncHudMsg(idg_MsgSync3"%d"idamage)
    }
    else
    {
        
ShowSyncHudMsg(idg_MsgSync3"%s^n^nCombo %d^n%d | %d"g_info_combo[id], combo 1g_damagecombo[id], ammount_damage(combo))
    }

PHP Code:
public finish_combo(taskid// public que finaliza el combo
{
    static 
idapinfo[32];
    
    
id ID_FINISH_COMBO // finaliza el combo
    
    
ap = (g_combo[id] * 2// nos dará los aps

    
set_hudmessage(255255255, -1.00.603.03.00.010.01// colores para el hud del combo

    
if (ap// condicion para proseguir
    
{
        
formatex(infocharsmax(info), "Extra AP ganados: %d"ap// nos dará los ammopacks correspondientes
    
}
    else
    {
        
info[0] = '^0'
    
}
    
    
ShowSyncHudMsg(idg_MsgSync3"Combo finalizado!^nTotal: %d, danio: %d, hits: %d^n^n%s"g_combo[id], g_damagecombo[id], g_damagehits[id], info// hud que índica que el combo ha finalizado
    
    
g_combo[id] = // reinicia el combo en cero
    
g_damagecombo[id] = // reinicia el damage
    
g_damagehits[id] = 0  // reinicia los hits por el damage

PHP Code:
public info_combo(taskid// public que nos dará la info del combo
{
    static 
id;
    
id ID_INFO_COMBO
    
    g_info_combo
[id][0] = '^0' // nos dará cierta información

PHP Code:
public reset_combo(taskid// public que reinicia el combo
{
    static 
id;
    
id ID_RESET_COMBO
    
    g_combo
[id] = 0
    g_damagecombo
[id] = 0
    g_damagehits
[id] = 0

Aquí les dejo la versión 4.3 con sistema de combo
Attached Files
File Type: sma Get Plugin or Get Source (zombie_plague40.sma - 1930 views - 337.3 KB)

Last edited by SkiGz; 03-15-2012 at 22:14.
SkiGz is offline
Send a message via MSN to SkiGz
 



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 08:57.


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