Possible to determine how much damage a player did?

Discuss all aspects related to modding Zandronum here.
Post Reply
t3hplayer
 
Posts: 29
Joined: Thu Sep 19, 2013 10:58 pm

Possible to determine how much damage a player did?

#1

Post by t3hplayer » Thu Dec 05, 2013 5:56 am

When a player fires a weapon, is it possible to determine how much damage was done?

Or, even not specific to a particular weapon or shot, is there any way to figure out how much damage was done by a particular player, like in coop?

Thanks.

Edit: To be clear, I don't want to just know this out of curiosity. Is there some bit of ACS code that can tell me how much damage was done with the most recent player shot, for example?
Last edited by t3hplayer on Thu Dec 05, 2013 7:21 am, edited 1 time in total.

Mr.Man
Forum Regular
Posts: 657
Joined: Thu May 09, 2013 7:25 pm

RE: Possible to determine how much damage a player did?

#2

Post by Mr.Man » Thu Dec 05, 2013 6:18 am

Well, look in the decorate file of the weapon, and at its damage, put random(100,200) for example.

t3hplayer
 
Posts: 29
Joined: Thu Sep 19, 2013 10:58 pm

RE: Possible to determine how much damage a player did?

#3

Post by t3hplayer » Thu Dec 05, 2013 6:24 am

Mr.Man wrote: Well, look in the decorate file of the weapon, and at its damage, put random(100,200) for example.
I probably wasn't clear in my post. Suppose a player fires a shotgun, for example. If all the bullets hit a wall, that shot did 0 damage. If a couple of the bullets hit an enemy, then some damage was done. If all the bullets hit an enemy, then more damage was done. Is there any way to know what amount of damage was done?

Mr.Man
Forum Regular
Posts: 657
Joined: Thu May 09, 2013 7:25 pm

RE: Possible to determine how much damage a player did?

#4

Post by Mr.Man » Thu Dec 05, 2013 6:48 am

I guess each pellet does the same damage, and the more pellets hit an enemy, the more it deals. If it does 25, 4 shots kill a player.
You can look this up i guess? I dont know if this is even right, it might be.

User avatar
IdeIdoom
Zandrone
Posts: 1112
Joined: Mon Jun 04, 2012 6:19 am
Location: Meldola, Italy
Contact:

RE: Possible to determine how much damage a player did?

#5

Post by IdeIdoom » Thu Dec 05, 2013 9:27 am

Hit scan weapons do the random(5,10,15) damage per pellet.
Usually players calculate for the one in the middle with how many pellets they hit.
THE ROMANIAN POWERImage

Code: Select all

<+Dastan>	edd
<+Dastan>	boxxy skin when
<+Shift>	dastan you really want to fap at it this much and now you are going crazy and shredding your hair into a million tiny pieces for this boxxy skin to come out that way you can cum out
<+Dastan>	Shift, yes
--------------------------------------------------------------------
21:53:26  <@Estar>	well, if i'd be a girl, i would say ideidoom has ok looks

User avatar
Hypnotoad
Retired Staff / Community Team Member
Posts: 528
Joined: Tue May 29, 2012 8:50 pm
Location: Britland

RE: Possible to determine how much damage a player did?

#6

Post by Hypnotoad » Thu Dec 05, 2013 10:12 am

t3hplayer wrote: Edit: To be clear, I don't want to just know this out of curiosity. Is there some bit of ACS code that can tell me how much damage was done with the most recent player shot, for example?
If you know the player/enemy he is shooting then yes, if you do not know what or who he will be shooting, then this becomes much harder and I am not sure if it is possible to do reliably yet using ACS.

User avatar
Guardsoul
Forum Regular
Posts: 495
Joined: Wed Jun 06, 2012 6:09 pm
Location: Creating the world

RE: Possible to determine how much damage a player did?

#7

Post by Guardsoul » Thu Dec 05, 2013 11:03 am

It´s possible via ACS (but very very hard to implement). There is an example of that in WrathOfCronos 1.6 b I think.
I dont care about how bad your maps are. Everything can be improved.
Banned for cheating at DoomBuilder.

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

RE: Possible to determine how much damage a player did?

#8

Post by Ijon Tichy » Thu Dec 05, 2013 1:15 pm

since monsters don't necessarily target or have any reference to who shot them, and no way to determine at all where the damage came from, there is no reliable way to do this

User avatar
Ænima
Addicted to Zandronum
Posts: 3578
Joined: Tue Jun 05, 2012 6:12 pm

RE: Possible to determine how much damage a player did?

#9

Post by Ænima » Thu Dec 05, 2013 1:19 pm

The "award damage dealt not kills" DMFLAG tracks damage, but it's hard-coded. :/
Reinforcements: midgame Survival joining/respawning
Doom64: Unabsolved: Doom64 + Diablo II
ZandroSkins: a pack made by our community
AeniPuffs: 3D blood and bullet puff effects, free to use for your own mods
Squad Radio: a WASD-based radio chat menu, add your own custom sounds!
Mercenaries (on hold)
Image

Catastrophe
Retired Staff / Community Team Member
Posts: 2568
Joined: Sat Jun 02, 2012 2:44 am

RE: Possible to determine how much damage a player did?

#10

Post by Catastrophe » Thu Dec 05, 2013 2:45 pm

Yeah, there's no way you can calculate through ACS on how much player-damage you've done. The main problem is that if two people shoot you at the same time in the same tic then it'll fuck up.

t3hplayer
 
Posts: 29
Joined: Thu Sep 19, 2013 10:58 pm

RE: Possible to determine how much damage a player did?

#11

Post by t3hplayer » Fri Dec 06, 2013 2:43 am

Hypnotoad wrote:
t3hplayer wrote: Edit: To be clear, I don't want to just know this out of curiosity. Is there some bit of ACS code that can tell me how much damage was done with the most recent player shot, for example?
If you know the player/enemy he is shooting then yes, if you do not know what or who he will be shooting, then this becomes much harder and I am not sure if it is possible to do reliably yet using ACS.
Yeah, that's what I was thinking. Unfortunately, there are likely to be many monsters on-screen at any given time. I suspect it's doable with instant attacks, like melee or bullets, but I suspect it's not really doable for missiles.
Guardsoul wrote: It´s possible via ACS (but very very hard to implement). There is an example of that in WrathOfCronos 1.6 b I think.
Is the source available for WoC? I poked around a bit on the WoC threads both here and on the Zdoom forums, but I didn't see a download for it.
Ænima wrote: The "award damage dealt not kills" DMFLAG tracks damage, but it's hard-coded. :/
That might be good enough, actually. I can probably be happy with just a looped script that recalculates based on score change since the last iteration. Shouldn't be too much of a hack.
Ijon Tichy wrote: since monsters don't necessarily target or have any reference to who shot them, and no way to determine at all where the damage came from, there is no reliable way to do this
That's sorta what I was figuring, but I wasn't certain if there was or wasn't a way for monsters to know who attacked them / players to know what they hit. All I knew is that if there is a way, it wasn't obvious to me.

Thanks for all the input, guys. I'll look into the DMFLAG Ænima mentioned. I don't need to know the exact damage done, rather I just want some kinda metric I can use to award points to players based on damage done (as opposed to based on enemies killed). That DMFLAG might be the ticket.

User avatar
Ænima
Addicted to Zandronum
Posts: 3578
Joined: Tue Jun 05, 2012 6:12 pm

RE: Possible to determine how much damage a player did?

#12

Post by Ænima » Fri Dec 06, 2013 2:54 am

t3hplayer wrote:
Ænima wrote: The "award damage dealt not kills" DMFLAG tracks damage, but it's hard-coded. :/
That might be good enough, actually. I can probably be happy with just a looped script that recalculates based on score change since the last iteration. Shouldn't be too much of a hack.


Thanks for all the input, guys. I'll look into the DMFLAG Ænima mentioned. I don't need to know the exact damage done, rather I just want some kinda metric I can use to award points to players based on damage done (as opposed to based on enemies killed). That DMFLAG might be the ticket.
Well uhhh ... The problem is that it's hard-coded. Yes you can see the points on the scoreboard (which is your total damage done divided by 100, i think), but there's no way to access that number through an ACS script.
Reinforcements: midgame Survival joining/respawning
Doom64: Unabsolved: Doom64 + Diablo II
ZandroSkins: a pack made by our community
AeniPuffs: 3D blood and bullet puff effects, free to use for your own mods
Squad Radio: a WASD-based radio chat menu, add your own custom sounds!
Mercenaries (on hold)
Image

t3hplayer
 
Posts: 29
Joined: Thu Sep 19, 2013 10:58 pm

RE: Possible to determine how much damage a player did?

#13

Post by t3hplayer » Fri Dec 06, 2013 3:02 am

Ænima wrote:
t3hplayer wrote:
Ænima wrote: The "award damage dealt not kills" DMFLAG tracks damage, but it's hard-coded. :/
That might be good enough, actually. I can probably be happy with just a looped script that recalculates based on score change since the last iteration. Shouldn't be too much of a hack.


Thanks for all the input, guys. I'll look into the DMFLAG Ænima mentioned. I don't need to know the exact damage done, rather I just want some kinda metric I can use to award points to players based on damage done (as opposed to based on enemies killed). That DMFLAG might be the ticket.
Well uhhh ... The problem is that it's hard-coded. Yes you can see the points on the scoreboard (which is your total damage done divided by 100, i think), but there's no way to access that number through an ACS script.
Oh...lame. I was thinking that number was gettable through PlayerFrags().

Edit: I may put in a feature request for a PlayerScore() function to be added in the future. I suspect I'm not the only one for whom such a function would be useful.
Last edited by t3hplayer on Fri Dec 06, 2013 3:07 am, edited 1 time in total.

User avatar
Ænima
Addicted to Zandronum
Posts: 3578
Joined: Tue Jun 05, 2012 6:12 pm

RE: Possible to determine how much damage a player did?

#14

Post by Ænima » Fri Dec 06, 2013 3:14 am

t3hplayer wrote:
Ænima wrote:
t3hplayer wrote:
Ænima wrote: The "award damage dealt not kills" DMFLAG tracks damage, but it's hard-coded. :/
That might be good enough, actually. I can probably be happy with just a looped script that recalculates based on score change since the last iteration. Shouldn't be too much of a hack.


Thanks for all the input, guys. I'll look into the DMFLAG Ænima mentioned. I don't need to know the exact damage done, rather I just want some kinda metric I can use to award points to players based on damage done (as opposed to based on enemies killed). That DMFLAG might be the ticket.
Well uhhh ... The problem is that it's hard-coded. Yes you can see the points on the scoreboard (which is your total damage done divided by 100, i think), but there's no way to access that number through an ACS script.
Oh...lame. I was thinking that number was gettable through PlayerFrags().
Nope. IIRC, using PlayerFrags in a non-PvP gamemode will just return 0.
t3hplayer wrote: Edit: I may put in a feature request for a PlayerScore() function to be added in the future. I suspect I'm not the only one for whom such a function would be useful.
That would be nice, yes. Even better if it had a dual functionality (return a player's caps if used in CTF, or a player's kills/damage if used in coop).
Reinforcements: midgame Survival joining/respawning
Doom64: Unabsolved: Doom64 + Diablo II
ZandroSkins: a pack made by our community
AeniPuffs: 3D blood and bullet puff effects, free to use for your own mods
Squad Radio: a WASD-based radio chat menu, add your own custom sounds!
Mercenaries (on hold)
Image

Watermelon
Zandrone
Posts: 1244
Joined: Thu Jun 28, 2012 9:07 pm
Location: Rwanda

RE: Possible to determine how much damage a player did?

#15

Post by Watermelon » Fri Dec 06, 2013 4:15 am

Mr.Man wrote: Well, look in the decorate file of the weapon, and at its damage, put random(100,200) for example.
Would it hurt to read what someone says for once? Just once. I don't bother people who misread posts cause I do it myself, but every single time I read a post by you, it's like you pick 2 (random) words out of a post and comment on something way off topic/something that doesn't help.





On topic:
It is possible if you give each player their own weapon (requiring 64 weapons with 64 puffs and so on) and then writing that to ACS.
IMO it's not worth it unless you're going to be doing something epic.

t3hplayer
 
Posts: 29
Joined: Thu Sep 19, 2013 10:58 pm

RE: Possible to determine how much damage a player did?

#16

Post by t3hplayer » Fri Dec 06, 2013 4:53 am

Watermelon wrote: It is possible if you give each player their own weapon (requiring 64 weapons with 64 puffs and so on) and then writing that to ACS.
IMO it's not worth it unless you're going to be doing something epic.
That actually hadn't occurred to me, so thanks for that. I probably wouldn't be entirely opposed to that approach, but I'd need something that would work with projectiles as well as bullets, and I don't think this would, since I don't think there's any trivial way to determine how much damage an explosion did.

Looks like it's a dead-end for now, at least for what I had in mind. Ahh well, not too big of deal. Thanks to everyone for the input.

Klofkac
Forum Regular
Posts: 481
Joined: Sat Jun 09, 2012 1:31 pm
Location: Ask Grandvoid servers

RE: Possible to determine how much damage a player did?

#17

Post by Klofkac » Fri Dec 06, 2013 2:27 pm

I think there can be concept of how to get damage:

Pseudocode:
new = GetActorHealth;
damage = old-new;
old = GetActorHealth;
TheLoop;

But it cannot be utilised really well practically, because it checks damage taken, not dealt.
Last edited by Klofkac on Fri Dec 06, 2013 2:29 pm, edited 1 time in total.
𝕂𝕝𝕠𝕗𝕜𝕒𝕔

t3hplayer
 
Posts: 29
Joined: Thu Sep 19, 2013 10:58 pm

RE: Possible to determine how much damage a player did?

#18

Post by t3hplayer » Fri Dec 06, 2013 7:43 pm

Klofkac wrote: I think there can be concept of how to get damage:

Pseudocode:
new = GetActorHealth;
damage = old-new;
old = GetActorHealth;
TheLoop;

But it cannot be utilised really well practically, because it checks damage taken, not dealt.
Yeah, I thought about this, but one other problem is that I don't know which actors might be getting damaged. I'm doing this with coop, and there could be 50 (or many more) monsters. With bullets it could probably be managed, but then I think about projectiles and BFG tendrils and I'm pretty sure it's nearly impossible to do without some kinda input from the engine side.

Post Reply