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

Regeneration not stacking (How?)


Post New Thread Reply   
 
Thread Tools Display Modes
Exploited
Veteran Member
Join Date: Jul 2010
Location: Sweden
Old 11-02-2010 , 15:20   Re: Regeneration not stacking (How?)
Reply With Quote #21

Quote:
Originally Posted by Exploited View Post
No, not that. How would I insert G-Dogs code into a switch? I tried, but I can't find a way that makes sense.
Does not look like "how do I use a switch instead of a condition" to me.
__________________
Jelle (1): I LOVE YOU
Jelle (1): Yeah. omg you are so awesome!
--------------
Jelle (1): You know when a poo is about to exit but it is too big?
Jelle (1): God my ass still hurts
Exploited is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 11-02-2010 , 15:48   Re: Regeneration not stacking (How?)
Reply With Quote #22

"How do I insert G-Dog's code into a switch?"

Then what does that mean?
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
Exploited
Veteran Member
Join Date: Jul 2010
Location: Sweden
Old 11-02-2010 , 16:00   Re: Regeneration not stacking (How?)
Reply With Quote #23

Exactly what it sounds like, how would I insert the code G-Dog made for detecting if the client have the other heroes into a switch as he uses a condition in the Magneto example.

Edit: I fixed it so that it compiles. Not sure if it works though, I will test it soon.

PHP Code:
//Regeneration

#include <superheromod>
#include <hamsandwich>

//Global commands
new gHeroID
new gHeroName[] = "Regeneration"
new bool:gHasRegen[SH_MAXSLOTS+1]
new 
pcvarHpRegenpcvarApRegen
//-------------------------------------------------------
public plugin_init()
{
     
register_plugin("SUPERHERO Regeneration""1.0""Exploited")

     new 
pcvarLevel register_cvar("regen_level""10")
     
pcvarHpRegen register_cvar("regen_hpregen""30")
     
pcvarApRegen register_cvar("regen_apregen""30")

     
gHeroID sh_create_hero(gHeroNamepcvarLevel)
     
sh_set_hero_info(gHeroID"Regeneration""High-speed regeneration!")

}   
//-------------------------------------------------------
public sh_hero_init(idheroIDmode)
{
    if (
gHeroID != heroID) return
    
    if(
mode == SH_HERO_ADD)
    {
        
gHasRegen[id] = true
        set_task
(1.0"taskRegen"id)
    }
    else
    {
        
gHasRegen[id] = false
        remove_task
(id)
    }
}
//-------------------------------------------------------
public taskRegen(id)
{
    if(!
sh_is_active() || !is_user_alive(id) )
        return
       
    static 
userarmor
    userarmor 
get_user_armor(id)

    
    
sh_add_hp(idget_pcvar_num(pcvarHpRegen) )
    
set_user_armor(idmin(userarmor get_pcvar_num(pcvarApRegen), sh_get_max_ap(id)))

My question still stands; how do I implent G-Dogs code for detecting if the sh_hero_init isn't a condition like his is in the example magneto?
__________________
Jelle (1): I LOVE YOU
Jelle (1): Yeah. omg you are so awesome!
--------------
Jelle (1): You know when a poo is about to exit but it is too big?
Jelle (1): God my ass still hurts

Last edited by Exploited; 11-02-2010 at 16:22.
Exploited is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 11-02-2010 , 16:33   Re: Regeneration not stacking (How?)
Reply With Quote #24

That's some awesome regen you got there. In my opinion, I wouldn't call that regen.
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 11-02-2010 , 16:46   Re: Regeneration not stacking (How?)
Reply With Quote #25

And I did just show you how to use a switch instead of an if condition.
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
Exploited
Veteran Member
Join Date: Jul 2010
Location: Sweden
Old 11-02-2010 , 16:48   Re: Regeneration not stacking (How?)
Reply With Quote #26

Quote:
Originally Posted by DarkGod View Post
That's some awesome regen you got there. In my opinion, I wouldn't call that regen.
You regenerate hp and ap. How is that not regeneration?

Quote:
Originally Posted by Jelle View Post
And I did just show you how to use a switch instead of an if condition.
My question was how to use G-Dogs code in a switch, wich you did not show.
__________________
Jelle (1): I LOVE YOU
Jelle (1): Yeah. omg you are so awesome!
--------------
Jelle (1): You know when a poo is about to exit but it is too big?
Jelle (1): God my ass still hurts
Exploited is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 11-02-2010 , 17:47   Re: Regeneration not stacking (How?)
Reply With Quote #27

G-Dog's post vanished lol.

But you are talking about how to make this code use a switch instead of if conditions, right?

PHP Code:
public sh_hero_init(idheroIDmode)
{
    if (
gHeroID != heroID) return
    
    if(
mode == SH_HERO_ADD)
    {
        
gHasRegen[id] = true
        set_task
(1.0"taskRegen"id)
    }
    else
    {
        
gHasRegen[id] = false
        remove_task
(id)
    }

__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 11-02-2010 , 17:53   Re: Regeneration not stacking (How?)
Reply With Quote #28

Yes that is what he meant.

"if" "else" is generally more efficient if there are only 2 statements over a using a switch, switch only becomes more efficient when there are 3 or more statements.

While the difference is almost negligible there is a difference. SH will not always do things as efficiently as possible as many things are done as examples of what can be done and also done for legibility to make it easier for beginners to understand.

Last edited by vittu; 11-02-2010 at 17:57.
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 11-02-2010 , 18:02   Re: Regeneration not stacking (How?)
Reply With Quote #29

like fakemeta --> engine but i think that pev stuff is more readable than engine functions
Fr33m@n is offline
Exploited
Veteran Member
Join Date: Jul 2010
Location: Sweden
Old 11-02-2010 , 18:19   Re: Regeneration not stacking (How?)
Reply With Quote #30

Quote:
Originally Posted by Exploited View Post
Wolverines regen stacks. I forgot to link G-DOgs post in my previous post, but here it is: http://forums.alliedmods.net/showpos...2&postcount=13
That is the code I mean. How would I implent it into a switch? I have never used Condition-type sh_hero_inits so I'd prefer to keep it a switch for now.
__________________
Jelle (1): I LOVE YOU
Jelle (1): Yeah. omg you are so awesome!
--------------
Jelle (1): You know when a poo is about to exit but it is too big?
Jelle (1): God my ass still hurts
Exploited 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 17:43.


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