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

Solved [TF2] How can I increase Spell damage?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 06-23-2019 , 23:58   [TF2] How can I increase Spell damage?
Reply With Quote #1

Team,

How can I increase the amount of damage that the Fireball, Lightning, or Meteor spells does for a particular client?

Goal: I use the Be the Merasmus and Be the Monoculus plugins on my server. They can cast the spells listed above. Since they are a Boss, I would like their spells to do 2 or 3 times the damage of a normal players spell.

Is this possible? If so, how?

Also on a related note... How can I increase the damage that the Monoculus eye rockets do?
I tried adding this in but it didn't work: SetEntPropFloat(iRocket, Prop_Send, "m_flDamage", 200.0);

Code:
bool:ShootRocket( iClient )
{
	if( !IsValidClient( iClient ) || !bEyeStatus[iClient] )
		return false;
	
	
	new iRocket = CreateEntityByName("tf_projectile_rocket");
	
	if( !IsValidEntity(iRocket) )
		return false;
	
	SetEntPropEnt( iRocket, Prop_Send, "m_hOwnerEntity", iClient );
	SetEntPropEnt( iRocket, Prop_Send, "m_hLauncher", iClient );
	SetEntProp( iRocket, Prop_Send, "m_bCritical", 1 );
	
	static offsRocketDeflected = -1;
	if( offsRocketDeflected == -1 )
		offsRocketDeflected = FindSendPropOffs("CTFProjectile_Rocket", "m_iDeflected");
	if( offsRocketDeflected != -1 )
		SetEntDataFloat( iRocket, offsRocketDeflected+4, 50.0, true );
	else
	{
		Error( ERROR_LOG, _, "Failed to set rocket damage!" );
		return false;
	}
	
	DispatchSpawn( iRocket );
	
	
	SetEntityModel( iRocket, strEyeModels[1] );
	
	
	new Float:vecOrigin[3], Float:vecAngles[3], Float:vecVelocity[3], Float:flMult;
	GetClientAbsOrigin( iClient, vecOrigin );
	GetClientEyeAngles( iClient, vecAngles );
	
	flMult = 56.0;
	vecOrigin[0] += flMult * Cosine( DegToRad(vecAngles[1]) );
	vecOrigin[1] += flMult * Sine( DegToRad(vecAngles[1]) );
	vecOrigin[2] += 48.0 - flMult * Sine( DegToRad(vecAngles[0]) );
	
	flMult = _:bEyeRage[iClient] ? 1500.0 : 500.0;
	GetAngleVectors( vecAngles, vecVelocity, NULL_VECTOR, NULL_VECTOR );
	NormalizeVector( vecVelocity, vecVelocity );
	ScaleVector( vecVelocity, flMult );
	
	TeleportEntity( iRocket, vecOrigin, vecAngles, vecVelocity );
	return true;
}

Last edited by PC Gamer; 06-25-2019 at 11:35.
PC Gamer is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 06-24-2019 , 05:37   Re: [TF2] How can I increase Spell damage?
Reply With Quote #2

You should be able to hook OnTakeDamage(Alive) on all clients and determine the inflictor source / launcher / owner entity and scale it there, unless you're avoiding that route for some reason.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 06-25-2019 , 02:07   Re: [TF2] How can I increase Spell damage?
Reply With Quote #3

Using OnTakeDamage works, but I get the following errors:
Code:
L 06/25/2019 - 00:52:49: [SM] Exception reported: Array index out-of-bounds (index 683, limit 66)
L 06/25/2019 - 00:52:49: [SM] Blaming: tf2betheeye.smx
L 06/25/2019 - 00:52:49: [SM] Call stack trace:
L 06/25/2019 - 00:52:49: [SM]   [1] Line 226, tf2betheeye.sp::OnTakeDamage
L 06/25/2019 - 00:52:49: [SM] Exception reported: Array index out-of-bounds (index 683, limit 66)
L 06/25/2019 - 00:52:49: [SM] Blaming: tf2betheeye.smx
L 06/25/2019 - 00:52:49: [SM] Call stack trace:
L 06/25/2019 - 00:52:49: [SM]   [1] Line 226, tf2betheeye.sp::OnTakeDamage
L 06/25/2019 - 00:52:50: [SM] Exception reported: Array index out-of-bounds (index 683, limit 66)
L 06/25/2019 - 00:52:50: [SM] Blaming: tf2betheeye.smx
L 06/25/2019 - 00:52:50: [SM] Call stack trace:
L 06/25/2019 - 00:52:50: [SM]   [1] Line 226, tf2betheeye.sp::OnTakeDamage
Here's the code I added:
Code:
public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype)
{
	if( !IsValidClient(victim) || !bEyeStatus[attacker] || bEyeStatus[attacker] == bEyeStatus[victim] )  //This is the Error Line (226)
	return Plugin_Continue;

	if( bEyeStatus[attacker] )
	damage = damage * 5;
	return Plugin_Changed;
}
Full code attached
Attached Files
File Type: sp Get Plugin or Get Source (tf2betheeye.sp - 288 views - 28.2 KB)
PC Gamer is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 06-25-2019 , 04:03   Re: [TF2] How can I increase Spell damage?
Reply With Quote #4

Verify that the attacker is a client index before the array access; attackers can also be the world, skeletons, and Halloween bosses (probably more, those are the ones that come to mind).
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 06-25-2019 , 11:34   Re: [TF2] How can I increase Spell damage?
Reply With Quote #5

Works. Thanks nosoop!

new code:
Code:
public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype)
{
	if( !IsValidClient(victim) || !IsValidClient(attacker) || !bEyeStatus[attacker] || bEyeStatus[attacker] == bEyeStatus[victim] )
	return Plugin_Continue;

	if( bEyeStatus[attacker] )
	damage = damage * 5;
	return Plugin_Changed;
}
PC Gamer 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 12:05.


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