RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.
[VX] Making items only usable on certain maps using events & variables.

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 69
RMRK Junior
Ok, I figured this may be a help to some newer game makers, seeing as it had me stumped for a few days.

This tutorial will explain how to make an item (ie. a tent) that is only usable on the world map, using variables.

Say we are making a tent item that is only usable on the world map.

 What we need:
 (1)Variable - lets just call this variable id 0001: Worldmap.
 (1)Common Event  - we will use 002 for intents and purposes.
 (1)Item - the item will be the tent
 (1)Map  - this will be the map id of the map you wish the item to only be used on, for intents and purposes, this will be Map ID: 001

1.     Ok, first we'll make a new variable:

We'll use 0001 and name it Worldmap.

2.     Then we'll make a common event called "tent".

  The common event will be as follows:

@>Control Variables: [0001:Worldmap] = Map ID
    This variable control checks the current map ID.

@>Conditional Branch: Variable [0001:Worldmap] == 1
   
   This conditional checks to see if the Map ID = 1.  (001 is the map ID of your world map, so it will be 1 if you are on the map.)

@>Fadeout Screen
@>Play ME: 'inn'
@>Recover All: Entire Party
@>Wait: 300 frame(s)
@>Fadein Screen

    This is the default inn, so you will recover and hear music,   blah blah blah.

: Else:
@>Text:-,-, Norman, Bottom
:         : You cannot use a tent here.

   This is the text that is displayed if your map id does not equal 1.  (ie. ANY other map that is not your first map)

@>Change Items: [Tent], +1

  This puts a tent into your inventory, this line is necassary because RPG Maker will still use the item, even if the script didn't let you recover, so instead of wasting a tent for using it in the wrong area, no tent is removed.[/color]

  That's basically it, of course you can interchange the music, wait times, ever character graphics (if you have a tent you would like to see displayed before the screen fade)

So once again this is the code without the commentary.

 @>Control Variables: [0001:Worldmap] = Map ID

@>Conditional Branch: Variable [0001:Worldmap] == 1
   
@>Fadeout Screen
@>Play ME: 'inn'
@>Recover All: Entire Party
@>Wait: 300 frame(s)
@>Fadein Screen

   
: Else:
@>Text:-,-, Norman, Bottom
:         : You cannot use a tent here.
@>Change Items: [Tent], +1


Now, the only thing left to do is create the item.

Create a new item called Tent, and make sure it is set up for No scope, Only From Menu, and Call Common Event, which would be whatever you chose as the ID,  in this example we used 001.


And that's that.  You have a tent that will only work on the worldmap.  I hope this helps someone. :D
« Last Edit: June 27, 2011, 06:37:43 AM by thanatos2k1 »

*
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
At least give me some form of credit.
But still, you explained it a lot better than I ever did. Kudos.
it's like a metaphor or something i don't know

***
Rep:
Level 69
RMRK Junior
Ha yes, Pacman helped me to figure it out. :)