Host32 1 Posted August 1, 2015 (edited) 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 August 1, 2015 by Host32 Quote Share this post Link to post Share on other sites
0 Host32 1 Posted August 1, 2015 (edited) 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 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 Edited August 1, 2015 by Host32 Quote Share this post Link to post Share on other sites
0 Winterfox 83 Posted August 1, 2015 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" ); Quote Share this post Link to post Share on other sites
0 Garr 117 Posted August 1, 2015 Hmm, but wouldn't it give stat points every time on level up, but not delete them on level down? Quote Share this post Link to post Share on other sites
0 Winterfox 83 Posted August 1, 2015 @@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. Quote Share this post Link to post Share on other sites
0 Host32 1 Posted August 1, 2015 (edited) @@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! Edited August 1, 2015 by Host32 Quote Share this post Link to post Share on other sites
0 Winterfox 83 Posted August 1, 2015 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;} Quote Share this post Link to post Share on other sites
Share this post
Link to post
Share on other sites