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

Request hero: electro (by AssKicR) with gravity and force push on players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TecJIa
Member
Join Date: Mar 2010
Location: Moscow
Old 03-30-2010 , 08:54   Request hero: electro (by AssKicR) with gravity and force push on players
Reply With Quote #1

Help unite this code:

*********BUT THIS HERO MUST OPERATE ON ALL ENEMYES IN RADIUS, BUT NOT ON ONE WHEN POWER IS USE*********

PHP Code:
// ELECTRO! - from Marvel Comics, Spider-Man villain.

/* CVARS - copy and paste to shconfig.cfg

//Electro
electro_level 0
electro_cooldown 45        //# of seconds for cooldown between use (Default 45)
electro_searchtime 45        //# of seconds to search for a victim when key is pressed (Default 45)
electro_maxdamage 50        //Damage on first victim, amount is decreased each jump by decay rate (Default 50)
electro_jumpdecay 0.66        //Decay rate for damage and sprite line width each lightning jump (Default 0.66)
electro_jumpradius 500        //Radius to search for a lightning jump (Default 500)

*/

/*
* v1.1 - vittu - 9/27/09
*      - Cleaned up and recoded using wc3ft chain lightning as a base.
*
*   Based on a mix of wc3 and wc3ft Orc Chain Lightning.
*   Originally commented with "WC3 Chain Lightning Ripoff :D".
*/

#include <superheromod>

#define LINE_WIDTH 80

// GLOBAL VARIABLES
new gHeroID
new bool:gHasElectro[SH_MAXSLOTS+1]
new 
bool:gLightningHit[SH_MAXSLOTS+1]
new 
bool:gIsSearching[SH_MAXSLOTS+1]
new const 
gSoundSearch[] = "turret/tu_ping.wav"
new const gSoundLightning[] = "weapons/gauss2.wav"
new gSpriteLightning
new gPcvarCooldowngPcvarSearchTimegPcvarMaxDamagegPcvarJumpDecaygPcvarJumpRadius
//----------------------------------------------------------------------------------------------
public plugin_init()
{
    
// Plugin Info
    
register_plugin("SUPERHERO Electro""1.1""AssKicR")

    
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
    
new pcvarLevel register_cvar("electro_level""0")
    
gPcvarCooldown register_cvar("electro_cooldown""45")
    
gPcvarSearchTime register_cvar("electro_searchtime""45")
    
gPcvarMaxDamage register_cvar("electro_maxdamage""50")
    
gPcvarJumpDecay register_cvar("electro_jumpdecay""0.66")
    
gPcvarJumpRadius register_cvar("electro_jumpradius""500")

    
// FIRE THE EVENTS TO CREATE THIS SUPERHERO!
    
gHeroID sh_create_hero("Electro"pcvarLevel)
    
sh_set_hero_info(gHeroID"Chain Lightning""Powerful Lightning Attack that can hurt Multiple Enemies")
    
sh_set_hero_bind(gHeroID)

    
register_forward(FM_TraceLine"fm_TraceLine")
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
    
precache_sound(gSoundSearch)
    
precache_sound(gSoundLightning)
    
gSpriteLightning precache_model("sprites/lgtning.spr")
}
//----------------------------------------------------------------------------------------------
public sh_hero_init(idheroIDmode)
{
    if ( 
gHeroID != heroID ) return

    
gHasElectro[id] = mode true false
}
//----------------------------------------------------------------------------------------------
public sh_client_spawn(id)
{
    
gPlayerInCooldown[id] = false
    gIsSearching
[id] = false
    gLightningHit
[id] = false

    remove_task
(id)
}
//----------------------------------------------------------------------------------------------
public sh_hero_key(idheroIDkey)
{
    if ( 
gHeroID != heroID || sh_is_freezetime() ) return
    if ( !
is_user_alive(id) || !gHasElectro[id] ) return

    if ( 
gIsSearching[id] ) return

    if ( 
key == SH_KEYDOWN )
    {
        
// Let them know they already used their ultimate if they have
        
if ( gPlayerInCooldown[id] )
        {
            
sh_sound_deny(id)
            return
        }

        
gIsSearching[id] = true

        
new parm[2]
        
parm[0] = id
        parm
[1] = get_pcvar_num(gPcvarSearchTime)
        
electro_search(parm)
    }
}
//----------------------------------------------------------------------------------------------
public electro_search(parm[2])
{
    new 
id parm[0]
    new 
timeLeft parm[1]

    
// Decrement our timer
    
parm[1]--

    
// User died or diconnected
    
if ( !is_user_alive(id) || !gHasElectro[id] )
    {
        
gIsSearching[id] = false
    
}

    
// This is the last "playing" of the sound, no target was found :/
    
if ( timeLeft == )
    {
        
gIsSearching[id] = false
    
}

    
// Then we need to play the sound + flash their icon!
    
if ( gIsSearching[id] )
    {
        
// Play the ping sound
        
emit_sound(idCHAN_STATICgSoundSearch1.0ATTN_NORM0PITCH_NORM)

        
set_task(1.0"electro_search"idparm2)
    }
}
//----------------------------------------------------------------------------------------------
public fm_TraceLine(Float:v1[3], Float:v2[3], const noMonsters, const pentToSkip)
{
    if ( !
sh_is_active() ) return FMRES_IGNORED

    
new victim get_tr(TR_pHit)
    if ( !
is_user_alive(victim) ) return FMRES_IGNORED

    
//new attacker = pentToSkip
    
if ( !is_user_alive(pentToSkip) || !gHasElectro[pentToSkip] || !gIsSearching[pentToSkip] ) return FMRES_IGNORED
    
if ( cs_get_user_team(pentToSkip) == cs_get_user_team(victim) ) return FMRES_IGNORED

    
new damage get_pcvar_num(gPcvarMaxDamage)

    
electro_attack(victimpentToSkipdamageLINE_WIDTHpentToSkip)

    new 
Float:seconds get_pcvar_float(gPcvarCooldown)
    if ( 
seconds 0.0 sh_set_cooldown(pentToSkipseconds)

    
gIsSearching[pentToSkip] = false

    
// Now we need to search for the next "jump"
    
new parm[4]
    
parm[0] = victim
    parm
[1] = damage
    parm
[2] = LINE_WIDTH
    parm
[3] = pentToSkip

    set_task
(0.2"electro_jump_check"pentToSkipparm4)

    return 
FMRES_IGNORED
}
//----------------------------------------------------------------------------------------------
public electro_jump_check(parm[4])
{
    
// parm[0] = victim
    // parm[1] = damage
    // parm[2] = linewidth
    // parm[3] = attacker

    
new lastVictim parm[0]
    new 
players[32], numberofplayersi
    get_players
(playersnumberofplayers"a")

    new 
Float:decay get_pcvar_float(gPcvarJumpDecay)

    
// Damage should be decreased on each jump
    
new damage floatround(parm[1] * decay)

    if ( 
is_user_connected(lastVictim) && damage )
    {
        new 
lvOrigin[3]
        
get_user_origin(lastVictimlvOrigin)

        new 
attacker parm[3]
        new 
CsTeams:attackerTeam cs_get_user_team(attacker)

        new 
targetclosestTargetclosestDistance
        
new distancetargetOrigin[3]
        new 
radius get_pcvar_num(gPcvarJumpRadius)

        
// Loop through every alive player
        
for ( 0numberofplayersi++ )
        {
            
target players[i]

            if ( 
target == attacker ||  target == lastVictim ) continue
            if ( 
gLightningHit[target] ) continue

            
// Make sure our target player isn't on the same team!
            
if ( cs_get_user_team(target) != attackerTeam )
            {
                
get_user_origin(targettargetOrigin)

                
distance get_distance(lvOrigintargetOrigin)

                
// Verify the user is within range
                
if ( distance <= radius )
                {
                    
// This user is closest!! Lets make a note of this...
                    
if ( distance closestDistance || !closestTarget )
                    {
                        
closestDistance distance
                        closestTarget 
target
                    
}
                }
            }
        }

        if ( 
closestTarget )
        {
            
// Then we have a valid target!!!

            // Decrease line width as well
            
new lineWidth floatround(parm[2] * decay)

            
// Display the actual lightning
            
electro_attack(closestTargetattackerdamagelineWidthlastVictim)

            
// Lets call this again on our next target!
            
parm[0] = closestTarget
            parm
[1] = damage
            parm
[2] = lineWidth
            set_task
(0.2"electro_jump_check"attackerparm4)

            return
        }
    }

    
// No valid target found - reset all lightning hit variables
    
for ( 0numberofplayersi++ )
    {
        
gLightningHit[players[i]] = false
    
}
}
//----------------------------------------------------------------------------------------------
electro_attack(const victim, const attacker, const damage, const linewidth, const beamStartID)
{
    
// Make sure we set this user as hit, otherwise we'll hit him again
    
gLightningHit[victim] = true

    
// Get the target's origin
    
new Float:beamOrigin[3]
    
pev(beamStartIDpev_originbeamOrigin)

    
// Damage the user
    
sh_extra_damage(victimattackerdamage"chain lightning"0SH_DMG_NORMtruefalsebeamOrigin)

    
// Create the lightning
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_BEAMENTS)
    
write_short(beamStartID)// start entity
    
write_short(victim)    // entity
    
write_short(gSpriteLightning)    // model
    
write_byte(0)        // starting frame
    
write_byte(15)        // frame rate
    
write_byte(40)        // life
    
write_byte(linewidth)    // line width
    
write_byte(10)        // noise amplitude
    
write_byte(0)        // r, g, b
    
write_byte(191)        // r, g, b
    
write_byte(255)        // r, g, b 125
    
write_byte(255)        // brightness 175
    
write_byte(0)        // scroll speed
    
message_end()

    
// Get the victim's origin
    
new vicOrigin[3]
    
get_user_origin(victimvicOrigin)

    
// Create an elight on the target
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(TE_ELIGHT)
    
write_short(victim)    // entity
    
write_coord(vicOrigin[0])  // initial position
    
write_coord(vicOrigin[1])  // initial position
    
write_coord(vicOrigin[2])  // initial position
    
write_coord(100)    // radius
    
write_byte(255)        // r, g, b
    
write_byte(255)        // r, g, b
    
write_byte(100)        // r, g, b
    
write_byte(10)        // life
    
write_coord(0)        // decay rate
    
message_end()

    
// Play the lightning sound
    
emit_sound(beamStartIDCHAN_STATICgSoundLightning1.0ATTN_NORM0PITCH_NORM)
}
//---------------------------------------------------------------------------------------------- 
with set X gravity on X seconds on all enemy attacked, who get in a radius (like ZeroG) and Force push all with X velocity (like Yoda)

The total we have cvars:

electromagnet_level //set level hero
electromagnet_radius //set radius of electro-magnet power (cvar from electro hero)
electromagnet_damage //set damage on attacked (cvar from electro hero)
electromagnet_cooldown //set cooldown here before u can use powe again (cvar from electro hero)
electromagnet_selfdamage //set damage on your team (cvar from yoda hero) - OPTIONAL
electromagnet_gravtime //time of players have gravity (cvar from zeroG hero)
electromagnet_playergrav //set gravity, which will have attacked players (regulation gravity cvar)
electromagnet_velocity // set force push power (cvar from yoda hero)

warning: sounds from yoda hero not use

Thank you!

Last edited by TecJIa; 03-30-2010 at 11:19.
TecJIa is offline
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 03-30-2010 , 10:13   Re: Request hero: electro (old version) with gravity on players
Reply With Quote #2

Use the new version and im sure someone will help you. Atleast im not even going to look at the code because I hate the old ways and I suck at them. Sorry
__________________
The Art of War is offline
TecJIa
Member
Join Date: Mar 2010
Location: Moscow
Old 03-30-2010 , 11:24   Re: Request hero: electro (by AssKicR) with gravity and force push on players
Reply With Quote #3

Now change code to new version
TecJIa is offline
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 03-30-2010 , 13:43   Re: Request hero: electro (by AssKicR) with gravity and force push on players
Reply With Quote #4

It is new ways coded. Imma take a look at it but dont hope on too much. What is it you really want? A keydown, attacked enemies have X gravity for X seconds and then when the key is pressed down again you want it to be like force push?
__________________

Last edited by The Art of War; 03-30-2010 at 13:57.
The Art of War is offline
TecJIa
Member
Join Date: Mar 2010
Location: Moscow
Old 03-30-2010 , 15:24   Re: Request hero: electro (by AssKicR) with gravity and force push on players
Reply With Quote #5

Quote:
Originally Posted by The Art of War View Post
It is new ways coded. Imma take a look at it but dont hope on too much. What is it you really want? A keydown, attacked enemies have X gravity for X seconds and then when the key is pressed down again you want it to be like force push?
I want that at pressure of the button of all of incoming in the radius of defeat enemyes beat the electricity - one, did them a gravitation on x seconds (but after gravitation players autoset to normal (to which they used) - two, and pushed aside - three. this is all

Last edited by TecJIa; 03-30-2010 at 15:29.
TecJIa is offline
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 03-31-2010 , 01:48   Re: Request hero: electro (by AssKicR) with gravity and force push on players
Reply With Quote #6

I dont really get it. You want to have the X gravity on keydown, and the push on keyup? Or both on keydown, so that they have X gravity first and then when the gravity resets you want the push to come?
__________________
The Art of War is offline
TecJIa
Member
Join Date: Mar 2010
Location: Moscow
Old 03-31-2010 , 11:39   Re: Request hero: electro (by AssKicR) with gravity and force push on players
Reply With Quote #7

Quote:
Originally Posted by The Art of War View Post
I dont really get it. You want to have the X gravity on keydown, and the push on keyup? Or both on keydown, so that they have X gravity first and then when the gravity resets you want the push to come?
All three powers (electricity beat, set gravity and push) must work simultaneously in one time after pressure key.But will repeat again: gravitation for the attacked players after set time must become to normal (like a hero ZeroG).
TecJIa is offline
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 03-31-2010 , 11:42   Re: Request hero: electro (by AssKicR) with gravity and force push on players
Reply With Quote #8

So you want to first damage the players, then push them away with low gravity?
__________________
The Art of War is offline
TecJIa
Member
Join Date: Mar 2010
Location: Moscow
Old 03-31-2010 , 13:46   Re: Request hero: electro (by AssKicR) with gravity and force push on players
Reply With Quote #9

Quote:
Originally Posted by The Art of War View Post
So you want to first damage the players, then push them away with low gravity?
yes
TecJIa is offline
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 03-31-2010 , 13:55   Re: Request hero: electro (by AssKicR) with gravity and force push on players
Reply With Quote #10

Alright im on it when ive finished the test version of a hero im creating.
__________________
The Art of War is offline
Reply



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


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