Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> [Eventing] Make A Racetrack, ::{Use Waypoints to Setup a Racetrack}::
Huepow00
post Mar 7 2008, 12:04 PM
Post #1


Level 4
Group Icon

Group: Member
Posts: 58
Type: Musician
RM Skill: Skilled




What this Tutorial will Teach You:
A General Understanding of Waypoints and their purpose.
How to create a racetrack using Waypoints.
How to use Waypoints for MORE than just a Race.
- Also Included are Proposed Race Ideas -


Thing's You should Already Understand:
Switches
Variables
Move Event Command

What is a Waypoint?
A: Waypoints are sets of coordinates that identify a point in physical space.
What is a Route?
A: A “route” is usually defined as a series of one or more waypoints. To follow such a route, the user navigates to the nearest waypoint, then to the next one in turn until the destination is reached.
- From Wikipedia Entry

RACE INFO

  • The user races around the track by following waypoints. The waypoints are invisible - but are used to determine that the hero is on the track and moving in the correct direction.
    <>
  • Waypoints, when stepped on, activate the next point in order, then deactivate themselves. - This way, they create a chain for the user to follow.
  • (If a timer is running - they can store the current timer value to a variable) & Anything else you want. The trick with placing the waypoints is that they must be gone through in order... So placing them in such a way so that the player is bound or forced to go through them is key.
    <>
  • On race's where the track is looped,the waypoint at the start/finish line is known as the "Lap Waypoint" and is set to OFF at the start of the race. The Lap Waypoint, upon reaching it, displays numerous stats and changes the LAP variables. It will wait until all laps are finished for it's end of the race code.
    <>
  • NPC's (Non-Playable Characters) can race on the track as well! there is some more work involved, but this tutorial will easily explain how to add one and set it's path.
  • If the NPC finishes the race before the Player, it's GAME OVER...


This is just a basic engine - but it can be tweaked and added to... There is A LOT of room for additional game play variables.

RACE SETUP


** Hero starts at the Lap Waypoint "a".
# When point "b" is reached - point "c" turns on. ('b' is turned off.)
# When point "c" is reached - point "d" turns on. ('c' is turned off.)
# When point "d" is reached - point "a" turns on. ('d' is turned off.)

Let's take a look at the code for each event.


EVENT : Race Start End

  1. Page 1 starts the race with a countdown and lets the game know it's started.
  2. Page 2 waits for the LAP variable to reach 3 to show you've won.

[Show/Hide] EVENT : Race Start End
CODE
EVENT : Race Start End

PAGE 01
> Auto-Start Trigger
> Below Hero

<>Message: 3!
<>Message: 2!
<>Message: 1!
<>Message: GO!!!
<>Switch Operation: [#: Waypoint "1"] ON
<>Switch Operation: [#: Race Started!] ON

PAGE 02
> Parallel Process Trigger
> Below Hero
> Preconditions = [Switch #: Race Started!] is ON

<>Branch if Var [#: Race Laps] is 3
<>Message: You Win!
<>Return to Title Screen
<>
: Else Handler
<>
: End



EVENT : NPC Lap Counter

    On Page 2 - When the NPC's Custom Path triggers the NPC LAP COUNTER switch to ON
  1. 1) If the NPC's LAP variable is 3 its GAME OVER
  2. 2) If not, it add's 1 unit to the NPC LAP variable and then turns itself off

[Show/Hide] EVENT : NPC Lap Counter
CODE
EVENT : NPC Lap Counter

PAGE 01
> Parallel Process Trigger
> Below Hero

PAGE 02
> Parallel Process Trigger
> Below Hero
> Preconditions = [Switch #: NPC Lap Counter] is ON

<>Branch if Var [#: NPC Laps] is 3
<>Tint Screen: (R100,G100,B100,S000), 0.4 Sec
<>Message: You Loose...
<>Return to Title Screen
<>
: Else Handler
<>Variable Oper: [#: NPC Laps] + , 1
<>Switch Opperation: [#: NPC Lap Counter] OFF
<>
: End



EVENT : NPC 01

  1. The NPC waits for the race to begin, then follow's its set path around the track.
  2. Each time it pass's the Start/Finish line (Lap Point) - It activates the NPC Lap Counter event to tell the game it's made 1 lap.

[Show/Hide] EVENT : NPC 01
CODE
EVENT : NPC 01

PAGE 01
> Parallel Process Trigger
> Same Layer as Hero
> Movement Type = Stationary

PAGE 02
> Parallel Process Trigger
> Preconditions = [Switch #: Race Started!] is ON
> Same Layer as Hero
> Movement Type = Custom Pattern - Repeat Pattern
!! While making the Custom path for the NPC - At the moment it touches the Lap Point marker. Include:
<>Switch ON "NPC Lap Counter"

PAGE 03
> Parallel Process Trigger
> Preconditions = [Variable #: Race Laps] is Equal to 3
> Same Layer as Hero
> Movement Type = Stationary



EVENT : Waypoint "#"

  1. Waypoints first check if the Hero is facing the direction he's supposed to be moving along the track.
  2. If they are, it Activates the next Waypoint, and then turns itself OFF.

[Show/Hide] EVENT : Waypoint "#
CODE
EVENT : Waypoint "#"

PAGE 01
> Parallel Process Trigger
> Below Hero

PAGE 02
> Touched by Hero
> Below Hero

<>Branch if Hero "The Direction Intended" Facing
<>Switch Operation: [#: Waypoint "2"] ON (or Lap Point if it's the end of the loop)
<>Switch Operation: [#: Waypoint "1"] OFF
<>
: Else Handler
<>
: End



EVENT : Lap Point

  1. Page 02 first checks the player is passing through in the correct direction.
  2. Then it turns on the first waypoint in the loop again.
  3. Add's 1 unit to the players 'Race Laps' Variable
  4. Then turns itself off.

[Show/Hide] EVENT : Lap Point
CODE
EVENT : Lap Point

PAGE 01
> Parallel Process Trigger
> Below Hero

PAGE 02
> Touched by Hero
> Below Hero

<>Branch if Hero "The Direction Intended" Facing
<>Switch Operation: [#: Waypoint "1"] ON
<>Variable Oper: [#: Race Laps] + , 1
<>Switch Operation: [#: Lap Point"] OFF
<>
: Else Handler
<>
: End


--->As you can see, Waypoints can be VERY useful for helping/checking that the player is moving towards a specific AREA... not just a specific X,Y position on the map. (This can always be done by checking the Hero's X,Y values) It's very simple to implement.


Proposed Race Ideas

[Show/Hide] Proposed Add-Ons
Proposed Add-Ons

Player with NPC Collision Options:

Collision with NPC blows up the player.
Collision with NPC blows up the NPC.
Collision with NPC from behind slows down player temporarily.
Collision with NPC from the front slows down NPC temporarily.
Collision with NPC gives damage to the NPC, player, or both.
Collision with NPC moves to a random, straight piece of track. NPC is set to move towards Hero - while the player must pass the NPC and reach the end to pass the NPC in-race. Causes the 2 events to swap places.

Player with Object Collision Options:

Collision with wall blows up the player.
Collision with wall gives damage to the player.
Collision with explosive obstacles blows up the player.
Collision with dirt slows down the player.
Collision with water stops or slows down the player.
Collision with Oil Slick forces the player forwards with no control temporarily.
Collision with Speed Pad increases the player or NPC's Speed temporarily.
Collision with Ice keeps the player & NPC's moving forward, but let's them also move side to side.


LEMME KNOW WHAT YOU THINK! happy.gif biggrin.gif


__________________________
| DJ / Composer |


~##WANT YOUR OWN $2 THEME SONG?~##

1. Go to: http://huepow00.synthasite.com/
2. Click the PAYPAL Button
3. DESCRIPTION = Your Current Forum ScreenName
4. UNIT PRICE = 2.00
5. Pay with Credit Card or Thru your own PayPal Account.


~## VISIT MY NEW WEBSITE AND GET EVERYTHING HUEPOW00! ##~

> !CLICK HERE!<


Go to the top of the page
 
+Quote Post
   
lahandi
post Mar 7 2008, 06:15 PM
Post #2


Level 8
Group Icon

Group: Revolutionary
Posts: 111
Type: Artist
RM Skill: Skilled




This is the kind of minigame that I'm looking for. banana.gif
But I still little bit confused. Maybe you could post the XP/VX sample file, so that we can learn from it.
Thank you very much. smile.gif


__________________________
Go to the top of the page
 
+Quote Post
   
Huepow00
post Mar 8 2008, 12:12 PM
Post #3


Level 4
Group Icon

Group: Member
Posts: 58
Type: Musician
RM Skill: Skilled




QUOTE (lahandi @ Mar 7 2008, 05:22 PM) *
This is the kind of minigame that I'm looking for. banana.gif
But I still little bit confused. Maybe you could post the XP/VX sample file, so that we can learn from it.
Thank you very much. smile.gif


I see... I will likely revise the tutorial later on... so that it's eaiser to understand.

ATTACHED is a Waypoint Race Example for RmXP.
Attached File(s)
Attached File  Waypoint_Race_Example.zip ( 182.32K ) Number of downloads: 178
 


__________________________
| DJ / Composer |


~##WANT YOUR OWN $2 THEME SONG?~##

1. Go to: http://huepow00.synthasite.com/
2. Click the PAYPAL Button
3. DESCRIPTION = Your Current Forum ScreenName
4. UNIT PRICE = 2.00
5. Pay with Credit Card or Thru your own PayPal Account.


~## VISIT MY NEW WEBSITE AND GET EVERYTHING HUEPOW00! ##~

> !CLICK HERE!<


Go to the top of the page
 
+Quote Post
   
lahandi
post Mar 9 2008, 03:22 AM
Post #4


Level 8
Group Icon

Group: Revolutionary
Posts: 111
Type: Artist
RM Skill: Skilled




QUOTE
ATTACHED is a Waypoint Race Example for RmXP.


Yeah. Big thanks mate! banana.gif


__________________________
Go to the top of the page
 
+Quote Post
   
Huepow00
post Mar 10 2008, 12:59 AM
Post #5


Level 4
Group Icon

Group: Member
Posts: 58
Type: Musician
RM Skill: Skilled




QUOTE (lahandi @ Mar 9 2008, 03:29 AM) *
QUOTE
ATTACHED is a Waypoint Race Example for RmXP.


Yeah. Big thanks mate! banana.gif

No Problem!

I think the concept of 'waypoints' are overlooked far to often when constructing a game and the kind of stories/gameplay that can be created with their implementation.

Waypoints are effective at tracking a players General Movement towards an area, point, or Objective... and you can even implement a visual tracking system to tell the user which direction they NEED to head in to reach the destination or next waypoint... or even how FAR AWAY they are from it...

So there's alot of way's they can be used to effectively control WHEN something should happen to the player.
- Their very much like Trigger Points.

This post has been edited by Huepow00: Mar 10 2008, 01:04 AM


__________________________
| DJ / Composer |


~##WANT YOUR OWN $2 THEME SONG?~##

1. Go to: http://huepow00.synthasite.com/
2. Click the PAYPAL Button
3. DESCRIPTION = Your Current Forum ScreenName
4. UNIT PRICE = 2.00
5. Pay with Credit Card or Thru your own PayPal Account.


~## VISIT MY NEW WEBSITE AND GET EVERYTHING HUEPOW00! ##~

> !CLICK HERE!<


Go to the top of the page
 
+Quote Post
   
justlevine
post Apr 1 2008, 09:07 AM
Post #6


Level 3
Group Icon

Group: Member
Posts: 32
Type: None
RM Skill: Undisclosed




Is there a way to make a waypoint without defining the path of the npc (aka check if they are past a certain y or x on the map)?
Go to the top of the page
 
+Quote Post
   
The Tao
post Apr 1 2008, 09:23 AM
Post #7


Level 20
Group Icon

Group: Revolutionary
Posts: 405
Type: None
RM Skill: Undisclosed




Okay, how would I make it so there's three opponents? I got it to work with 2 but three doesnt seem to wanna work :|


EDIT: Forget it I fixed it


__________________________
Apparently I am back.
Go to the top of the page
 
+Quote Post
   
Huepow00
post Apr 2 2008, 06:00 PM
Post #8


Level 4
Group Icon

Group: Member
Posts: 58
Type: Musician
RM Skill: Skilled




QUOTE (justlevine @ Apr 1 2008, 09:21 AM) *
Is there a way to make a waypoint without defining the path of the npc (aka check if they are past a certain y or x on the map)?

Yes - checking the X,Y position of any Event - be it the Hero's Location, or the Location of any other Event is monitored the same as any other "X,Y position check" Code...

Use Parallel Process Events to constantly store the current X,Y value of a given event.
:: Then use a Waypoint to check if the X,Y of the stored event is Greater,Less, or Equal to the X,Y value of the Waypoint

QUOTE (TwinnKilla @ Apr 1 2008, 09:37 AM) *
Okay, how would I make it so there's three opponents? I got it to work with 2 but three doesnt seem to wanna work :|


EDIT: Forget it I fixed it

Glad Ya figured it out happy.gif


__________________________
| DJ / Composer |


~##WANT YOUR OWN $2 THEME SONG?~##

1. Go to: http://huepow00.synthasite.com/
2. Click the PAYPAL Button
3. DESCRIPTION = Your Current Forum ScreenName
4. UNIT PRICE = 2.00
5. Pay with Credit Card or Thru your own PayPal Account.


~## VISIT MY NEW WEBSITE AND GET EVERYTHING HUEPOW00! ##~

> !CLICK HERE!<


Go to the top of the page
 
+Quote Post
   
ssluffy
post Apr 14 2008, 07:04 AM
Post #9



Group Icon

Group: Member
Posts: 4
Type: None
RM Skill: Undisclosed




Hi, um just wondering how would you add the race ideas add ons
Go to the top of the page
 
+Quote Post
   
Huepow00
post Apr 17 2008, 10:45 AM
Post #10


Level 4
Group Icon

Group: Member
Posts: 58
Type: Musician
RM Skill: Skilled




QUOTE (ssluffy @ Apr 14 2008, 07:18 AM) *
Hi, um just wondering how would you add the race ideas add ons

Proposed Add-Ons

Player with NPC Collision Options:
:: Code within the NPC event and set to run when the Player Collides with it.
Collision blows up the player or NPC or gives dammage : Either Erase the NPC Event, or stop the race somehow... or remove some HP

And... for things that alter the players control or speed, just use Move-Event's and Waits... or Timers, up to you.


__________________________
| DJ / Composer |


~##WANT YOUR OWN $2 THEME SONG?~##

1. Go to: http://huepow00.synthasite.com/
2. Click the PAYPAL Button
3. DESCRIPTION = Your Current Forum ScreenName
4. UNIT PRICE = 2.00
5. Pay with Credit Card or Thru your own PayPal Account.


~## VISIT MY NEW WEBSITE AND GET EVERYTHING HUEPOW00! ##~

> !CLICK HERE!<


Go to the top of the page
 
+Quote Post
   
HTMLCODER.exe
post Apr 18 2008, 02:38 PM
Post #11



Group Icon

Group: Member
Posts: 2
Type: None
RM Skill: Skilled




Amazing, mate!
Go to the top of the page
 
+Quote Post
   
yaoimutt
post Apr 20 2008, 04:15 PM
Post #12



Group Icon

Group: Member
Posts: 2
Type: None
RM Skill: Undisclosed




what code would you use to find the xy coronets?
Go to the top of the page
 
+Quote Post
   
Huepow00
post Apr 21 2008, 12:04 AM
Post #13


Level 4
Group Icon

Group: Member
Posts: 58
Type: Musician
RM Skill: Skilled




QUOTE (HTMLCODER.exe @ Apr 18 2008, 02:52 PM) *
Amazing, mate!

Thanks a bunch!

QUOTE (yaoimutt @ Apr 20 2008, 04:29 PM) *
what code would you use to find the xy coronets?

You'd probably be better off looking at a Tutorial specifically on tracking the Hero's X,Y location - but its done something like this...:

1) Create 2 Variables
Var 1= Hero X
Var 2= Hero Y

2) Check the X,Y Cord by asking
Does Hero X = the same as another X
Does Hero Y = the same as another Y


__________________________
| DJ / Composer |


~##WANT YOUR OWN $2 THEME SONG?~##

1. Go to: http://huepow00.synthasite.com/
2. Click the PAYPAL Button
3. DESCRIPTION = Your Current Forum ScreenName
4. UNIT PRICE = 2.00
5. Pay with Credit Card or Thru your own PayPal Account.


~## VISIT MY NEW WEBSITE AND GET EVERYTHING HUEPOW00! ##~

> !CLICK HERE!<


Go to the top of the page
 
+Quote Post
   
matty0828
post Apr 27 2008, 03:27 AM
Post #14


Level 4
Group Icon

Group: Member
Posts: 54
Type: None
RM Skill: Beginner




Hey

Great tutorial but could you make a VX example? It would help me understand it a little better
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 11:17 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker