Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[xp ]super simple event ore mining?

im using RMXP, and i need a little help setting up an event that checks if you have X item (such as pickaxe), if so then you have X% chance of getting an ore.
i really dont want a whole bunch of features, and i only have like 6 or so mining spots, so i thought it would be easier to use events than scripts.

im guessing i would use variables? so i would do "random variable: 1-100," and "if variable: <11," then you recieve 1 ore, and "if variable >10" then you get nothing? that would be if you had a 10% chance. correct? sorry, im just staring to learn variables and branches. :\

if you could help me out i would be eternally grateful...

PS. is there anyway to add a timer so that you cant mine again for X amount of time? just wondering, i dont have to have it.
 
Sure lordnick, try something like this.

Code:
@>Conditional Branch: Item [Pickaxe] in Inventory
  @>Control Variables: [Random] = Ran (1...10)
  @>Conditional Branch: Variable [Random] = 1
     @>Receive 1 ore!
    : Else
     @>Receive nothing.
    : Branch End
 : Branch End

Basically, a conditional branch checks if the pickaxe is in your inventory. If so, it sets a random variable and checks if it's 1 out of 10, which is 10%. Pretty much what you guessed, except 1/10 is easier than 10/100.

Of course, you can adjust the random variable values to get different %'s.

Oh and if you don't want the player to mine for X amount of time, at the end of the event turn on a self-switch.
Code:
@>Control Self-Switch A = On

Now create a New Event Page (button at the top), and check the Conditions box "Self-Switch A is On." Now set it to Parallel Processing, and have a "Wait: x frames." After the wait command, turn self-switch A off and the player will be able to mine again.

Good luck with it!
 
so i tried to do something similar, and it seems to work when i test it.

does this look like its supposed to? ignore the "potion" i just used it instead of a pickaxe due to my inventory not being finished.
http://img.photobucket.com/albums/v463/lordnick5000/mine.jpg[/img]
 
Regi beat me to it, but I'll post this, anyway.  Sorry if it overlaps at all.

First of all, you have your signs reversed.

< is less than
> is greater than

Now, what you'd do is create an event for the ore.  It'll be easier for me to just show you, then explain it step by step.
http://img361.imageshack.us/img361/1237/62233701on4.th.png[/img]

The outermost conditional branch controls whether or not the event works based on the timer.  The conditional branches under that are the scale of pickaxes like this:

Most effective
>True
>Else
  Second Effective
    >True
    >Else
      Third Effective
        >True
        >Else
          Least Effective
          >True
          >Else
              You don't have a pickaxe.

This way, you can have an upgrade option that increases the player's chances of mining ore.  Then the last conditional branch is deciding whether or not the player receives ore and the event finishes by setting the timer.  There are some issues with the timer and battles, so I'd recommend making the ores in a room without encounters and make sure you turn off the timer when the player leaves the room.  I hope this helps. :thumb:
 
Looks fine to me. Guardian's version also works if you want to have multiple pickaxes, but it's a bit more complicated.

Also, if you use the timer, it will show how much time is remaining, but if you have multiple ores in one room the timing will get messed up.

It's up to you which one you want to use, good luck anyway :smile:
 
You could replace the timer with another variable.  Set a second variable to 10 or whatever and have a parallel process event reduce the variable every x frames, then use a variable conditional branch instead of a timer.  That would probably work better, actually.  Just make sure to set the variable to 0 upon exiting the room.
 
@ Guardian1239: alright, this explains a bit. i hadnt thought about adding stuff like that, good to know.

@ Regi: i think i love you. you just taught me how to use switches in like one sentance without even trying to. thanks :] and thank you for explaining this, it would have caused me hell to go with an uber jacked up script version.
 
That's weird.  The timer has some issues in RMXP.  Try the variable idea.  You'll just need to create a separate parallel event like so:

Control Variable 2: -1
Wait: x Frames

Then, replace the timer conditional branch in the ore event with one that says "If Variable 2 is less than or equal to 0" instead of the timer being 0 and set the variable to ten instead of setting the timer after the player mines at the ore.  I hope that made sense...  Anyway, that should work better.
 
*sigh* sorry for all the trouble.

this is the timer technique, i perfer this one...
http://img.photobucket.com/albums/v463/lordnick5000/mine3.png[/img]

this should work flawlessly, the timer is less than 0 and i have the potion...

EDIT: GOT IT!
i tried doing the same thing, but "wording" it different. i dont know why it wasnt recognising it before, but it does now.if someone could compare these two and tell me what i did wrong.

http://img.photobucket.com/albums/v463/lordnick5000/mine4.png[/img]
 
It looks good, so there must be a problem with the timer operation.  Does the timer graphic disappear when it hits 0?

Note: You're not being any trouble.  I enjoy working on stuff like this.
Note2: It's "You got a Wall Ore!" not "You got an Wall Ore!"  Grammatical errors bother me, so I notice the little stuff like that. ^-^
 
No, the timer does not disappear, it pissed me off at first... any way to get rid of it after it hits 0? it pissed me off until i realised that i was using rooms specifically made for mining, with no enemies and that the player wouldnt notice. if it doesnt leave, thats fine, it will once they transfer maps. hopefully. crap. *goes to test*

lol, it was just a test, who the hell calls anything a "Wall Ore," and uses a potion to mine things out of the side of a house anyways? XD it was totally just a similation thing i made up to test it.
>_>
<_<
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top