ta script: add get coords commands

Content and general development discussion, including quest scripts and server code. TMW Classic is a project comprising the Legacy tmwAthena server & the designated improved engine server based on evolHercules.


Forum rules

This forum houses many years of development, tracing back to some of the earliest posts that exist on the board.

Its current use is for the continued development of the server and game it has always served: TMW Classic.

Post Reply
nmaligec
Warrior
Warrior
Posts: 253
Joined: 08 Apr 2010, 01:55

ta script: add get coords commands

Post by nmaligec »

I noticed that there is no way to get a player's map coordinates. It should be easy to expose a get coord command for scripting. What about a set player coords, can this be done, along with the appropriate client update?

For npcs, would it be possible to get/set their coords?

I would really want to be able to get/set mob coords. I know there is currently no way to interact with mobs through scripting. If we can get the mob's id when it is created and store it, then it would be possible to interact with it through specialized commands? Maybe have a special spawnOne command that spawns one mob and returns its id.
Snurayroth
Newly Registered User
Posts: 2
Joined: 28 Mar 2011, 17:17

Re: ta script: add get coords commands

Post by Snurayroth »

Im totally New to TMW, im from the eAthena forum and worked for years with eAthena.
I dont know how eAthena works with the TMW client, i suspect ur eAthena(TMW) no longer corresponds to the original eAthena but usually ... erm take a look:

Code: Select all

*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:

  0 - Character object
  1 - NPC object
  2 - Pet object
  3 - Monster object.
  
While 3 is meant to look for a monster object, no searching will be done if you 
specify type 3, and the function will always return -1.

The search string is optional. If it is not specified, the location of the 
invoking character will always be returned for types 0 and 2, the location of 
the NPC running this function for type 1.
If a search string is specified, for types 0 and 1, the character or NPC with 
the specified name will be located. If type is 3, the search will locate the 
current pet of the character who's name is given in the search string, it will 
NOT locate a pet by name.

What a mess. Example, a working and tested one now:

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

    prontera.gat,164,299,3|	|script|	|Nyah|	|730,{
        mes "My name is Nyah.";
        mes "I will now search for Meh all across the world!";
        if (getmapxy(@mapname$,@mapx,@mapy,1,"Meh")!=0) goto Notfound;
        mes "And I found him on map "+@mapname$+" at X:"+@mapx+" Y:"+@mapy+" !";
        close;
    Notfound:
        mes "I can't seem to find Meh anywhere!";
        close;
   }
   
Notice that NPC objects disabled with 'disablenpc' will still be located. 

I hope I could help you with this. My english isn't very good. sorry xD
nmaligec
Warrior
Warrior
Posts: 253
Joined: 08 Apr 2010, 01:55

Re: ta script: add get coords commands

Post by nmaligec »

Your knowledge of eAthena scripting is very helpful, especially for fakenpcname. Unfortunately tmwAthena is lacking several commands. getmapxy is one of them. In the manual I was referencing it said getmapxy did not work properly for mobs, I guess they fixed it since the manual version I was looking at.

The commands I am most bummed about not having are:
  • setcell/setwall
  • areamobuseskill
  • for (no built in loops!)
  • if, with multiple statements
  • anything that acesses a spawned mobs info (you can get the mob db info but not current hp or location)
  • a command that lets you do something to all pcs in an area/map.
  • clone (not crucial but it would have been fun)
If you are interested in knowing what commands are currently implemented you can sorta get a list by checking out the source code for scripts. Check lines 115-318, the format is
int buildin_commandname (struct script_state *st);

here is the link (be patient if it doesnt load right away, it is a large file):
http://gitorious.org/tmw-eathena/mainli ... p/script.c
Zutan
Novice
Novice
Posts: 60
Joined: 22 Feb 2011, 02:43

Re: ta script: add get coords commands

Post by Zutan »

The manaplus client is able to show map co-ordinates, is that client side?
User avatar
Freeyorp101
Archivist Prime
Archivist Prime
Posts: 765
Joined: 04 Nov 2008, 09:17
Location: New Zealand

Re: ta script: add get coords commands

Post by Freeyorp101 »

This is regarding tmwAthena scripting and has absolutely nothing to do with what the client displays.


---Freeyorp
(09:58:17) < tux9th> Freeyorp: your sig on the forums is kind of outdated
User avatar
Crush
TMW Adviser
TMW Adviser
Posts: 8046
Joined: 25 Aug 2005, 16:08
Location: Germany

Re: ta script: add get coords commands

Post by Crush »

The normal client also displays map coordinates in the F10 window. We have this feature for ages. It's funny how many features are attributed to the ManaPlus patch although they have been core features of the unmodified client for ages. But, as Freeyorp pointed out, this is off topic.
  • former Manasource Programmer
  • former TMW Pixel artist
  • NOT a game master

Please do not send me any inquiries regarding player accounts on TMW.


You might have heard a certain rumor about me. This rumor is completely false. You might also have heard the other rumor about me. This rumor is 100% accurate.
Zutan
Novice
Novice
Posts: 60
Joined: 22 Feb 2011, 02:43

Re: ta script: add get coords commands

Post by Zutan »

Ohh. Thanks for that. I use .29 1.0 and manaplus almost everyday sometimes things jump out more on one client than the others.

So the client does the calculating of that from data files I am guessing. Does the server see players when monsters with aggro come into view?
User avatar
Freeyorp101
Archivist Prime
Archivist Prime
Posts: 765
Joined: 04 Nov 2008, 09:17
Location: New Zealand

Re: ta script: add get coords commands

Post by Freeyorp101 »

The server has the complete state of the game world at any time.


---Freeyorp
(09:58:17) < tux9th> Freeyorp: your sig on the forums is kind of outdated
Post Reply