PDA

View Full Version : [Subplugin Submission] ZP: Regeneration


hleV
10-20-2008, 14:58
The code was created by request for Zombie Plague Mod and I decided to make this as a ZP sub-plugin, though I'm not using or playing this mod. This was not tested by myself but someone else said that it works perfectly.

So, what it does?
As the title says, it makes zombies regenerate their health after being hit.There are several CVars to configure everything as you want:

zp_regeneration <1|0> - enables/disables plugin.
zp_regen_time <#> - every x seconds zombie will get back some health.
zp_regen_amount <#> - how many health zombie will get on every x seconds.
zp_regen_nemesis <1|0> - enables/disables regeneration for Nemesis.
zp_regen_firstzombie <1|0> - enables/disables regeneration for the first zombie.
zp_regen_lastzombie <1|0> - enables/disables regeneration for the last zombie.
Modules:Fakemeta.To do:Set CVar so only Nemesis/first zombie/last zombie could regenerate.Note: To compile the plugin, you MUST have zombieplague.inc in your scripting/include folder.

Changelog:1.2:

Removed Survivor CVar though Survivor is not a zombie.
Added CVars to control first and last zombie regeneration.
1.1:Added CVars to control regeneration of Nemesis.

Fry!
10-20-2008, 15:03
Oh, I was going to create this in this week, but it's ok, good job. :D

Hammerfallerz
10-20-2008, 15:40
Does it ignore nemesis?

Fry!
10-20-2008, 15:54
I don't think cuz in code there was regenaration for all zombies...

Hammerfallerz
10-20-2008, 15:55
It would be good to add a cvar for ignoring regeneration:
Nemesis & last zombie.

ifx
10-20-2008, 16:53
thanks!

hleV
10-20-2008, 17:28
Updated. Check first post (http://forums.alliedmods.net/showpost.php?p=702726&postcount=1).

NestleMilo
10-20-2008, 23:19
Can you make this a seperate class plugin?

[Regeneration Zombie]

Fry!
10-21-2008, 00:34
hleV You are really good at this. :)

Hammerfallerz
10-21-2008, 06:39
Excuse me, hleV, can you make this plugin like a passive zombie skill? I mean so it will always (no need to being hit) regenerate zombie health for X hp every second with no timelimit (besides last zombie, nemesis & survivor)? And, of course, zombie's HP can't go over it classes max hp :)

hleV
10-21-2008, 08:32
Removed Survivor thing. It looks like Survivor is a human, lol.
Excuse me, hleV, can you make this plugin like a passive zombie skill? I mean so it will always (no need to being hit) regenerate zombie health for X hp every second with no timelimit (besides last zombie, nemesis & survivor)? And, of course, zombie's HP can't go over it classes max hp :)
Try this:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

new g_Status, g_Time, g_Amount, g_ZombiePlague, g_Nemesis, g_FirstZombie, g_LastZombie, g_MaxPlayers;

public plugin_init()
{
register_plugin("ZP: Regeneration", "1.2 (Special)", "hleV");

g_Status = register_cvar("zp_regeneration", "1");
g_Time = register_cvar("zp_regen_time", "1");
g_Amount = register_cvar("zp_regen_amount", "10");
g_Nemesis = register_cvar("zp_regen_nemesis", "1");
g_FirstZombie = register_cvar("zp_regen_firstzombie", "1");
g_LastZombie = register_cvar("zp_regen_lastzombie", "1");

set_task(get_pcvar_float(g_Time), "Regenerate", _, _, _, "b");

g_ZombiePlague = get_cvar_pointer("zp_on");
g_MaxPlayers = get_maxplayers();
}

public Regenerate()
{
if (!get_pcvar_num(g_Status) || !g_ZombiePlague || !get_pcvar_num(g_Status))
return;

for (new Client = 1; Client <= g_MaxPlayers; Client++)
{
new Health = get_user_health(Client);

if (!is_user_connected(Client) || !is_user_alive(Client) || !zp_get_user_zombie(Client))
return;

if (!get_pcvar_num(g_Nemesis) && zp_get_user_nemesis(Client))
return;

if (!get_pcvar_num(g_FirstZombie) && zp_get_user_first_zombie(Client))
return;

if (!get_pcvar_num(g_LastZombie) && zp_get_user_last_zombie(Client))
return;

new NeededHealth = zp_get_zombie_maxhealth(Client) - Health;

if (NeededHealth <= get_pcvar_num(g_Amount))
{
set_pev(Client, pev_health, Health + float(NeededHealth));
return;
}

set_pev(Client, pev_health, Health + get_pcvar_float(g_Amount));
}
}
Also, check the new update.

Fry!
10-21-2008, 13:39
why You ask it here? this has nothing to do with Regeneration...

MEN
10-21-2008, 14:36
I am sorry at the moment of creation of a theme had no possibility to make the correct decision. I will be corrected!

Fry!
10-21-2008, 14:45
You just could add it as request and someone probably would do this actually I was looking at it but deleted it...

Hammerfallerz
10-22-2008, 01:55
Any cvar for automatic turning off regeneration for zombies when there's a survivor round? Makes kinda impossible for survivor to kill them all.

Mlk27
10-23-2008, 09:24
edit: nevermind

what's #define TASK_REGENERATION 1024 for?

hleV
10-23-2008, 14:15
edit: nevermind

what's #define TASK_REGENERATION 1024 for?
I'm giving task a number so I could remove this task without messing the other tasks that contains Client info.
BTW I realized that it's not needed because there are no other tasks in plugin.

Updated to 1.2 Final.

Mlk27
10-23-2008, 18:18
eh..just checked the plugin..i see you have g_FirstZombie and g_LastZombie but their cvars aren't registered

spirt90
10-24-2008, 13:02
L 10/24/2008 - 17:19:17: Invalid CVAR pointer
L 10/24/2008 - 17:19:17: [AMXX] Displaying debug trace (plugin "zp_regeneration.amxx")
L 10/24/2008 - 17:19:17: [AMXX] Run time error 10: native error (native "get_pcvar_num")
L 10/24/2008 - 17:19:17: [AMXX] [0] zp_regeneration.sma::SetRegeneration (line 29)

i got this error can some one tell me why and how to fix it

hleV
10-24-2008, 14:14
L 10/24/2008 - 17:19:17: Invalid CVAR pointer
L 10/24/2008 - 17:19:17: [AMXX] Displaying debug trace (plugin "zp_regeneration.amxx")
L 10/24/2008 - 17:19:17: [AMXX] Run time error 10: native error (native "get_pcvar_num")
L 10/24/2008 - 17:19:17: [AMXX] [0] zp_regeneration.sma::SetRegeneration (line 29)

i got this error can some one tell me why and how to fix it
Does this happen with the latest version (1.2 Final)? I've checked that line and can't really see the problem. Can't see one in all plugin.

spirt90
10-24-2008, 17:34
yes it is 1.2

hleV
10-25-2008, 11:13
Try to redownload current version. No idea what's wrong.

MEN
10-29-2008, 16:00
There is one error! When I play, sometimes at me the administrator, and maybe on other players, for a second I die and then again I revive, as is shown in drawing!

http://img112.**************/img112/8320/wtfht5.th.jpg (http://img112.**************/my.php?image=wtfht5.jpg)http://img112.**************/images/thpix.gif (http://g.**************/thpix.php)

Sn!ff3r
10-29-2008, 16:51
There is one error! When I play, sometimes at me the administrator, and maybe on other players, for a second I die and then again I revive, as is shown in drawing! This error occured when health < 1.

Mlk27
10-29-2008, 22:36
i suggest you to add cvar for a minimium health that zombie needs to have in order to regenerate

aaarnas
10-30-2008, 14:54
What about zombie class with regenerating hp? someone alredy posted this request, but no one ansswered.

Killer12201
10-30-2008, 20:07
You could just make a regenerate zombie for it being passive then.

hleV
11-08-2008, 12:27
Updated to 1.3. Need some people to test all it's functionality (I mean changing all CVARs, etc.).

TIP: normal Zombies - all Zombies except Nemesis, First Zombie and Last Zombie.

CVARs:

zp_regeneration <1|2|0> - 1 - regen for normal Zombies, 2 - no regen for normal Zombies (def: 1).
zp_regen_time <num> - regeneration each <num> seconds (def: 1).
zp_regen_amount <num> - amount of health to regenerate (def: 10).
zp_regen_nemesis <1|0> - Nemesis' ability to regenerate (def: 1).
zp_regen_firstzombie <1|0> - First Zombie's ability to regenerate (def: 1).
zp_regen_lastzombie <1|0> - Last Zombie's ability to regenerate (def: 1).About CVAR zp_regeneration. If it's number is:

- every Zombie will be able to regenerate. You can disable regeneration ONLY for Nemesis, First and/or Last Zombie.
- normal zombies wont be able to regenerate. ONLY Nemesis, First and/or Last Zombie will be able to regenerate (depending on it's CVARs).Examples:

zp_regeneration 1, zp_regen_nemesis 1, zp_regen_firstzombie 1, zp_regen_lastzombie 1: ALL Zombies can regenerate.
zp_regeneration 1, zp_regen_nemesis 1, zp_regen_firstzombie 0, zp_regen_lastzombie 0: ONLY normal Zombies and Nemesis can regenerate.
zp_regeneration 1, zp_regen_nemesis 0, zp_regen_firstzombie 0, zp_regen_lastzombie 0: ONLY normal Zombies can regenerate.
zp_regeneration 2, zp_regen_nemesis 1, zp_regen_firstzombie 1, zp_regen_lastzombie 1: ONLY Nemesis, First and Last Zombie can regenerate.
zp_regeneration 2, zp_regen_nemesis 1, zp_regen_firstzombie 0, zp_regen_lastzombie 0: ONLY Nemesis can regenerate.I've added debug messages, so you'll be able to understand if everything is working easier.

Waiting for testers' notes.

drumzplaya13
11-22-2008, 22:58
your going to be waiting a while since the plugin fails to compile, and if you try to do it on the website compile it says this....

/home/groups/amxmodx/tmp3/phpXmcC7q.sma(3) : fatal error 100: cannot read from file: "zombieplague"

Compilation aborted.

so maybe once i am able to download it ill test it out for you.
1 Error.

Fry!
11-23-2008, 03:36
your going to be waiting a while since the plugin fails to compile, and if you try to do it on the website compile it says this....

/home/groups/amxmodx/tmp3/phpXmcC7q.sma(3) : fatal error 100: cannot read from file: "zombieplague"

Compilation aborted.

so maybe once i am able to download it ill test it out for you.
1 Error.

lol? You can't compile it? It's compiles fine for me. Here small help ...

drumzplaya13
11-23-2008, 03:43
ok found some glitch or something...
every time someone is nemesis it freezes them sideways and takes all their health away, their health says 0% and its in red but it doesnt kill them, they just get stuck and cant do anything... idk heres a picture to better explain it..


http://img380.**************/img380/6518/regennemsideog4.png (http://img380.**************/my.php?image=regennemsideog4.png)
http://img380.**************/img380/regennemsideog4.png/1/w640.png (http://g.**************/img380/regennemsideog4.png/1/)

drumzplaya13
11-26-2008, 16:11
someone please fix the glitch that i posted. or at least look at it.

1sland
11-30-2008, 08:13
hmm i have problems with this plugin..
when i turning it on, on RoundStart few people respawn DEAD..

drumzplaya13
11-30-2008, 17:14
ya if someone fixed all of the bugs in this i would definitely use it... since its the only one i can find. but since its not fixed, i wont.

Mazzerin
12-02-2008, 01:01
Maybe the map has too little of spawns for many people?

1sland
12-02-2008, 06:03
omg yes we are so stupid noobs that cant understand it lol

Tidius
12-02-2008, 10:01
If i want a x zombie class to regenerate how can y do that ?

Mlk27
12-14-2008, 02:29
port this to zombie item, will you?

rzlqwerty
02-03-2009, 11:23
is bad :D

Fry!
02-03-2009, 11:28
port this to zombie item, will you?

Actually I tried to do that time ago, but I fail... That wasn't so easy...

Mlk27
02-03-2009, 12:03
never mind..i already made one :D i removed everything except the regen amount and interval

Fry!
02-03-2009, 12:10
And it work as extra item? :o

G-Dog
02-03-2009, 13:15
not exactly that hard to do...in plugin_init
set_task(get_pcvar_float(g_Time), "refill_hp", _, _, _, "b")

...

public refill_hp()
for (new i = 1; i <= 32; i++ )
if ( is_user_alive(i) && has_item[i] )
{
static Float:hpamnt;
pev(i, pev_health, hpamnt);
hpamnt = floatmin(hpamnt+get_pcvar_float(g_Amount), MAX_HEAL_DEFINE);
set_pev(i, pev_health, hpamnt);
}just include the stuff for the has_item, etc. and you've ported to item.

Fry!
02-03-2009, 13:21
nice! :)

AlejandroSk
02-03-2009, 13:32
nice plugin! + k

Speed!
02-03-2009, 19:47
suggestion:
use this for evictin errors
if (is_user_connected(id))
{
if (is_user_alive(id) &....

if not you can get some annoing errors

IneedHelp
02-03-2009, 19:59
You don't need to check if the user is connected because if you check if the user is alive is connected :\

Speed!
02-03-2009, 20:01
You don't need to check if the user is connected because if you check if the user is alive is connected :\
mmmm up to where i know, if you check something on someone not connected it gives you an error but dont remember at all

blue2kx
03-18-2009, 12:28
http://forums.alliedmods.net/showthread.php?t=87827

My bad, I didn't read this thread first :D

If anyone is still managing this plugin, SnoW's suggestion might help, although I wouldn't know since I'm quite clueless to be honest. I think it's a great plugin except for the spawning sideways thing...

IbaneZ
05-20-2009, 07:13
Nice plugin

-=3JIou-TaTaPuH=-
11-17-2009, 19:28
I've got a problem when people respawn at round start. What happens is that some people "die" or they spawn with 0 hp. Their screen (as I've seen and experienced) goes sideways on the ground. They appear alive in the TAB screen but in actuality, they're dead. Either that happens or they are also buried or stuck.
P.S. When I disable it everything works perfect, but I really wanna use this plugin so can U fix this issue

Dinosaur
01-06-2010, 02:44
It says the plugin is working, but when I put the cvar in console, nothing happens?

Shoul
01-06-2010, 06:37
I've got a problem when people respawn at round start. What happens is that some people "die" or they spawn with 0 hp. Their screen (as I've seen and experienced) goes sideways on the ground. They appear alive in the TAB screen but in actuality, they're dead. Either that happens or they are also buried or stuck.
P.S. When I disable it everything works perfect, but I really wanna use this plugin so can U fix this issue

I have this problem too :( , the idea is good but the plugin doesnt work .

Habetdin
07-23-2010, 11:50
I've got a problem when people respawn at round start. What happens is that some people "die" or they spawn with 0 hp.
Try attached plugin :up:

teobrvt1995
08-05-2010, 04:04
I found the bug of this plugins! When I del it, The bug gone!
http://ca5.upanh.com/10.1002.15140871.KUX0/de_dust20000.bmp
Plz fix it

John301
08-23-2010, 11:13
Man i have a problem! I have a ZP 4.3 but i cant use your plugin :( he say: Load fails: Failed to allocate memory (plugin "zp_regeneration.amxx") please help! and in the over me are a error!

Nisstyre
09-06-2010, 13:32
Hello guys. Well i didnt notice the bug with spawning with 0 hp. BUT:(
When Nemesis should spawn(by admin or by mod) it dies instantly. After one death Nemesis can be spawned once more but only on that player who had nemesis earlier and died after spawn(on other players BOOM and Nemesis dead again).
I've tried turning off hp renegeration for nemesis(and also all other cvars) but this bug still occurs.

vaan123
09-06-2010, 15:11
hleV please fix this plugin :(

hleV
09-07-2010, 06:47
It's redundant. Search for a better plugin. I'm not interested in ZP nor I plan on fixing this.

Hezerf
09-08-2010, 09:59
Try this.

PS : I see tag mismatches,but just try :).

tei1995
03-12-2011, 05:46
here the fix bug :D