Jump to content
  • 0

Can someone whip this teleport script up for me?


Question

Posted (edited)

Greetings friends /ok

I would like an item or an npc i can call that does the follow :

I am standing in pay_fild01 150,150

i use the item and it will ALWAYS teleport me to Prontera but to the cords i was standing before  /hmm :

So i would want it to teleport me to Prontera 150,150

 

 

Why do i need this you ask? Because I would like to make a multi dimensional dungeon using this feature. /bo

 

Edited by lllaaazzz

2 answers to this question

Recommended Posts

  • 2
Posted

The script commands is getmapxy:

 

NPC Script:

getmapxy(@mapname$, @mapx, @mapy, UNITTYPE_PC, ""+strcharinfo(0)+"");
warp "prontera",@mapx,@mapy;

 

Item Script:

{ getmapxy(@mapname$, @mapx, @mapy, UNITTYPE_PC, ""+strcharinfo(0)+""); warp "prontera",@mapx,@mapy; }

 

To more info search  in doc/script_commands.txt

*getmapxy("<variable for map name>",<variable for x>,<variable for y>,<type>{,"<search string>"})

This function will locate a character object, NPC object or pet's coordinates
and place their coordinates into the variables specified when calling it. It
will return 0 if the search was successful, and -1 if the parameters given were
not variables or the search was not successful.

Type is the type of object to search for:

	UNITTYPE_PC   - Character object
	UNITTYPE_NPC  - NPC object
	UNITTYPE_PET  - Pet object
	UNITTYPE_HOM  - Homunculus object
	UNITTYPE_MER  - Mercenary object
	UNITTYPE_ELEM - Elemental object

The search string is optional. If it is not specified, the location of the
invoking character will always be returned for types UNITTYPE_PC and UNITTYPE_PET,
the location of the NPC running this function for type 1.

If a search string is specified, for types UNITTYPE_PC and UNITTYPE_NPC, the
character or NPC with the specified name will be located.

If type is UNITTYPE_PET/UNITTYPE_HOM/UNITTYPE_MER/UNITTYPE_ELEM, the search
will locate the current object of the character who's name is given in the
search string, it will NOT locate the object by name.

Example:

    prontera,164,301,3%TAB%script%TAB%Meh%TAB%730,{
        mes "My name is Meh. I'm here so that Nyah can find me.";
        close;
    }

    prontera,164,299,3%TAB%script%TAB%Nyah%TAB%730,{
        mes "My name is Nyah.";
        mes "I will now search for Meh all across the world!";
        if (getmapxy(@mapname$, @mapx, @mapy, UNITTYPE_NPC, "Meh") != 0) {
                mes "I can't seem to find Meh anywhere!";
                close;
        }
        mes "And I found him on map " + @mapname$ + " at X:" + @mapx + " Y:" + @mapy + " !";
        close;
   }

Notice that NPC objects disabled with 'disablenpc' will still be located.

 

  • Upvote 1

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...