Jump to content


Photo
- - - - -

Rpg Leveling And Experience System


  • Please log in to reply
13 replies to this topic

#1 matty_richo

matty_richo

    GMC Member

  • GMC Member
  • 486 posts
  • Version:GM:Studio

Posted 19 December 2009 - 07:34 AM

  • Title: Basic RPG Leveling and Experience System
  • Description: Shows you how to do a basic Leveling and experience system for a game
  • GM Version: 7
  • Registered: Yes (if you take out the line of code that draws the xp bar it will work for unregistered
  • File Type: .gmk
  • File Size: 0.02mb
  • File Link: Linky
Additional Info
This shows how to create things like Level up and experience points for an RPG game using mostly global variables.
Example of code

Player's Create Event
global.level = 1 
global.spd = 5
global.maxexp = (30+(global.level*100)-20)
global.xp = 0

Player's Step Event
if (global.xp>=global.maxexp)
	{
	global.xp = 0;
	global.level += 1;
	global.spd += 0.3;
	global.maxexp = (30+(global.level*100)-20);
	}

Draw Object's Draw event
draw_text(5,5,"Level: "+string(global.level));
draw_rectangle_color(5,30,5+(global.xp/global.maxexp*100),30+10,178,134,200,134,0)

  • 0

#2 Tarik

Tarik

    GMC Member

  • GMC Member
  • 2731 posts
  • Version:GM:Studio

Posted 19 December 2009 - 08:30 PM

*throws it on pile of other examples doing the same thing*
  • 0

#3 Titanium

Titanium

    the perfectionist

  • GMC Member
  • 1138 posts

Posted 14 January 2010 - 03:07 AM

*throws it on pile of other examples doing the same thing*

Well the math here, is definitely interesting. Thanks matty_richo.
  • 0

#4 disturbed317

disturbed317

    GMC Member

  • GMC Member
  • 557 posts

Posted 14 January 2010 - 03:35 AM

Well the math here, is definitely interesting. Thanks matty_richo.


I'm assuming you're being sarcastic...?

Well, that'll definintely help out some new users trying to switch from DnD to GML. But from what I can see, the Experience code is... odd... basically it's (level*100)+10, or am I reading it wrong? What's with the 30 starting when you just minus 20 at the end? And normally you throw in a learning curve, even if it's something really simple: a = 1 + (level/4) and then times your code by that. I'd give a better example, but it's been a long daying and I'm burnin' out.
  • 0

#5 Titanium

Titanium

    the perfectionist

  • GMC Member
  • 1138 posts

Posted 19 January 2010 - 04:57 AM

Well the math here, is definitely interesting. Thanks matty_richo.


I'm assuming you're being sarcastic...?

Well, that'll definintely help out some new users trying to switch from DnD to GML. But from what I can see, the Experience code is... odd... basically it's (level*100)+10, or am I reading it wrong? What's with the 30 starting when you just minus 20 at the end? And normally you throw in a learning curve, even if it's something really simple: a = 1 + (level/4) and then times your code by that. I'd give a better example, but it's been a long daying and I'm burnin' out.

No just pointing out the aforementioned dude, was a jerk, and I actually liked what matty said.
  • 0

#6 Mr. Munchkin

Mr. Munchkin

    GMC Member

  • GMC Member
  • 717 posts
  • Version:GM:Studio

Posted 19 January 2010 - 08:30 AM

If all that is in the GMK is that code then it doesn't need to be registered.
Otherwise is can be useful for some new members!

Try doing some more advanced ones now!
~ Mr. Munchkin
  • 0

#7 matty_richo

matty_richo

    GMC Member

  • GMC Member
  • 486 posts
  • Version:GM:Studio

Posted 25 January 2010 - 06:14 AM

It also draws an experience bar, and it needs regitered because of the way i did it.
  • 0

#8 Shorooq

Shorooq

    GMC Member

  • GMC Member
  • 526 posts

Posted 03 February 2010 - 01:18 PM

awwwwwwwwww
just pro
  • 0

#9 peter john

peter john

    GMC Member

  • New Member
  • 18 posts

Posted 05 February 2010 - 05:53 AM

Good Job!!...

U really used good math over here!!...
:)
  • 0

#10 busylop

busylop

    GMC Member

  • New Member
  • 50 posts

Posted 11 September 2010 - 11:49 AM

Nicely done. Thank you.
  • 0

#11 ChickenViking

ChickenViking

    GMC Member

  • New Member
  • 368 posts

Posted 12 September 2010 - 02:17 PM

I needed a simple RPG system, and this one works fine for me. I'm sure there are better and more complicated RPG tutorials out there, but I just need a basic one. I can improve it myself later when I get around to it. :)
  • 0

#12 _COCE_

_COCE_

    GMC Member

  • New Member
  • 17 posts

Posted 17 September 2010 - 06:48 PM

best & easiest lvl up system
thnx alot<3
  • 0

#13 Disruptor

Disruptor

    GMC Member

  • GMC Member
  • 40 posts
  • Version:GM:Studio

Posted 04 August 2011 - 05:11 AM

I would highly recommend not using global for player settings, rather store your player information on a per-object basis; you can still access this information outside of the player by doing something like the following:

o_player.level
o_player.xp
AND
o_badguy.level
o_badguy.hp
etc...

that way when you do decide to add more than one player you do not run into a problem. Also I would suggest avoiding global variables for most all coding other than things that only really need to be accessed everywhere, for instance maybe a variable for sound... something like global.sound = true or false, it then can be checked in all objects to determine whether or not to play a sound clip.

other than that, good idea and good example

here is an example of what I mean, just modified a few things....

http://www.mediafire...39wdiq7lddzp4a3

Edited by Disruptor, 04 August 2011 - 05:23 AM.

  • 0

#14 The_Puzzle

The_Puzzle

    GMC Member

  • GMC Member
  • 80 posts
  • Version:GM:HTML5

Posted 10 August 2011 - 02:31 AM

You just made my day! This will totally help me with the RPG game I'm making. Thanks dude!

Edited by The_Puzzle, 10 August 2011 - 02:31 AM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users