Variables - Tips and tricks

Ruiran

Veteran
Veteran
Joined
Nov 4, 2013
Messages
78
Reaction score
30
First Language
English
Primarily Uses
Variables 
Tips and Tricks
 ​
 ​
1.Rewards for tenaciousness

Ever had a useless lever or button just laying around ? Ever wanted to reward your players for pressing those buttons or levers? Well you visited the right place.

 a.Requirements

   A variable (how many times you pulled)

   A switch

   A lever (+1 every time you pull)

   An event (shows your "progress"")

   Basic knowledge about variables and events (making them and modify them)

 b.Setup

   Make a variable and name it.

   Same for the levers.

   To make the lever simply make an action button triggered event, choose your sprite, then add 1 to the variable, turn the switch on,      then create a new event page, make it a auto run,make it's run condition the switch you just turned, choose the appropriate sprite,

   also on the second event page make it so the switch you just turned on gets turned off, then you can add a SE and some waiting 

   time if you feel the need :

   Page 1 of the event

   


   Page 2 of the event

   
  Now, I did say there was going to be a reward didn't I ? Well this can be done in multiple ways, 

  Way N.1 is to make a parallel process (common) event that checks if your Variable is over a certain number, and then give a reward

  when the number is achieved:

   This also works with Npc's, just make it an action button at that point, also if you wish to track your progress, you can type in \v[x]         while editing a chatbox, and it will show you what that current variable is ( x being the ID of your variable ) :

(ignore the first line)


2.Battle damage formulas using variables ?

Usually in Ace battle formulas you are only allowed to use the basic 4 mathematical operations (+,*,/,-) and that can usually limit a game maker slightly, but Variables can include different operations and can add variety to your formulas (through scripting visit this thread for more details about that : http://forums.rpgmakerweb.com/index.php?/topic/16541-intermediateadvanced-game-variables/?hl=variables)   A. Requirements

    A variable

    A skill

    You have to have a minimum knowledge math

    B. Setup

Make a variable that you want to allow damage modifications, examples would be a permanent boost (passive skills maybe ?) 

Now to implement that variable in the damage formula just add v[x] (X being the number of your variable) 

ex : 

a.atk * 4 + v[x] - b.def * 2  I'm not going to go into details or this thread would be veeeeeeeery long and boring to read , but you can do many things that would add diversity in your game.   

EX : http://www.rpgmakervxace.net/topic/17451-damage-formula-operations/

    

   

  
3.Counts how many times you stepped on grass (using region ID's)

This process is pretty complicated so I'll only explain it through images:


Add regions to your map by pressing F7.



Thanks to Zeriab for fixing my original post.

2 of my variables define the characters X and Y location, 1 of my variables define what region I'm currently on, and 1 variable counts how many times I stepped on the grass, the conditional branches are obligatory or your Variable designating how many times you stepped on the grass will go up by 1 every ten frames even if you don't move.  :



The script event command isn't necessary as I only used it to see if the event worked.
4.(Evil) Maze of Variables

Have you ever been annoyed by very puzzling mazes that use teleports, similar looking rooms, and more ? Well Today I will present you with a way to make the experience even "more positive".A. Requirements

Any number of variables (min 1)

Any number of rooms (min 3)

Any number of events that teleport you from room to room (min 2 for each room)

Optionally some other events affected by our variable 

Some time on your hands.

B. Setup

So let's build our maze shall we ? I chose to make my maze size 4 rooms, (Optionally you can tint the screen dark so it gives a more realistic feel to it) I made 2 pairs of identical rooms the identical room to the starting room will be the exit, also all rooms have 2 events that teleport the player elsewhere., also my example maze will depend of a loops and slightly on making your player give up before he finds the exit.

So the starting room will have an event to transport you outside, or to the next room, the following room (room a) will be setup so if you go back you will end up on the upper level of it's identical copy (room B) , and going up makes you appear on the bottom level of the copy, the top level of the copy will bring you back to the start and the bottom level will bring you back to the "room a".

Each event that transfers you to the next area will add a +1 on your chosen variable.

Now choose a random number for your variable and change one of the transfer events to a conditional branch that will bring you to the identical room of the entrance ( exit ) , the bottom level of the exit will set you free, the top level will set the variable to 0 and teleport you to the bottom of the entrance:

So Entrance -) Room a

     Room a -) Room b top or Room b bottom

     Room b -) Room a top or entrance top

     Exit -) entrance bottom or Freedom

Things you should know:

There are hundreds of things you can do with variables, especially if you mix it up with some scripting.

The variables on the battle formula can depend on allot of things, for example a skill that does more damage the more money you have, or the more steps you have done.

The variables maze can be made allot harder, I'm just putting out the idea and the basic concept.
 
Last edited by a moderator:

Acetonide

Event Coordinator
Veteran
Joined
Apr 16, 2012
Messages
660
Reaction score
31
First Language
English
Primarily Uses
N/A
Hm... I'm just quickly skimming over your images, I can't test this atm. =x

But for the count how many times you stepped on something using region ID..

Theoretically if you were walking into a wall on top of grass and held the button down wouldn't it just keep counting without an actual step taken? (Player stays in place because walking into an event, wall, or otherwise impassable tile)
 

Ruiran

Veteran
Veteran
Joined
Nov 4, 2013
Messages
78
Reaction score
30
First Language
English
Primarily Uses
Hm... I'm just quickly skimming over your images, I can't test this atm. =x

But for the count how many times you stepped on something using region ID..

Theoretically if you were walking into a wall on top of grass and held the button down wouldn't it just keep counting without an actual step taken? (Player stays in place because walking into an event, wall, or otherwise impassable tile)
:o never thought about that, a fix would be to remove regions beside walls, that would lower the amounts of total steps but it's the only fix I can find at the moment. Might figure out something later
 
Last edited by a moderator:

Zeriab

Huggins!
Veteran
Joined
Mar 20, 2012
Messages
1,268
Reaction score
1,422
First Language
English
Primarily Uses
RMXP
Try implementing the step as the players x- and y-coordinates being different from before. See how such a solution fares.
 

Ruiran

Veteran
Veteran
Joined
Nov 4, 2013
Messages
78
Reaction score
30
First Language
English
Primarily Uses
Try implementing the step as the players x- and y-coordinates being different from before. See how such a solution fares.
Good idea, I'm pretty sure you need to use the script option in the conditional branch for that ?

If so I would be curious if there's a function that checks if a variable changes.
 

Acetonide

Event Coordinator
Veteran
Joined
Apr 16, 2012
Messages
660
Reaction score
31
First Language
English
Primarily Uses
N/A
Good idea, I'm pretty sure you need to use the script option in the conditional branch for that ?

If so I would be curious if there's a function that checks if a variable changes.
You don't need to use the script option, although you can.

You can just use conditional branches and four variables.

2 for x, and 2 for y.. One for before it moves and one for after, with the one for before updating only if they match.

So essentially

New x = Player x

New y = Player y

New x == old x?

    YES >

     New y == old y?

          YES >

            +1 for steps

            old y = new y (or Player y)

            old x = new x (or Player x)

And if it's a parallel process you probably want to add a wait x frames in there some where.

(Please excuse the poor spacing, I don't do this type of thing much.. Explaining I mean.)
 

Ruiran

Veteran
Veteran
Joined
Nov 4, 2013
Messages
78
Reaction score
30
First Language
English
Primarily Uses
You don't need to use the script option, although you can.

You can just use conditional branches and four variables.

2 for x, and 2 for y.. One for before it moves and one for after, with the one for before updating only if they match.

So essentially

New x = Player x

New y = Player y

New x == old x?

    YES >

     New y == old y?

          YES >

            +1 for steps

            old y = new y (or Player y)

            old x = new x (or Player x)

And if it's a parallel process you probably want to add a wait x frames in there some where.

(Please excuse the poor spacing, I don't do this type of thing much.. Explaining I mean.)
I tried this and it didn't work , I think it mainly because the Player X and Y are the same even when the player stays still, meaning the player could not move and still gain steps.     I didn't try this yet but it would probably work if you had a button pressed conditional branch before " New Y == Old Y"
 

Zeriab

Huggins!
Veteran
Joined
Mar 20, 2012
Messages
1,268
Reaction score
1,422
First Language
English
Primarily Uses
RMXP
That  is because you have to change the check. For a parallel process you can do something like this:

  New x = Player x

  New y = Player y

  if New x == old x?

       fi New y == old y?

            wait a few frames

            exit event processing (which will cause it to loop from the beginning)

  old y = new y (or Player y)

  old x = new x (or Player x)

  +1 for steps

It can naturally be adapted to fit other  types of events.

*hugs*
 

Ruiran

Veteran
Veteran
Joined
Nov 4, 2013
Messages
78
Reaction score
30
First Language
English
Primarily Uses
That  is because you have to change the check. For a parallel process you can do something like this:

  New x = Player x

  New y = Player y

  if New x == old x?

       fi New y == old y?

            wait a few frames

            exit event processing (which will cause it to loop from the beginning)

  old y = new y (or Player y)

  old x = new x (or Player x)

  +1 for steps

It can naturally be adapted to fit other  types of events.

*hugs*
*hugs*   Never thought about that, thanks.
 

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

Latest Threads

Latest Profile Posts

Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:

Forum statistics

Threads
105,854
Messages
1,017,004
Members
137,562
Latest member
tamedeathman
Top