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

Hero: Protoman (useless)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Chivas2973
Veteran Member
Join Date: Mar 2004
Location: Wisconsin
Old 07-22-2004 , 20:27   Hero: Protoman (useless)
Reply With Quote #1

Protoman

Description
Proto Shield", "Autoblock all projectiles when not moving, shooting, or zooming for x seconds

CVARS
protoman_level - what level must they be for Protoman's powers?
proto_delay - how long after shooting does the shield kick in?
Attached Files
File Type: sma Get Plugin or Get Source (sh_protoman.sma - 1064 views - 4.0 KB)
__________________

Last edited by vittu; 10-04-2009 at 23:17.
Chivas2973 is offline
yang
Veteran Member
Join Date: May 2005
Location: galoreservers.net
Old 09-12-2005 , 04:32  
Reply With Quote #2

here's a temporary fix for this hero (AMXX ONLY) o.O... it was pretty messy code, had compiler errors and i dunno why he used his global variables the way he did o.O so... hehe i'll work on it later, but for now this will have to do as a temp fix o.O... (note, i don't have a comp that have cstrike stuff installed, so cannot test, but i think it should work try it )

Bugs still need to fix:

- seconds it takes to activate projectile

and yes... i dunno where the hell i digged this one out of the forum lol...
Attached Files
File Type: sma Get Plugin or Get Source (sh_protoman.sma - 1320 views - 3.9 KB)
__________________
yang is offline
Send a message via AIM to yang
Mega
Senior Member
Join Date: Aug 2005
Old 09-12-2005 , 10:32  
Reply With Quote #3

nice nice ;)
yang ur the best!
Mega is offline
yang
Veteran Member
Join Date: May 2005
Location: galoreservers.net
Old 09-12-2005 , 12:45  
Reply With Quote #4

Here's an even further update lol... this one is well optimized but just doesn't have the time to activate it yet... cuz well my server testin comp is no longer with us o.O... cuz of a girl lol.... so here is another version:

Code:
ProtoMan 1.2 - yang

 * Corrected for AMXX Compiler
 * Code CleanUp
 * Optimized Code
Attached Files
File Type: sma Get Plugin or Get Source (sh_protoman.sma - 1285 views - 4.0 KB)
__________________
yang is offline
Send a message via AIM to yang
mage
Senior Member
Join Date: Sep 2005
Old 09-12-2005 , 14:00  
Reply With Quote #5

fixed for amxx only thats pretty good bad no-one can join my server and use it(i have lost my steam.dll)
mage is offline
yang
Veteran Member
Join Date: May 2005
Location: galoreservers.net
Old 09-12-2005 , 14:07  
Reply With Quote #6

Quote:
Originally Posted by spyhunter
fixed for amxx only thats pretty good bad no-one can join my server and use it(i have lost my steam.dll)
yes i already said it was a fix for amxx, and what does your server setup have anything to do with this thread? o.O maybe post it in the tech support if you need something lol...
__________________
yang is offline
Send a message via AIM to yang
mage
Senior Member
Join Date: Sep 2005
Old 09-12-2005 , 14:14  
Reply With Quote #7

that wasent my point my point was no-one can join my server to use a soo cool hero becouse i dont got the file.

they cant join and try the cool hero
mage is offline
MasterShake
New Member
Join Date: Sep 2005
Old 09-14-2005 , 11:33  
Reply With Quote #8

Thanks yang for changing it
MasterShake is offline
heliumdream
Senior Member
Join Date: Aug 2006
Old 10-28-2006 , 13:46   Re: Hero: Protoman (useless)
Reply With Quote #9

Code:
// Protoman - Proto Shield blocks all projectiles while not moving, shooting, or zooming for x seconds

 /*

 //Protoman
 protoman_level 60   - what level must they be for Protoman's powers?
 protoman_delay 8    - how long after shooting does the shield kick in?
 protoman_chance .25   - % chance the shield will work


 Version Changes:

 1.0 - useless

 * Initial Release

 1.2 - yang

 * Corrected for AMXX Compiler
 * Code CleanUp
 * Optimized Code

1.3 - heliumdream

* Made use of the proto_delay cvar
* Added a %chance cvar
* Switched health preservation code from old method to the method used in 'Juggernaut II'
* Also note about 8 lines below this is a defination 'HPNO 1200'.  This should be treated as 'additional health'.

 */


 #include <amxmod>
 #include <superheromod>

 // VARIABLES
 #define HPNO 1200
 new gHeroName[]="Protoman"
 new playerhealth[SH_MAXSLOTS+1]
 new bool:gHasProtoPower[SH_MAXSLOTS+1]
 new bool:gProtoShield[SH_MAXSLOTS+1]
 new protoDelay[SH_MAXSLOTS+1]
 //----------------------------------------------------------------------------------------------
 public plugin_init()
 {
    // Plugin Info
    register_plugin("SUPERHERO Protoman","1.2","useless / yang")

    // FIRE THE EVENT TO CREATE THIS SUPERHERO!
    if ( isDebugOn() ) server_print("Attempting to create Protoman Hero")
    if ( !cvar_exists("protoman_level") ) register_cvar("protoman_level", "3")
    shCreateHero(gHeroName, "Proto Shield", "Chance to block projectiles when not moving, shooting, or zooming for x seconds", false, "protoman_level" )

    // REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
    register_event("ResetHUD","newRound","b")
    register_event("Damage", "proto_damage", "b", "2!0")
    // INIT
    register_srvcmd("protoman_init", "protoman_init")
    shRegHeroInit(gHeroName, "protoman_init")

    // CHECK SOME BUTTONS
    set_task(0.01,"check_attack",0,"",0,"b")
    set_task(0.01,"check_two_buttons",0,"",0,"b")
    set_task(0.01,"check_move_buttons",0,"",0,"b")

    // DEFAULT THE CVARS
    register_cvar("protoman_delay", "8.0")
    register_cvar("protoman_chance", "0.25")
 }
 //----------------------------------------------------------------------------------------------
 public protoman_init()
 {
    new temp[128]    
    // First Argument is an id
    read_argv(1,temp,5)
    new id=str_to_num(temp)
    // 2nd Argument is 0 or 1 depending on whether the id has proto
    read_argv(2,temp,5)
    new hasPowers=str_to_num(temp)
    gHasProtoPower[id]=(hasPowers!=0)
    protoDelay[id]=get_cvar_float("protoman_delay")

    // Got to remove the powers if he is not Protoman
    if ( !hasPowers ){
        uninvis(id)
    }
    //Give Powers to the Protoman
    if ( hasPowers )
    set_task(protoDelay[id],"invis",id)
 }

 public newRound(id)
 {
    new parm[1]
    parm[0]=id  
    if ( is_user_alive(id) && gHasProtoPower[id] == true ) {
        set_task(protoDelay[id],"invis",id)
    }
    set_task(1.0,"sethealth",id,parm,1)
 }
 
 public sethealth(parm[])
{
    new id=parm[0]
    playerhealth[id]=get_user_health(id)+HPNO
    set_user_health(id, playerhealth[id])
}

 public invis(id) {
    if ( gProtoShield[id] != true )
    {
         client_print(id, print_chat, "[SH](Protoman): You have a chance to absorb projectiles.")
         gProtoShield[id] = true
    
    }
 }

 public uninvis(id) {
    if ( gProtoShield[id] != false )
    {        
        client_print(id, print_chat, "[SH](Protoman): No longer impervious to projectiles.")
        gProtoShield[id] = false
         }
 }

 public check_attack() {

    for(new i = 1; i <= get_maxplayers(); ++i) {
        if (is_user_alive(i)) {
            if ((get_user_button(i)&IN_ATTACK) && gHasProtoPower[i]) {
                uninvis(i)
            }
            else if (!(get_user_button(i)&IN_ATTACK) && gHasProtoPower[i]) {
                set_task(protoDelay[i],"invis",i)
            }
        }
    }
    return PLUGIN_CONTINUE
 }

 public check_two_buttons() {

    for(new i = 1; i <= get_maxplayers(); ++i) {
        if (is_user_alive(i) || gHasProtoPower[i] ) {
            if (get_user_button(i)&IN_USE || get_user_button(i)&IN_ATTACK2) {
                uninvis(i)
            }
        }
    }
    return PLUGIN_CONTINUE
 }

 public check_move_buttons() {
    for(new i = 1; i <= get_maxplayers(); ++i)
    {
        if (is_user_alive(i) && gHasProtoPower[i] == true )
        {
            if (get_user_button(i)&IN_BACK || get_user_button(i)&IN_MOVELEFT || get_user_button(i)&IN_MOVERIGHT || get_user_button(i)&IN_FORWARD || get_user_button(i)&IN_RUN )
            {
                uninvis(i)
            }
        }
    }
    return PLUGIN_CONTINUE
 }
 
public proto_damage(id) {
    if (gProtoShield[id]) {
        new damage = read_data(2)
        new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)
        if (attacker!=id && weapon!=CSW_KNIFE) playerhealth[id] -= damage
        new randNum = random_num(0, 100)
        if (get_user_health(id) < playerhealth[id] && (get_cvar_float("protoman_chance") * 100 >= randNum)) 
            {
            set_user_health(id, playerhealth[id])
            new message[128]
            format(message, 127, "Protoman deflected the projectile!" )
            set_hudmessage(0,120,255,-1.0,1.0,0,0.25,1.0,0.0,0.0,4)
            show_hudmessage(id, message)
            }
        }
 }
-edit #3- This is not a fixed release. I got a version working that involved an ambiguous loop and check that were being tastked every .1 seconds. however, I tried following the suggestions yang gave me below, and I've been frustrated with failure.

I believe everything is working properly - except my set_task call. My set_tasks are executing immediately, and not 8 seconds in the future.

Yang I'm hoping you'll prolly be able to look at it and tell me whats wrong :-D.

Any help is appreciated.

Yang if you read this, also jump to page 2 of this thread and read my next code chunklet.

Last edited by heliumdream; 10-30-2006 at 00:36.
heliumdream is offline
yang
Veteran Member
Join Date: May 2005
Location: galoreservers.net
Old 10-29-2006 , 10:04   Re: Hero: Protoman (useless)
Reply With Quote #10

you do not need a every 1 second checker -.- thats not necessary. use set_task to run ONCE based on the float variable of the delay factor once nothing is clicked everytime. If it gets interrupted by a key input, then the protoman var should be false.

i dunno if i explained that closely enough but if you have a looping checker that checks say every 1 second its gonna be inaccurate, and 2, a timer that starts right at end of an action is more accurate.

There's also the post_think method but not recommanded. There's alot of ways, come up with some instead of using code that is there but really doesn't necessary meet your needs.
__________________
yang is offline
Send a message via AIM to yang
Reply


Thread Tools
Display Modes

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 16:28.


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