Hello dudes!
I’m trying to generate the same object order from a random generation, using a seed.
So for this effect I made my little random generator. Note: This is for planet generation.
I thought that just putting random.seed= s would solve the problem, I was wrong.
here’s my code:
import bge, math, mathutils,random
sce= bge.logic.getCurrentScene()
def emit(cont):
own= cont.owner
emittion=own["emit"]
particles=(own["particles"])
count= own["particles_Count"]
rand=random
rand.seed=own["seed"]
rangeX=own["rangeX"];rangeY=own["rangeY"]; rangeZ=own["rangeZ"]
if emittion ==True:
for a in range(count):
b= rand.choice(particles)
p= sce.addObject(sce.objectsInactive[b], own)
posX= rand.uniform(-rangeX,rangeX);posY= rand.uniform(-rangeY,rangeY); posZ= rand.uniform(-rangeZ,rangeZ)
p.position= own.position+mathutils.Vector((posX,posY,posZ)); p.setParent(own,1,1)
So the result must always be the same, every time the script is run, it needs to run only once!
Thank you for your assistance.