Get xyz coords as for RadiusDamage
I assume RadiusDamage requires (as a first param) xyz coords for the "explosion".
http://softwarecns.herobo.com/syntax.png So is there any way I can get them corresponding to an entity say "player" ( entity_get_vector ? ) ? PHP Code:
|
Re: Get xyz coords as for RadiusDamage
get_user_origin() will get you the location of a player. You'll have to convert the coordinates into floating point values before using them in radius_damage().
Alternatively, if you are already using fakemeta, you can use pev(ent, pev_origin, fOrigin) where fOrigin is a floating point array with 3 elements. |
Re: Get xyz coords as for RadiusDamage
I am coding an exclusively large cs mod. All libraries I needed to include.
It appears that me using Pawn/amxmod is somehow easier than me using C, although I've been developing in C for years. There are just a few things I cannot know unless they are referenced and so forth. Or unless I get back to find and read the library implementations (which may direct me to other dependencies, a chain of library implementations) but why if already some of you may know the answer(s). Thanks :) |
Re: Get xyz coords as for RadiusDamage
Though why even if I
PHP Code:
|
Re: Get xyz coords as for RadiusDamage
What's the purpose of
PHP Code:
Anyway, I've never used RadiusDamage() (radius_damage()), but looking at its code, its implementation is really bad in my opinion. Code: https://mxr.alliedmods.net/amxmodx/s...engine.cpp#178 So, if you are standing really close to explosion origin (2 * radius multiplier), which does happen if you create an explosion at player's origin, it's going kill that player every time. The best thing would probably be to create your own function to which you could pass explosion origin, damage and radius, and deal damage based on range. No multipliers involved, just raw values. |
Re: Get xyz coords as for RadiusDamage
I thought that by that I'm gonna send it to completely different location, far from the player so it doesn't die.
I agree RadiusDamage() has awful implementation. Redundant and performance-irrational coding. If I am to create my own function what should I use? fakemeta_stocks's fakedamage()? That one isn't referenced as well. In http://www.amxmodx.org/ only its prototype is shown, like I cannot see it myself or use the amxx studio's autocomplete... |
Re: Get xyz coords as for RadiusDamage
Here's the official documentation if you haven't found it by now: http://amxmodx.org/api/engine_stocks/fakedamage
If a function is a stock (has stock in front of the function name), it means it's implemented in PAWN. Just click the File link in the upper right corner of the page and find the function in there. If it is a native however, like radius_damage() is (RadiusDamage() just calls radius_damage()), its implementation is found within the AMXX (or its modules). You can easily browse through the code at GitHub or Cross Reference. To answer your question: you could call TakeDamage on victim Code:
/**PHP Code:
EDIT: Sending the explosion to different location works the way you did it, but the thing is, you have overridden fOrigin[]'s value by calling pev() and saving its result into that array. You should take the execution order in account too. |
Re: Get xyz coords as for RadiusDamage
What if the "victim" is breakable object?
That surely won't affect it. And do you mean fakedamage() ? |
Re: Get xyz coords as for RadiusDamage
I edited my previous post a bit, read through it again.
You should check if the victim is actually a player, by calling PHP Code:
|
Re: Get xyz coords as for RadiusDamage
Silly me I didn't noticed that I was calling it pev after the post-calculation.
Yes I have been using Damage event as well as Ham_TakeDamage ham the problem is that the player isn't attacking. Think of it as if I were to re-create c4. I thought Ham_TakeDamage doesn't execute on anything else but when damage has been received from someone/to someone. |
| All times are GMT -4. The time now is 22:11. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.