RSS

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:

  1. 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
  2. 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 pentagram graphic.

Go on to Part 2:  Complicated Line of Sight Examples

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: