Line of Sight/Auras Without Plugins! - RPG Maker MZ Tutorial (Expert)

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ม.ค. 2025

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

  • @TheOdie
    @TheOdie  4 ปีที่แล้ว +9

    The copy/paste code can be found on my blog here:
    bit.ly/3tjDmpg
    Let me know if there's anything you're interested in learning :)
    Check out my development journey of a puzzle horror game:
    Dev Vlogs: bit.ly/3hx7h7X​
    Behind the Scenes: bit.ly/2LcTJCg

  • @claude-alexandretrudeau1830
    @claude-alexandretrudeau1830 ปีที่แล้ว +1

    I love these kind of videos, even if they are not as popular as they should be.
    I'm tired of people asking for plugins, because there is nothing to learn from their interactions in forums and YT.
    I want to use RPG Maker to make. And just like you, I learned from decade old tutorials.

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

      Absolutely! It's the best way to learn how the engine works and become an extremely efficient eventer!

  • @sikuaq1035
    @sikuaq1035 3 ปีที่แล้ว

    thank you! not only do i see this as an easy solution, i appreciate that you took the time to explain each variable and it's uses within the script

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

    Love this! Thank you for explaining this

  • @mamzugasti
    @mamzugasti 4 ปีที่แล้ว

    Amazing, actually what I was looking for, thanks for the vid and looking forward to code those circles of vision ^~^

  • @thomasung1700
    @thomasung1700 18 วันที่ผ่านมา

    I've come back to this video, still can't believe this good content hasn't been viewed more. It's been real helpful so thanks Odie.
    I thought I'd add to the box method line of sight. The trouble with the code in the video is: When you add the second direction condition -> it's not specific enough for the box view and it'll end up having the chaser detect in sort of like a sword line of site (like 2 side beams like a sword guards + then the sword itself.)
    For box vision where the line of sight is a rectangle in front of the user:
    Lets make say Variable 59 be the length or distance you want your chaser to see, Variable 60 be the width of the vision box.
    First condition:
    Math.abs($gameMap.event(this._eventId).y - $gamePlayer.y)

    • @TheOdie
      @TheOdie  18 วันที่ผ่านมา +1

      Thanks for dropping the comment! It's something I haven't found myself, but I'm sure others have. You certainly saved a lot of people from headaches 😀

  • @magiaOW
    @magiaOW 3 ปีที่แล้ว

    Thank you so much you saved me like 1000000+ hours!

    • @TheOdie
      @TheOdie  3 ปีที่แล้ว

      😁

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

    Is it possible to make the line of sight change while the enemy moves? I'm trying to make Persona-like enemies in my game but can't seem to find anything like it.

    • @TheOdie
      @TheOdie  3 ปีที่แล้ว

      Yup! The line of Sight will actually move with the event using what was made in this video

    • @kuddlycritiques
      @kuddlycritiques 3 ปีที่แล้ว

      @@TheOdie Ok, so I also want to make sure I’m doing something correct with the enemy’s event *after* they spot the player. Do you have an email or something I can use to send images on the event? The event seems to glitch out when following the event.

    • @TheOdie
      @TheOdie  3 ปีที่แล้ว

      Theopolisgaming@gmail.com
      Sounds like it may be switching pages on a switch but I'll take a look when you send me that

  • @xXBlackSilverXx
    @xXBlackSilverXx 6 หลายเดือนก่อน

    Thank you very much for the tutorial, it has been my first time dabbling in to scripting on my RPG Maker journey and your tutorial was quite digestible and thorough!
    If trying to make a mini-game where a guard NPC follows and searches for you in a set path- if I may ask, is there a to make it to where the guard has a linear line of sight that is tied to only spotting you in the direction the event is facing?
    Also, if possible, is there a resource that might provide how to implement a method of having the npc’s “vision” be obscured by objects?
    I know this is a lot to ask, and thank you deeply for what’s been given and more if you respond- even a direction to a helpful resource would be appreciated

    • @TheOdie
      @TheOdie  6 หลายเดือนก่อน +1

      Facing direction should be around the 9 min mark. You can find the timestamp in the descriptions.
      As for blocking objects, that gets complicated. I wouldn't recommend it if you're still new the engine. However, the idea is pretty simple once you get the hang of rpg maker. You'll want to assign a region ID to the blocking objects. Then, test if that ID is between the NPC and player by testing each space in between. It'll require a bit of Javascript code in conditional branches, similar to what we do in this variable.

    • @xXBlackSilverXx
      @xXBlackSilverXx 6 หลายเดือนก่อน

      ⁠@@TheOdie Thank you very much for the reply! If I might inquire just a bit further, would you happen to know of a good go to resource to start dabbling in region ID learning?
      For the facing direction question- is there a way to constrain it to where the player character is only spotted in the tiles in a line directly protruding from the event npc’s location as opposed to the full direction? Or maybe an easier way to put it is for the line vision script reading all 4 directions at once, is it possible to constrain it to one direction that the event is facing?
      Again, thank you very much!
      My apologies if that is ill worded and confusing..

    • @TheOdie
      @TheOdie  6 หลายเดือนก่อน +1

      @xXBlackSilverXx region IDs is that extra tab you see when putting tiles to the map. It's no more than tagging each tile with an ID number so you can refer to it with variables.
      For facing direction, it's using the conditional branch for which type of sight and which direction the NPC is facing. It should be in that section of the video. You can also find the code on my website in the descriptions

    • @xXBlackSilverXx
      @xXBlackSilverXx 6 หลายเดือนก่อน

      @@TheOdie Again, thank you very very much!

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

    I have been tested this sript but it can't make the event block Line Of Sight when facing obstacle. Line Of Sight should like that.

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

    Hi, thanks for the tutorial. Easy like and subscribe. (Just hope TH-cam algorithm doesn’t start thinking I want unskippable horror ads).
    The thing I’m struggling with is making objects/doodads break line of sight, as the aura in these cases go through trees etc. Static chasers are fine as I can just break up the facing direction condition into 4 separate conditional branches and do the ranges. But I want this for enemies with random movements. Having “safe spots” via specific tile events and region ID/map ID stuff to turn off switches is also not quite what I’m after.
    What I’m trying now is making the chaser fire invisible dummy projectiles that detects/initiates chase sequence if it they hit. But it feels a little clunky.
    Do you have a good solution for this?

    • @TheOdie
      @TheOdie  7 หลายเดือนก่อน +1

      Unfortunately, it isn't easy to do. I explained a similar situation to another commenter in this video not so long ago. It would require a bit of trigonometry, where you're making a triangle (diffX is length, diffY is height, and hypotenuse is the space between them). You'll be testing that difference one space at a time to identify if it's a blockage (you'll define them with region ID tags, i.e. region ID 1 are walls. If space has region ID 1, do not see the player). Overall, it'd be a lot easier with a plugin than to make via events. I'll touch upon this after I release my current project, Captive: You Are My Idol, since I did this in that game

    • @thomasung1700
      @thomasung1700 6 หลายเดือนก่อน +1

      @@TheOdie All good. I'll look for forward to it =)

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

    I'm a complete noob when it comes to writing script code for RPG Maker MZ but I'm wondering if there's a way to make it so an enemy NPC only sees you if they're directly facing you and are within say 2 tiles of the enemy. As of now the enemy event detects the player from the sides/back which isn't ideal. Using MZ3D to make the game 3D and have a maze where the character has to sneak past enemies but if caught start a battle. Then I can begin to try and figure out the Region ID thing so the 3D walls also block vision. Any help is greatly appreciated! :)
    Also I can take a short video to show what I'm working on if seeing it visually would help!

    • @TheOdie
      @TheOdie  7 หลายเดือนก่อน +1

      You'll want to use the facing direction & line vision conditions. If I didn't demonstrate that exactly in the video, you should be able to see an example of direction and one of the vision patterns used together in there. I also explain how to adjust the vision range.
      If the video is too lengthy for your preference, the code on my site in the descriptions is written there.
      Best of luck on your dev journey!

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

      @@TheOdie That did the trick, using two conditional branches first looking for direction and the second the line vision conditions, thank you so much! :D

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

    Will you ever do a tutorial on installing plug-ins? I've tried to find a tutorial on how to do it, and nobody is really dumbing it down for me >.< I'd really like to use CGMZ as well as Caster's other fantastic plug-ins (Caster is a plug-in creator for MZ: I'm saying I want to use the plug-ins from Caster's Trap lol, funny coincidence.)

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

      In general, installing a plugin is quite simple. Just drag and drop into your plugin folder inside the js folder. Then, go to the plugin manager (next to the database button), add the plugin, and turn it on. From there, it's reading their notes, a bit of trial and error to test what they say, and it'll eventually start to click.
      Overall, I won't be doing a tutorial on plugins as they're pretty simple to learn once you're ready to start using them. Instead, I plan to do plug-in showcases

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

    Do you have a way of making it so walls prevent line of site?

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

      It honestly gets extremely complicated. You use region IDs and must check if the wall is between the player and subject. I've made this in my current project Captive: YAMI. Here's the steps:
      1)Region ID the map's walls.
      2) Check if player is in subject's sight as in the tutorial
      3) Check if player is above, below, left, or right of subject
      4) Check if that region ID is between them.
      As you can imagine, it gets more complicated with different vision types. At this point, you'll want to find a plugin unless you're good at both trigonometry and rpg maker eventing

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

      @@TheOdie Thanks! I'll take a crack at it and see if I can get it working.

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

    Combining a few of the scripts you've listed here, I've made guards in my castle that function essentially like Pokemon trainers in the Pokemon gameboy games. If you pass directly in front of them, they start a battle processing. My problem is I also want it so you can just click on the guard and have it also start battle processing. Without using two events per guard and needing to change every instance of "(this._eventId)" to an actually event ID number, which gets tedious and I could miss one, is there and easier way to do this? Again, I want it so you can also still click on the event to trigger an effect.

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

      Hi! Shoot me an email and I can describe with screenshots. email at bottom of vid descriptions

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

      @@TheOdie I actually figured it out! Thank you! I have a video on my channel explaining how I took the code here and turned it into Pokemon trainer style. If anyone else is looking for that. I gave this video credit of course

  • @Xynteract
    @Xynteract 3 ปีที่แล้ว

    Thanks!

  • @destro4005
    @destro4005 10 หลายเดือนก่อน

    Can I Get This Sight Event's Gamefile?? It Looks Hard to Make It, You Know. X(
    If You Allow, I Will Write You On Credit!!

    • @TheOdie
      @TheOdie  10 หลายเดือนก่อน

      Sorry that game file is long gone. If you look on my website in the descriptions, you'll find the copy-paste code there.

    • @destro4005
      @destro4005 10 หลายเดือนก่อน

      @@TheOdie Oooah, Thank You For Reply, Actually, I Solve the Problem To Research Your Scripts Yesterday!!
      You Did a Great Work!! XD