Archived copy of war3source.com, the War3Source forum (2009–2020), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2012-09-22 (original capture). Forum · All archived topics · Wiki · Bug tracker · Blog
Chat

War3:Source
September 21, 2012, 10:22:27 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Download: http://war3source.com/index.php?board=9.0
What is War3Source?: http://war3source.com/index.php?topic=200.0
Sample Stats: http://war3source.com/war3stats
Steam Community Group: http://steamcommunity.com/groups/war3source
War3Source SVN Checkout: http://ownageclan.com/svn/war3source/
War3Source servers: http://www.game-monitor.com/search.php?vars=war3_version=
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [Help] HobGoblin  (Read 438 times)
Scyther
Full Member
***
Posts: 120


View Profile Email
« on: September 06, 2010, 03:47:14 AM »

Code:
/**
* File: War3Source_UndeadScourge.sp
* Description: The Undead Scourge race for War3Source.
* Author(s): Anthony Iacono
*/

#pragma semicolon 1

#include <sourcemod>
#include "W3SIncs/War3Source_Interface"
#include <sdktools>
#include <sdktools_functions>
#include <sdktools_tempents>
#include <sdktools_tempents_stocks>

// War3Source stuff
new thisRaceID;
new BeamSprite;
new MyWeaponsOffset,AmmoOffset;
public Plugin:myinfo =
{
name = "SH Hero HobGoblin",
author = "Scyther",
description = "SH Hero",
version = "1.0.0.0",
url = "http://war3source.com"
};

// War3Source Functions
public OnPluginStart()
{
HookEvent("hegrenade_detonate", GrenadeDetonate);
HookEvent("weapon_fire", GrenadeThrown);
MyWeaponsOffset=FindSendPropOffs("CBaseCombatCharacter","m_hMyWeapons");
}
public OnMapStart()
{
BeamSprite=PrecacheModel("materials/sprites/lgtning.vmt");
}

public OnWar3LoadRaceOrItemOrdered(num)
{
if(num==30)
{

thisRaceID=SHRegisterHero(
"HobGoblin",
"hobg",
"Never ending supply of hobgoblin grenades (crit nades)",
"Never ending supply of hobgoblin grenades (crit nades)",
false
);

}
}

public OnWar3EventSpawn(client)
if(SHHasHero(client,thisRaceID))
{
GivePlayerItem(client, "weapon_hegrenade");
}

public Action:GrenadeThrown(Handle:event, const String:name[], bool:dontBroadcast)
{
}

public Action:GrenadeDispense(Handle:timer,any:index)
{
if(ValidPlayer(index)&&IsPlayerAlive(index))
{
GivePlayerItem(index,"weapon_hegrenade");
}
}

public Action:GrenadeDetonate(Handle:event, const String:name[], bool:dontBroadcast)
{
new userid=GetEventInt(event,"userid");
new index=GetClientOfUserId(userid);
if(index>0)
{
new race=War3_GetRace(index);
if(SHHasHero(index,thisRaceID))
{
GivePlayerItem(index,"weapon_hegrenade");
}
}
return Plugin_Continue;
}

public PlayerHurtEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
new userid=GetEventInt(event,"userid");
new attacker_userid=GetEventInt(event,"attacker");

new victim=GetClientOfUserId(userid);
new attacker=GetClientOfUserId(attacker_userid);

new dmg=GetEventInt(event,"dmg_health");
if(War3_GetGame()==Game_TF)
dmg=GetEventInt(event,"damageamount");
if(victim>0&&attacker>0&&victim!=attacker)
{
new race_attacker=War3_GetRace(attacker);
if(SHHasHero(attacker,thisRaceID) && War3_GetGame()!=Game_TF&&!Silenced(attacker,false))
{
decl String:weapon[64];
GetEventString(event,"weapon",weapon,63);
if(StrEqual(weapon,"hegrenade",false) && !W3HasImmunity(victim,Immunity_Skills))
{
new Float:percent=1.8;
new originaldamage=dmg;
new health_take=RoundFloat((float(dmg)*percent));

new onehp=false;
///you cannot die from orc nade unless the usual nade damage kills you
if(GetClientHealth(victim)>originaldamage&&health_take>GetClientHealth(victim)){
health_take=GetClientHealth(victim) -1;
onehp=true;
}
////new new_health=GetClientHealth(victim)-health_take;
//if(new_health<0)
// new_health=0;
//SetEntityZHealth(victim,new_health);
if(War3_DealDamage(victim,health_take,attacker,_,"criticalnade",W3DMGORIGIN_SKILL,W3DMGTYPE_PHYSICAL))
{
W3PrintSkillDmgHintConsole(victim,attacker,health_take,"Critical Nade");
PrintHintText(attacker,"Your Grenades do 1.8x damage!");
if(onehp){
SetEntityHealth(victim,1);
} 
}
}
}
}
}




The crit nades dont work though the regeneration of nades works perfectly.. :/
Logged
gghh3322
Jr. Member
**
Posts: 56


View Profile
« Reply #1 on: September 06, 2010, 05:07:34 AM »

Code:
if(StrEqual(weapon,"hegrenade",false) && !W3HasImmunity(victim,Immunity_Skills))
{
new Float:percent=1.8;
new originaldamage=dmg;
new health_take=RoundFloat((float(dmg)*percent));

new onehp=false;
///you cannot die from orc nade unless the usual nade damage kills you
if(GetClientHealth(victim)>originaldamage&&health_take>GetClientHealth(victim)){
health_take=GetClientHealth(victim) -1;
onehp=true;
}
////new new_health=GetClientHealth(victim)-health_take;
//if(new_health<0)
// new_health=0;
//SetEntityZHealth(victim,new_health);
if(War3_DealDamage(victim,health_take,attacker,_,"criticalnade",W3DMGORIGIN_SKILL,W3DMGTYPE_PHYSICAL))
{
W3PrintSkillDmgHintConsole(victim,attacker,health_take,"Critical Nade");
PrintHintText(attacker,"Your Grenades do 1.8x damage!");
if(onehp){
SetEntityHealth(victim,1);
} 
}
if(StrEqual(weapon,"hegrenade",false)  it's..
allow the gun?(i'm not sure..)

Logged
Scyther
Full Member
***
Posts: 120


View Profile Email
« Reply #2 on: September 06, 2010, 05:44:51 AM »

Well thats what it said in orc which has working crit nades.. which is why i cant work out why it doesnt work :S ive moved on to making unlimited ammo hero (punisher) hopefully someone can work out why this doesnt work and then it can be finished Smiley
Logged
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2032



View Profile WWW Email
« Reply #3 on: September 06, 2010, 08:29:40 AM »

u didnt hook even damage
Logged

DarkEnergy
Scyther
Full Member
***
Posts: 120


View Profile Email
« Reply #4 on: September 06, 2010, 03:50:40 PM »

OHhh right thanks ownz
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!