AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   Subplugin Submission [ZP] Addon: Quad Damage (Human) (https://forums.alliedmods.net/showthread.php?t=163545)

yokomo 07-31-2011 14:05

[ZP] Addon: Quad Damage (Human)
 
2 Attachment(s)
Last night i play Quake 3 Arena with my friend and i got this idea, so i decide to create a plugin that make a similar effect in Quake 3 Arena.

Plugin Descriptions:
* On each round but not survivor round, a Quad Damage model will spawn randomly on map, so human need to pickup it to get extra damage multiplier.

Cvars:
* zp_quad_spawntime 30 -- Interval for 1 Quad Damage model spawning on map.
* zp_quad_quadtime 30 -- Quad Damage effect time.
* zp_quad_dmgmulti 5 -- Quad Damage multiplier.

Modules:
* engine
* fakemeta
* hamsandwich

Credits:
* David Anderson -- CSDM's collect spawn point.
* Quake 3 Arena -- Quad Damage sound.

Changes log:
* Code optimization, thanks to Excalibur.007.

Excalibur.007 07-31-2011 18:45

Re: [ZP] Addon: Quad Damage (Human)
 
Nice

PHP Code:

switch(mode)
{
    case 
MODE_INFECTIONset_task(get_pcvar_float(cvar_spawntime), "CreateQuadEntity"TASK_QUAD_SPAWN)
    case 
MODE_MULTIset_task(get_pcvar_float(cvar_spawntime), "CreateQuadEntity"TASK_QUAD_SPAWN)    
    case 
MODE_PLAGUEset_task(get_pcvar_float(cvar_spawntime), "CreateQuadEntity"TASK_QUAD_SPAWN)
    case 
MODE_NEMESISset_task(get_pcvar_float(cvar_spawntime), "CreateQuadEntity"TASK_QUAD_SPAWN)
    case 
MODE_SWARMset_task(get_pcvar_float(cvar_spawntime), "CreateQuadEntity"TASK_QUAD_SPAWN)


:arrow:
PHP Code:

if(mode != MODE_SURVIVOR)
{
    
set_task(get_pcvar_float(cvar_spawntime), "CreateQuadEntity"TASK_QUAD_SPAWN)



bibu 07-31-2011 19:09

Re: [ZP] Addon: Quad Damage (Human)
 
+

#1 Is this needed in zp_user_infected_post?

PHP Code:

if(!id || !infector) return 

#2 Check in TakeDamage if attacker is a player. And this also not needed !pev_valid(victim).

yokomo 08-01-2011 04:50

Re: [ZP] Addon: Quad Damage (Human)
 
Quote:

Originally Posted by Excalibur.007 (Post 1522959)
Nice

PHP Code:

switch(mode)
{
    case 
MODE_INFECTIONset_task(get_pcvar_float(cvar_spawntime), "CreateQuadEntity"TASK_QUAD_SPAWN)
    case 
MODE_MULTIset_task(get_pcvar_float(cvar_spawntime), "CreateQuadEntity"TASK_QUAD_SPAWN)    
    case 
MODE_PLAGUEset_task(get_pcvar_float(cvar_spawntime), "CreateQuadEntity"TASK_QUAD_SPAWN)
    case 
MODE_NEMESISset_task(get_pcvar_float(cvar_spawntime), "CreateQuadEntity"TASK_QUAD_SPAWN)
    case 
MODE_SWARMset_task(get_pcvar_float(cvar_spawntime), "CreateQuadEntity"TASK_QUAD_SPAWN)


:arrow:
PHP Code:

if(mode != MODE_SURVIVOR)
{
    
set_task(get_pcvar_float(cvar_spawntime), "CreateQuadEntity"TASK_QUAD_SPAWN)



Oww i though switch case is faster, gonna change later.

Quote:

Originally Posted by bibu (Post 1522972)
+

#1 Is this needed in zp_user_infected_post?

PHP Code:

if(!id || !infector) return 

#2 Check in TakeDamage if attacker is a player. And this also not needed !pev_valid(victim).

PHP Code:

if(!id || !infector) return 

To prevent from an error log message by new zp4.3fix5, if it not necessary i can delete it.

PHP Code:

pev_valid(victim

Checking whether player is valid or not, for me this is useful in zp4.3, it can block from taking damage by world trigger damage (asid, lava, laserbeam) before round start & after round end.

For example you can watch this simple clip:
http://www.youtube.com/watch?v=akUFdbdZky8

bibu 08-01-2011 05:31

Re: [ZP] Addon: Quad Damage (Human)
 
Alright, but you still need to check in TakeDamage if attacker is a player.

abdul-rehman 08-01-2011 05:37

Re: [ZP] Addon: Quad Damage (Human)
 
You dont need to check if victim is player since you registered the Ham_TakeDamage with "player" entities only, also if you check pev_valid(victim) with an entity you will get the same results whether the entitiy is player or non-player.

yokomo 08-01-2011 05:42

Re: [ZP] Addon: Quad Damage (Human)
 
Quote:

Originally Posted by bibu (Post 1523197)
Alright, but you still need to check in TakeDamage if attacker is a player.

What do you mean by that? using pev_valid(attacker)?

Quote:

Originally Posted by abdul-rehman (Post 1523203)
You dont need to check if victim is player since you registered the Ham_TakeDamage with "player" entities only, also if you check pev_valid(victim) with an entity you will get the same results whether the entitiy is player or non-player.

Then how about this? http://www.youtube.com/watch?v=akUFdbdZky8 can you explain it to me?

Excalibur.007 08-01-2011 06:43

Re: [ZP] Addon: Quad Damage (Human)
 
Quote:

Originally Posted by yokomo (Post 1523210)
What do you mean by that? using pev_valid(attacker)?


Then how about this? http://www.youtube.com/watch?v=akUFdbdZky8 can you explain it to me?

pev_valid(entity) checks if the entity is valid or not. So just use is_user_alive(entity)

and for the (!id | !infector),
I don't think is necessary. But if it for known error log, then leave it there. I still don't find problems in ZP 4.3 Fix 5a.

abdul-rehman 08-01-2011 06:59

Re: [ZP] Addon: Quad Damage (Human)
 
Quote:

Originally Posted by Excalibur.007 (Post 1523255)
pev_valid(entity) checks if the entity is valid or not. So just use is_user_alive(entity)

and for the (!id | !infector),
I don't think is necessary. But if it for known error log, then leave it there. I still don't find problems in ZP 4.3 Fix 5a.

You still need to add this check in zp_user_infected_post
if (!infector) return;
since sometimes the infector is set to 0 (in the case of first zombie) so if you then do something with the infector (like check its zombie class) then ZP would throw a run-time error.

Excalibur.007 08-01-2011 07:09

Re: [ZP] Addon: Quad Damage (Human)
 
Oh, didn't notice the problem :X.


All times are GMT -4. The time now is 14:37.

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