Random damage values being too random
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Random damage values being too random
Okay, so Melee attacks are supposed to do x*1,10 damage, correct? Well, that's a little too much, so for my melee attack I used:
A_CustomPunch((2*random(1,7))
giving a max of 14 damage from one hit, correct? Unfortunately, ZDoom doesn't seem to be listening to this at all. Not only is it not listening, it seems to be doing more damage than should even be possible from one punch. If it were still using the usual melee formula, it would be a max of 20, yet this attack routinely kills sargeants and imps in one hit. Anyone know what's going on?
A_CustomPunch((2*random(1,7))
giving a max of 14 damage from one hit, correct? Unfortunately, ZDoom doesn't seem to be listening to this at all. Not only is it not listening, it seems to be doing more damage than should even be possible from one punch. If it were still using the usual melee formula, it would be a max of 20, yet this attack routinely kills sargeants and imps in one hit. Anyone know what's going on?
Re: Random damage values being too random
You don't even have matched parentheses 
Re: Random damage values being too random
EDIT: no, actually, they are matched, that just isn't the end of the equation/argument/whatever.
Re: Random damage values being too random
Have you enabled the norandom bool?
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Random damage values being too random
Obviously not.
Re: Random damage values being too random
CLEARLY!
Let me review. I want it to do a custom random damage amount, as seen by the expression given. Why, then, would enabling the norandom bool be necessary?
Let me review. I want it to do a custom random damage amount, as seen by the expression given. Why, then, would enabling the norandom bool be necessary?
Re: Random damage values being too random
Because the damage is automatically randomized, and you're adding randomization on top of that. To have complete control of the randomization you need to disable the automatic randomization using that flag.
Re: Random damage values being too random
Yeah, at present, as far as I can tell, you are using a number from 2 through 14 that will then have Doom randomisation applied to it.
Re: Random damage values being too random
Hmm . . . that explains a few things. This should be made clear in the wiki.
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: Random damage values being too random
[wiki=A_CustomPunch]Better than nothing I guess.[/wiki]Grimm wrote:Hmm . . . that explains a few things. This should be made clear in the wiki.
