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

War3:Source
October 24, 2012, 03:24:35 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: OnW3TakeDmgBullet  (Read 807 times)
zero
Full Member
***
Posts: 191



View Profile WWW Email
« on: February 06, 2011, 11:26:17 AM »

I figured from the name that OnW3TakeDmgBullet() would only apply if the damage came from a bullet. However it appears to trigger even with nades. Is this intended, or is this function broken?
Logged

Ownz
Developer
Administrator
Hero Member
*****
Posts: 2045



View Profile WWW Email
« Reply #1 on: February 06, 2011, 12:44:10 PM »

its damage dealt from normal (non warcraft) sources, that includes nades
Logged

DarkEnergy
zero
Full Member
***
Posts: 191



View Profile WWW Email
« Reply #2 on: February 06, 2011, 01:13:46 PM »

Do you think in the future we could expand it to support the weapon used so that we can filter without needing to use a hurt hook?
Logged

Ownz
Developer
Administrator
Hero Member
*****
Posts: 2045



View Profile WWW Email
« Reply #3 on: February 06, 2011, 01:26:19 PM »

onwar3posthurt is a hurt hook, and u can GetEventString as usual inside that function

ontakedamage is from SDKHooks and does not pass the weapon
Logged

DarkEnergy
zero
Full Member
***
Posts: 191



View Profile WWW Email
« Reply #4 on: February 06, 2011, 01:48:14 PM »

ok cool, do I use it the same way then?

Code:
decl String:weapon[64];
GetEventString(event,"weapon",weapon,63);
StrEqual(weapon,"hegrenade",false)
Logged

Ownz
Developer
Administrator
Hero Member
*****
Posts: 2045



View Profile WWW Email
« Reply #5 on: February 06, 2011, 01:52:41 PM »

yes, inside war3posthurt
Logged

DarkEnergy
zero
Full Member
***
Posts: 191



View Profile WWW Email
« Reply #6 on: February 21, 2011, 01:38:31 PM »

It does not work b/c event is not defined. Is there any way to get that value so you can detect the weapon?
Logged

Ownz
Developer
Administrator
Hero Member
*****
Posts: 2045



View Profile WWW Email
« Reply #7 on: February 21, 2011, 01:39:50 PM »

w3getvar(SmEvent)
Logged

DarkEnergy
zero
Full Member
***
Posts: 191



View Profile WWW Email
« Reply #8 on: April 09, 2011, 08:26:25 PM »

When using W3GetVar(SmEvent) I get errors like:

Code:
L 04/09/2011 - 22:22:36: [SM] Displaying call stack trace for plugin "War3Source_021_Hells Demon.smx":
L 04/09/2011 - 22:22:36: [SM]   [0]  Line 182, G:\Sm Plugins\WCS\021_Hells_Demon\War3Source_021_Hells Demon.sp::OnWar3EventPostHurt()
L 04/09/2011 - 22:22:36: [SM] Native "GetEventString" reported: Invalid game event handle 1f1b0319 (error 3)
L 04/09/2011 - 22:22:36: [SM] Displaying call stack trace for plugin "War3Source_023_Shadow_Of_The_Void.smx":
L 04/09/2011 - 22:22:36: [SM]   [0]  Line 170, G:\Sm Plugins\WCS\023_Shadow_Of_The_Void\War3Source_023_Shadow_Of_The_Void.sp::OnWar3EventPostHurt()
L 04/09/2011 - 22:22:36: [SM] Native "GetEventString" reported: Invalid game event handle 1f1b0319 (error 3)
L 04/09/2011 - 22:22:36: [SM] Displaying call stack trace for plugin "War3Source_025_Nebula.smx":

The code I am using is:
Code:
public OnWar3EventPostHurt(victim,attacker,dmgamount)
{
    decl String:weapon[64];
    GetEventString(W3GetVar(SmEvent),"weapon",weapon,63);

Is there something wrong with the way I am doing this?

Note that I do not get these errors when I test in my test server. However in the main server with multiple players it then appears. There seems to be an issue with the way the commend is processed or something.
« Last Edit: April 09, 2011, 09:45:11 PM by zero » Logged

Ownz
Developer
Administrator
Hero Member
*****
Posts: 2045



View Profile WWW Email
« Reply #9 on: April 10, 2011, 02:36:12 AM »

your code is correct, but somehow SmEvent expires by the time PostHurt forward is called, and i dont know what is wrong with the core code.
the only way around is to hook damage directly
Logged

DarkEnergy
zero
Full Member
***
Posts: 191



View Profile WWW Email
« Reply #10 on: April 10, 2011, 09:28:21 AM »

Ah, I thought the point of being able to use this was to avoid needing to do that... always something.

Anyways, do you think war3 could be updated to store some of the useful event data like weapon directly to avoid this problem. Otherwise it is currently too risky to use W3GetVar like this b/c of the errors generated. I just believe it is preferable for coders to be able to use the OnWar3Event methods as intended for simplification and consistency.
Logged

Ownz
Developer
Administrator
Hero Member
*****
Posts: 2045



View Profile WWW Email
« Reply #11 on: April 10, 2011, 11:40:30 AM »

well yes it was meant to simplify, but i don't know why it is not working, theory is that races dealing damage within posthurt that is breaking the event

that means even if i store the weapon, that can get overwritten too
Logged

DarkEnergy
zero
Full Member
***
Posts: 191



View Profile WWW Email
« Reply #12 on: April 10, 2011, 02:29:30 PM »

However such an override would not occur until after that part in the code right? So if you are deal damage from within there as long as anything from W3GetVar is used before that it should be fine.
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!