Jump to content
  • 0
Sign in to follow this  
Cabrera

Is this possible?

Question

Hey guyz i donno if im in the right section but i think it is something to do with scripting :I if not im sorry ohmy.png,

 

Ok let me start! Well im trying to configure my server in a way that 3rd jobs cant enter a certain map(town actually) and once a trans job converts to a 3rd job he will be automatically warped to a town example map,x,y and also will recieve a certificate of authorization(LOL its just an item xD nothing to do with this.) from the jobchanger. By this ITEM ( say item 1220?) the 3rd job player cant enter prontera( YEa prontera xD)(is this possible? like to restrict warping to town based on an item?

 

Also, Once a trans 1st job turns to his 2nd job(example: i mean from trans thief to assassin cross) he also gets an item say 1221? which causes him to NOT warp to the 3rd job town(like i said before map x,y) i mean hes restricted to go there.(Hope this is do able? could u use something like (checkitem == 1221)? Thnx in advance it Would be SO Great if u help me on this smile.png

 

P.S: Hope u understood tongue.png and i will be using the official rAthena job quests smile.png

THnx in advance,

Santafe from rA~

 

I posted here cuz im a Fan of annie and shes here :P so plz annie help me xD Any 1 else can also help cuz i really need this one :P :P

Edited by Cabrera

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0

The solution is there, but it's quite processor intensive to be honest.

 

Just add loadevent mapflags to all the cities you want to restrict the warps in, and make a NPC that should be much like this:

http://upaste.me/54a9103646ac0b102 (I haven't tested it but it should work)

-	script	warp_banned	-1,{OnInit:	setarray .not_2ndjob$[0], "prontera", "payon", "aldebaran"; // Maps NOT for second jobs. Add more with a comma, last member should have a semicolon	setarray .not_3rdjob$[0], "amatsu", "gonryun", "geffen"; // Same as above, but for third jobs	set .item_2ndjob, 1220; // Set your 2nd job item here	set .item_3rdjob, 1221; // Set your 3rd job item here	end;OnPCLoadMapEvent:	if (countitem(.item_2ndjob)) { // Player has the 2nd job item		for (set .@i,0; .@i < getarraysize(.not_2ndjobs$); set .@i, .@i + 1){			if (strcharinfo(3) == .not_2ndjobs$[.@i]){				dispbottom "You're not supposed to be here...";				warp "SavePoint",0,0;			}		}	}	else if (countitem(.item_3rdjob)) { // Player has the 3rd job item		for (set .@i,0; .@i < getarraysize(.not_3rdjobs$); set .@i, .@i + 1){			if (strcharinfo(3) == .not_3rdjobs$[.@i]){				dispbottom "You're not supposed to be here...";				warp "SavePoint",0,0;			}		}	}	end;}

 

Just don't forget to remove the 2nd job token when changing to third!

 

P.S.: Anyways, scripting lets you know if someone is 2nd or third job, so in my modest opinion that item is just unnecessary mess.

Share this post


Link to post
Share on other sites
  • 0

The solution is there, but it's quite processor intensive to be honest.

 

Just add loadevent mapflags to all the cities you want to restrict the warps in, and make a NPC that should be much like this:

http://upaste.me/54a9103646ac0b102 (I haven't tested it but it should work)

 

-	script	warp_banned	-1,{OnInit:	setarray .not_2ndjob$[0], "prontera", "payon", "aldebaran"; // Maps NOT for second jobs. Add more with a comma, last member should have a semicolon	setarray .not_3rdjob$[0], "amatsu", "gonryun", "geffen"; // Same as above, but for third jobs	set .item_2ndjob, 1220; // Set your 2nd job item here	set .item_3rdjob, 1221; // Set your 3rd job item here	end;OnPCLoadMapEvent:	if (countitem(.item_2ndjob)) { // Player has the 2nd job item		for (set .@i,0; .@i < getarraysize(.not_2ndjobs$); set .@i, .@i + 1){			if (strcharinfo(3) == .not_2ndjobs$[.@i]){				dispbottom "You're not supposed to be here...";				warp "SavePoint",0,0;			}		}	}	else if (countitem(.item_3rdjob)) { // Player has the 3rd job item		for (set .@i,0; .@i < getarraysize(.not_3rdjobs$); set .@i, .@i + 1){			if (strcharinfo(3) == .not_3rdjobs$[.@i]){				dispbottom "You're not supposed to be here...";				warp "SavePoint",0,0;			}		}	}	end;}
 

Just don't forget to remove the 2nd job token when changing to third!

 

P.S.: Anyways, scripting lets you know if someone is 2nd or third job, so in my modest opinion that item is just unnecessary mess.

Wow thx for the script sir, about the mess u talked about, is there a possibility for a mapflag to restrict trans jobs from entering a certain town or map? Then i can remove the need of having an item to restric trans jobs from entering the 3rd jobs town. Though i think ill keep the 3rd job item thing. Is this possible? Thanx alot sir :)

Share this post


Link to post
Share on other sites
  • 0

If I were you, I'd just get rid of the item since you could try to cheat your way off the restrictions while using the class renders these cheats impossible. You could still give the item for the fun if you want, but do the checks based on the job.

 

Keeping on the processor-intensive idea of using the loadevent mapflag on each map you want to restrict and add them to its respective list, for restricting 3rd jobs or 2nd trans jobs you should use bitmasks, which is minor magic but makes the restriction easier:

-	script	warp_banned	-1,{OnInit:	setarray .not_2ndjob$[0], "prontera", "payon", "aldebaran"; // Maps NOT for second jobs. Add more with a comma, last member should have a semicolon	setarray .not_3rdjob$[0], "amatsu", "gonryun", "geffen"; // Same as above, but for third jobs	end;OnPCLoadMapEvent:	if ( eaclass()&(EAJL_UPPER|EAJL_2) ) { // Player is 2nd trans job		for (set .@i,0; .@i < getarraysize(.not_2ndjobs$); set .@i, .@i + 1){			if (strcharinfo(3) == .not_2ndjobs$[.@i]){				dispbottom "You're not supposed to be here...";				warp "SavePoint",0,0;			}		}	}	else if ( eaclass()&EAJL_THIRD ) { // Player is the 3rd job		for (set .@i,0; .@i < getarraysize(.not_3rdjobs$); set .@i, .@i + 1){			if (strcharinfo(3) == .not_3rdjobs$[.@i]){				dispbottom "You're not supposed to be here...";				warp "SavePoint",0,0;			}		}	}	end;}

 

Again, I haven't tested it but should work as expected.

 

If you want to make custom mapflags for checking if somebody is 2nd trans or 3rd job, then it's a source request and it's beyond my abilities ATM ;).

Share this post


Link to post
Share on other sites
  • 0

If I were you, I'd just get rid of the item since you could try to cheat your way off the restrictions while using the class renders these cheats impossible. You could still give the item for the fun if you want, but do the checks based on the job.

 

Keeping on the processor-intensive idea of using the loadevent mapflag on each map you want to restrict and add them to its respective list, for restricting 3rd jobs or 2nd trans jobs you should use bitmasks, which is minor magic but makes the restriction easier:

 

-	script	warp_banned	-1,{OnInit:	setarray .not_2ndjob$[0], "prontera", "payon", "aldebaran"; // Maps NOT for second jobs. Add more with a comma, last member should have a semicolon	setarray .not_3rdjob$[0], "amatsu", "gonryun", "geffen"; // Same as above, but for third jobs	end;OnPCLoadMapEvent:	if ( eaclass()&(EAJL_UPPER|EAJL_2) ) { // Player is 2nd trans job		for (set .@i,0; .@i < getarraysize(.not_2ndjobs$); set .@i, .@i + 1){			if (strcharinfo(3) == .not_2ndjobs$[.@i]){				dispbottom "You're not supposed to be here...";				warp "SavePoint",0,0;			}		}	}	else if ( eaclass()&EAJL_THIRD ) { // Player is the 3rd job		for (set .@i,0; .@i < getarraysize(.not_3rdjobs$); set .@i, .@i + 1){			if (strcharinfo(3) == .not_3rdjobs$[.@i]){				dispbottom "You're not supposed to be here...";				warp "SavePoint",0,0;			}		}	}	end;}
 

Again, I haven't tested it but should work as expected.

 

If you want to make custom mapflags for checking if somebody is 2nd trans or 3rd job, then it's a source request and it's beyond my abilities ATM ;).

Thx :) solved :D ill checkout the bitmast thing i think i saw emistry have one script so yea thx for the advice sir it helped Alot!

Share this post


Link to post
Share on other sites
  • 0

I posted here cuz im a Fan of annie and shes here :P so plz annie help me xD Any 1 else can also help cuz i really need this one :P :P

a bit off-topic but

yeah, 1 of the reason I move here because in hercules already has some powerful scripters around :P

 

the only thing that jabote missed out is missing setmapflag

-	script	warp_banned	-1,{OnInit:	setarray .not_2ndjob$[0], "morocc", "payon", "aldebaran"; // Maps NOT for second jobs. Add more with a comma, last member should have a semicolon	setarray .not_3rdjob$[0], "amatsu", "gonryun", "geffen"; // Same as above, but for third jobs	.not_2ndjob_size = getarraysize(.not_2ndjob$);	.not_3rdjob_size = getarraysize(.not_3rdjob$);	for ( .@i = 0; .@i < .not_2ndjob_size; .@i++ )		setmapflag .not_2ndjob$[.@i], mf_loadevent; // Thx to Keyworld <3	for ( .@i = 0; .@i < .not_3rdjob_size; .@i++ )		setmapflag .not_3rdjob$[.@i], mf_loadevent;	end;OnPCLoadMapEvent:	if ( eaclass() & ( EAJL_UPPER | EAJL_2 ) ) { // Player is 2nd trans job		while ( strcharinfo(3) != .not_2ndjob$[.@i] && .@i < .not_2ndjob_size ) .@i++;	}	else if ( eaclass() & EAJL_THIRD ) { // Player is the 3rd job		while ( strcharinfo(3) != .not_3rdjob$[.@i] && .@i < .not_3rdjob_size ) .@i++;	}	else		end;	if ( .@i != .not_2ndjob_size || .@i != .not_3rdjob_size ) {		dispbottom "You're not supposed to be here...";		warp "SavePoint",0,0;	}	end;}
... hmm .. why this {code} doesn't has cut the length ...

edit ... oh ... have to refresh the page =/

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

Thanks for the setmapflag point, I just supposed Cabrera would have them set by himself somewhere else and didn't add them on the script.

 

I usually prefer to make the scripts readable for the people, so that they could easily modify and/or use them for learning. At least in my hopes someone would ever get encouraged to jump upon the scripting because of my scripts...

Share this post


Link to post
Share on other sites
  • 0

 

I posted here cuz im a Fan of annie and shes here :P so plz annie help me xD Any 1 else can also help cuz i really need this one :P :P

a bit off-topic butyeah, 1 of the reason I move here because in hercules already has some powerful scripters around :Pthe only thing that jabote missed out is missing setmapflag
-	script	warp_banned	-1,{OnInit:	setarray .not_2ndjob$[0], "morocc", "payon", "aldebaran"; // Maps NOT for second jobs. Add more with a comma, last member should have a semicolon	setarray .not_3rdjob$[0], "amatsu", "gonryun", "geffen"; // Same as above, but for third jobs	.not_2ndjob_size = getarraysize(.not_2ndjob$);	.not_3rdjob_size = getarraysize(.not_3rdjob$);	for ( .@i = 0; .@i < .not_2ndjob_size; .@i++ )		setmapflag .not_2ndjob$, mf_loadevent;	for ( .@i = 0; .@i < .not_3rdjob_size; .@i++ )		setmapflag .not_3rdjob$, mf_loadevent;	end;OnPCLoadMapEvent:	if ( eaclass() & ( EAJL_UPPER | EAJL_2 ) ) { // Player is 2nd trans job		while ( strcharinfo(3) != .not_2ndjob$[.@i] && .@i < .not_2ndjob_size ) .@i++;	}	else if ( eaclass() & EAJL_THIRD ) { // Player is the 3rd job		while ( strcharinfo(3) != .not_3rdjob$[.@i] && .@i < .not_3rdjob_size ) .@i++;	}	else		end;	if ( .@i != .not_2ndjob_size || .@i != .not_3rdjob_size ) {		dispbottom "You're not supposed to be here...";		warp "SavePoint",0,0;	}	end;}
... hmm .. why this {code} doesn't has cut the length ...edit ... oh ... have to refresh the page =/

So sorry for the late reply but annie may i ask? Should i set the mapflag in the mapflag folder or this script already sets is? Since i see a line mf_loadevent so it initiates the loadevent? Thx again ;)

 

 

@jabote

Thank you for ur reply sir, it really helped me cuz i wanted to implement 3rd jobs in sucha. Way that they dont clash with 2nd jobs (during woe,pvp etc) and vice versa for trans :) thx again <3

Share this post


Link to post
Share on other sites
  • 0

@Annie

 

Just because it's you <3

You miss array element in the setmapflag :P

 

And because it's too much time since the last time I touch to Athena script, just cheating:

 

-	script	warp_banned	-1,{OnInit:	setarray .@denymap_2nd$, "morocc", "payon", "aldebaran"; // Maps NOT for second jobs. Add more with a comma, last member should have a semicolon	setarray .@denymap_3rd$, "amatsu", "gonryun", "geffen";  // Same as above, but for third jobs	.@denymap_2ndSize = getarraysize(.@denymap_2nd$);	.@denymap_3rdSize = getarraysize(.@denymap_3rd$);	for (.@i = 0; .@i < .@denymap_2ndSize; .@i++) {		setmapflag .@denymap_2nd$[.@i], mf_loadevent;	}	for (.@i = 0; .@i < .@denymap_3rdSize; .@i++) {		setmapflag .@denymap_3rd$[.@i], mf_loadevent;	}	.@joinMap_2nd$ = "x1" + implode( .@denymap_2nd$, "x1") + "x1";	.@joinMap_3rd$ = "x1" + implode( .@denymap_3rd$, "x1") + "x1";	end;OnPCLoadMapEvent:	.@class   = eaclass();	.@search$ = "x1" + strcharinfo(3) + "x1";	if (		((.@class & (EAJL_UPPER | EAJL_2)) && strpos(.@joinMap_2nd$, .@search$) > -1) ||		((.@class & EAJL_THIRD)            && strpos(.@joinMap_3rd$, .@search$) > -1)	) { 		dispbottom "You're not supposed to be here...";		warp "SavePoint",0,0;	}}

 

Share this post


Link to post
Share on other sites
  • 0

hahaha @KeyWorld ! I just learn strpos can be use this way !

it seems better than *compare ... that *compare method was learned from you to begin with

 

now I go open another topic, solve for me please <3

http://herc.ws/board/topic/4321-help-me-improve-this-merge-sort-algorithm/

 

@Cabrera

since the script already has setmapflag, there is no need to set another mapflag again

use keyworld's script, his script better than mine ! ( my scripting rival hahaha )

 

 

EDIT:

it seems keyworld's script somehow not working when I test it, let me check

 

yeah, really out from scripting for too long hahaha

.@joinMap_2nd$ is a scope variable that will vanish after the script hits an END;

it should be change into npc variable

Edited by AnnieRuru

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.