- Dec 25, 2019
- 177
- 260
Ok i have a new random number problem if anyone wants to help a poor confused old scrub that's just starting out
I'm trying to make a random encounter system and i've got it mostly working but it's throwing an error whenver Autoreload kick's in and also blocking auto saves .
SPOILER: This is the error
and this is the code that is causing it
Code:
label randomencounterengine: #hurhur engine my arse
python:
import random
$randomnum = random.randint(1,3) #(randomize random encounters)
if randomnum == 1:
jump slimefight1
if randomnum == 2:
jump gnollfight1
if randomnum == 3:
jump skeletonfight1
I know it's not exactly elegant but it works. (sort of)
my only guess is that it's storing the random number and that's causing the error? maybe...
is there maybe a way to clear the stored number (if that's what's happening) after the event is over?
i've tried googling it but no luck.
*Edit* after thought could it be the python bit at the begining. I know from experimenting that i need that for it to roll a different number each time it triggers (Because renpy.random.randint only rolls the first time it's triggered then gives the same result every time). If that is the problem is there an end type statement to stop the python after it's done it's job (Maybe. I'm really just guessing at this point.)
I'm trying to make a random encounter system and i've got it mostly working but it's throwing an error whenver Autoreload kick's in and also blocking auto saves .
SPOILER: This is the error
and this is the code that is causing it
Code:
label randomencounterengine: #hurhur engine my arse
python:
import random
$randomnum = random.randint(1,3) #(randomize random encounters)
if randomnum == 1:
jump slimefight1
if randomnum == 2:
jump gnollfight1
if randomnum == 3:
jump skeletonfight1
I know it's not exactly elegant but it works. (sort of)
my only guess is that it's storing the random number and that's causing the error? maybe...
is there maybe a way to clear the stored number (if that's what's happening) after the event is over?
i've tried googling it but no luck.
*Edit* after thought could it be the python bit at the begining. I know from experimenting that i need that for it to roll a different number each time it triggers (Because renpy.random.randint only rolls the first time it's triggered then gives the same result every time). If that is the problem is there an end type statement to stop the python after it's done it's job (Maybe. I'm really just guessing at this point.)