Jump to content
  • 0

Max Level Cap NPC


SovietBR

Question


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.01
  • Content Count:  20
  • Reputation:   1
  • Joined:  12/10/22
  • Last Seen:  

Hi, I'm tryng to make a NPC that can lock the max level of a player when asked so, but it's reversable. The max level o the server is 250/130, but the NPC would cap that to 99/70 if the player want. The easiest way I found was to make the player go back to 99/70 everytime he level up above that.
This is the script I'm trying to work on:

prontera,150,150,5	script	test	714,{
	mes "[Level Cap Setter]";
	mes "Hello, adventurer!";
	mes "Would you like to cap your base level at 99 and job level at 70?";
	mes "Or, if you want to remove the cap, I can help with that too.";
	next;

	if (#BaseLevelCap == 99 && #JobLevelCap == 70) {
		switch(select("Uncap my levels:Cancel")) {
			case 1:
				mes "[Level Cap Setter]";
				set #BaseLevelCap, 0;
				set #JobLevelCap, 0;
				mes "Your levels are now uncapped.";
				close;

			case 2:
				mes "[Level Cap Setter]";
				mes "No problem, feel free to come back anytime!";
				close;
		}
	} else {
		switch(select("Cap my levels:Cancel")) {
			case 1:
				mes "[Level Cap Setter]";
				set #BaseLevelCap, 99;
				set #JobLevelCap, 70;
				mes "Your base level will now be capped at 99 and job level at 70.";
				mes "If you reach level 99/70, you will be reset to level 99/70 and lose any excess experience.";
				close;

			case 2:
				mes "[Level Cap Setter]";
				mes "No problem, feel free to come back anytime!";
				close;
		}
	}
	
	OnInit:
		// Initialize global variables to zero
		set #BaseLevelCap, 0;
		set #JobLevelCap, 0;
		end;
}

OnPCBaseLevelUpEvent:
	if (#BaseLevelCap == 99 && BaseLevel > #BaseLevelCap) {
		set BaseLevel, #BaseLevelCap;
		set BaseExp, 0;
		mes "[Level Cap Setter]";
		mes "You have reached the base level cap. Your base level is now reset to 99.";
		end;
	}

OnPCJobLevelUpEvent:
	if (#JobLevelCap == 70 && JobLevel > #JobLevelCap) {
		set JobLevel, #JobLevelCap;
		set JobExp, 0;
		mes "[Level Cap Setter]";
		mes "You have reached the job level cap. Your job level is now reset to 70.";
		end;
	}

And those are the errors I'm getting:
image.png.f1d717e9d01c23b8642f3b1daef87dbe.png

I have try to change to "OnPcBaseLVUpEvent" too, but still gives the same errors.

I'll be really greatfull if someone could give me a hand on this. Thanks!

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Forum Manager
  • Topic Count:  282
  • Topics Per Day:  0.06
  • Content Count:  3145
  • Reputation:   1633
  • Joined:  03/26/12
  • Last Seen:  

The labels need to be inside the curly braces {} of the NPC script.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...