Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I suck at math but i need a random attack damage generator?

 players can have weapons damage up to 15
 their attack damage can be changed by stats points when they reach level 15 
 there's also Defence that can be changed by stats points

What I'm trying to do

so I'm trying to make a random attack damage script, but as the title said, I am not good at math. and I don't want players being too Overpowered all the time, but it can happen sometimes.

i know i'm not supposed to ask for a script without trying, but the math part is the part that's bad for me

10 comments

0

i know how to use random numbers. but that still doesnt help with the math part :(

0

Try to use a formula like x = math.random(5) damage = (x*5)-10 so even if it's 5 the max will be 15 though it limits the range of damage.

0

if i wanted to add the player's defense to that, would i divide it?

0

No, you'd subtract the defense from it before applying the damage to the humanoid.

0

damage can get up to 1000 or more if a lucky hit, and some NPCs wont have that much HP

0

Are you asking for a basic formula for weapons in general or multiple for specific weapons?

0

all weapons. sorry D: i never have been good at math. i tried to do a formula but i couldnt think of one

0

why is math.random alone not sufficient for this

0

Percil Ever played an RPG before. They use formulas for their attacks based on stats and the skill/attack the character is using.

1 answer

Well if you want different weapons to do different amounts of damage I'd do something like this: x =player strength w = weapons attack Sword Formula- (x+w)+(x*1.5) or 2xw or 1.5x+w The weapons will do pretty good damage and if you want varied damage you can just use math.random(10) and add it to the end of the formula.

Ax Formula- 2x + w + 20 or 2xw + (x+w) or xw/(w-x) Axes are supposed t do alot of damage so I guess this works. You'll have to tweak them so they won't be to overpowered. Just play around with numbers and you'll get the hang of it.

2 comments

0

i used the first one. with 0 wep damage and 5 attack damage, it print 12.5 (x+w)+(x*1.5) is the one i used

0

Is that okay?

This discussion is preserved as it was. New answers, comments, and votes are closed.