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

Regeneration not stacking (How?)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Exploited
Veteran Member
Join Date: Jul 2010
Location: Sweden
Old 11-01-2010 , 17:40   Regeneration not stacking (How?)
Reply With Quote #1

Hey,

So, I want to create a hero that heals 30hp and 30ap per second, but doesn't stack with other heroes, for example Wolverine or Iron Man. Jelle said he'd help me out with this one, but I wont be able to access Steam for another 9000 years so I might aswell ask here. I am also unable to access a compiler except for the online one, so I'm not sure if the errors are get are caused by the compiler or by the code, but when I try to compile it there it says every single line is too long, wich I have no idea how to fix, if it really is the code.

Like I said, what I wonder how to do is how to do so it doesn't stack with other heroes. The heroes I have that regens.. at the moment is:

Hp:
Wolverine
Darth Maul
Riddick

Ap:
Iron Man
Spy
Armor Pack

And heres the code I have so far wich hopefully compiles on a normal compiler.. As I said, the only errors I get are from too long lines.

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(indexid)
{
    if(!
sh_is_active() || !is_user_alive(index) )
        return
    
    
sh_add_hp(indexget_pcvar_num(gPcvarHpRegen) )
    
set_user_armor(idmin(userarmor get_pcvar_num(pcvarApRegen), sh_get_max_ap(id)))

I was extremely tired when I made this, so I probably forgot something. I'm only human.

Any help is appreciated,
Exploited
__________________
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
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 11-01-2010 , 17:42   Re: Regeneration not stacking (How?)
Reply With Quote #2

set_task(1.0, "taskRegen", id)

public taskRegen(index, id)

wat
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
Exploited
Veteran Member
Join Date: Jul 2010
Location: Sweden
Old 11-01-2010 , 17:54   Re: Regeneration not stacking (How?)
Reply With Quote #3

wat, you're the one who taught me how to use tasks with the Darth Maul you sent me. Should I replace index with id in the hphealing thing and remove index from the parantheseline? Damn, I suck at explaining things, but I mean like this:

PHP Code:
public taskRegen(id)
{
    if(!
sh_is_active() || !is_user_alive(id) )
        return
    
    
sh_add_hp(idget_pcvar_num(gPcvarHpRegen) )
    
set_user_armor(idmin(userarmor get_pcvar_num(pcvarApRegen), sh_get_max_ap(id)))

Or are you on about something else?
__________________
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
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 11-01-2010 , 18:45   Re: Regeneration not stacking (How?)
Reply With Quote #4

Quote:
Originally Posted by Exploited View Post
wat, you're the one who taught me how to use tasks with the Darth Maul you sent me. Should I replace index with id in the hphealing thing and remove index from the parantheseline? Damn, I suck at explaining things, but I mean like this:

PHP Code:
public taskRegen(id)
{
    if(!
sh_is_active() || !is_user_alive(id) )
        return
    
    
sh_add_hp(idget_pcvar_num(gPcvarHpRegen) )
    
set_user_armor(idmin(userarmor get_pcvar_num(pcvarApRegen), sh_get_max_ap(id)))

Or are you on about something else?
Yes, precisely that. One variable passed can't magically turn into two.
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
Exploited
Veteran Member
Join Date: Jul 2010
Location: Sweden
Old 11-01-2010 , 18:58   Re: Regeneration not stacking (How?)
Reply With Quote #5

Alright, I thought so. Anyways, do you know how to do so the regen doesn't stack?

Edit: I found this post by G-Dog, but I am not sure how to do it with multiple heroes, nor do I know how to do it if a forward is run in sh_hero_init, as it isn't in the example he gave. Any ideas?
__________________
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-01-2010 at 19:54.
Exploited is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 11-01-2010 , 20:56   Re: Regeneration not stacking (How?)
Reply With Quote #6

Look at the hero wolverine...
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 11-02-2010 , 04:19   Re: Regeneration not stacking (How?)
Reply With Quote #7

Quote:
Originally Posted by Jelle View Post
Look at the hero wolverine...
Quote:
Originally Posted by Exploited View Post
Anyways, do you know how to do so the regen doesn't stack?
But no.
__________________
The Art of War is offline
Exploited
Veteran Member
Join Date: Jul 2010
Location: Sweden
Old 11-02-2010 , 06:15   Re: Regeneration not stacking (How?)
Reply With Quote #8

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
__________________
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
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 11-02-2010 , 06:42   Re: Regeneration not stacking (How?)
Reply With Quote #9

2 methods :
- use g-Dog method.
- combine 3 hero in one plugin.

Last edited by Fr33m@n; 11-02-2010 at 06:47.
Fr33m@n is offline
Exploited
Veteran Member
Join Date: Jul 2010
Location: Sweden
Old 11-02-2010 , 07:08   Re: Regeneration not stacking (How?)
Reply With Quote #10

How would I use G-Dogs method in my code? I tried to insert it but it just looked weird and I had no idea where to put certain things as his sh_hero_init looks different to mine as he doesnt run any forwards in it.
__________________
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


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 10:50.


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