Spooon's Exp/Leveling System

Features

  • You gain EXP when you kill a baddy
  • Saves exp as client.exp and maxexp (exp you need to gain a level) as client.maxexp
  • Players gain levels
  • Levels are saved as client.level
  • NPCs can give exp when they are killed (added script in NPC needed)
if ( playerenters && !hasweapon(-EXPsys) ) {
 toweapons -EXPsys;
 setstring clientr.level,1;
 setstring clientr.maxexp,50;
 setstring clientr.exp,0;
}
if ( hasweapon(-EXPsys) ) {
 if ( created || timeout ) {
  for ( i = 0; i < compuscount; i++ ) {
   if ( compus[i].mode == 5 && compus[i].type == 0 ) {
    setstring clientr.exp,#v(strtofloat(#s(clientr.exp)) + 2);
   }
   if ( compus[i].mode == 5 && compus[i].type == 1 ) {
    setstring clientr.exp,#v(strtofloat(#s(clientr.exp)) + 5);
   }
   if ( compus[i].mode == 5 && compus[i].type == 2 ) {
    setstring clientr.exp,#v(strtofloat(#s(clientr.exp)) + 10);
   }
   if ( compus[i].mode == 5 && compus[i].type == 3 ) {
    setstring clientr.exp,#v(strtofloat(#s(clientr.exp)) + 5);
   }
   if ( compus[i].mode == 5 && compus[i].type == 4 ) {
    setstring clientr.exp,#v(strtofloat(#s(clientr.exp)) + 2);
   }
   if ( compus[i].mode == 5 && compus[i].type == 5 ) {
    setstring clientr.exp,#v(strtofloat(#s(clientr.exp)) + 1);
   }
   if ( compus[i].mode == 5 && compus[i].type == 6 ) {
    setstring clientr.exp,#v(strtofloat(#s(clientr.exp)) + 1);
   }
   if ( compus[i].mode == 5 && compus[i].type == 7 ) {
    setstring clientr.exp,#v(strtofloat(#s(clientr.exp)) + 15);
   }
   if ( compus[i].mode == 5 && compus[i].type == 8 ) {
    setstring clientr.exp,#v(strtofloat(#s(clientr.exp)) + 25);
   }
   if ( compus[i].mode == 5 && compus[i].type == 9 ) {
    setstring clientr.exp,#v(strtofloat(#s(clientr.exp)) + 25);
   }
  }
  timeout = 1.5;
 }
}
if ( strtofloat(#s(clientr.exp)) >= strtofloat(#s(clientr.maxexp)) ) {
 setstring clientr.maxexp,#v(strtofloat(#s(clientr.maxexp)) * 2.5);
 setstring clientr.level,#v(strtofloat(#s(clientr.level)) + 1);
 say2 You are now level #s(clientr.level)!;
}

You can change the amount of exp gained yourselves.

Add to a NPC to get exp when they are killed. Make sure the NPC has maxhearts set to the amount of hearts the NPC starts with.

maxhearts = 5; //example

The script that adds the EXP should be added to the bottom of the script.

//mine looks like this
if (timeout && this.mode==4) { // DYING
 setstring clientr.exp,#v(strtofloat(#s(clientr.exp)) + ((maxhearts ^ 3)%(swordpower ^ 3)));
 this.mode = 5; // RESPAWN
 timeout = 10;
}

NOTE - This leveling system DOES NOT set attributes like strength and dexterity nor does it add to player vars. You’ll have to do that yourself.

Re: Spooon’s Exp/Leveling System

THATS HIM, THATS HIS AIM SN RIGHT THERE!

Re: Spooon’s Exp/Leveling System

THATS HIM, THATS HIS AIM SN RIGHT THERE!

Re: Spooon’s Exp/Leveling System

drop a timereverywhere in there and it will work for everyone not just the leader

Re: Spooon’s Exp/Leveling System

Eh, either way there has allready been nearly identical exp systems posted allready. (Like one 6 topics below this one.)

Re: Spooon’s Exp/Leveling System

I made this in five minutes. I never said it was perfect.

Re: Spooon’s Exp/Leveling System

This system sucks! 8)

Re: Spooon’s Exp/Leveling System

blah i don’t care i put this here because i was bored <.<

Re: Spooon’s Exp/Leveling System

FYI. I wasn’t being seriously if you didn’t notice in my last post.

Re: Spooon’s Exp/Leveling System

blah i don’t care i cannot easily tell if there is sarcasm in something writen

Re: Spooon’s Exp/Leveling System

I have to say, porely scripted. Let me explain, you’re using multiple lines of the SAME command

   if ( compus[i].mode == 5 && compus[i].type == 0 ) {

When you could do it in as little as 4 lines.

I don’t notice a pattern persay so id create a string with the values… a forloop to process comand x number of times were x is how many values in the array.

Could greatly be improved I guess.

so this will work on a server??
hope you dont mind if i use it, i may enjoy having an EXP system in a PW…

would this work with a door that only opens at certain lvls?? (yes i know its a used idea but its still a good one :D)

No offense to Spooon, but you’re better off using Hashi’s version for that. It has more strings that you can call requests for. You would be using a “if (strequals()) {” kind of thing for that type of door.

i may do, i kind of end up doing NPC as i need them and doing anything to try to get them to work, now i think about it, it could be VERY useful to have this forum to help me with making my PW, it is my first PW im making from scratch so abit of help from you guys would be awsome :slight_smile:

any idea where i can get a hold of Hashi’s version if you think it will help, oh and does it have an EXP bar that you can see moving??

Hay Hay Spooon!

Blargh you gotta use all the GS1 stuff here lmao
I’lllearn eventually if I can I guess…

My EXP System

Humm i finaly got around to trying this out and it didnt work? is it only online?

anyway i desided that i would do all i can to get a working one, so i used a bit of another PlayerWorlds code that i got and tied spooon’s in to it, the results i got at first were bad to say the least…

But with a bit of work i have fully functional EXP system, also for the hell of it i put in an MP generator so ever kill gives you 5 MP… oh yea and its got a progess bar that im still working on abit as it dont work as well as i would like (the frame dont show up, but the bar does).

i would post it but 2 things are stopping me, 1 i dont know how to use the BB Code to post Codes, 2 its not finnished as the frame doesnt work… oh yea and 3 i need to test it for buggs, i dont like showing stuff that could have buggs in it.

GTFO SWITCH!!!

Lock this damn thread! I’m sick of people saying it sucks when I already know it does. I’m not going to put my best works onto the forums. I put this to show people a way to get exp from baddies. I could have made it easier for experienced scripters but I think this is easier to see how it works for newer scripters.

if you dont like the thread dont post in it, or dont even read it if its that bad… but let some of us get help when we need it please.

ok i think i got my exp system working used abit of spooon’s to help me along and it turned out good i think, may be a bit long but that tends to be how most of my codes turn out like.
here you go try it out and tell me if you can find any problems… and even better the solutions as well :smiley:

[code]// NPC made by Lord Negitar

if (playerenters) {
hidelocal;
}

timeout=0.05;

if (playerenters&&isweapon) {
reMap();
timeout=.05;
}

if (playerenters&&!isweapon) {
toweapons -Server Sys;
setstring client.ep,0;
setstring client.MP,0;
setstring client.mxep,100;
setstring client.eplvl,1;
setstring client.epmaxlvl,99;
if (strequals(#v(strtofloat(#s(client.ep))),0)) {
hideimg 505;
}
}

if (timeout&&isweapon) {
this.ep = strtofloat(#s(client.ep));
this.mxep = strtofloat(#s(client.mxep));
reMap();
timeout=.05;
}

function reMap() {
this.x1 = screenwidth-210;
this.y1 = 4;
showimg 504,expbar.gif,this.x1-115,this.y1+5;
changeimgvis 504,35;
changeimgpart 504,0,0,110,35;
showimg 505,expbar2.gif,this.x1-85,this.y1+15;
changeimgvis 505,12;
changeimgpart 505,0,0,(this.ep/this.mxep)*72,12;
return;
}

if (strequals(#v(strtofloat(#s(client.ep))),0)) {
hideimg 505;
}

timeout=0.05;

if (timeout) {
//Ratio = EXP out : variable in.
//Dont change client.MP values.
for ( i = 0; i < compuscount; i++; ) {
if ( compus[i].mode == 5 && compus[i].type == 0 ) {
//Ratio = 30:1
setstring client.ep,#v(strtofloat(#s(client.ep)) + .1);
setstring client.MP,#v(strtofloat(#s(client.MP)) + .033);
}
if ( compus[i].mode == 5 && compus[i].type == 1 ) {
//Ratio = 30:1
setstring client.ep,#v(strtofloat(#s(client.ep)) + .15);
setstring client.MP,#v(strtofloat(#s(client.MP)) + .033);
}
if ( compus[i].mode == 5 && compus[i].type == 2 ) {
//Ratio = 30:1
setstring client.ep,#v(strtofloat(#s(client.ep)) + .15);
setstring client.MP,#v(strtofloat(#s(client.MP)) + .033);
}
if ( compus[i].mode == 5 && compus[i].type == 3 ) {
//Ratio = 30:1
setstring client.ep,#v(strtofloat(#s(client.ep)) + .15);
setstring client.MP,#v(strtofloat(#s(client.MP)) + .033);
}
if ( compus[i].mode == 5 && compus[i].type == 4 ) {
//Ratio = 30:1
setstring client.ep,#v(strtofloat(#s(client.ep)) + .05);
setstring client.MP,#v(strtofloat(#s(client.MP)) + .033);
}
if ( compus[i].mode == 5 && compus[i].type == 5 ) {
//Ratio = 16:1 to 20:1 (varys on unknown)
setstring client.ep,#v(strtofloat(#s(client.ep)) + .0);
setstring client.MP,#v(strtofloat(#s(client.MP)) + .0);
}
if ( compus[i].mode == 5 && compus[i].type == 6 ) {
//Ratio = 20:1
setstring client.ep,#v(strtofloat(#s(client.ep)) + .2);
setstring client.MP,#v(strtofloat(#s(client.MP)) + .033);
}
if ( compus[i].mode == 5 && compus[i].type == 7 ) {
//Ratio = 30:1
setstring client.ep,#v(strtofloat(#s(client.ep)) + .25);
setstring client.MP,#v(strtofloat(#s(client.MP)) + .033);
}
if ( compus[i].mode == 5 && compus[i].type == 8 ) {
//Ratio = 30:1
setstring client.ep,#v(strtofloat(#s(client.ep)) + .3);
setstring client.MP,#v(strtofloat(#s(client.MP)) + .033);
}
if ( compus[i].mode == 5 && compus[i].type == 9 ) {
//Ratio = 30:1
setstring client.ep,#v(strtofloat(#s(client.ep)) + .15);
setstring client.MP,#v(strtofloat(#s(client.MP)) + .033);
}
}
}
if (strequals(#v(strtofloat(#s(client.MP))),0.99)) {
playermp+=5;
setstring client.MP,0;
}

if (timeout) {
showimg 600,@b@Server@EXP: #s(client.ep),this.x1-115,this.y1+40;
showimg 601,@b@Server@Level: #s(client.eplvl),this.x1-115,this.y+60;
changeimgvis 600,5;
changeimgvis 601,5;
changeimgzoom 600,.7;
changeimgzoom 601,.7;
changeimgcolors 600,.1,.1,.1,.1;
changeimgcolors 601,.1,.1,.1,.1;
}

if (timeout) {
if (strequals(#v(strtofloat(#s(client.ep))),100)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))+1);
setstring client.ep,0;
play chest.wav;
}
if (strequals(#v(strtofloat(#s(client.ep))),101)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))+1);
setstring client.ep,0;
play chest.wav;
}
if (strequals(#v(strtofloat(#s(client.ep))),102)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))+1);
setstring client.ep,0;
play chest.wav;
}
if (strequals(#v(strtofloat(#s(client.ep))),103)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))+1);
setstring client.ep,0;
play chest.wav;
}
if (strequals(#v(strtofloat(#s(client.ep))),104)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))+1);
setstring client.ep,0;
play chest.wav;
}
if (strequals(#v(strtofloat(#s(client.ep))),105)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))+1);
setstring client.ep,0;
play chest.wav;
}
if (strequals(#v(strtofloat(#s(client.ep))),100.5)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))+1);
setstring client.ep,0;
play chest.wav;
}
if (strequals(#v(strtofloat(#s(client.ep))),101.5)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))+1);
setstring client.ep,0;
play chest.wav;
}
if (strequals(#v(strtofloat(#s(client.ep))),102.5)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))+1);
setstring client.ep,0;
play chest.wav;
}
if (strequals(#v(strtofloat(#s(client.ep))),103.5)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))+1);
setstring client.ep,0;
play chest.wav;
}
if (strequals(#v(strtofloat(#s(client.ep))),104.5)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))+1);
setstring client.ep,0;
play chest.wav;
}
if (strequals(#v(strtofloat(#s(client.ep))),105.5)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))+1);
setstring client.ep,0;
play chest.wav;
}
if (strequals(#v(strtofloat(#s(client.eplvl))),100)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))99);
}
if (strequals(#v(strtofloat(#s(client.eplvl))),101)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))99);
}
if (strequals(#v(strtofloat(#s(client.eplvl))),102)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))99);
}
if (strequals(#v(strtofloat(#s(client.eplvl))),103)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))99);
}
if (strequals(#v(strtofloat(#s(client.eplvl))),104)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))99);
}
if (strequals(#v(strtofloat(#s(client.eplvl))),105)) {
setstring client.eplvl,#v(strtofloat(#s(client.eplvl))99);
}
}
[/code]

How cute. You made your own cute, little script.

ty, i have found 1 bugg in it, the frame for the exp bar wont load still it seems to be completely bust but i dont know how to fix it.