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

Gambit tweaking


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
slamx
Member
Join Date: Jun 2006
Old 07-23-2010 , 23:20   Gambit tweaking
Reply With Quote #1

hi I was wondering if someone could help me. im not sure how to go at this but i did try but was unsuccessful.
I tried to make gambit only do damage when the attacker's level is less than the victims.

so basically if you were level 10 and i was level 9 and i threw a gambit grenade at you it would calculate the damage mult and work accordingly. but if the level 10 was to throw it at a level 9 it would act as a regular nade. i have done this with other heroes but was not successful with gambit. help would be much appreciated.

Code:
// GAMBIT! - from the X-men. Can convert any inorganic object's potential energy into kinetic energy on contact.

/* CVARS - copy and paste to shconfig.cfg

//Gambit
gambit_level 0
gambit_grenademult 60.9		//Damage multiplyer from orginal damage amount (def 60.9)
gambit_grenadetimer 30.0		//How many seconds delay for new grenade after nade is thrown (def 30.0)
gambit_cooldown 120.0		//How many seconds until extra grenade damage can be used again (def 120.0)

*/

/*
* v1.3 - vittu - 9/27/05
*      - Fixed up cooldown to only be set once.
*      - Removed some useless checks.
*
* v1.2 - vittu - 6/19/05
*      - Minor code clean up.
*
* v1.1 - vittu - 5/10/05
*      - Fixed giving new grenades using a more reliable event.
*      - Fixed grenade timer to only be set if you have no nades,
*          avoids timer exploiting.
*      - Added cooldown cvar, sets only if someone is hurt by gambit.
*      - Added grenade glow and trail only for gambit nades.
*
*   Hero Created by Vectren
*/

#include <amxmod>
#include <Vexd_Utilities>
#include <superheromod>

#define AMMOX_HEGRENADE 12

// GLOBAL VARIABLES
new gHeroName[]="Gambit"
new bool:gHasGambitPower[SH_MAXSLOTS+1]
new gPlayerLevels[SH_MAXSLOTS+1]
new gGrenTrail
new const HEGRENADE_MODEL[] = "models/w_hegrenade.mdl"
//----------------------------------------------------------------------------------------------
public plugin_init()
{
	// Plugin Info
	register_plugin("SUPERHERO Gambit", "1.3", "Vectren / vittu")

	// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
	register_cvar("gambit_level", "0")
	register_cvar("gambit_grenademult", "60.9")
	register_cvar("gambit_grenadetimer", "30.0")
	register_cvar("gambit_cooldown", "120.0")

	// FIRE THE EVENT TO CREATE THIS SUPERHERO!
	shCreateHero(gHeroName, "Kinetically Charged Nades", "Charge your HE Grenades with Kinetic Energy for Extra Damage, also refill HE Grenades.", false, "gambit_level")

	// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
	// INIT
	register_srvcmd("gambit_init", "gambit_init")
	shRegHeroInit(gHeroName, "gambit_init")

	// NEW SPAWN
	register_event("ResetHUD", "newSpawn", "b")

	// EXTRA NADE DAMAGE
	register_event("Damage", "gambit_damage", "b", "2!0")

	// FIND THROWN GRENADES
	register_event("AmmoX", "on_AmmoX", "b")
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
	gGrenTrail = precache_model("sprites/zbeam5.spr")
}
//----------------------------------------------------------------------------------------------
public gambit_init()
{
	// First Argument is an id
	new temp[6]
	read_argv(1,temp,5)
	new id = str_to_num(temp)

	// 2nd Argument is 0 or 1 depending on whether the id has the hero
	read_argv(2,temp,5)
	new hasPowers = str_to_num(temp)

	gHasGambitPower[id] = (hasPowers!=0)

	if ( hasPowers && is_user_alive(id) ) {
		gambit_weapons(id)
	}
}
//----------------------------------------------------------------------------------------------
public newSpawn(id)
{
	if ( shModActive() && gHasGambitPower[id] && is_user_alive(id) ) {
		gPlayerUltimateUsed[id] = false
		set_task(0.1, "gambit_weapons", id)
	}
}
//----------------------------------------------------------------------------------------------
public gambit_weapons(id)
{
	if ( shModActive() && gHasGambitPower[id] && is_user_alive(id) ) {
		shGiveWeapon(id, "weapon_hegrenade")
	}
}
//----------------------------------------------------------------------------------------------
public gambit_damage(id)
{	
	new damage = read_data(2)
	new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)
	new headshot = bodypart == 1 ? 1 : 0

	if ( !shModActive() || !is_user_alive(id) || (gPlayerLevels[id]<gPlayerLevels[attacker])  ) return PLUGIN_CONTINUE

	
	if ( attacker <= 0 || attacker > SH_MAXSLOTS ) return PLUGIN_CONTINUE

	if ( gHasGambitPower[attacker] && weapon == CSW_HEGRENADE && is_user_alive(id) && !gPlayerUltimateUsed[attacker] ) {
		// do extra damage
		new extraDamage = floatround(damage * get_cvar_float("gambit_grenademult") - damage)
		if (extraDamage > 0) shExtraDamage(id, attacker, extraDamage, "grenade", headshot)

		if ( attacker != id ) {
			// Set the cooldown in x seconds because nades can hurt more then one person
			// only when damaging others
			new parm[1]
			parm[0] = attacker
			set_task(0.2, "gambit_setcooldown", 0, parm,1)
		}
	}
}
//----------------------------------------------------------------------------------------------
public on_AmmoX(id)
{
	if ( !shModActive() || !is_user_alive(id) ) return

	new iAmmoType = read_data(1)
	new iAmmoCount = read_data(2)

	if ( iAmmoType == AMMOX_HEGRENADE && gHasGambitPower[id] ) {

		if (iAmmoCount == 0) {
			set_task(get_cvar_float("gambit_grenadetimer"), "gambit_weapons", id)

			if ( !gPlayerUltimateUsed[id] ) {
				// Have to Find the current HE grenade
				new iCurrent = -1
				while ( ( iCurrent = FindEntity(iCurrent, "grenade") ) > 0 ) {
					new string[32]
					Entvars_Get_String(iCurrent, EV_SZ_model, string, 31)

					if ( id == Entvars_Get_Edict(iCurrent, EV_ENT_owner) && equali(HEGRENADE_MODEL, string)) {

						new Float:glowColor[3] = {225.0, 0.0, 20.0}

						// Make the nade glow
						Entvars_Set_Int(iCurrent, EV_INT_renderfx, kRenderFxGlowShell)
						Entvars_Set_Vector(iCurrent, EV_VEC_rendercolor, glowColor)

						// Make the nade a bit invisible to make glow look better
						Entvars_Set_Int(iCurrent, EV_INT_rendermode, kRenderTransAlpha)
						Entvars_Set_Float(iCurrent, EV_FL_renderamt, 100.0 )

						// Make a trail
						message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
						write_byte(22)			//TE_BEAMFOLLOW
						write_short(iCurrent)	// entity:attachment to follow
						write_short(gGrenTrail)	// sprite index
						write_byte(10)		// life in 0.1's
						write_byte(10)		// line width in 0.1's
						write_byte(225)	// colour
						write_byte(90)
						write_byte(102)
						write_byte(255)	// brightness
						message_end()
					}
				}
			}
		}
		else if (iAmmoCount > 0) {
			// Got a new nade remove the timer
			remove_task(id)
		}
	}
}
//----------------------------------------------------------------------------------------------
public gambit_setcooldown(parm[])
{
	new id = parm[0]

	if ( !is_user_alive(id) || gPlayerUltimateUsed[id] ) return

	// Cooldown will only be set if user hurts someone with a gambit nade
	new Float:gambitCooldown = get_cvar_float("gambit_cooldown")
	if (gambitCooldown > 0.0) ultimateTimer(id, gambitCooldown)
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
{
	gHasGambitPower[id] = false
}
//----------------------------------------------------------------------------------------------
__________________
slamx is offline
Exploited
Veteran Member
Join Date: Jul 2010
Location: Sweden
Old 07-24-2010 , 06:34   Re: Gambit tweaking
Reply With Quote #2

Wouldn't this make Gambit useless for people who reached the maxlevel? Gambit + Penguin is a very very good combo, if you have a decent dmgmult.
Exploited is offline
slamx
Member
Join Date: Jun 2006
Old 07-24-2010 , 08:19   Re: Gambit tweaking
Reply With Quote #3

i guess it would make it useless but it would balance the server more. i would rather have this than have level 20's using it and 1 hit nading people
__________________
slamx is offline
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 07-26-2010 , 18:19   Re: Gambit tweaking
Reply With Quote #4

so you want a level limit for this hero ?
Fr33m@n is offline
slamx
Member
Join Date: Jun 2006
Old 07-26-2010 , 19:56   Re: Gambit tweaking
Reply With Quote #5

No not at all, what I want is for it to only Damage players who are higher level than or equal to the user them self.

Scenario 1: YOU = level 10, OPPONENT = level 1
YOU throw gambit grenade at OPPONENT and it should do regular grenade damage.

Scenario 2: YOU = level 1, OPPONENT = level 10
YOU throw gambit grenade at OPPONENT and it should do gambit grenade damage.

I want this implemented to balance out my Server. From what i have seen people are killing low levels with gambit and making it difficult for them to level. I have this feature implemented in two heroes already and want it to work with gambit but I am unable to do so. I am stuck with a delima remove gambit, a hero that everyone loves or keep it and lose multiple new players.

any help will be appreciated
SlamX
__________________
slamx is offline
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 08-01-2010 , 05:21   Re: Gambit tweaking
Reply With Quote #6

Dont got the sh includes where I am right now, but something like this?

Code:
 new victimLevel
new attackerLevel
 
victimLevel = sh_get_user_level(victim)
attackerLevel = sh_get_user_level(attacker)
And so on, not sure about case sensitives though
__________________
The Art of War 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 18:04.


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