Discuss Scratch

BannedForever451
Scratcher
100+ posts

Having random battles(like in pokemon)

So, in my game Rogue Lands RPG I want it to be like pokemon in the sense that if you're walking along the path you might randomly get in a battle. This is what I'm using now:
when [ d] key pressed
forever

if <(pick random (1) to (100)) > [ 99]> then
switch backdrop to [ plains]

end

end
Any helpful info. would be great!

\{T}/
BannedForever451
Scratcher
100+ posts

Having random battles(like in pokemon)

That one though makes it so you get into a battle a lot…

\{T}/
InternetUser_005
Scratcher
100+ posts

Having random battles(like in pokemon)

Hi,

I wrote a quick script to demonstrate an idea for this:
http://scratch.mit.edu/projects/38348798/

It uses a forever loop with a randomly timed wait in it. When the loop does execute it simulates a dice roll to decide if it is going to do a battle or not.

I made it log a time stamp to a list so you can tweak it until it's doing battles with the frequency you want.

Tweak the range of the wait time, and the size of the total of the dice roll to get the frequency and randomness you want.

Lots of ways to do this… this was just one idea.

Cheers
IU5
BannedForever451
Scratcher
100+ posts

Having random battles(like in pokemon)

Thanks a lot, but do I need the fight time stamps?

\{T}/
InternetUser_005
Scratcher
100+ posts

Having random battles(like in pokemon)

BannedForever451 wrote:

Thanks a lot, but do I need the fight time stamps?

Hey,

No… you don't need the time stamps at all. I just did that as a tool to use while testing it out and fiddling with the inputs until it works the way you want. Once you have it working they way you want you can remove that part completely. I don't suppose you are going to need the cat saying “Let's Fight!” and meowing either.

Cheers
IU5
BannedForever451
Scratcher
100+ posts

Having random battles(like in pokemon)

Right, thanks a heap!

\{T}/

Powered by DjangoBB