How to make Enemies have random stats

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Newby

I want to have my enemy to have random stats like strength, defense,etc how do i do it
i know about randi() function but i want to use just one randi for all stats how do i make it so that the stats are each different.

Not sure what you mean by “one randi for all stats”, randi() is a function, it will return the next random number in sequence. Can you explain what you mean by wanting one randi for all stats?

pgregory | 2018-03-04 09:50

somthing coded like this

var rand1=randi()%amount
var rand2=randi()%amount
var rand3=randi()%amount
var rand4=randi()%amount
ect..
STR=rand1
DEF=rand2
MAG=rand3
RES=rand4
etc...

it just seem big to me and there is probably a simpler solution than this

Newby | 2018-03-04 10:49

:bust_in_silhouette: Reply From: rustyStriker

you will need multiple values for multiple stats(or break down a high value to a couple of small ones) and you can use randi() multiple times without any worries, you can just set the stats using randi() in the _ready() function