Jump to content
  • 0
Sign in to follow this  
Host32

Set a player's lvl only in one map?

Question

Hello guys!
 
I would like to know how to create a PvP map where all players were lvl 99 it.
 
For example, a player low lvl when entering the map, him lvl would be set to 99, but when he leave it, he back to the original character level.
 
The player's status points can be reset if is necessary...
 
Sorry for my english and thanks in advance :)
Edited by Host32

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Something i quickly hacked together, not sure if it works 100%:

-	script	PVP_LEVEL_UP	-1,{	OnInit:		setarray .maps$, "pvp1", "pvp2", "pvp3";		setarray .minLevel, 99;				for( .@i = 0; .@i < getarraysize( .maps$ ); .@i++ )			setmapflag .maps$[ .@i ], mf_loadevent;	end;		OnPCLoadMapEvent:		getmapxy( .@map$, .@x, .@y, 0 );		if( !compare( implode( .@maps$, ":" ), .@map$ ) ) end;				if( BaseLevel < .minLevel ) {			PVPLP_TRUE_LEVEL = BaseLevel;			atcommand "@blvl " + .minLevel - BaseLevel;		}	end;		OnPCLogoutEvent:		callfunc( "PVPLP_revertLevel" );	end;}function	script	PVPLP_revertLevel	{	getmapxy( .@map$, .@x, .@y, 0 );	if( !compare( implode( .@maps$, ":" ), .@map$ ) ) end;	atcommand "@blvl " + PVPLP_TRUE_LEVEL - BaseLevel;}

You need to call this function before any part of your pvp script where the player leaves your pvp map to revert his level:

callfunc( "PVPLP_revertLevel" );

Share this post


Link to post
Share on other sites
  • 0

@@Garr I didn't really test it thorougly so it that might be possible.

Even though i believe @blevel manages those points on level down or doesn't it?

 

It is more of a example and less of a usable solution.

Share this post


Link to post
Share on other sites
  • 0

@@Winterfox its amazing! but i have one problem here:

 

[Warning]: script:implode: array length = 0

 

then I commented these lines:

 

getmapxy( .@map$, .@x, .@y, 0 );if( !compare( implode( .@maps$, ":" ), .@map$ ) ) end; 

 

And now it works:
 

-	script	PVP_LEVEL_UP	-1,{	OnInit:		setarray .maps$, "pvp1", "pvp2", "pvp3";		setarray .minLevel, 99;				for( .@i = 0; .@i < getarraysize( .maps$ ); .@i++ )			setmapflag .maps$[ .@i ], mf_loadevent;	end;	 	OnPCLoadMapEvent:		if( BaseLevel < .minLevel ) {			PVPLP_TRUE_LEVEL = BaseLevel;			atcommand "@blvl " + .minLevel - BaseLevel;		}	end;		OnPCLogoutEvent:		callfunc( "PVPLP_revertLevel" );	end;} function	script	PVPLP_revertLevel	{	atcommand "@blvl " + PVPLP_TRUE_LEVEL - BaseLevel;}

 

My question now is: what are the lines that I removed? I will have a problem if i leave without them?

 

Thank you! :D

Edited by Host32

Share this post


Link to post
Share on other sites
  • 0

I wouldn't recommed to remove parts of scripts that you don't understand.

Even if they give you errors, it could lead to even more errors and mostly won't really solve anything even though you don't get errors.

 

What this line does is, since OnPCLogoutEvent is started on every logout regardless of the map, it checks if you are on a pvp map and reverts the characters level. It might not be important, since when you relog you will end on the same map anyway, but i added it to prevent possible vulnerabilities there might be, that i didn't think of.

 

I also found the mistake, it was a variable i named wrong.

 

-	script	PVP_LEVEL_UP	-1,{	OnInit:		setarray .maps$, "pvp1", "pvp2", "pvp3";		setarray .minLevel, 99;				for( .@i = 0; .@i < getarraysize( .maps$ ); .@i++ )			setmapflag .maps$[ .@i ], mf_loadevent;	end;	 	OnPCLoadMapEvent:		getmapxy( .@map$, .@x, .@y, 0 );		if( !compare( implode( .maps$, ":" ), .@map$ ) ) end;				if( BaseLevel < .minLevel ) {			PVPLP_TRUE_LEVEL = BaseLevel;			atcommand "@blvl " + .minLevel - BaseLevel;		}	end;		OnPCLogoutEvent:		callfunc( "PVPLP_revertLevel" );	end;} function	script	PVPLP_revertLevel	{	getmapxy( .@map$, .@x, .@y, 0 );	if( !compare( implode( .@maps$, ":" ), .@map$ ) ) end; 	atcommand "@blvl " + PVPLP_TRUE_LEVEL - BaseLevel;}

Share this post


Link to post
Share on other sites
  • 0

ok now I understand

 

the OnPCLoadMapEvent label can be triggered by any map with the flag and not just the maps in this script, so you do this validation :)

 

Ha, and the error was repeated in function too :P

 

here is corrected:

 

-	script	PVP_LEVEL_UP	-1,{	OnInit:		setarray .maps$, "izlude", "pvp2", "pvp3";		setarray .minLevel, 99;				for( .@i = 0; .@i < getarraysize( .maps$ ); .@i++ )			setmapflag .maps$[ .@i ], mf_loadevent;	end;	 	OnPCLoadMapEvent:		getmapxy( .@map$, .@x, .@y, 0 );		if( !compare( implode( .maps$, ":" ), .@map$ ) ) end;				if( BaseLevel < .minLevel ) {			PVPLP_TRUE_LEVEL = BaseLevel;			atcommand "@blvl " + (.minLevel - BaseLevel);		}	end;		OnPCLogoutEvent:		callfunc( "PVPLP_revertLevel" );	end;} function	script	PVPLP_revertLevel	{	setarray .@maps$, "izlude", "pvp2", "pvp3";	getmapxy( .@map$, .@x, .@y, 0 );	if( !compare( implode( .@maps$, ":" ), .@map$ ) ) end; 	atcommand "@blvl " + (PVPLP_TRUE_LEVEL - BaseLevel);}
Note the parentheses in "atcommand" too :)

 

And i need copy the var maps to inside the function... the functions do not share variables with NPCs?

 

of all thank you! I managed to get the hang :D

Edited by Host32

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.