Author Topic: How to make an RPG with variables  (Read 4112 times)

Introduction

Ok, in this tutorial i'm going to show you how to make an RPG with variables.  It won't be that hard.  That was a short intro :3

Getting Started

To make a variable RPG your going to need to have the variable add-on.  The current version is 4.  You can download it here: http://forum.blockland.us/index.php?topic=43084.0

Now if once you downloaded it, we can move on.


Making your RPG

-Mining
Mining is probaly the easiest to do, so that's why i'm starting with it.  Usually I start making copper ore first, so i'm going to explain how to do that.  look at the code here:
Code: [Select]
onActivate---self---fakekillbrick---[  ][  ][  ] [15]
onActivate---client---bottomprint---[You mine some copper! +1 mining XP]
onActivate---player---addVariable---[copper] [1]
onActivate---player---addVariable---[Mining XP] [1]
onActivate---client---displayvariable---[player] [chatbox] [copper]
onActivate---client---displayvariable---[player] [chatbox] [Mining XP]

There is you simple copper ore.  Now when you click the brick the brick will dissapear for 15 seconds and give you 1 copper and 1 Mining XP.  You can edit that to give more XP or copper if you want.

To make somthing that you need more Mining XP to mine then for the first line of wrench events you use:
Code: [Select]
onActivate---self---ifVariable---[player] [Mining XP] [GreaterEquals] [how much XP they need to have to mine the ore]
also for the rest of the wrench events the input event should be ifvariabletrue instead of onActivate.  also you may want it to say somthing if they don't have enough XP, for that just say:
Code: [Select]
ifvariablefalse---client---bottomprint---[what you want it to say]
That's it for mining.

-Logging

First examine this code:
Code: [Select]
onActivate---self---fakekillbrick---[  ][  ][  ] [15]
onActivate---client---bottomprint---[You cut some logs! +1 logging XP]
onActivate---player---addVariable---[logs] [1]
onActivate---player---addVariable---[Logging XP] [1]
onActivate---client---displayvariable---[player] [chatbox] [logs]
onActivate---client---displayvariable---[player] [chatbox] [Logging XP]

Ok, that is kind of like the copper ore code but with wood.  If you want to make higher levels of wood to cut then just do what we did with the copper ore.

Others

If you have a requests please tell me.


Depositing money, Withdrawing money, Buying items, picking up money, giving money, and loans (pretty much stuff from city RP that can be done with events

You just ruined the fun of making a rpg with events, leave it to others to figure it out on there own so we wont have a stuff load of crappy rpgs running a muck...Oh wait. Also yes this is a flame and yes this is in help yet this is a tutorial so I do not think it counts as it is not a question.

So, if I were to make a deducting event, would it be like this?
Code: [Select]
OnActivate --> AddVariable --> [Thing you want to deduct] --> [-1]

So, if I were to make a deducting event, would it be like this?
Code: [Select]
OnActivate --> Player --> AddVariable --> [Thing you want to deduct] --> [-1]

Sorry for the triple toast.

No modifying posts in the help forums? Aw, that sucks.

Hey great tutorial! Honestly i have no intention of creating an rpg but i didnt know how to use the variables so this helped. It was a tad short though but hey.