Original Source
- Original title: Harvesting/Gathering System Without Multiple Variables
- Original author: YvetteJene
- Original date: January 6, 2016
- Source thread: https://forums.rpgmakerweb.com/threads/harvesting-gathering-system-without-multiple-variables.54404/
- Source forum path: Game Development Engines > RPG Maker Tutorials > RMMV Tutorials
Summary
Gathering System with No Variables Hello, everyone! After MV came out, I had been on the lookout for gathering and crafting systems and plugins for this specific editor. I came across this thread on Mining, Smelting, & Synthesis by Syndicate (which was super helpful,) and used it as a springboard for my own system. This one, however, does not rely on individual variables for each gatherable node. Instead, it relies on self-switches and script calls. I am by no means saying this way is better, only that I prefer to...
Archived First Post
Hello, everyone! After MV came out, I had been on the lookout for gathering and crafting systems and plugins for this specific editor. I came across this thread on Mining, Smelting, & Synthesis by Syndicate (which was super helpful,) and used it as a springboard for my own system. This one, however, does not rely on individual variables for each gatherable node. Instead, it relies on self-switches and script calls.
I am by no means saying this way is better, only that I prefer to forego the use of multiple variables. I think that it's hard to keep track of them all and, if for some reason you want to edit the order of your variables later, you have to also edit each individual event. If you aren't incredibly strict about where your variables go, you may not care to use this system, but that's okay!
The pros to this system are the lack of variables, and a simple common event to regulate all of your nodes across the game.
The cons are that you can have no more than 4 "swings" from each individual node, you can always get more items per swing if you wanted. For me, this works just fine because I won't ever need to get more than 3 from a node in my game. If you need a node that will give you 5 or more swings, you may need to use variables in your project.
So, without further ado!
-----
Things You May Want/Need
Here's the Project Download
Yanfly's Engine and Message Core Plugins
(For reward messages that use the \ni[x] message shortcuts.)
Vlue of Daimonious Tails Advanced Time System Plugin
(Used to respawn events in this tutorial at 6:00AM, but you can use any time system that allows you to do an if/else check if the time is right. This can be done with other plugins, or variables.)
If you don't know how to install plugins, and want to know, go here, to Yanfly's "How to Install Plugins" tutorial video.
-----
Gathering System with No Variables Step-by-Step
1. Create a New Project (if you want,) and a new map. I created two just to be sure that events would still respawn when I was on a different map.
2. Go to the "Cog" or Database Button and go to the "Items" tab. Create the items you need. You can use the ones I made as a guide. Make the tools non-consumable, just in case your PC accidentally uses it up--we don't want that...unless you DO, I don't know.
4. The first thing you do is add a Control Variable. Choose whichever variable you want to be the "randomizer." This will be the only variable you use, and even then it's not necessarily required. Set the variable to Random, 1-100.
5. Create a Conditional Branch with an "Else Branch," that checks to see if the Party has a Legendary Axe in their inventory.
8. Copy the Random Variable is >= 85 branch and paste it inside its own Else Branch. That is, NEST it. There's going to be a lot of nesting in this. This new conditional branch will instead check if the random variable is greater than or equal to 25, so change the 85 to 25 in this one. Also change the items gained to Maple, and the message to \ni[20]. Keep the self-switch to 'B'.
9. Do this one more time, copy and paste the branch into the else case of the >=25 branch, and make the random variable check for 2 or greater. Change the items to Branches, and change the message to \ni[19]. Again, keep the Self-Switch.
10. Lastly, to finish up the Legendary Axe Conditional Branch, put in the last branch (>=2) Else Case, a message that says "Got Nothing!" That means if they get less than 2, they get nothing!
To review, this is what we have done-- We created a branch to see if we had the legendary axe. If we DO, we check to see what the number from earlier was. If it was >=85, we get an apple, if it wasn't, we check if it was >=25, to get maple. If it wasn't, we check if it is >=2 to get branches. If it wasn't greater than 2, than it must have been 1! So that last 1% get's nothing.
This is what it should look like:
Again, inside the IRON AXE Else Branch, paste the same Legendary Axe Conditional Branch. Change this one to the RUSTY Axe. If we don't have the Legendary Axe, we check for Iron Axe, if we don't have the Iron Axe, we check for Rusty Axe. Hope this makes sense. Make sure to download the project to see what I mean, but here's a brief idea.
Play SE: Move1
If: Random Variable >= 85
Change Items: Golden Apple +1
Text: Got \ni[21]!
Control Self-Switch B = ON
Else: <If Variable is NOT >= 85>
If: Random Variable >= 25
Change Items: Maple +1
Text: Got \ni[20]!
Control Self-Switch B = ON
Else: <If Variable is NOT >= 25>
If Random Variable >= 2
Change Items: Branches +1
Text: Got \ni[19]!
Control Self-Switch B = ON
Else: <If Variable is NOT >= 2>
Text: "Got Nothing!"
End
End
End
Else <If Party does NOT have Legendary Axe>
If: Party has Iron Axe
Play SE: Move1
If: Random Variable >= 90
Change Items: Golden Apple +1
Text: Got \ni[21]!
Control Self-Switch B = ON
Else: <If Variable is NOT >= 90>
If: Random Variable >= 40
Change Items: Maple +1
Text: Got \ni[20]!
Control Self-Switch B = ON
Else: <If Variable is NOT >= 40>
If Random Variable >= 10
Change Items: Branches +1
Text: Got \ni[19]!
Control Self-Switch B = ON
Else: <If Variable is NOT >= 10>
Text: "Got Nothing!"
End
End
End
Else <If the Party Does NOT have the Iron Axe>
If: Party has Rusty Axe
Play SE: Move1
If: Random Variable >= 95
Change Items: Golden Apple +1
Text: Got \ni[21]!
Control Self-Switch B = ON
Else: <If Variable is NOT >= 95>
If: Random Variable >= 60
Change Items: Maple +1
Text: Got \ni[20]!
Control Self-Switch B = ON
Else: <If Variable is NOT >= 60>
If Random Variable >= 20
Change Items: Branches +1
Text: Got \ni[19]!
Control Self-Switch B = ON
Else: <If Variable is NOT >= 20>
Text: "Got Nothing!"
End
End
End
Else <If the Party Does NOT have the Rusty Axe, we assume they are BARE HANDED.>
Play SE: Knock <Because it sounds like a fist hitting the tree.>
If: Random Variable >= 85
Change Items: Maple +1
Text: Got \ni[20]!
Control Self-Switch B = ON
Else: <If Variable is NOT >= 85>
If Random Variable >= 35
Change Items: Branches +1
Text: Got \ni[19]!
Control Self-Switch B = ON
Else: <If Variable is NOT >= 35>
Text: "Got Nothing!"
End
End
12. Copy the Event page. Paste it. We will only make two changes-- One, make this page dependent on the condition of self-switch A. This way, self-switch A must be on to activate THIS page. In the Contents, make sure to add "Self-Switch A = OFF" underneath every Self-Switch B=ON. This way, when you go to Self-Switch B, you should turn off Self-Switch A! Kind of like this:
Play SE: Move1
If: Random Variable >= 85
Change Items: Golden Apple +1
Text: Got \ni[21]!
Control Self-Switch B = ON
Control Self-Switch A = OFF
Else: <If Variable is NOT >= 85>
If: Random Variable >= 25
Change Items: Maple +1
Text: Got \ni[20]!
Control Self-Switch B = ON
Control Self-Switch A = OFF
Play SE: Move1
If: Random Variable >= 85
Change Items: Golden Apple +1
Text: Got \ni[21]!
Control Self-Switch C = ON
Control Self-Switch B = OFF
Else: <If Variable is NOT >= 85>
If: Random Variable >= 25
Change Items: Maple +1
Text: Got \ni[20]!
Control Self-Switch C = ON
Control Self-Switch B = OFF
14. Do this ONE MORE TIME. Page 4 will be changing the dependency to Self Switch C, and changing the Contents to D=ON, and C=OFF.
15. Page 5, with a dependency on Self-Switch D, only has a message telling you there's nothing left to gain! Page 1 and 2 have the same full tree graphic. Page 3 has a slightly chipped tree graphic, page 4 has a teetering tree graphic, and page 5 has a stump. This will allow you to see the changes when you use the event!
16. We are done with the event!! It was a lot of work, but the cool thing is, we will never have to make another tree again! Remember the MAP ID number and EVENT ID number for the next part. In my case, the event was Map 1 and Event 1.
17. Go to the Cog again, to the Database, and this time, go to Common Events tab. Make it dependent on a Parallel Process Trigger. The Switch should be a switch you always plan to have on, or can turn on and off to allow the respawning of events as you choose. Name the Switch something like "Gathering Respawn".
18. Inside the Common Event, we are going to run another nested conditional branch. They are going to use Vlue's time system plugin, but you can do this any way you want. Whatever conditions you want met to respawn will go here. In this case, the conditional branches will use Script Calls.
19. When you have created a conditional branch with NO else case and selected Script Call on the last tab, put this inside of it: $gameTime.inBetweenHour(6,7)
This checks if it is after 6AM but before 7AM.
Inside this conditional branch, make another conditional branch with a similar script call that says: $gameTime.inBetweenMin(0,1)
Together, these branches continuously check if it is 6:00AM. This is when we want to have our gathering nodes respawn!
Inside both conditional branches, put a Script Call:
$gameSelfSwitches.setValue([1, 1, 'A'], true);
$gameSelfSwitches.setValue([1, 1, 'B'], false);
$gameSelfSwitches.setValue([1, 1, 'C'], false);
$gameSelfSwitches.setValue([1, 1, 'D'], false);
20. For every event you create, just copy and paste the Script Call into the Common Event inside the Conditional Branches, changing the map and event IDs to the event you want to reset. Where we save on Variables, we make up for in Script Calls! But this way, we can rearrange them however we like in any order, and not worry that it will effect the events themselves.
21: Go back to your map and create an event, like a bed, that will change the time to 5:55 AM. We choose this time because we want to see the event change at 6:00! To do this using Vlue's plugin, we create a plugin command that says "GameTime set x 55 5 x x x x" The "x's" are parts of time we want ignored, only 5 hours and 55 minutes matter! Another Plugin Command should be used after this one, "GameTime add day 1" -- This moves it to the NEXT DAY. :]
If you need an idea of how this works, check the tutorial project's campfire event.
22. SAVE!
23. Try it! When you enter the game, be sure that you enter the Debug menu by pressing F9 or FN+F9, and check to see your Respawn switch is ON. I don't know how many times I forgot this and thought I had messed up my script somehow. It won't respawn if the switch is off!
24. Chop down a tree using your bare manly hands and when it is completely a stump, or you have gathered 3 items from it, go talk to your time warp event and change time. At 6:00AM, it should have the tree pop back up!! If you only gather one item from it, it will still respawn as the first switch.
-----
So that's the GIST of it. If you want more events, all you have to do is copy and paste them where ever you want! Make sure to add the script calls to the Common Event so that they are affected by respawn. Check out the tutorial project to see how you can do this for Mining and Fishing, as well. It's the same principle! Just edit the pages to use different tools and get different materials.
The reason I used TWO MAPS, was to make doubly sure that my events were changing even when I was not on the same map as them-- and it works! You can leave the map and wait til 6:00AM passes and come back, they will still respawn as long as the Common Event Switch is on!
Another thing-- some of you may be wondering why the duplicate pages on the event. The reason I did this is because the time starts at 6:00AM in my game. The switch to reboot the nodes is not on, so the events would not set themselves to Self-Switch A using the reboot. HOWEVER, if you set a switch at the start of your game, you can have the reboot run right away and have self-switch A turn on right away as well. Doing this can free up a page. You could then turn switch A off, and have FOUR items come from the event instead. Hope that makes sense.
-----
If you have any questions about this, let me know. Again, I don't think that this is the only way to do this, and it IS a bit of work. However, I think that it is worth the effort to forego variables and keep things organized.
Hopefully this helps you somehow. Feel free to use this any way you want! Have fun!
Edit: Found a cosmetic mistake in the project, where Branches should have been Ruby lol. oops.
Downloads / Referenced Files
Log in, then follow the RPG Maker Developers Group to see these download links.
Log in to downloadCreator Claims / Removal
If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.
Replies (0)
No replies yet.
Topic Summary
Loading summary...