Direction Based Line of Sight Events

The Infamous Bon Bon

Executive Geek
Veteran
Joined
Mar 13, 2012
Messages
850
Reaction score
410
First Language
English
Primarily Uses
Introduction

I made this mostly for touch encounter games to help add a little personality to the touch encounters. I also think that this can be utilized for puzzles and stealth missions in games.


This tutorial was made with the default scripts. There may be incompatibility with some scripts, particularly pixel movement scripts in which case you would have to completely rewrite the Conditional Branch script calls using the syntax of those scripts. Another that comes to mind would be an 8 directional movement script in which case you may need to take the concepts presented here and expand them to include the additional directions.

You can download the project file here. I recommend you play through the test game to get a feel of the events before you read the tutorial.

Glossary of Terms used in Script Calls


*Note: I am not a scripter and have a limited understanding of RGSS3, so if I got any of the descriptions wrong, I will not be offended if you correct me in the comment section below.
$game_map.events[@event_id] - this is used to get information about the currently running event @event_id is the same as saying this event if you need a specific event on a map just use it's event id number which is displayed in the upper left hand corner when you edit the event.

$game_player - this used to get information about the player

(compared values).abs - is used to get the absolute value between them. Absolute values are always positive.
Some uses:


$game_map.events[@event_id].x - this gets the X coordinate value of the currently running event's position on the map

$game_map.events[@event_id].y - this gets the Y coordinate value of the currently running event's position on the map

$game_player.x - this gets the X coordinate value of the player's position on the map

$game_player.y - this gets the Y coordinate value of the player's position on the map

$game_map.events[@event_id].direction - this gets the value of which direction the currently running event is currently facing.

$game_player.direction - this gets the value of which direction the player is currently facing

Direction Key:

  • 2 is down
  • 8 is up
  • 4 is left
  • 6 is right
&& - when used between to conditions basically means "and". If there are multiple && used then all conditions must be met.

|| - when used, is basically a line break and can be said to be the same as "or". If this is used in a conditional branch script call that means any of the conditions will be enough to satisfy the conditional branch.
The X/ Y Coordinate Plane and Relative Values


In mathematics the X axis is horizontal and the Y axis is vertical and is generally written as (x,y). This is true in RPG Maker as well and you can see this in the bottom right hand corner of the map editor. In RPG Maker coordinate (0,0) is in the upper left hand corner which means as you go right from (0,0) the X value increases and as you go down from (0,0) the Y value increases.
A relative value compares two objects on a coordinate plane and finds the difference between them. This tutorial utilizes this and also uses script calls that use less than and greater than X and/ or Y comparisons to determine where an object is relative to a different object.



I'll use the above image to illustrate some examples:
  • the X value of the spider is less than the X value of Ralph
  • the X value of the scorpion is greater than the X value of Ralph
  • the Y value of the bat is less than the Y value of Ralph
  • the Y value of the hornet is greater than the Y value of Ralph
Part 1: Four Simple Line of Sight Examples


In the first three of these after the conditions are met (the event sees the player), the player is transferred from the room. I did this mostly for testing purposes and because once the player is in range the event will keep going off until the player is out of range, which you should keep in mind when using this. You can replace the Transfer Player and Show Text with whatever, like a Battle Processing command (an example of this is provided in Part 2).
Also all three of these events use a similar set of conditional branches as the one below to display the animation seen in game test mode.






Nothing special and can be erased if you don't want to give the player a visual cue. These are really simple animations I made with an image taken from one of the RTP animations (can't remember which one now), so if you want to use it go ahead.




In all three of these events there are two conditional branches used. The first conditional branch defines the range and the second conditional branch provides the limitations based on the direction the event is facing. The Script Calls for the Conditional Branches can't be seen of course so they are expanded and explained below, but the second conditional branch is the same for all three:



This script call checks which direction the event is facing and if the player is in the relative correct direction from the event, this condition is met. For example if the event is facing right (.direction == 6) and the player's x coordinate is greater than the event's (aka to the right of the event) this condition will be satisfied. If you use a less than/ greater than or equal to sign on the second part of each possible condition the range is changed.

Note that all of these are parallel process events. They are also just script calls, so no variables need to be changed. Remember these are pretty bare bones. You can add a lot of eventing to this to make puzzles rooms, stealth missions, more interesting touch encounters, etc.

1) Triangular Line of Sight Event





The First Conditional Branch's Script Call:



This script call compares the player's x coordinate and the event's x coordinate along with the player's y coordinate and the event's y coordinate on the map and then adds them together to determine how far the player is from the event. It is currently set to 1 which mean this conditional branch is satisfied when the player is within one square of the event. This is separated out so you can easily adjust the range of the event's line of sight.



If used without any other conditions this is what the event's line of sight will be depending on the value that you use. Kind of handy if you have an event that doesn't need to be facing a specific direction to see the player. If set to 2 the event can see all squares marked 1 and 2. If set to 3 the event can see all squares marked 1, 2, and 3.

The Second Conditional Branch Script Call:

With both conditions combined this is what the event's line of sight is (when facing right):




Notice I used a greater than sign and not a greater than or equal to sign if you do this is what the events line of sight ends up being:



This can be used if you want to give the event peripheral vision.
2) Basic Line of Sight Event





This event is similar to the previous one, but the first conditional branch is different.

The First Conditional Branch Script Call:



This script call evaluates whether one of two possible conditions is met:

  • by comparing the event's Y coordinate with the player's Y coordinate and if the absolute value between them is less then the defined range (in this example 3) and if the event's X coordinate is the same as the player's X coordinate
  • by comparing the event's X coordinate with the player's X coordinate and if the absolute value between them is less then the defined range and if the event's Y coordinate is the same as the player's Y coordinate
then the player is within range, here is how it looks:



The Second Conditional Branch Script Call:

Combined, this is what the range ends up looking like, when facing right:




When you use an or equal to sign then this is what the line of sight for facing right is:




3) Wide Line of Sight Event





The First Conditional Branch Script Call:



This is similar to the Basic LoS script call, but the second part of either condition has been changed from the X or Y having the same value to being within 1 which makes the LoS wider. Its not suggested that you make the second parts value higher than the first parts because this makes for some weird line of sight. This is what it looks like without the second conditional branch with its current settings:




The Second Conditional Branch Script Call:

Combined, this is what the range ends up looking like, when facing right:




When you use an or equal to sign then this is what the line of sight for facing right is:





4) Not Touching Event


Just a basic recover party on touch, but with a Self Switch A command.




This script call checks to see if the player is touching the event and when the player isn't the Self Switch A is turned Off, returning it to the yellow magic circle graphic.
Part 2: Complicated Line of Sight Examples
These four examples combine the Simple Line of Sight Examples or use more complicated lines of sight with eventing to provide various effects. Its assumed that you read Part 1 because I won't be explaining concepts from that part again.
1) Chase/ Tag Event

This event varies from the others because it was made to move. This event could be used for kids playing tag with the player for example and other things. Let's look at the parts:




This uses the Wide Line of Sight script calls, and if the player is in range, the event will move towards the player after speeding up. If the player isn't in range the event will return to normal speed and go back to moving randomly. I did it this way so the player could run out of the event's range and the event would stop pursuing.



This utilizes the Triangular Line of Sight script calls with the Range script call set to 1. This is just like the earlier Triangular Line of Sight example.
2) Assassination Event





This is just the Basic Line of Sight example from Part 1.

The basic purpose of this section is to allow the player to hit the C Button (usually Enter, Space Bar, Z) and the player can attack from behind or from the side. I separated these out so you could do different things, but I was being lazy so they both do the same thing.
The first conditional branch is a simple button press conditional branch.
The second conditional branch uses the Triangular Line of Sight Range script call, but this time the Range is actually the player's range and not the event's.
The third conditional branch determines whether the player is behind the event, of course you can't see it:

When the event and the player are facing the same direction and are within one square of each other (because of the second conditional branch), then one is behind the other, which is why the third part of each condition checks that the player is behind the event.
The fourth conditional branch determines whether the player is to the side of the event, here it is:

When the player is facing the event and within one square, if the player is facing a perpendicular direction then this is satisfied.
Of course when all of this is satisfied the Self Switch A is turned on, which triggers page 2 of the event:

This page is all about the enemy dying visually on the screen.

First it shows an animation. I created the animation from the slash and darkness animations, so feel free to use this if you want to.
Then we have a series of conditional branches. These check which direction the player is facing so that the event has the appearance of being knocked back while the animation is playing.

This is just a move route that turns the image on and off to give the blinking effect on the screen. If you use a different animation you might extend or shorten this to go with the animation.

At the end it turns Self Switch B on and A off which brings up the 3rd page which is blank, so the event no longer matters. Turning Self Switch A off in this event makes it easier to turn the event back on with the transfer from the room event.

This is a standard transfer event with a script call added which can be used to turn the event back on as the player leaves the room. The example here is set for map id 1, event id 3, it effects Self Switch B, and the false turns the switch off.
Its handy particularly for puzzles/ touch encounters you want to reset when the player leaves the room or if you want, you can use this to create a reset switch in the room as another example.
3) Surprise Battle Event


This event uses line of sight with a particular emphasis on the direction the player and event are facing when the range condition is satisfied. It will show a different Balloon Icon on the player or event depending on whether the event and player are facing each other when the battle is initiated, one initiates the battle on the other from behind, or one initiates the battle from the other's side. The Wait command is used primarily to give the appearance that the player and event are closer together when the battle transition actually occurs, basically its a timing issue that I thought looked better, on screen, by adding a little wait.
This also differs from all the other examples in that it actually uses switches and variables and has components in the database (other than animations), such as Troops, Enemies, and States tabs.
I'll start by explaining the conditional branches and show the relevant database tabs afterwards.
The Conditional Branches


The main conditional branch is just the triangular line of sight range script call that is the basis of this whole event page. Now the other two are checking whether the player is sneaking up behind the enemy or vice versa. I added comments to these in my event example to help keep things organized. When you have this many nested conditional branches I would highly recommend you do so.

This is a similar to the Assassination Event above, but if you'll notice the sign are reversed in the third part because this is checking if the event is sneaking up on the player. If this condition is met then the switch I used [0101: Surprised] is turned on and the Ballon Icon appears over the player.

This is exactly the same as the script call in the Assassination Event. If this condition is met then the switch I used [0102: Pre-emptive Strike] is turned on and the Ballon Icon appears over the event.

These conditional branches are checking whether the player initiates combat from the side of the event or vice versa.

This is similar to the Assassination Event's script call, but the signs in the third part are reversed because this is checking if the event initiates combat from the player's side and if the conditions are met the Ballon Icon appears over the player. Also if the conditions are met then a random number from 1 to 100 is assigned to Variable [0101: Random Number] and the immediately following conditional branch checks to see if the variable is below the value set (this example is 50). If it is then the Switch [0101: Surprised] is turned on.

This is just like the check in the Assassination Event, which is checking whether the player is initiating battle from the event's side and if the conditions are met the Ballon Icon appears over the event. Also if the conditions are met then a random number from 1 to 100 is assigned to Variable [0101: Random Number] and the immediately following conditional branch checks to see if the variable is below the value set. If it is then the Switch [0102: Pre-emptive Strike] is turned on.


This conditional branch is checking if the player and event are facing each other when battle is initiated. If so the Ballon Icon appears over the player, but you could have it appear over the event or both if you so desired.
All of these turn of Self Switch A which leads us to page 2 of the event.

This is just the Battle Processing and after the battle the event blinks in and out then shuts its self off similar to the Assassination Event.
The Database Changes

So with the conditional branches I turned on switches depending on how the player and event were oriented when battle was initiated. Here is why:

This troop page is triggered by Switch [0101: Surprised] being on. First, it adds the state Surprised (shown further down) to the entire party. Then, using Show Text displays the message "The party is surprised". Finally, it turns off the switch to clear it out.

Similar to the one above, this troop page is instead triggered by Switch [0102: Pre-emptive Strike] being on. First, it adds the state Surprised to the entire enemy troop. Then, using Show Text displays the message "The enemy is surprised". Finally, it turns off the switch to clear it out.
Note: You will have to add these to each of the troops that you want affected by this. This gives you a lot of flexibility if you want to utilize this to have different states or forced actions per troop. If you want this to happen with all your troops, I would suggest finding a Base Troop script. There are a lot of different versions, so find the one that suits you.

This is the state Surprised that I created. It has a Restriction of Cannot Move and adds some negative Features. It is set to go away at the end of turn in one to three turns. Of course you are welcome to make the Surprised state however you want.

Now if you played with the Test Game for a bit you may have noticed the Bat enemy is never surprised, that is because one of its Features is State Resist (Surprised). This is one of the advantages of using a state to add surprise because you can make enemies and actors resistant to the Surprise state, which can give you some extra flexibility.
4) Zapper Event


This event uses a the Basic Line of Sight with the Range set to 5. When the player is in range an animation will play to indicate that the player was damaged and the entire party takes a little damage. The damage is set low because the damage will occur each time the parallel process cycles through. The 2nd page is blank with a Condition: Self Switch A On and the crystal graphic. When this page is active the event is essentially off.

This event shows an animation, followed by a wait of 20 frames to give the animation to complete. Then it uses the script call described in the Transfer Event of the Assassin Event above to turn the Self Switch A of the Zapper Range event On, which turns the event off. Next it waits 45 frames to give the player a chance to get past unharmed. Finally it uses the script call again to turn the Zapper Range event back on by changing it's Self Switch A Off again. The 2nd part is the same as the first with a different animation.
I hope you found the examples helpful. Feel free to ask any questions you may have.

I've gotten the question a few times so to clarify:  You can use this system/ script (whatever you consider it) in commercial and non-commercial games free of charge as long as you give me credit.  So enjoy. 
 
Last edited by a moderator:

NO!

Adventurer
Member
Joined
May 15, 2012
Messages
221
Reaction score
10
First Language
Cymraeg
Primarily Uses
This does sound very interesting, but when I try test playing the demo, it keeps saying it cannot find graphic 'CrystalSquished'. Now, I've looked at each of the events, and also changed the graphics for the custom animations you had on there, but it still keeps coming up the same. Which event uses that particular graphic?
 

The Infamous Bon Bon

Executive Geek
Veteran
Joined
Mar 13, 2012
Messages
850
Reaction score
410
First Language
English
Primarily Uses
@ The Welsh Paddy - 'crystalsquished' is the graphic for the damaging light beam crystals. I don't know why that didn't get put in the graphics folder. Try downloading again and I will also post the graphic here when I get home (about 10 hours from now). <-- I lied sorry.

Has this happened for anyone else?
 
Last edited by a moderator:

NO!

Adventurer
Member
Joined
May 15, 2012
Messages
221
Reaction score
10
First Language
Cymraeg
Primarily Uses
Ah, I actually figured that out yesterday. :D I think I've been up late a bit much lately and must've missed it. So yeah, I just changed that graphic and it works well, and it really helps me understand the tutorial you wrote. It is a very fun system, and from branching out from your examples, I've managed to come up with some very neat stuff for my project. :) Monsters attempting to flee if your level is too high... Pickpocketing NPCs, NPCs Pickpocketing you and then having to chase them down to get your stuff back...
 
Joined
Jun 26, 2012
Messages
209
Reaction score
9
First Language
English
Primarily Uses
Notice I used a greater than sign and not a greater than or equal to sign if you do this is what the events line of sight ends up being:


This can be used if you want to give the event peripheral vision.
@TIBB know this is all about scripting.. but i wanna know how did this happen :D

So if we use a greater than and equal to sign then nothing should happen because... lets suppose we use a greater than and equal to sign for Right side of x axis or "6" ....

So if we use it then this means that if the player's x coordinate is higher than or equal to EVENT'S X coordinate then conditions are met...

BUT equal to would mean the TILE.,, right?? the EVENT is on... so we can't go on that tile.... so it'd be useless??If u can explain it, it'd be very helpful :(



I'll use the above image to illustrate some examples:

  • the X value of the spider is less than the X value of Ralph
  • the X value of the scorpion is greater than the X value of Ralph
  • the Y value of the bat is less than the Y value of Ralph
  • the Y value of the hornet is greater than the Y value of Ralph
I don't know if i am right... But i think it should be " the Y value of hornet is less than Y value of ralph because its on the negative side???? right????

EDIT:- OK now i got the first part... no need to explain, now i understand.. :D

It was an AWESOME tutorial dude.... U explained the script calls so nicely that now i actually know what those calls did.... Finally the first tutorial i see which explained the script calls......

Now I don't need to think... "How did this happen and that" :D

IT was very cool. Thanx for posting this :D
 
Last edited by a moderator:

The Infamous Bon Bon

Executive Geek
Veteran
Joined
Mar 13, 2012
Messages
850
Reaction score
410
First Language
English
Primarily Uses
Ah, I actually figured that out yesterday. :D I think I've been up late a bit much lately and must've missed it. So yeah, I just changed that graphic and it works well, and it really helps me understand the tutorial you wrote. It is a very fun system, and from branching out from your examples, I've managed to come up with some very neat stuff for my project. :) Monsters attempting to flee if your level is too high... Pickpocketing NPCs, NPCs Pickpocketing you and then having to chase them down to get your stuff back...
This is what I was hoping for, so this made me very happy.

Just in case anyone has any issues here's the 'crystalsquished' graphic.



Nothing fancy just the crystal graphics from the RTP shrunken.



I'll use the above image to illustrate some examples:

  • the X value of the spider is less than the X value of Ralph
  • the X value of the scorpion is greater than the X value of Ralph
  • the Y value of the bat is less than the Y value of Ralph
  • the Y value of the hornet is greater than the Y value of Ralph
I don't know if i am right... But i think it should be " the Y value of hornet is less than Y value of ralph because its on the negative side???? right????

It would seem to be the logical assumption, especially if you spent a lot of time in advanced mathematics, but this is how RPG Maker does it. If you are making a map you will notice the coordinates in the lower right hand of the screen do this. It is hard to remember, so I use that to remind myself sometimes.

I'm glad this is useful for so many people and thank you for the comments. :)

If I missed answering a question just ask again, sometimes I miss the most obvious things (which is why is took so long to write this tutorial).
 
Last edited by a moderator:

LazyViking

Warper
Member
Joined
Oct 21, 2012
Messages
4
Reaction score
0
First Language
Norwegian
Primarily Uses
i am fully aware that this is gonna be a super necro post... i'm sorry but i realy need help with this one: 

when i set the wide line of sight, with:

1 conditional branch: 

($game_map.events[@event_id].x - $game_player.x).abs <= 1 &&

($game_map.events[@event_id].y - $game_player.y).abs <= 3 ||

($game_map.events[@event_id].y - $game_player.y).abs <= 1 &&

($game_map.events[@event_id].x - $game_player.x).abs <= 3

2. conditional branch:

$game_map.events[@event_id].direction == 2 && $game_map.events[@event_id].y < $game_player.y || 

$game_map.events[@event_id].direction == 8 && $game_map.events[@event_id].y > $game_player.y || 

$game_map.events[@event_id].direction == 4 && $game_map.events[@event_id].x > $game_player.x ||  

$game_map.events[@event_id].direction == 6 && $game_map.events[@event_id].x < $game_player.x
according to the tutorial the LOS is supposed to be like this


but the LOS i get in my game is:
wich is the LOS i am supposed to get if i use "an or equal to sign" wich in that context, i have no idea what is... someone please help me :p i realy need this
 

The Infamous Bon Bon

Executive Geek
Veteran
Joined
Mar 13, 2012
Messages
850
Reaction score
410
First Language
English
Primarily Uses
I personally have no issue with the necropost and I'm sorry I haven't been active lately, so I didn't respond sooner.

Were you able to resolve the issue already?
 

Khaz

Learning Game Maker
Veteran
Joined
Dec 11, 2012
Messages
44
Reaction score
6
First Language
Finnish
Primarily Uses
RMVXA
I'm pretty much having the same problem as which LazyViking has(/had). I'm attempting to use the left pictures line of sight as well.

-
However, it comes up as seen on the right picture instead.


Would you be able to assist me with this, please?


Thank you in advance.
 

Zachy

Veteran
Veteran
Joined
Mar 16, 2012
Messages
43
Reaction score
5
First Language
English
Primarily Uses
This is great, most likely I'll use it in something I've been messing with. Thanks for the detailed and helpful explanation  :)
 

bobisme

Veteran
Veteran
Joined
Apr 25, 2013
Messages
112
Reaction score
4
First Language
english
Primarily Uses
Gotta love LOS, thanks for putting this up.

I have a few questions for you
 
um, okay, is it possible to have the monster only have LOS in his passage, as you can see in this pic
i would want the player to be able to... walk over, i suppose i could disable his los via a common event when
you go to the upper platform.. and re enable when you get passed..? >.<
 

 

also I love LOS but, being able to stand on the square next to him/behind with no repercusions... how would I place a LOS 1 square behind the enemy with a say 30 frame delay?  like this:
 



sorry I've been trying to wrap my head around it, guess that means i should come back when i am a bit more advanced :p ...but.. hehe

what I can't work out is how you set the LOS distance from the event, i understand the x and y, well actually i probably don't..

i figure that if the enemy is facing left and you had conditional branch: $game_map.events[@event_id] conditional branch: player is -1X, 0Y [battle process] but i see no - or + in the X or Y i see the greater than less than symbols >  < , but how does that define how much greater it is? from going one square to say 3 if i set it that if the players x is greater than enemy's X would it not activate say 15 squares away as it meets the requirements that player's X is greater? >.<

It's the abs right? at the end, so abs 1,2,3 n so on.. will set the distance?   :   .abs <= 3    so max of 3 squares away? :)

( i notice it is only mentioned once at the top in your explanations of the script pieces, but not shown how it is implemented, but i suppose if it were just handed.. like give a man a fish, or teach him how to.. yada yada )

So, i  think i have grasped it? ... hehe

(So am i handing out fish? lol)

sorry i know i did not go into the proper eventing above, so i know there is a bit missing but you get me? :p   

cause i don't lol, kidding... hehe

now, to add a delay...  :)
 

thanks for the demo, it taught me a lot :)
 
Last edited by a moderator:

The Infamous Bon Bon

Executive Geek
Veteran
Joined
Mar 13, 2012
Messages
850
Reaction score
410
First Language
English
Primarily Uses
Sorry about the late reply.

@bobisme

As for the first question.  I'm sure it is possible, but since that would involve factoring passability of tiles and coming up with someway to designate height, I think an intricate script might be more appropriate.

For the second question, just add a triangular line of sight set to 1 square without a direction condition in addition to the other line of sight.

@LazyViking and Khaz

I didn't test appropriately and I'm getting the problem now.  I think I know how to fix it, but I need to run some tests first.

Okay, so the problem was that the conditions in the first branch were too vague for the conditions in the second branch.  Using just one condition branch with this instead works:

 

$game_map.events[@event_id].direction == 2 && $game_map.events[@event_id].y < $game_player.y && ($game_map.events[@event_id].x - $game_player.x).abs <= 1 && ($game_map.events[@event_id].y - $game_player.y).abs <= 3 || $game_map.events[@event_id].direction == 8 && $game_map.events[@event_id].y > $game_player.y && ($game_map.events[@event_id].x - $game_player.x).abs <= 1 && ($game_map.events[@event_id].y - $game_player.y).abs <= 3 || $game_map.events[@event_id].direction == 4 && $game_map.events[@event_id].x > $game_player.x && ($game_map.events[@event_id].y - $game_player.y).abs <= 1 && ($game_map.events[@event_id].x - $game_player.x).abs <= 3

 ||  $game_map.events[@event_id].direction == 6 && $game_map.events[@event_id].x < $game_player.x && ($game_map.events[@event_id].y - $game_player.y).abs <= 1 && ($game_map.events[@event_id].x - $game_player.x).abs <= 3

 

Basically I combined the appropriate condition from the top branch with the two that it applies to in the second branch.  Sorry about that guys.  And sorry again that it has taken me so long to get back to you guys.
 
Last edited by a moderator:

Thalldor

Making a game.
Veteran
Joined
Aug 2, 2013
Messages
56
Reaction score
1
Primarily Uses
All right, i seem to have a problem, I'm wanting a "Guard" to move left and right and chase you down if he sees you... it seems to not be working correctly... : \ There is also some type of bug where it lags if i have more than 2 "Guards" on a map at a time...
 
Last edited by a moderator:

5ynical

Villager
Member
Joined
Nov 9, 2013
Messages
7
Reaction score
9
First Language
English
Primarily Uses
Very interesting concept! Makes it a lot easier and much more compressed than having to event out the X/Y coordination individually...

My only question is that whenever the line of sight goes through an 'X' tileset object/tile (impassable), it can still view the Player and trigger the event. Is their any way around this through regions, script calls, etc?

Nonetheless, fantastic job on this eventing tutorial and thank you very much for making my eventing process a lot more compact and less scattered!
 

Mireneye

High Chromancer
Veteran
Joined
Dec 22, 2013
Messages
143
Reaction score
19
Primarily Uses
I'm using the one condition branch script you provided above. Basically I have fire that is following the player around, approaching from different locations. Everything is working fine except one detail. 

I'll try to explain it as eloquently as possible. 

Food for thought:
*My characters are 64x32 sprites. Double height
*Using diagonal and pixel movement

I think those are the relevant facts to consider. Please ask if you need any additional information. Granted I only skimmed the details of this post at best. I'm looking at the script and I understand the basics of it. However I can not see what to edit to correct my issue. Not sure where to begin for trial and error either. 

The problem:

The fire I have follows me. From the top from any facing it exlplodes and damages me. Fine. But if I let the fire follow me so it aligns perfectly behind me, I can stand either to the side or I can stand facing down and the fire will not damage me. I have no idea why this is, could it be because of the 1 pixel movement? Is there a way to correct the script to make it work?

Thank you for your time amazing tutorial and script man! Will be using this for sure! (And really get into the detail of how it works). 

Cheers!

EDIT: Also First post so, hello all you wonderful community members!
 
Last edited by a moderator:

The Infamous Bon Bon

Executive Geek
Veteran
Joined
Mar 13, 2012
Messages
850
Reaction score
410
First Language
English
Primarily Uses
@Mireneye - It could be so many things it really is hard to tell.

Some pixel movement scripts overwrite the $game_player and $game_event x and y and basically it makes it so you have to increase the ranges by whatever factor the script changes those definitions.  That combined with the double height character images could explain it.

Diagonal movement adds a whole new can of worms that can complicate this eventing method because you have to include directions 1, 3, 7, and 9.  It maybe easier to remove the requirement that the event has to face a certain direction to trigger the fire damage (considering most fire images don't have distinctive faces this may end up being acceptable).

Also welcome to the community :)

@PKDarmstr0ng - I'm sure there is a way but I don't know which script calls to use and it would make it a lot more complicated.

@Thalldor - I would need a lot more info in order to help you with your problem with the "Guard" and since it uses parallel processes lag can occur especially if you are running other parallel processes and there may be scripts causing problems as well.
 

Mireneye

High Chromancer
Veteran
Joined
Dec 22, 2013
Messages
143
Reaction score
19
Primarily Uses
Just wanted to chime in and thank you for the response! I ended up doing this which made my case much tighter. Came to this after reading up a a bunch:

$game_player.x == $game_map.events[@event_id].x and $game_player.y == $game_map.events[@event_id].y

I'd hate to be the guy who drops in and be like "I solved it, thanks" :p So, for future reference!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Karen: Hi, I have a condition that prevents me from wearing a mask. :)

Employee: Can you tell me what it is?

Karen: >:(
Feeling a little overwhelmed... There are so many things to do.
- Building a simple website for portfolio
- Setup *******
- Manage social media
There are so many things inside of these tasks :(
Meet the cute little ghost, FhooFhoo. :kaopride:
If anyone here is looking for another high-potential RPGMaker game--besides She Dreams Elsewhere--be sure to follow Lawmage Academy. Good social media presence will take that game far.
Lol, I was about to write a small tutorial and realized it would belong to the MZ section ....that does not exist yet.

Forum statistics

Threads
99,574
Messages
966,812
Members
131,231
Latest member
air_kity
Top