Forum

> > CS2D > Scripts > RandomParse
Forums overviewCS2D overview Scripts overviewLog in to reply

English RandomParse

7 replies
To the start Previous 1 Next To the start

old RandomParse

Precel97
User Off Offline

Quote
Hi all! I was wondering about random script
Is this possible? I mean Randomscript then
parse something...
Can someone help?

old Re: RandomParse

Banaan
User Off Offline

Quote
that prolly won't work TimeQuest...

1
2
3
4
5
6
local n = math.random(1, 5)
if n == 1 then
	-- parse
elseif n == 2 then
	-- parse something else
end

This will pick a random number between one and five. If that random number == 1, then it'll parse the first parse, if it == 2, it'll parse the second parse. That means about 20% change for each of the situations.

old Re: RandomParse

RAVENOUS
BANNED Off Offline

Quote
however, random does use the same numbers after a while, use randomseed.

old Re: RandomParse

KimKat
GAME BANNED Off Offline

Quote
As Tobey said use randomseed.

I also made a script that will trigger one of these walls, opening up just one path out of three. If any bugs, please correct it.
Spoiler >
Or use this code...
Spoiler >
I think it should work.

old Re: RandomParse

Banaan
User Off Offline

Quote
Using a static math.randomseed is even worse than using none at all.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview