Set a player's lvl only in one map?

Host32

New member
Messages
22
Points
0
Age
32
Location
Brazil
Github
Host32
Emulator
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
default_smile.png

 
Last edited by a moderator:
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:

Code:
callfunc( "PVPLP_revertLevel" );
 
Hmm, but wouldn't it give stat points every time on level up, but not delete them on level down?

 
@@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.

 
@@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!
default_biggrin.png


 
Last edited by a moderator:
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.

Code:
-	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;}
 
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
default_smile.png


Ha, and the error was repeated in function too
default_tongue.png


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
default_smile.png

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
default_biggrin.png


 
Last edited by a moderator:
Back
Top