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

Hero: Mr. Hydrogen


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zul Rivers
Member
Join Date: May 2008
Old 05-14-2008 , 10:33   Hero: Mr. Hydrogen
Reply With Quote #1

Mr. Hydrogen

Image:
Not Available

Descriptions:
Fill Enemy With Hydrogen Gas.
Boost Knife Damage & Victim Floats Like A Balloon When Being Hit By Your Knife.

Cvars:
Code:
//Mr. Hydrogen
mrhydrogen_level 0        // Level Acquired To Use Hero
mrhydrogen_knifemult 1.10    // Multiply Knife Damage
mrhydrogen_floattime 8.0    // Time Before Victim Drops
Updates:
Code:
VERSION 1.4
- MODIFIED AND ENHANCED CODES FOR MRHYDROGEN_VICTIM_FLOAT(ID) AND MRHYDROGEN_POWERS(ID) - CREDITS: G-DOG

VERSION 1.3
- REMOVED VEXD_UTILITIES INCLUDES AS IT IS NOT NEEDED
- ADDED ENGINE INCLUDES
- CVAR CHANGES - MR_HYDROGEN TO MRHYDROGEN
- MINOR CODE CLEANUP

VERSION 1.2
- REMOVED AMXMOD INCLUDES AS REQUESTED BY VITTU

VERSION 1.1
- ADDED SOUND EFFECTS - WHEN POWER IS USED ON ENEMY, VICTIM MAKES BREATHING SOUNDS UNTIL HYDROGEN GAS IS GONE
- ADDED HUD MESSAGE - WHEN POWER IS USED ON ENEMY, HUD MESSAGE WILL ONLY SHOW TO VICTIM
- MAJOR CODE CLEANUP

VERSION 1.0
- RELEASE OF HERO
Comments:
Best gravity to use with hero - Min(0) Max(2000)
Thanks to D o o m and G-Dog for teaching me to script superheroes
Attached Files
File Type: sma Get Plugin or Get Source (sh_mrhydrogen.sma - 2115 views - 6.4 KB)
File Type: zip sh_mrhydrogen_required_files.zip (7.1 KB, 743 views)
__________________
Projects:
Superhero: Hydrogen [Completed]
Superhero: Liberty Lad [Incomplete]


No Longer AMX Scripting, I Suck At It.

Last edited by Zul Rivers; 05-18-2008 at 03:42. Reason: Updated Hero
Zul Rivers is offline
Dark_Menace
Junior Member
Join Date: Jan 2008
Location: Denmark
Old 05-14-2008 , 13:17   Re: Hero: Mr. Hydrogen
Reply With Quote #2

Seems like a nice hero , though i have a tiny note for you q: vittu doesn't like amxmod includes as he stated in the sticky http://forums.alliedmods.net/showthread.php?t=59519
__________________
.:: I live for the weekend, I live for hardstyles, I live for hardstyle baby! ::.
.:: Showtek - FTS ::.
Dark_Menace is offline
Zul Rivers
Member
Join Date: May 2008
Old 05-14-2008 , 18:41   Re: Hero: Mr. Hydrogen
Reply With Quote #3

ok, i have updated the attachment, thanks for the reminder. ^^
__________________
Projects:
Superhero: Hydrogen [Completed]
Superhero: Liberty Lad [Incomplete]


No Longer AMX Scripting, I Suck At It.
Zul Rivers is offline
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 05-14-2008 , 18:57   Re: Hero: Mr. Hydrogen
Reply With Quote #4

Code:
	#include <Vexd_Utilities>
your not even using this amxmod include, you're using engine so don't include it...


Also, attach the sma outside of the zip... guidelines below as stated here:
Quote:
All heroes must be posted as the sma file, and online compiler will provide a link to the compiled amxx file. All hero extras (models/sounds) must be posted as ZIP files, or it will be moved to the trash (no RARs). Please name the zip the same name as the sma + _required_files, ex. sh_blink_required_files.zip . If your zip is too large because of models or sounds, either separate the extra files and make more then one attachment (make sure you explain what they are), or contact one of us to possibly either compact it smaller or host it for you, send a Private Message (PM).
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
Zul Rivers
Member
Join Date: May 2008
Old 05-15-2008 , 04:23   Re: Hero: Mr. Hydrogen
Reply With Quote #5

Ok vittu, i have updated the hero and did as you said.. i also changed a little of the cvars.. please report any errors, bugs or any other problems..
__________________
Projects:
Superhero: Hydrogen [Completed]
Superhero: Liberty Lad [Incomplete]


No Longer AMX Scripting, I Suck At It.
Zul Rivers is offline
G-Dog
Senior Member
Join Date: Dec 2005
Location: Thunderstorm Central
Old 05-15-2008 , 05:19   Re: Hero: Mr. Hydrogen
Reply With Quote #6

one question: why in your "mrhydrogen_victim_float" function do you have
Code:
entity_get_vector(id, EV_VEC_velocity, HydroVelocity[id])
when your redefining HydroVelocity[id] right below it
Code:
	get_user_origin(id, Origin)
	get_user_origin(id, vOrigin)
	get_distance(vOrigin, Origin)
	HydroVelocity[id][0] = (vOrigin[0] - Origin[0]) / 1000.0
	HydroVelocity[id][1] = (vOrigin[1] - Origin[1]) / 1000.0
	HydroVelocity[id][2] = 1000.0
also since thats the only function you use HydroVelocity theres no reason to make it global. In fact, theres no reason to do what you did there at all since both origin, and vorigin are for the same person the math for
Code:
	HydroVelocity[id][0] = (vOrigin[0] - Origin[0]) / 1000.0
	HydroVelocity[id][1] = (vOrigin[1] - Origin[1]) / 1000.0
	HydroVelocity[id][2] = 1000.0
would always equate to
Code:
	HydroVelocity[id][0] = 0.0
	HydroVelocity[id][1] = 0.0
	HydroVelocity[id][2] = 1000.0
in the damage function you have the is_user_alive(id) check twice, which is just redundent, same thing with
Code:
if (attacker <= 0 || attacker > SH_MAXSLOTS)
and
Code:
is_user_alive(attacker)
they are basically the same check. Also when possible make use of pcvars(mrhydrogen_knifemult, and mrhydrogen_floattime). All in all rescripted it would look like
Code:
//--------------------------------------------------------------------------------------------------
// INCLUDED HEADERS
//--------------------------------------------------------------------------------------------------
	#include <amxmodx>
	#include <superheromod>
	#include <engine>
//--------------------------------------------------------------------------------------------------
// GLOBAL VARIABLES
//--------------------------------------------------------------------------------------------------
	new gHeroName[]="Mr. Hydrogen"
	new bool:gHasMrHydrogenPowers[SH_MAXSLOTS+1]
	new sndStop=(1<<5)
	new bool:gIsHitByMrHydrogen[SH_MAXSLOTS+1]
	//pcvars
	new cvar_time, cvar_mult
//--------------------------------------------------------------------------------------------------
// PLUGIN EVENTS
//--------------------------------------------------------------------------------------------------
	public plugin_init()
	{
		register_plugin("SUPERHERO Mr. Hydrogen", "1.3", "Zul Rivers")
		register_cvar("mrhydrogen_level", "0")
		cvar_mult = register_cvar("mrhydrogen_knifemult", "1.10" )
		cvar_time = register_cvar("mrhydrogen_floattime", "8.0" )
		shCreateHero(gHeroName, "Fill Enemy With Hydrogen Gas", "Boost Knife Damage & Victim Floats When Being Hit By Your Knife", false, "mrhydrogen_level")
		register_srvcmd("mrhydrogen_init", "mrhydrogen_init")
		shRegHeroInit(gHeroName, "mrhydrogen_init")
		register_event("ResetHUD", "mrhydrogen_newspawn", "b")
		register_event("DeathMsg", "mrhydrogen_death", "a")
		register_event("Damage", "mrhydrogen_powers", "b", "2!0")
	}
//--------------------------------------------------------------------------------------------------
// HERO EVENTS
//--------------------------------------------------------------------------------------------------
	public mrhydrogen_init()
	{
		new temp[6]
		read_argv(1, temp, 5)
		new id = str_to_num(temp)
		read_argv(2, temp, 5)
		new hasPowers=str_to_num(temp)
		gHasMrHydrogenPowers[id] = (hasPowers != 0)
	}
//--------------------------------------------------------------------------------------------------
// PLUGIN PRECACHES
//--------------------------------------------------------------------------------------------------
	public plugin_precache()
	{
		precache_sound("player/breathe2.wav")
	}
//--------------------------------------------------------------------------------------------------
// EVENTS ON NEW SPAWN
//--------------------------------------------------------------------------------------------------
	public mrhydrogen_newspawn(id)
	{
		if (is_user_alive(id))
		mrhydrogen_stop_powers(id)
	}
//--------------------------------------------------------------------------------------------------
// EVENTS ON DEATH
//--------------------------------------------------------------------------------------------------
	public mrhydrogen_death()
	{
		new id = read_data(2)
		mrhydrogen_stop_powers(id)
	}
//--------------------------------------------------------------------------------------------------
// HERO POWERS
//--------------------------------------------------------------------------------------------------
	public mrhydrogen_powers(id)
	{
		if (!shModActive() && !is_user_alive(id))
		return PLUGIN_CONTINUE
		
		new damage = read_data(2)
		new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)
		new headshot = bodypart == 1 ? 1 : 0
		if ((attacker <= 0 || attacker > SH_MAXSLOTS) && id != attacker)
		return PLUGIN_CONTINUE
		
		if (gHasMrHydrogenPowers[attacker] && weapon == CSW_KNIFE && is_user_alive(id))
		{
			new extraDamage = floatround(damage * get_pcvar_float(cvar_mult) - damage)
			if (extraDamage > 0)
			shExtraDamage(id, attacker, extraDamage, "knife", headshot)
			if ( !gIsHitByMrHydroggen[id] )
			{
				gIsHitByMrHydrogen[id] = true
				set_task(0.1,"mrhydrogen_victim_float", id, "", 0, "b")
				set_task(get_cvar_float("mrhydrogen_floattime"),"mrhydrogen_stop_powers", id)
				set_hudmessage(255, 0, 0, -1.0, 0.35, 0, 5.0, 5.0, 0.1, 0.2, 4)
				show_hudmessage(id, "Someone Filled You With Hydrogen Gas! - It Will Run Out In Sometime", gHeroName)
				emit_sound(id, CHAN_STATIC, "player/breathe2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
			}
		}
		return PLUGIN_CONTINUE
	}
//--------------------------------------------------------------------------------------------------
// VICTIM EFFECTS WHEN BEING HIT BY KNIFE
//--------------------------------------------------------------------------------------------------
	public mrhydrogen_victim_float(id)
	{
		if (is_user_alive(id) && gIsHitByMrHydrogen[id])
		{
			static Float:fvelocity[3]
			
			HydroVelocity[id][0] = 0.0
			HydroVelocity[id][1] = 0.0
			HydroVelocity[id][2] = 1000.0
			entity_set_vector(id, EV_VEC_velocity, fvelocity)
		}
	}
//--------------------------------------------------------------------------------------------------
// STOP ALL RUNNING TASK
//--------------------------------------------------------------------------------------------------
	public mrhydrogen_stop_powers(id)
	{
		remove_task(id)
		gIsHitByMrHydrogen[id] = false
		emit_sound(id, CHAN_STATIC, "player/breathe2.wav", 1.0, ATTN_NORM, sndStop, PITCH_NORM)
	}
//--------------------------------------------------------------------------------------------------
__________________
If at first you don't succeed, then skydiving isn't for you.

Last edited by G-Dog; 05-15-2008 at 05:21.
G-Dog is offline
Send a message via AIM to G-Dog
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:21.


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