RPG Maker MZ: Make a better mining system.

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ต.ค. 2024
  • In this video, we use Trihans tutorial as a base to make a better minning system in RPG maker MZ.
    Trihan: forums.rpgmake...
    See my website for RPG Maker Assets, consultation pricing and much more.
    lvlupdesign.my...
    Codes for the System.
    In the ore event.
    if ($gameVariables.value(1) === 0) $gameVariables.setValue(1, []);
    $gameVariables.value(1).push([this._mapId, this._eventId, 500]);
    In the common event have an conditional branch with an if statement.
    $gameVariables.value(1) !== 0
    And in that if statement, run the code.
    for (const oreData of $gameVariables.value(1)) {
    oreData[2]--;
    if (oreData[2] === 0) {
    $gameSelfSwitches.setValue([oreData[0], oreData[1], 'A'], false);
    $gameVariables.value(1).remove(oreData);
    }
    }
    If this is your first time on the channel seeing one of my videos then a huge 'Welcome to Level Up Design.' On this channel, I share tips and tricks, tutorials, and overall RPG related content. If you want even more knowlege on the general topic of game design then here are some of the books I read when studying games design in university.
    The Art of Game Design: A Book of Lenses, Third Edition - amzn.to/3zkOh5H
    Good game design happens when you view your game from as many perspectives as possible, and award-winning author Jesse Schell presents over 100 sets of questions to ask yourself as you build, play and change your game until you finalise your design.
    Rules of Play: Game Design Fundamentals - amzn.to/3OFeRw8
    A unified model for looking at all kinds of games, from board games and sports to computer and video games. As active participants in game culture, the authors have written Rules of Play as a catalyst for innovation, filled with new concepts, strategies, and methodologies for creating and understanding games.
    Any Amazon links in this description are affiliate links, meaning that if you decide to purchase something, LvL Up Design will earn a commission.

ความคิดเห็น • 83

  • @luminin3994
    @luminin3994 2 ปีที่แล้ว +3

    it keeps saying .remove() is not a function :(

    • @LvLUpDesign
      @LvLUpDesign  2 ปีที่แล้ว

      Are you using MZ or MV? I haven't tried this with MV.

    • @luminin3994
      @luminin3994 2 ปีที่แล้ว

      @@LvLUpDesign mv, but I don’t see why it wouldn’t work. Isn’t remove() a built in js function?

    • @LvLUpDesign
      @LvLUpDesign  2 ปีที่แล้ว +1

      I just made my self a coffee so I'll jump into MV and have a play around.

    • @luminin3994
      @luminin3994 2 ปีที่แล้ว

      @@LvLUpDesign thanks, let me know how it goes :)

    • @LvLUpDesign
      @LvLUpDesign  2 ปีที่แล้ว +6

      @@luminin3994 So I have messed around with it for the better part of an hour and .remove should be a normal js function but for some reason it's not working so I asked the original tutorial creator if he has any idea why. forums.rpgmakerweb.com/index.php?threads/how-to-create-respawning-resource-nodes-using-a-single-variable-and-a-common-event.144193/

  • @kainestolkyn
    @kainestolkyn 2 ปีที่แล้ว +38

    One thing you might want to consider doing is future videos is doing a preview of the finished product, meaning that demonstrate what it will look like when finished, and then start explaining from the beginning. That way, viewers will know if this is something they're interested in learning about. Great vid. Great explanation.

  • @bannedaccount586
    @bannedaccount586 2 ปีที่แล้ว +10

    A video series teaching new people how to code would be awesome you really seem to know your stuff and can break it down in a way thats easy to digest (the added comedic value is a plus too)

  • @AutMouseLabs
    @AutMouseLabs 2 ปีที่แล้ว +7

    Excellent tutorial. I am using code more and more in MZ and the more examples I get to dissect the better. Thanks for taking us to that next level.

  • @dfa_evans
    @dfa_evans 9 หลายเดือนก่อน

    These tutorials are actually so valuable as a new user. Incredible at explaining stuff!

  • @rainer1531
    @rainer1531 ปีที่แล้ว +2

    ok i did some research and found the following solution for MV users:
    create a document and add:
    Array.prototype.remove = function(element) {
    for (;;) {
    const index = this.indexOf(element);
    if (index >= 0) {
    this.splice(index, 1);
    } else {
    return this;
    }
    }
    };
    You save this as name.js in the plugin folder and activate it afterwards, the remove works perfectly

    • @cindybee1455
      @cindybee1455 ปีที่แล้ว

      Not all heroes wear capes XD saw this mentioned in the comments on the original site but had no idea how it was supposed to be implemented haha. thanks for this clarification!

  • @nightcoreparadise7531
    @nightcoreparadise7531 2 ปีที่แล้ว +1

    Your video, they all very good and useful for me. 🤩 Could you do some RPG Maker MV tutorials video pls ? 🥺

  • @steakdriven
    @steakdriven 7 หลายเดือนก่อน

    Wait. Doesn't pushing a value inside of brackets just create a nested array? [1.2,3].push([4]) becomes [1,2,3 [4]] does it not?

  • @luciamitsu2248
    @luciamitsu2248 2 หลายเดือนก่อน

    It's a old video but as a french fan of RPG Maker it helps me alot to understand even in english what you are talking about for scripts thank you alot !

  • @DH-tt3jw
    @DH-tt3jw 2 ปีที่แล้ว +2

    Very cool, I've learned over time what different javascript snippets do but never really understood them in a way that I could explain it to others as I was just trying things till it all worked for me. But now it actually feels like I have a genuine understanding of it, your explanations were very clear and I feel even someone who hasn't experimented with snippets would still be able to pick up and understand what you're saying. I would love to see more re-created tutorials, especially ones that cover snippets as they always expand the engine's capabilities in meaningful ways, everyone should be taking advantage of them. Also, thanks for being one of the couple youtubers that have helped me greatly in my adventure as an indie dev. You're a big inspiration to me and others in this somewhat niche community of rpg maker.

    • @LvLUpDesign
      @LvLUpDesign  2 ปีที่แล้ว +1

      Hey DH, Thanks for the comment. This is the reason I make videos like this because my overall goal with content creation on TH-cam is to build up the skillset and output of other Indie Devs. If my videos are a step in the direction to where people are releasing higher-quality games then I feel I've served my purpose.

  • @william.strebe
    @william.strebe 6 หลายเดือนก่อน

    mining with js looked like a blockchain tutorial hahaha until I saw the channel ofc

  • @jrdanlee
    @jrdanlee 7 หลายเดือนก่อน

    Could we have this run for hidden monsters that respawn?

  • @mauigamestudio
    @mauigamestudio 2 ปีที่แล้ว +1

    Great video. You could almost have titled the video about arrays, objects and variables... but mining is a bit more sexy

    • @LvLUpDesign
      @LvLUpDesign  2 ปีที่แล้ว +1

      Lets be real though, no one is clicking on a video about Arrays and Variables :P

    • @heroslegendstudios1658
      @heroslegendstudios1658 2 ปีที่แล้ว

      Look someone used a const! Lol

  • @shiroisekai_20
    @shiroisekai_20 ปีที่แล้ว

    sheeeeesshh

  • @StarlightBettaGamer
    @StarlightBettaGamer 8 หลายเดือนก่อน

    what if you wanted them to respawn only when reentering the map rather than a frame rate? so if you're dungeon crawling, you can only clear one level once of its items and will have to come back later to get them again, that way its not just infinite items in one go :0

    • @LvLUpDesign
      @LvLUpDesign  8 หลายเดือนก่อน +1

      Then I would just have the events exit event processing then when the player returns to the map, it should start the event processing again. No code needed for that one I believe.

  • @undyingunity6420
    @undyingunity6420 2 ปีที่แล้ว +3

    If you're using RPG Maker MV, and the array deletion part isn't working for you. I have found something that worked as a fix for me, however I'm not sure if there is anything wrong with it, so take it with a grain of salt. I ended up changing the line "$gameVariables.value(4).delete(oreData);" to "delete $gameVariables.value(4)[oreData];". Like I said this way worked for me, however I have no idea if it is the proper way.

    • @undyingunity6420
      @undyingunity6420 2 ปีที่แล้ว +1

      The reason why my game variable is set to the number 4 is because I am using a different variable slot from the tutorial, make sure to change yours back to 1 if you used the first variable!

    • @Petq011
      @Petq011 ปีที่แล้ว

      @@undyingunity6420 WTF!? That actually fixed it!
      Though I also, have pretty much no idea if it ends up ruining something else in the future... I guess we'll see.
      Please let me know if you've found out if it breaks anything, and if there's a better fix. thank you!

  • @renatofaria4167
    @renatofaria4167 2 ปีที่แล้ว

    Hello!!!! The system is amazing! Can you help with harvest herbs system? I tried to use the same system to do a herb collector, but did'nt work properly... Some of the events didn't appear in the map or didn't respawn.

  • @rayenrek2363
    @rayenrek2363 2 ปีที่แล้ว

    Dude... Can you make a tutorial on how we make a quest board system in RPG maker.

  • @Anim3ddicted
    @Anim3ddicted 2 ปีที่แล้ว

    Iirc, you could make this with the commands.
    Just use conditional branch, then control variable > script > "[]" and it will make the selected variable into an array...
    I might be wrong because I haven't touched RPG Maker in a while.

  • @jorgh.9889
    @jorgh.9889 2 ปีที่แล้ว

    First thing. Great tutorial!!! This can't described better than you have done.
    In my project I don't want to use frames for respawning. Because I have a day-change event when the player is resting at night. So I uses the oreData[2] item to count the day until it will respawn. But.... the loop for reset seems to skip array-items when another item was deleted from array. It's not a big deal, because it's a little more random which event respawns ;) ... but maybe some other watcher has this as a problem... and maybe another watcher has a solution :D
    But nevertheless, great video! great work! hope to see more stuff like that!

  • @Petq011
    @Petq011 ปีที่แล้ว

    So, I suppose this doesn't work in MV sadly?
    As I tried it just now and it shows: "SyntaxError Unexpected token ==="
    When I change it down to only one = on every place it has 3, it then shows "ReferenceError Invalid left-hand side in assignment".
    Any help with that, or is MV simply not capable of that for whatever reason?
    I have no plugins. It's a base new project. so it can't be a problem caused by some plugin.

    • @LvLUpDesign
      @LvLUpDesign  ปีที่แล้ว

      Yeah Mv has different case in its base engine which effects script calls. I think I got a response I posted in one of the comments here from Trihan but that was about the .remove function, not ===. Try two =

    • @Petq011
      @Petq011 ปีที่แล้ว

      @@LvLUpDesign I also tried it in a demo version of MZ but it also gave an error there.
      Okay, I will redo the whole thing again on MV with two = just in case to see if that fixes it. Thanks for the response!

    • @Petq011
      @Petq011 ปีที่แล้ว

      @@LvLUpDesign Okay, It was apparently some sort of a mistype on my part the first time.
      I copy-pasted everything, and now I can mine the event, and it starts processing the common event until the "time/500 frames" runs out.
      When the time runs out and it gets to the last line it gives an error:
      TypeError
      $gameVariables.value(...).remove is not a function
      But I know it's a function, I've used it before...
      And I copy/pasted it, can I really mess it up THAT badly? 😅🤣

    • @Petq011
      @Petq011 ปีที่แล้ว

      @@LvLUpDesign, Oh, so it's probably the same?
      I guess I will look into the comments to see if there is and what is the fix to that, as my problem is the .remove function currently apparently.

  • @REJEXCOLLECTS
    @REJEXCOLLECTS 2 ปีที่แล้ว

    Weird question. I'm wanting to make a game where it's 16 bit jrpg style but when you encounter an enemy, the combat system is like the game "worms" or "pocket tanks" style. Is that possible in this engine. I'm trying to think wich engine to design something like this.

    • @LvLUpDesign
      @LvLUpDesign  2 ปีที่แล้ว +1

      You'd be better off using game maker or unity, something that can handle physics.

  • @DJVibeDubstep
    @DJVibeDubstep ปีที่แล้ว

    Is MZ basically MV, but better? Like does MZ have everything MV has but more? MZ is basically an expanded MV? I have MV but if MZ is basically MV but better I’d consider upgrading to MZ.

    • @LvLUpDesign
      @LvLUpDesign  ปีที่แล้ว +1

      Depends on where your project is upto. MZ is the next iteration in the maker engine from MV, so MZ does have more. But if you're half way through an MV project, you're better to finish that first and do your next project on MZ. Also, RPG Maker Unite is coming out soon which will be a toolkit built ontop of Unity, so really, it all depends on what you want for your game.

    • @LvLUpDesign
      @LvLUpDesign  ปีที่แล้ว +1

      I've got this video on the topic. th-cam.com/video/dNpdlcN2998/w-d-xo.html

    • @DJVibeDubstep
      @DJVibeDubstep ปีที่แล้ว

      @@LvLUpDesign I haven't started my MV project yet. I've only started creating and gathering resources for it for awhile now. So I bet MZ would be the better option? Unless with unite I can sell my game on consoles too and not just Steam because it's built in Unity, right? If so I must just build it with Unite to save me the hassle of porting/publishing.. even though learning Unity engine and not the simple RPG Maker engine is a different beast.
      And just to be clear, I can sell my MV/MZ games on Steam? No need to worry about "porting" or whatever like you do with consoles?

    • @LvLUpDesign
      @LvLUpDesign  ปีที่แล้ว +1

      @@DJVibeDubstep Yeah you can sell your MV/MZ games on steam. And console ports should be way easier with Unite, but we'll have to wait till it comes out to see the full potential.

    • @DJVibeDubstep
      @DJVibeDubstep ปีที่แล้ว

      @@LvLUpDesign Alright great! Now I think I'll just make the game with MZ and sell it on Steam; and if it does well enough porting it won't be a problem anyway!
      2-3+ years of development expected for this project. I aim to make it unrecognizable that it's been made in an RPG Maker engine.
      I just love it's simplicity.
      Thanks!

  • @dummythickcephalon2591
    @dummythickcephalon2591 2 ปีที่แล้ว

    i like you an all but the epic thing was a bit too much, love your content tho

  • @heroslegendstudios1658
    @heroslegendstudios1658 2 ปีที่แล้ว

    Great video! Alot of great code here for improving RPG Maker Events! Although there could be a big performance issue if there was probably around 50+ ores maybe on weaker machines 20+ ores as the for loop is occurring every frame.

    • @LvLUpDesign
      @LvLUpDesign  2 ปีที่แล้ว +2

      Good point! You could tie it to a time system that only runs a loop every second or every minute depending on what result you were after.

  • @owarida6241
    @owarida6241 2 ปีที่แล้ว +1

    Wow you explained those codes better than my programming professor.

    • @LvLUpDesign
      @LvLUpDesign  2 ปีที่แล้ว

      I wanted to make sure each are of the code was well explained, even if it did push the video time up.

    • @owarida6241
      @owarida6241 2 ปีที่แล้ว

      @@LvLUpDesign your videos just got suddenly recommended to me yesterday and Its been my long lost dream of making an RPG game when I was just freshman college. Already bought the RPG maker MV+MZ bundles yesterday and been marathoning all of your videos, I'll be sure to buy your assets very very soon as a symbol of appreciation and good will once I'm in a good level of proficiency with the software, thank you for inspiring me.

    • @LvLUpDesign
      @LvLUpDesign  2 ปีที่แล้ว

      @@owarida6241 Yeah, I hit 10k subs last month and my Analytics have been up 40% ever since, so I think YT is just showing my channel to more audiences now. Hope I have my assets finished soon. Have spent 3 months trying to make them :p

    • @owarida6241
      @owarida6241 2 ปีที่แล้ว

      @@LvLUpDesign keep up the good work 👍.

  • @illyont
    @illyont 2 ปีที่แล้ว

    Thank you! I've been looking for days trying to find a decent way of doing this without using a bunch of not really useful plugins without documentation. MZ is probably too new still and because of that lacking a bit compared to some of the older versions.

    • @LvLUpDesign
      @LvLUpDesign  2 ปีที่แล้ว

      The good thing is this isn't just with mining. Any time you want to store multiple bits of information somewhere, you could use this method to use an array to store it. There are loads of possibilities.

  • @jobe_gryant152
    @jobe_gryant152 2 ปีที่แล้ว

    Thanks for adding the codes and the explanation. This makes RPG Maker MZ way more functional. I feel limited using the original contents and this adds RNG to the content.

  • @RebellonRM
    @RebellonRM ปีที่แล้ว

    Great script. It is also suitable for respawning monsters. Is it possible to somehow change it to add animation of plants growing in the garden?

    • @Zamoksva
      @Zamoksva ปีที่แล้ว +1

      Yes add a B switch and write this > for (const harvesting of $gameVariables.value(1)) {
      harvesting[2]--;
      if (harvesting[2] === 0) {
      $gameSelfSwitches.setValue([harvesting[0], harvesting[1], 'B'], false);
      $gameVariables.value(1).remove(harvesting);
      }
      if (harvesting[2] === 500) {
      $gameSelfSwitches.setValue([harvesting[0], harvesting[1], 'A'], false);
      $gameSelfSwitches.setValue([harvesting[0], harvesting[1], 'B'], true);
      }
      }
      Note that your initial number in your main srpite should be higher than 500

  • @mathiasbisaillon-leblanc2940
    @mathiasbisaillon-leblanc2940 ปีที่แล้ว

    Thank you it was really helpful!

    • @LvLUpDesign
      @LvLUpDesign  ปีที่แล้ว +1

      Glad it was helpful!

  • @chaseyou2573
    @chaseyou2573 2 ปีที่แล้ว

    Love your videos! Btw can you make a video about clothing and armor system? Like you'll be wearing nothing if you don't have any armor/clothes on and when u equip one, you can actually see your character wearing it. Just a tip would do too!

    • @LvLUpDesign
      @LvLUpDesign  2 ปีที่แล้ว +1

      The only way to do that would be to have a different sprite for your character wearing the different armours, and change the sprite whenever a new armour is equiped.

    • @chaseyou2573
      @chaseyou2573 2 ปีที่แล้ว

      @@LvLUpDesign Yeah I figured it out, thanks tho!

  • @godsend1112
    @godsend1112 2 ปีที่แล้ว

    Will this work on events on maps that you are not currently visiting? Right now I have a mining system that uses way too many switches and variables, and a common event that counts time and after so many in game days respawns the events even when you aren't on the map, obviously a player isn't going to hang around the same map for very many in game days waiting on minable resources, especially as my in game time is every 120 frames equal 1 minute. So I would like to use this to respawn the mining spots without the player having to be on the same map as the events.

    • @LvLUpDesign
      @LvLUpDesign  2 ปีที่แล้ว +1

      Yep. It's all controlled by the common event which will identify the exact map and event

    • @godsend1112
      @godsend1112 2 ปีที่แล้ว

      @@LvLUpDesign very cool. Thank you for the reply. love your videos, lots of helpful ones.

  • @mollyoglesby5149
    @mollyoglesby5149 ปีที่แล้ว

    I keep getting the error, "$gamevariables.value(...).remove is not a function" T__T Please help

    • @LvLUpDesign
      @LvLUpDesign  ปีที่แล้ว

      I'm guessing you're using MV?
      I'm not sure how much about coding you know but I did ask Trihan about this and he just responded to me the other day.
      forums.rpgmakerweb.com/index.php?threads/how-to-create-respawning-resource-nodes-using-a-single-variable-and-a-common-event.144193/page-2#post-1321935

    • @mollyoglesby5149
      @mollyoglesby5149 ปีที่แล้ว

      @@LvLUpDesign I know absolutely nothing about coding :D Which is why I love and appreciate your videos so much! I will look into this link. Thank you very much for posting it. (and yes, I'm using MV)

  • @steakdriven
    @steakdriven 7 หลายเดือนก่อน

    CONST in a for loop????

  • @rainer1531
    @rainer1531 ปีที่แล้ว

    hello my english is not good but this video is very good but i become a error message " Type Error "
    $game.Variables.value(...).remove is not a function
    Can any help me please (i am german) i have rebuilt this video 1:1 and after 500 frames i become this error i use RPG maker MV

    • @Zamoksva
      @Zamoksva ปีที่แล้ว

      hey do yo u still have difficulty with your game, I can help

    • @Zamoksva
      @Zamoksva ปีที่แล้ว

      If you are using MV and not MZ this is probably why

  • @travisenglish8033
    @travisenglish8033 2 ปีที่แล้ว

    Will this work for MV?

    • @LvLUpDesign
      @LvLUpDesign  2 ปีที่แล้ว

      Not quite sure, maybe, but some of the code might be different.

  • @Idlemage
    @Idlemage 2 ปีที่แล้ว

    I followed all the code correct but my nodes dont respawn am I missing something?

    • @LvLUpDesign
      @LvLUpDesign  2 ปีที่แล้ว

      Have you turned on the parallel common event buy making sure the switch is turned on?

    • @PenguinCinema
      @PenguinCinema 2 ปีที่แล้ว +1

      yes

    • @Idlemage
      @Idlemage 2 ปีที่แล้ว

      @@LvLUpDesign switch A is set to on

    • @LvLUpDesign
      @LvLUpDesign  2 ปีที่แล้ว

      Self switch A should be switched off by the code when oreData[2] ===0

    • @LvLUpDesign
      @LvLUpDesign  2 ปีที่แล้ว

      Try copying and pasting the code directly from the description.