Jump to content
  • 0
Sign in to follow this  
msecastro

If player has item, warp back to savepoint

Question

Good day, Hercules Community!

 

I just switched from using rAthena to Hercules and I'm perfectly happy and satisfied with the switch! Good job on the project and more power to you guys!

 

I do have one question though:

 

I'm particularly new to scripting and have made my own scripts one way or another, but I have yet to learn about some more advanced scripting commands. I am currently developing an RP server where players can choose their citizenship (Rune-Midgard Kingdom, Republic of Schwartzvald, Arunafeltz States, etc..). Once they create a character and choose their country, they will be given an ID to prove their citizenship and then warp to its specific capital city/town. For instance, I've chosen to be part of the Rune-Midgard Kingdom, I will be given a Midgard ID Card and teleported to its capital city, Prontera. When I try to access a different country via warper or simply travelling all the way from Prontera to Yuno, I wil be warped out and sent back to my savepoint (Prontera). Is there any way to do this?

 

I tried looking into Hercules' Map Zone DB but I still cannot fully grasp it, but I feel that it has to be done here.

 

If anyone can extend their help, it would truly appreciated until I go over to the next life! More power to you guys!

 

Best regards,

msecastro

Share this post


Link to post
Share on other sites

13 answers to this question

Recommended Posts

  • 0

Just make 3 custom items, an NPC that checks what your citizenship is, and gives you the appropriate "Citizen ID" item.

Each one of the items can be something like this:

 

100000,Rune-Midgard ID,Rune-Midgard ID,11,0,,0,,,,0,0xFFFFFFFF,63,2,,,,,,{ warp "prontera",150,180; },{},{}

 

Obviously change the item ID, Name, and script to fit whatever you want it to be.

 

If you need more help with this feel free to PM me tomorrow, I'm headed to bed.

Edited by Nova

Share this post


Link to post
Share on other sites
  • 0

Just make 3 custom items, an NPC that checks what your citizenship is, and gives you the appropriate "Citizen ID" item.

Each one of the items can be something like this:

 

100000,Rune-Midgard ID,Rune-Midgard ID,11,0,,0,,,,0,0xFFFFFFFF,63,2,,,,,,{ warp "prontera",150,180; },{},{}

 

Obviously change the item ID, Name, and script to fit whatever you want it to be.

 

If you need more help with this feel free to PM me tomorrow, I'm headed to bed.

 

Thank you for replying to my inquiry, Nova! I'm truly grateful!

 

I have already made an NPC and the respective items required prior to the creation of this thread and I apologize for not mentioning it. What I want to clear up is: Is it possible to use map zone db in this case? I have read through Hercules' Map Zone DB but I cannot seem to find anything related to warping someone out of a zone if they have specific items in their inventory - or maybe I am misunderstanding something.

 

I made a temporary restriction by doing this:

-	script	ItemRestriction#from_midgard	-1,{	OnPCLoadMapEvent:		while ( strcharinfo(3) == "yuno" || strcharinfo(3) == "rachel" ) {			if ( countitem(30200) ) {				mes "[Citizenship Checker]";				mes "Halt, Stranger!";				next;				mes "[Citizenship Checker]";				mes "Through checking you ID card, you are a citizen of the Rune-Midgard Kingdom! You are not allowed to enter!";				next;				mes "[Citizenship Checker]";				mes "I will be teleporting you back to your capital city.";				next;				warp "SavePoint", 0, 0;				end;			}		sleep2 1000;		}		end;}-	script	ItemRestriction#from_arunafeltz	-1,{	OnPCLoadMapEvent:		while ( strcharinfo(3) == "prontera" || strcharinfo(3) == "rachel" ) {			if ( countitem(30201) ) {				mes "[Citizenship Checker]";				mes "Halt, Stranger!";				next;				mes "[Citizenship Checker]";				mes "Through checking you ID card, you are a citizen of the Arunafeltz States! You are not allowed to enter!";				next;				mes "[Citizenship Checker]";				mes "I will be teleporting you back to your capital city.";				next;				warp "SavePoint", 0, 0;				end;			}		sleep2 1000;		}		end;}-	script	ItemRestriction#from_schwartzvald	-1,{	OnPCLoadMapEvent:		while ( strcharinfo(3) == "prontera" || strcharinfo(3) == "yuno" ) {			if ( countitem(30202) ) {				mes "[Citizenship Checker]";				mes "Halt, Stranger!";				next;				mes "[Citizenship Checker]";				mes "Through checking you ID card, you are a citizen of the Republic of Schwartzvald! You are not allowed to enter!";				next;				mes "[Citizenship Checker]";				mes "I will be teleporting you back to your capital city.";				next;				warp "SavePoint", 0, 0;				end;			}		sleep2 1000;		}		end;}prontera	mapflag	loadeventyuno	mapflag	loadeventrachel	mapflag	loadevent

 

..but it feels so memory intensive so I'm quite looking for alternatives.

Edited by msecastro

Share this post


Link to post
Share on other sites
  • 0

I recommend you learn Map Zone DB ,its better than running a while loop

 

example, go to the bottom of map_zone_db.conf and add BEFORE the last ) the following:

 

,{    name: "Custom"        disabled_skills: {        SA_ABRACADABRA: "PLAYER"    }        mapflags: (        "noknockback",    )} 


now go to any npc script file and add this:

yourmapname<tab>mapflag<tab>zone<tab>Custom
Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0

 

I recommend you learn Map Zone DB ,its better than running a while loop

 

example, go to the bottom of map_zone_db.conf and add BEFORE the last ) the following:

 

 

,{    name: "Custom"        disabled_skills: {        SA_ABRACADABRA: "PLAYER"    }        mapflags: (        "noknockback",    )} 

 

now go to any npc script file and add this:

 

yourmapname<tab>mapflag<tab>zone<tab>Custom

 

Thank you for your reply, Angelmelody!

 

Yes, I am currently looking into Map Zone DB for a while now and have been making tests. I'm also looking at related scripts using it to have knowledge on how to use it on scripts.

Share this post


Link to post
Share on other sites
  • 0

I'm not running Herc so I can't test for you, but check this line.

getmapflag(strcharinfo(3),mf_zone);

If it returns something higher than 1 we should be able to do this easily.

 

Obviously test it on a zone you've marked as your custom zone.

 

 

Uh, I'm not quite sure how experienced you are with this stuff. I'll clarify just in case, I mean no disrespect.

 

prontera,158,180,4	script	MapCheck	4_F_CAPEGIRL,{mes "Mapflag: "+getmapflag(strcharinfo(3),mf_zone)+"";end;}

After activating your mapflag in the map_zone_db file and reloading those.

Edited by Nova

Share this post


Link to post
Share on other sites
  • 0

I'm not running Herc so I can't test for you, but check this line.

getmapflag(strcharinfo(3),mf_zone);

If it returns something higher than 1 we should be able to do this easily.

 

Obviously test it on a zone you've marked as your custom zone.

 

Thank you, Nova!

 

How would I go about this?

 

Do I just:

-	script	testgetmapflag	-1,{OnPCLoadMapEvent:getmapflag(strcharinfo(3),mf_zone);}prontera	mapflag	loadevent

..or am I misunderstanding something?

 

Thank you for your patience.

Share this post


Link to post
Share on other sites
  • 0

Haha I just went back to edit my post, sorry :]

 

Just to make sure, you've already set your custom map zones right? And they're loaded?

Share this post


Link to post
Share on other sites
  • 0

Haha I just went back to edit my post, sorry :]

 

Just to make sure, you've already set your custom map zones right? And they're loaded?

 

Haha, I just made something similar to what you've edited. Yes, I think so, I will be testing now and will get back to you in a few minutes for the results.

 

@@Nova - I'm quite new to this but I'm quite a fast learner so it isn't disrespectful on your part. :)

 

Getting back, while running and talking the NPC I've made with your snippet, I am having these messages on my map-server:

[Error]: script:op_2: invalid data for operator C_ADD[Debug]: Data: C_ARG[Debug]: Data: string value="Mapflag: "[Debug]: Source (NPC): MapCheck at prontera (154,176)

Share this post


Link to post
Share on other sites
  • 0

Huh weird, let's tone that down then.

 

prontera,158,180,4	script	MapCheck	4_F_CAPEGIRL,{mes getmapflag(strcharinfo(3),mf_zone);close;}

 

If that won't work, maybe 

 

prontera,158,180,4	script	MapCheck	4_F_CAPEGIRL,{dispbottom getmapflag(strcharinfo(3),mf_zone);end;}
Edited by Nova

Share this post


Link to post
Share on other sites
  • 0

 

Huh weird, let's tone that down then.

 

prontera,158,180,4	script	MapCheck	4_F_CAPEGIRL,{mes getmapflag(strcharinfo(3),mf_zone);close;}

 

If that won't work, maybe 

 

prontera,158,180,4	script	MapCheck	4_F_CAPEGIRL,{dispbottom getmapflag(strcharinfo(3),mf_zone);end;}

Sorry for the late reply, I had some problems with the internet.

 

An empty textbox appears on the first snippet. I may have not set the mapflag correctly.

 

Now, I'm having this on the dispbottom:

[Error]: script:conv_str: cannot convert to string, defaulting to ""[Debug]: Data: nothing (nil)[Debug]: Source (NPC): MapCheck at prontera (158,180)
Edited by msecastro

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.