Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-04-2005, 01:15 AM
Torankusu_2002 Torankusu_2002 is offline
'been round.
Torankusu_2002's Avatar
Join Date: Nov 2001
Posts: 1,246
Torankusu_2002 is on a distinguished road
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.
__________________
torankusu's
Reply With Quote
  #2  
Old 09-04-2005, 01:39 AM
Polo Polo is offline
Classic Systems Admin
Join Date: Sep 2002
Location: Vancouver, Canada
Posts: 735
Polo is on a distinguished road
Send a message via AIM to Polo
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.
__________________
Be good little players, or Master Storm will ban you!



Proof that the staff are crazy..
*Ghost Pirate: I'm a little teacup short and stubbe here is my raygun here is my butt
DragonX: Jumping jack rabbits Batman! Our eggo waffles have been stolen! To the batmobile Robin!
X-Mann (RC): I have a head ache
Reply With Quote
  #3  
Old 09-04-2005, 03:47 AM
Torankusu_2002 Torankusu_2002 is offline
'been round.
Torankusu_2002's Avatar
Join Date: Nov 2001
Posts: 1,246
Torankusu_2002 is on a distinguished road
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.
__________________
torankusu's
Reply With Quote
  #4  
Old 09-04-2005, 03:59 AM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
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.
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight
Reply With Quote
  #5  
Old 09-04-2005, 04:21 AM
Torankusu_2002 Torankusu_2002 is offline
'been round.
Torankusu_2002's Avatar
Join Date: Nov 2001
Posts: 1,246
Torankusu_2002 is on a distinguished road
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?
__________________
torankusu's
Reply With Quote
  #6  
Old 09-04-2005, 05:40 AM
Riot Riot is offline
Delteria Management
Join Date: Nov 2003
Location: Seminole County, Florida
Posts: 280
Riot is on a distinguished road
Arrays start at 0
Reply With Quote
  #7  
Old 09-04-2005, 12:15 PM
Polo Polo is offline
Classic Systems Admin
Join Date: Sep 2002
Location: Vancouver, Canada
Posts: 735
Polo is on a distinguished road
Send a message via AIM to Polo
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.
__________________
Be good little players, or Master Storm will ban you!



Proof that the staff are crazy..
*Ghost Pirate: I'm a little teacup short and stubbe here is my raygun here is my butt
DragonX: Jumping jack rabbits Batman! Our eggo waffles have been stolen! To the batmobile Robin!
X-Mann (RC): I have a head ache
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:46 PM.


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