Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Experience system... (https://forums.graalonline.com/forums/showthread.php?t=60981)

Torankusu_2002 09-04-2005 01:15 AM

Experience system...
 
I'm debating whether or not i want to start woring on an experience system. I pretty much know how I want it laid out, and how to go about doing it, but I have a few questions regarding "short cuts."

Okay, on GK for example, when get to a certain level, you need x amount of exp to level up. Does this have to be done by something like
"if (theexperience>=thenumberblah) {
the level goes up one;
}"
for every individual level, or could I use something mathematical?
I don't want to have to go and add all of the codes manually, but I was wondering if there was a set or a few lines that I could make it with to determine when the player needs to level up.

Polo 09-04-2005 01:39 AM

Well, if your numbers have some form of pattern, then yes its possible.

NPC Code:
//Example Only. 
//This is a simple one that increases the Experience Gap between each level by 100.
//Assumes you dont reset Experience each level.
if (Experience > (Level^2 + Level)*50) {
...
}



You could also have all the ammounts stored in an array and then just look through it using thier current level as the index.

NPC Code:
//Example Only. 
ExperienceAmmounts = {0,100,300,600,1000}; //Etc...
if (Experience > ExperienceAmmounts[Level]) {
...
}



If the scripts are wrong well meh its late. They're just examples anyway.

Torankusu_2002 09-04-2005 03:47 AM

Quote:

Originally Posted by Polo
Well, if your numbers have some form of pattern, then yes its possible.

You could also have all the ammounts stored in an array and then just look through it using thier current level as the index.

NPC Code:
//Example Only. 
ExperienceAmmounts = {0,100,300,600,1000}; //Etc...
if (Experience > ExperienceAmmounts[Level]) {
...
}



If the scripts are wrong well meh its late. They're just examples anyway.

Yeah, I think you got the gist of what I was trying to show with my example.
I was going to store them in an array, but I've never really toyed with them before. you'd get them like this, right?
experienceammounts = {0,100,300,600};

if (experience >= #I(experienceammounts,2)){
blah
}

right? I've never used string arrays before, if that's what I would use.

ForgottenLegacy 09-04-2005 03:59 AM

Quote:

Originally Posted by Torankusu_2002
Yeah, I think you got the gist of what I was trying to show with my example.
I was going to store them in an array, but I've never really toyed with them before. you'd get them like this, right?
experienceammounts = {0,100,300,600};

if (experience >= #I(experienceammounts,2)){
blah
}

right? I've never used string arrays before, if that's what I would use.

They're arent string arrays; they're just arrays, so experienceammounts[2] would work.

Torankusu_2002 09-04-2005 04:21 AM

Quote:

Originally Posted by ForgottenLegacy
They're arent string arrays; they're just arrays, so experienceammounts[2] would work.

oh, gotcha.

The syntax for them is experienceammounts[portion#]?
Does it start at 0,1,2,...etc or 1,2,3,...etc?

Riot 09-04-2005 05:40 AM

Arrays start at 0

Polo 09-04-2005 12:15 PM

Quote:

Originally Posted by Torankusu_2002
oh, gotcha.

The syntax for them is experienceammounts[portion#]?
Does it start at 0,1,2,...etc or 1,2,3,...etc?

Arrays start at 0, which is why I added the experience ammount 0 at the start of my example, thus meaning if you are level 0 you need 0 experience to level up lol.

You could always access them with somthing like 'ExperienceAmmounts[Level - 1]' instead, so that when you are Level 1, it looks at Position 0 (ie: the first position) in the array.


All times are GMT +2. The time now is 04:12 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.