NPC cucurachas
#1
Buenas, vi las cucurachas de Mario Ar.., y esta buenisimo para reirse un rato..
Pero hay manera de asignarle un valor X cuando individualmente las matas? Es decir una recompenza, como dinero.
Código PHP:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <xs>

#define PLUGIN "NPC Cucarachas"
#define VERSION "1.2"

const Float:SPEED 120.0 // Velocidad
const Float:VIDA 10.0 // Demasiada vida = cucarachas mutantes (?
const Float:SALTO 200.0 // Maxima velocidad que puede obtener una cucaracha al saltar. (0.0 = no salta)
const Float:DAMAGE 10.0 // Daño de la cuca agresiva
const Float:RADIO 300.0 // Radio de vision de la cucaracha agresiva
const CANTIDAD_BLOOD // Cantidad de 'sangre' (?

#define USAR_GLOW  // Elimina la linea si no quieres que las cucarachas tengan un glow.

new const CLASSNAME[] = "CUCARACHA";
new const 
MODEL[] = "models/roach.mdl";
new const 
SONIDO_SPLASH[] = "roach/rch_smash.wav";
new const 
SONIDO_DMG[] = "roach/rch_die.wav";
new const 
SONIDO_ATTACK[] = "roach/rch_walk.wav";

#pragma semicolon 1

enum _:SPRS
{
    
SPR_BLOOD 0,
    
SPR_BLOODSPRAY
};

enum _:MODOS_CUCAS
{
    
MC_ESTUPIDA 0,
    
MC_ASTUTA,
    
MC_AGRESIVA
};

const 
Float:TRACE_DIST 20.0//Bugfix

new g_modelg_regg_sprindex[SPRS];

public 
plugin_precache()
{
    
precache_sound(SONIDO_SPLASH);
    
precache_sound(SONIDO_DMG);
    
precache_sound(SONIDO_ATTACK);
    
g_model precache_model(MODEL);
    
    
g_sprindex[SPR_BLOOD] = precache_model("sprites/blood.spr");
    
g_sprindex[SPR_BLOODSPRAY] = precache_model("sprites/bloodspray.spr");
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSION"Mario AR.");
    
    
register_clcmd("cuca""clcmd_roach");
    
register_clcmd("say /cuca""clcmd_cuca");
    
    
register_touch(CLASSNAME"player""fw_Touch");
    
register_think(CLASSNAME"fw_Think");
    
    
register_event("HLTV""event_HLTV""a""1=0""2=0");
}

public 
clcmd_cuca(id)
{
    new 
Float:origin[3];
    
entity_get_vector(idEV_VEC_originorigin);
    
origin[0] = Float:origin[0] + random_float(-50.050.0);
    
origin[1] = Float:origin[1] + random_float(-50.050.0);
    
    
create_roach(originMC_AGRESIVA);
    
    return 
PLUGIN_HANDLED_MAIN;
}

public 
clcmd_roach(id)
{
    new 
Float:origin[3];
    
entity_get_vector(idEV_VEC_originorigin);
    
origin[0] = Float:origin[0] + random_float(-50.050.0);
    
origin[1] = Float:origin[1] + random_float(-50.050.0);
    
    new 
arg[2];
    
read_argv(1arg1);
    
    
create_roach(originstr_to_num(arg)-1);
    
    return 
PLUGIN_HANDLED_MAIN;
}

public 
event_HLTV()
{
    new 
ent = -1;
    
    while ((
ent find_ent_by_class(entCLASSNAME)) > 0)
        
remove_entity(ent);
}

public 
fw_Think(ent)
{
    if (!
is_valid_ent(ent))
        return 
PLUGIN_CONTINUE;
    
    static 
Float:velocity[3], Float:origin[3], Float:originT[3];
    static 
Float:spdFloat:lenghtFloat:fractiontrace;
    
    switch (
entity_get_int(entEV_INT_iuser1))
    {
        case 
MC_ESTUPIDA:
        {
            
spd random_float(0.0SPEED);
            
velocity[0] = random_num(01) ? spd : -spd// Por alguna razon, random() sale casi siempre 0, es mejor random_num
            
velocity[1] = random_num(01) ? floatsqroot(SPEED*SPEED spd*spd) : 0.0 floatsqroot(SPEED*SPEED spd*spd);
            
//velocity[2] = random(25) ? 0.0 : SALTO;
            
            
entity_set_vector(entEV_VEC_velocityvelocity);
            
            
vector_to_angle(velocityvelocity);
            
entity_set_vector(entEV_VEC_anglesvelocity);
            
            
entity_set_float(entEV_FL_nextthinkhalflife_time() + 0.4);
        }
        case 
MC_ASTUTA:
        {
            
entity_get_vector(entEV_VEC_originorigin);
            
entity_get_vector(entEV_VEC_velocityvelocity);
            
lenght xs_vec_len(origin);
            
            
originT[0] = origin[0] + (TRACE_DIST origin[0] / lenght);
            
originT[1] = origin[1] + (TRACE_DIST origin[1] / lenght);
            
originT[2] = origin[2] + 2.0// Bugfix
            
origin[0] = origin[0] - (2.0 origin[0] / lenght);
            
origin[1] = origin[1] - (2.0 origin[1] / lenght);
            
            
engfunc(EngFunc_TraceLineoriginoriginTIGNORE_MONSTERSenttrace);
            
            
get_tr2(traceTR_flFractionfraction);
            
            if (
fraction == 1.0)
            {
                
velocity[0] = velocity[0] + random_float(-SPEED/4.0SPEED/4.0);
                
velocity[1] = velocity[1] > 0.0 floatsqroot(SPEED*SPEED spd*spd) : 0.0 floatsqroot(SPEED*SPEED spd*spd);
                
//velocity[2] = random(25) ? 0.0 : SALTO;
            
}
            else
            {
                
spd random_float(0.0SPEED/2.0);
                
velocity[0] = random_num(01) ? spd : -spd// Por alguna razon, random() sale casi siempre 0, es mejor random_num
                
velocity[1] = random_num(01) ? floatsqroot(SPEED*SPEED spd*spd) : 0.0 floatsqroot(SPEED*SPEED spd*spd);
                
//velocity[2] = random(25) ? 0.0 : SALTO;
            
}
            
            
entity_set_vector(entEV_VEC_velocityvelocity);
            
            
vector_to_angle(velocityvelocity);
            
entity_set_vector(entEV_VEC_anglesvelocity);
            
            
entity_set_float(entEV_FL_nextthinkhalflife_time() + 0.3);
        }
        case 
MC_AGRESIVA:
        {
            static 
victim;
            
entity_get_vector(entEV_VEC_originorigin);
            
            if ((
victim entity_get_int(entEV_INT_iuser2)) == -1)
            {
                
victim = -1;
                while ((
victim find_ent_in_sphere(victimoriginRADIO)) > 0)
                {
                    if (
is_user_alive(victim))
                        break;
                }
            }
            else
            {
                
entity_set_int(entEV_INT_iuser2, --victim);
                
victim 0;
            }
            
            if (!(
<= victim <= 32))
            {
                
entity_get_vector(entEV_VEC_velocityvelocity);
                
lenght xs_vec_len(origin);
                
                
originT[0] = origin[0] + (TRACE_DIST origin[0] / lenght);
                
originT[1] = origin[1] + (TRACE_DIST origin[1] / lenght);
                
originT[2] = origin[2] + 2.0// Bugfix
                
origin[0] = origin[0] - (2.0 origin[0] / lenght);
                
origin[1] = origin[1] - (2.0 origin[1] / lenght);
                
                
engfunc(EngFunc_TraceLineoriginoriginTIGNORE_MONSTERSenttrace);
                
                
get_tr2(traceTR_flFractionfraction);
                
                if (
fraction == 1.0)
                {
                    
velocity[0] = velocity[0] + random_float(-SPEED/4.0SPEED/4.0);
                    
velocity[1] = velocity[1] > 0.0 floatsqroot(SPEED*SPEED spd*spd) : 0.0 floatsqroot(SPEED*SPEED spd*spd);
                    
//velocity[2] = random(25) ? 0.0 : SALTO;
                
}
                else
                {
                    
spd random_float(0.0SPEED/2.0);
                    
velocity[0] = random_num(01) ? spd : -spd// Por alguna razon, random() sale casi siempre 0, es mejor random_num
                    
velocity[1] = random_num(01) ? floatsqroot(SPEED*SPEED spd*spd) : 0.0 floatsqroot(SPEED*SPEED spd*spd);
                    
//velocity[2] = random(25) ? 0.0 : SALTO;
                
}
                
                
entity_set_vector(entEV_VEC_velocityvelocity);
                
                
vector_to_angle(velocityvelocity);
                
entity_set_vector(entEV_VEC_anglesvelocity);
            }
            else
            {
                
entity_get_vector(victimEV_VEC_originoriginT);
                
                
lenght xs_vec_len(origin);

                
origin[0] = origin[0] - (2.0 origin[0] / lenght);
                
origin[1] = origin[1] - (2.0 origin[1] / lenght);
                
origin[2] = origin[2] - 1.0;
                
                
engfunc(EngFunc_TraceLineoriginoriginTIGNORE_MONSTERSenttrace);
            
                
get_tr2(traceTR_flFractionfraction);
                
                if (
fraction == 1.0)
                {
                    
velocity[0] = originT[0] - origin[0];
                    
velocity[1] = originT[1] - origin[1];
                    
velocity[2] = originT[2] - origin[2];
                    
                    
vector_to_angle(velocityvelocity);
                    
entity_set_vector(entEV_VEC_anglesvelocity);
                    
                    
angle_vector(velocityANGLEVECTOR_FORWARDvelocity);
                    
xs_vec_normalize(velocityvelocity);
                    
xs_vec_mul_scalar(velocitySPEEDvelocity);
                    
                    if (
get_distance_f(originoriginT) > 50.0)
                        
velocity[2] = 0.0;
                    else
                        
velocity[2] = SALTO;
                    
                    
entity_set_vector(entEV_VEC_velocityvelocity);
                }
                else
                {
                    
spd random_float(0.0SPEED/2.0);
                    
velocity[0] = random_num(01) ? spd : -spd// Por alguna razon, random() sale casi siempre 0, es mejor random_num
                    
velocity[1] = random_num(01) ? floatsqroot(SPEED*SPEED spd*spd) : 0.0 floatsqroot(SPEED*SPEED spd*spd);
                    
//velocity[2] = random(25) ? 0.0 : SALTO;
                    
                    
entity_set_vector(entEV_VEC_velocityvelocity);
            
                    
vector_to_angle(velocityvelocity);
                    
entity_set_vector(entEV_VEC_anglesvelocity);
                }
            }
            
            
entity_set_float(entEV_FL_nextthinkhalflife_time() + 0.2);
        }
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
fw_Touch(touchedtoucher)
{
    if (!
is_valid_ent(touched))
        return 
PLUGIN_CONTINUE;
    
    if (
entity_get_int(touchedEV_INT_iuser1) == MC_AGRESIVA && entity_get_int(touchedEV_INT_iuser2) == -&& is_user_alive(toucher))
    {
        
ExecuteHam(Ham_TakeDamagetouchertouchedtouchedDAMAGEDMG_SLASH);
        
emit_sound(touchedCHAN_VOICESONIDO_ATTACK1.0ATTN_NORM0PITCH_NORM);
        
entity_set_int(touchedEV_INT_iuser210); // Delay para el proximo ataque
    
}
        
    if (
entity_get_int(touchedEV_INT_flags) & FL_ONGROUND)
    {
        static 
Float:origin[3];
        
entity_get_vector(touchedEV_VEC_originorigin);
        
        
UTIL_BloodDrips(origin);
        
emit_sound(touchedCHAN_VOICESONIDO_SPLASH1.0ATTN_NORM0PITCH_NORM);
        
ExecuteHam(Ham_Killedtouchedtoucher0);
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamagebits)
{
    if (!
is_valid_ent(victim))
        return 
HAM_IGNORED;
    
    
emit_sound(victimCHAN_VOICESONIDO_DMG1.0ATTN_NORM0PITCH_NORM);
        
    static 
Float:origin[3];
    
entity_get_vector(victimEV_VEC_originorigin);
    
    
UTIL_BloodDrips(origin);
    
    return 
HAM_IGNORED;
}

public 
fw_Killed(victimattacker)
{
    if (!
is_valid_ent(victim))
        return 
HAM_IGNORED;
    
    new 
Float:origin[3], Float:direction[3];
    
entity_get_vector(victimEV_VEC_originorigin);
    
xs_vec_set(directionrandom_float(-1.01.0), random_float(-1.01.0), random_float(0.01.0));
        
    
FX_StreakSplash(origindirection51650200);
    
    return 
HAM_IGNORED;
}

create_roach(Float:origin[3], modo)
{
    new 
ent create_entity("info_target");
    
    
entity_set_origin(entorigin);
    
    
entity_set_string(entEV_SZ_classnameCLASSNAME);
    
    
entity_set_model(entMODEL);
    
entity_set_int(entEV_INT_movetypeMOVETYPE_BOUNCE);
    
entity_set_int(entEV_INT_solidSOLID_SLIDEBOX);
    
    
// Un poco más grandes para que no sea tan jodido pisarlas...
    
entity_set_size(entFloat:{ -2.0, -2.00.0 }, Float:{ 2.02.01.0 });
    
entity_set_int(entEV_INT_modelindexg_model);
    
    
entity_set_int(entEV_INT_sequence0);
    
entity_set_float(entEV_FL_animtimeget_gametime());
    
entity_set_float(entEV_FL_framerate1.0);
    
    
entity_set_float(entEV_FL_takedamage1.0);
    
entity_set_float(entEV_FL_healthVIDA);
    
entity_set_float(entEV_FL_gravity0.6);
    
entity_set_float(entEV_FL_friction0.8);
    
    
entity_set_float(entEV_FL_nextthinkhalflife_time() + 0.1);
    
    
#if defined USAR_GLOW
    
static const RGB_COLORS[][3] =
    {
        {    
150,    170,    200    },    // Blanco
        
{    255,    0,    0    },    // Rojo
        
{    0,    255,    0    },    // Verde
        
{    0,    0,    255    },    // Azul
        
{    255,    255,    0    },    // Amarillo
        
{    0,    250,    250    },    // Celeste
        
{    170,    50,    100    },    // Magenta
        
{    100,    50,    200    },    // Morado
        
{    255,    150,    100    }    // Naranja
    
};
    
    new 
rdn random(sizeof(RGB_COLORS));
    
set_rendering(entkRenderFxGlowShellRGB_COLORS[rdn][0], RGB_COLORS[rdn][1], RGB_COLORS[rdn][2], kRenderNormal25);
    
#endif
    
    
if (!(MC_ESTUPIDA <= modo MODOS_CUCAS))
        
modo MC_ESTUPIDA;
    
    
entity_set_int(entEV_INT_iuser1modo); // Indicador de cucaracha
    
    
drop_to_floor(ent);
    
    if (!
g_reg)
    {
        
RegisterHamFromEntity(Ham_TakeDamageent"fw_TakeDamage"1);
        
RegisterHamFromEntity(Ham_Killedent"fw_Killed"1);
        
        
g_reg 1;
    }
}

// De HL Snarks
FX_StreakSplash( const Float:Origin], const Float:Direction], const Color, const Count, const Speed, const VelocityRange )
{
    
#define message_begin_f(%1,%2,%3) ( engfunc ( EngFunc_MessageBegin, %1, %2, %3 ) )
    #define write_coord_f(%1)         ( engfunc ( EngFunc_WriteCoord, %1 ) )
    
    
message_begin_fMSG_PVSSVC_TEMPENTITYOrigin0);
    
write_byteTE_STREAK_SPLASH );
    
write_coord_fOrigin] );
    
write_coord_fOrigin] );
    
write_coord_fOrigin] );
    
write_coord_fDirection] );
    
write_coord_fDirection] );
    
write_coord_fDirection] );
    
write_byteminColor255 ) );
    
write_shortCount );
    
write_shortSpeed );
    
write_shortVelocityRange );// random velocity modifier
    
message_end();
}

UTIL_BloodDrips(Float:Origin[3])
{
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_BLOODSPRITE);
    
engfunc(EngFunc_WriteCoordOrigin[0]);
    
engfunc(EngFunc_WriteCoordOrigin[1]);
    
engfunc(EngFunc_WriteCoordOrigin[2]);
    
write_short(g_sprindex[SPR_BLOOD]);
    
write_short(g_sprindex[SPR_BLOODSPRAY]);
    
write_byte(195);
    
write_byte(CANTIDAD_BLOOD);
    
message_end();
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang10250\\ f0\\ fs16 \n\\ par }
*/ 
Responder
#2
https://amxmodx-es.com/Thread-Cucarachas-Mod
[Imagen: b_350_20_323957_202743_f19a15_111111.png]

Estudia siempre; el tiempo es oro, lo material se puede recuperar pero el tiempo no se puede recuperar.
(02/10/2016, 05:05 PM)meTaLiCroSS escribió: Siempre me gusta ayudar cuando alguien esta interesado realmente en ver que esta programando.
(08/08/2019, 05:32 PM)meTaLiCroSS escribió: grax x el dato cr4ck


Mis aportes

PLUGINS
MAPAS
Menú LANG [SF] Sistema de Frags
Say System (Admin Prefix)
Responder
#3
Información del Mod
¡Corre de las cucarachas y acuchilla a tus enemigos! El objetivo es sobrevivir al ataque de las cucarachas y acuchillar a los enemigos.
Las cucarachas aparecen en lugares determinados del mapa.
Persiguen a los jugadores cercanos, saltan, evaden obstáculos y atacan.
Acumula puntos por matar a las cucarachas y enemigos, úsalos para comprar extra items.

Acumula puntos por matar a las cucarachas y enemigos, úsalos para comprar extra items.
https://steamcommunity.com/id/adriancek1ng/

Aquellos que te critican quieren verte distinto,
Por que ven en ti lo que ellos no serán jamás. Feel like a sir
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)