Random damage values being too random

Archive of the old editing forum
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.
Locked
Grimm
Posts: 326
Joined: Tue May 11, 2004 7:42 pm

Random damage values being too random

Post by Grimm »

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?
User avatar
Spleen
Posts: 497
Joined: Fri Nov 28, 2008 7:07 pm

Re: Random damage values being too random

Post by Spleen »

You don't even have matched parentheses :?
Grimm
Posts: 326
Joined: Tue May 11, 2004 7:42 pm

Re: Random damage values being too random

Post by Grimm »

EDIT: no, actually, they are matched, that just isn't the end of the equation/argument/whatever.
User avatar
Enjay
 
 
Posts: 27280
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Random damage values being too random

Post by Enjay »

Have you enabled the norandom bool?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Random damage values being too random

Post by Graf Zahl »

Obviously not.
Grimm
Posts: 326
Joined: Tue May 11, 2004 7:42 pm

Re: Random damage values being too random

Post by Grimm »

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?
User avatar
Spleen
Posts: 497
Joined: Fri Nov 28, 2008 7:07 pm

Re: Random damage values being too random

Post by Spleen »

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.
User avatar
Enjay
 
 
Posts: 27280
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Random damage values being too random

Post by Enjay »

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.
Grimm
Posts: 326
Joined: Tue May 11, 2004 7:42 pm

Re: Random damage values being too random

Post by Grimm »

Hmm . . . that explains a few things. This should be made clear in the wiki.
User avatar
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

Post by Matt »

Grimm wrote:Hmm . . . that explains a few things. This should be made clear in the wiki.
[wiki=A_CustomPunch]Better than nothing I guess.[/wiki]
Locked

Return to “Editing (Archive)”