AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=43)
-   -   freezing shield (https://forums.alliedmods.net/showthread.php?t=323066)

Arje 04-11-2020 14:48

freezing shield
 
Well this power would have a chance to freeze the enemy hitting you, and obviously it should have its own cooldown

sorry for my bad english.

heliumdream 06-22-2020 15:03

Re: freezing shield
 
1 Attachment(s)
You could rip Magneto and Kraven or Stungun and achieve this.

https://forums.alliedmods.net/showthread.php?t=132532
https://forums.alliedmods.net/showthread.php?t=30252
I cannot find the Magneto hero any longer on the forum, so here is a copy attached.

You would use the code from Magneto to detect when an enemy shoots you, and instead of replacing their gun with a glock, stun them for a moment.

Arje 02-24-2022 12:41

Re: freezing shield
 
If in the end I end up seeing the conditions in magneto, and use part of the subzero code, although I should see a better way to make it work, but it works when you get hit with knife


PHP Code:

// Frozen!

/* CVARS - copy and paste to shconfig.cfg

// Frozen Shield
frozen_level 10
frozen_cooldown 25        //cooldown para tener el escudo
frozen_stuntime 3        //cuanto tiempo queda stuneado
frozen_percent 0.15        //porcentaje segun el cual se activa el poder

*/

#include <superheromod>

// GLOBAL VARIABLES
new gHeroID
new const gHeroName[] = "Frozen"
new bool:gHasFrozen[SH_MAXSLOTS+1]
new const 
gSoundDisarm[] = "shmod/freezed.wav"
new pCvarCooldownpCvarStunpcvarPercent
new const MODEL_FROZENS[]    = "models/shmod/frozenshield.mdl";
//----------------------------------------------------------------------------------------------
public plugin_init()
{
    
// Plugin Info
    
register_plugin("SUPERHERO Frozen"SH_VERSION_STR"AssKicR / JTP10181 / Lucas Arje")

    
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
    
new pcvarLevel register_cvar("frozen_level""10")
    
pCvarCooldown register_cvar("frozen_cooldown""3")
    
pCvarStun register_cvar("frozen_stuntime""3")
    
pcvarPercent register_cvar("frozen_percent""0.15")

    
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
    
gHeroID sh_create_hero(gHeroNamepcvarLevel)
    
sh_set_hero_info(gHeroID"Congela a quién quiera lastimarte.""Cuando te pegan un Fakaso tenes una probabilidad de poder congelarlos.")
    
sh_set_hero_shield(gHeroIDtrue)
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
    
precache_sound(gSoundDisarm)
    
precache_model(MODEL_FROZENS)
}
//----------------------------------------------------------------------------------------------
public sh_hero_init(idheroIDmode)
{
    if ( 
gHeroID != heroID ) return

    
gHasFrozen[id] = mode true false

    sh_debug_message
(id1"%s %s"gHeroNamemode "ADDED" "DROPPED")
}
//----------------------------------------------------------------------------------------------
public sh_client_spawn(id)
{
    if ( 
gHasFrozen[id] ) { 
        
gPlayerInCooldown[id] = false
        RemoveByClass
(id)
    }
}
//----------------------------------------------------------------------------------------------
public client_damage(attackervictimdamagewpnindex)
{
    if ( !
sh_is_active() ) return
    if ( 
damage <= || victim == attacker ) return
    if ( !
is_user_alive(victim) || !is_user_alive(attacker) ) return
    if ( !
gHasFrozen[victim] || gPlayerInCooldown[victim] ) return

    new 
slot sh_get_weapon_slot(wpnindex)
    
    new 
randnum random_num(0100)
    new 
frozenchanche floatround(get_pcvar_float(pcvarPercent) * 100)

    if ( 
slot == && frozenchanche >= randnum ) {

        new 
Float:cooldown get_pcvar_float(pCvarCooldown)
        if ( 
cooldown 0.0 sh_set_cooldown(victimcooldown)

        
// Disarm enemy and get their gun!
        //play_sound(victim)
        
new id attacker
         
        
new Float:stuntime get_pcvar_float(pCvarStun)
        
sh_set_stun(idstuntime1.0)
        
        
//Screen Flash - sse le pone la pantalla al que te ataco por un segundo de color celeste
        
new alphanum clamp((damage 2), 40200)
        
sh_screen_fade(attacker1.00.50255255alphanum)
        
        
//Poner model y sacar model
        
freezed(id)
        
play_sound(id)
        
set_task(stuntime"RemoveByClass"id)
        
        
// ESto es para que no se le reste hp - Lado de la victima es decir el que tiene el frozen
        
new u_health get_user_health(victim)
        new 
newlife u_health damage 1
        shAddHPs
(victimdamagenewlife
        
        
set_hudmessage(01002000.020.6500.02.00.00.03)
        
show_hudmessage(victim"[%s] Congelaste a un Enemigo."gHeroName)
        
        
sh_set_rendering(victim025525516kRenderFxGlowShell)
        
set_task(1.0"frozen_unglow"victim)
    }
}
//----------------------------------------------------------------------------------------------
play_sound(id)
{
    
emit_sound(idCHAN_AUTOgSoundDisarmVOL_NORMATTN_NORM0PITCH_HIGH)
    
set_task(1.5"stop_sound"id)
}
//----------------------------------------------------------------------------------------------
public stop_sound(id)
    
emit_sound(idCHAN_AUTOgSoundDisarmVOL_NORMATTN_NORMSND_STOPPITCH_NORM)
//----------------------------------------------------------------------------------------------
public freezed(id)
{
    new 
Float:vOrigin[3]
    
entity_get_vector(idEV_VEC_originvOrigin)
    
//vOrigin[2] -= 25    //esto es para bajar mas el model.
    
    
new icecube create_entity("info_target")
    
entity_set_string(icecubeEV_SZ_classname"icecube")
    
entity_set_model(icecubeMODEL_FROZENS)
    
entity_set_size(icecubeFloat:{-2.5, -2.5, -1.5}, Float:{2.52.51.5})    //este es el original
    
entity_set_int(icecubeEV_INT_solid0)
    
entity_set_int(icecubeEV_INT_movetypeMOVETYPE_NOCLIP)
    
entity_set_vector(icecubeEV_VEC_originvOrigin)
    
    
// random orientation    //esto es del frostnades esta demas?
    
new Float:angles[3];
    
angles[1] = random_float(0.0,360.0);
    
set_pev(icecube,pev_angles,angles);

    
//drop_to_floor(icecube)
    
}

//----------------------------------------------------------------------------------------------
public frozen_unglow(victim)
{
    
sh_set_rendering(victim)
}
//----------------------------------------------------------------------------------------------
public RemoveByClass(id)
{
    new 
icecube 0
    
do {
        
icecube find_ent_by_class(icecube"icecube")
        if (
icecube 0)
            
remove_entity(icecube)
    }
    while (
icecube)



heliumdream 02-26-2022 11:14

Re: freezing shield
 
Sí, es una combinación de algunas cosas existentes, pero ha dado a luz una nueva idea única de héroe.
¡muy bien!

¡Viva la escudo congelado!

Arje 02-26-2022 18:29

Re: freezing shield
 
Quote:

Originally Posted by heliumdream (Post 2772521)
Sí, es una combinación de algunas cosas existentes, pero ha dado a luz una nueva idea única de héroe.
¡muy bien!

¡Viva la escudo congelado!

yes, thanks, although I would like to see some way to fix a part of the code but I don't know how
PHP Code:

    new u_health get_user_health(victim)
        new 
newlife u_health damage 1
        shAddHPs
(victimdamagenewlife

because this says that if you get hit with a knife, you will block but only if the blow does not kill you KO, so I have to see how to fix that, maybe if I discount part of the damage of the armor idk, Or else I could make it activate from time to time instead of just when you get hit idk, but well when I finish those details, maybe I'll publish it as a New Submissions, as the last one I publish I hope you can try it! https://forums.alliedmods.net/showthread.php?t=336405


All times are GMT -4. The time now is 03:43.

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