Proper way to deal damage without extensions
Because I love you.
Code:
#define DMG_GENERIC 0Code:
DealDamage(victim_index,50,attacker_index,DMG_BULLET,"weapon_ak47"); |
Re: Proper way to deal damage without extensions
war3_hurtme ?
|
Re: Proper way to deal damage without extensions
Its the targetname I use because of war3source... point_hurt works by looking up a target name. You can make it whatever you want really.
|
Re: Proper way to deal damage without extensions
Oooh cool :D
|
Re: Proper way to deal damage without extensions
Pretty useful. Thank you!
|
Re: Proper way to deal damage without extensions
Dang I was so close ^_^ Anyways ty so much..thats gonna help..
|
Re: Proper way to deal damage without extensions
Quote:
|
Re: Proper way to deal damage without extensions
I'm not sure, I'm assuming your using EventScripts. Give it a try.
|
Re: Proper way to deal damage without extensions
Quote:
|
Re: Proper way to deal damage without extensions
I got 2 questions :shock::
1.) Can you fake headshot damage as well? I basically want to create fake damage which kills somebody with a headshot... 2.) Im a bit confused... why is this method failing? -> Code:
new Handle:event_hurt = CreateEvent("player_hurt"); |
Re: Proper way to deal damage without extensions
Why are you creating the event? It will automatically occur if you use DealDamage()
Also, I don't think you can make it headshot unfortunately, maybe a hook inside player_hurt to force a headshot might? |
Re: Proper way to deal damage without extensions
Quote:
http://developer.valvesoftware.com/wiki/Point_hurt Quote:
|
Re: Proper way to deal damage without extensions
ah ok thanks both of you.. that helped alot ^_^
This got me confused: http://wiki.alliedmods.net/Events_%2...d_Scripting%29 |
Re: Proper way to deal damage without extensions
Quote:
If you really wanted to use this method, I'd spawn a point_hurt one time at map start and then always use that entity rather than constantly respawning them. And even then, I'd only do that in the absence of the extension that does it properly. Just my opinion dont mind me :) |
Re: Proper way to deal damage without extensions
Then it would need to be integrated with your plugin and not a simple snippet.
|
Re: Proper way to deal damage without extensions
I take it there's no way to deal damage from the client to themselves with this?
Specifically in conjunction with pyro flamethrower to create a jetpack effect in PropHunt. |
Re: Proper way to deal damage without extensions
if you kill people using damage like this, making the attacker another client, what kill-message would come up (tf2 particularly?)
the weapon the attacker is currently holding? or a world kill message? also, i'm guessing this way painsounds automatically play? (my previous method of dealing damage made use of SetEntityHealth, and thus had no sound, which i had to provide for it :shock:) edit: ohw, also... does this damage push a player? |
Re: Proper way to deal damage without extensions
A suicide message like when a soldier kills himself with a rocket?
|
Re: Proper way to deal damage without extensions
Quote:
When I kill myself with damage from myself to myself with the demoman bottle it gives me a kill message like this: |Bottle Icon| |My name| |
Re: Proper way to deal damage without extensions
Quote:
DealDamage(victim_index,50,attacker_index,DMG _BULLET,"weapon_ak47"); That would make the engine think victim_index was shot for 50 damage (armor distribution works too) with an AK47 used by attacker_index. You can have alot of fun experimenting with Damage type as well. |
Re: Proper way to deal damage without extensions
I wish the time based damages worked on tf2.
|
Re: Proper way to deal damage without extensions
Is there a way to use something like this to -cancel- damage being given?
|
Re: Proper way to deal damage without extensions
Quote:
|
Re: Proper way to deal damage without extensions
one thing worth mentioning, a while ago i tried something like this to "modify" damage. you cant use it inside a player_hurt event and try and deal damage with the weapon used by the attacker, since it fires the same event before handling the first one. i hope that makes sense :|. maybe you guys know a way around this?
|
Re: Proper way to deal damage without extensions
Quote:
|
Re: Proper way to deal damage without extensions
Quote:
erm, quick question though, that means i need a weapon name, which i can easily find... but, what if i want to make like a new weapon, then use this code to make it do damage? of course, i can make it use a weapon name thats already used, but then people will get confused as to which weapon actually killed/hurt/whatevered them... so, i guess my question(s) is/are: are there unused weapons? if so, how to find them? (tf2 this case) or can i somehow extend the list of possible choices? |
Re: Proper way to deal damage without extensions
Is there a way to change the origin or direction the damage is delt from? When I kill someone with this they always fly a certain direction, its never random (like its always north->south damage, making their body fly south)
|
Re: Proper way to deal damage without extensions
yea, just teleport the point_hurt to the attacker position.
|
Re: Proper way to deal damage without extensions
i've slightly altered it so i could use it on multiple people at the same time,
but it seems to not be working as in it doesn't damage people. it doesn't error out however as server console logthingy is clean can anyone spot where i've gone wrong? PHP Code:
TPHurt is probably not needed, since i don't think its possible to see point hurts ingame, but ahwell.. also a slight change in DealDamage aswell, as i teleport it to the victim, so it should damage it from the right direction(?) and i call the DealDamage with: PHP Code:
edit: also, slight sidequestion, can this also damage buildings? or destroyable entities? edit2: it is! possible to see point hurts...(i tried it without the TPHurt function) so yes, the point hurt is even teleported to the right position... it still doesn't do damage though... |
Re: Proper way to deal damage without extensions
You could do this:
Code:
stock MultiDealDamage(Handle:hVictims,victimCount,damage,attacker=0,dmg_type=DMG_GENERIC,String:weapon[]="")Code:
new Handle:hPack=CreateDataPack(); |
Re: Proper way to deal damage without extensions
ok, interesting idea, i'll try it out
i see you use "weapon_rocket" as weapon name, and i can't really find any reference as to where you got that name from, is there a list with all the tf2 weapon names somewhere perhaps? edit: nvm, just found it on the wikithing, its the entity name, not the classname as i thought, right? (nvm, tried all names, classnames&entitynames, even modelnames, nothing works) edit2: alright, i've tried every name i could find for weapons in tf2, tried it without a weaponname, and still, the pointhurt doesn't hurt anyone. i've checked, it's got the right victim&attacker, the right weaponname, the right damage, it goes through every line of code, yet somehow when it does: AcceptEntityInput(pointHurt[victim],"Hurt",(attacker>0)?attacker:-1); it doesn't hurt anyone... :( i mean... why? (though, it can't be just because i might have a wrong weaponname, right? since it only applies if it has one, right? though then.... it's even more strange, since there isn't a reason why it shouldn't work...) are certain damagetype maybe not available in tf2? (i'm just guessing by now) |
Re: Proper way to deal damage without extensions
Paste your exact code. Weapon name only effects death messages.
|
Re: Proper way to deal damage without extensions
well, my code is basically what i posted earlier, or do you mean the whole plugin i'm making?
anyway, atm i'm trying this: PHP Code:
PHP Code:
edit: i've now also tried giving each victim an unique targetname, to see wether it might have been caused by that, but no luck, still no damage |
Re: Proper way to deal damage without extensions
That's pretty awesome. Could come in handy :)
|
Re: Proper way to deal damage without extensions
ok i've tested it proper now, simply your code, but then with a command so i can use it ingame:
PHP Code:
it does hurt people, although people don't scream of pain when hit with this (or do people need a certain amount of damage before painsounds start being used? since atm i'm using amounts of 25) and when it kills people, console gives out the right kill message, but the message that shows up ingame is always a skull, instead of the weapon i told it :S am i doing something wrong to not get the killmessages/painsounds? also still don't understand why my alteration(post before) doesn't work though, it basically does the exact same thing, except for the fact that i create them at start, and teleport them round a bit, the damaging part is identical, yet non-functioning :( edit1:ahh eff it, i'll just keep making and deleting pointhurts, if thats what it takes to make this working (which it did btw) only having some problem with killmessages but that was because i was using projectile weapons, and obviously i didn't think of a rocket being the killer instead of the rocketlauncher (it worked with tf_projectile_rocket) anyway, thanks for the code and the help edit2:btw, anyone perhaps know how to get this kill-message: http://www.mzzt.net/tf2/dark/unusedexplosion.png ? or rather, know the weaponname/classname? |
Re: Proper way to deal damage without extensions
Sorry, not sure about that death message. By the way, reusing an entity is probably no different than the method I provided. The reason being I remove the entity when I am finished.
|
Re: Proper way to deal damage without extensions
you can fake a headshot in css easily
for the weapon name to pass to the DealDamage function make a unique name with the weapon_ prefix e.g weapon_testgun then. PHP Code:
some info on death notices in css. if you change the weapon name in pre death event to a weapon that doesn't exist or to a weapon that doesn't have an icon the skull icon is used. you can set the weapon to "headshot" to get just the headshot icon as the weapon used. there is an unused icon for killing someone with a shield called "shieldgun". you can also use hl1 weapon names although it only gives partial kill icons. most death icons that are available are inside scripts/mod_textures.txt so for any unused icons that would be the first place to check. i tried to get custom death icons working last summer through eventscripts and partially got it working. you can't get players to download files they have so i embedded a modified mod_textures.txt into a test map and managed to get the custom kill icons working only when a player minimised then maximised the game which causes most files to be reloaded, in that case the files embedded in the map get priority over the clients files. |
Re: Proper way to deal damage without extensions
For more information, I've included a modified version of this feature. It's intended for TF2, simplified, includes some assumptions, but more importantly fixes a potential infinite loop issue. Code first, then explanation!
applyDamage() PHP Code:
PHP Code:
1) Client X dies (player_death event fires). 2) Client X death causes damage to nearby enemy, client Y. 3) Damage to client Y is sufficient to kill them. 4) Thus, client Y dies (player_death event fires). 5) Client Y death causes damage to nearby enemy, client X. 6) See step 1. Repeat until SM stack overflow. You'll notice that, in that loop, client X dies multiple times resulting from a single death event. Tracking debugging output in SM indicates that yes, a client can die multiple times under such circumstances, and the player_death event can even be called for clients with negative health! Either way, for those interested in this feature, I hope this helps. |
Re: Proper way to deal damage without extensions
It seems like it would be easier to just track if you've "killed" a target rather than going through timers and such. Thanks for the stocks though. :up:
|
Re: Proper way to deal damage without extensions
you don't need to teleport the point_hurt if you use a target entity to hurt.
if you want to hurt people within a radius of a person who dies its easier to use the none target method. teleport the point_hurt to the coords of the player who died, set radius to the radius you want to injure near by players, leave the damagetarget part blank then fire the hurt input and all players within the radius will take damage. |
| All times are GMT -4. The time now is 18:42. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.