Cydh Posted July 9, 2018 Group: Developer Topic Count: 153 Topics Per Day: 0.03 Content Count: 2285 Reputation: 748 Joined: 06/16/12 Last Seen: February 21 Share Posted July 9, 2018 (edited) *getobjects(<type>,<data>{,"<map name>"{,<x1>,<y1>,<x2>,<y2>}}) Get object GIDs on specified location based on specified 'type'. The returned value is number of all objects found. The GIDs is stored in temporary NPC variables. <type> can be combined value as bitwise of BL_PC - Character object BL_MOB - Monster object BL_PET - Pet object BL_HOM - Homunculus object BL_NPC - NPC object BL_MER - Mercenary object BL_ELEM - Elemental object 'data' values are bitmask of 0x1 - GID (default) 0x2 - Name 0x4 - Char ID (only for BL_PC) 0x8 - Class (Job ID for BL_PC, Sprite ID for BL_NPC, and Class for other types) Default 'map name' for look up is invoker location or NPC if no invoker found. Object GID found will be saved in these arrays, while 'type' is value of UNITTYPE_*. Use getd for good practice. .@obj_type_id[] .@obj_type_name$[] .@obj_type_cid[] .@obj_type_class[] Example 1: getobjects(BL_PC,0x1); .@n = getarraysize(getd(".@obj_"+BL_PC+"_id")); for (.@i = 0; .@i < .@n; .@i++) { getitem 607,1,getd(".@obj_"+BL_PC+"_id["+.@i+"]"); } Example 2: getobjects(BL_PC|BL_NPC,0x1|0x2); // For players .@pc = getarraysize(getd(".@obj_"+BL_PC+"_id")); for (.@i = 0; .@i < .@pc; .@i++) { getitem 501,1,getd(".@obj_"+BL_PC+"_id["+.@i+"]"); } // For NPCs .@npc = getarraysize(getd(".@obj_"+BL_NPC+"_id")); for (.@i = 0; .@i < .@npc; .@i++) { npctalk "My number is "+(.@i+1)+"",getd(".@obj_"+BL_NPC+"_name$["+.@i+"]"); } Keywords how to get players (account id) on a map, how to get player/char name on a map, how to get char id on a map, how to get char's job on a map, how to get npc id on a map, how to get npc name on a map (exname with hidden part), how to get monster gid on a map, how to get monster name on a map, how to get monster id (class) on a map, .... so does with homunculus, elementals, pets, mercenaries Downloads Latest: getobjects-rA-20180806-65df844d.diff getobjects-rA-20180708-b2c026d4.diff testgetobjects.txt Edited August 7, 2018 by Cydh 6 Quote Link to comment Share on other sites More sharing options...
crazyarashi Posted July 9, 2018 Group: Developer Topic Count: 50 Topics Per Day: 0.02 Content Count: 776 Reputation: 239 Joined: 02/11/17 Last Seen: 7 hours ago Share Posted July 9, 2018 There are lots of interesting release lately, thanks for this :)) Quote Link to comment Share on other sites More sharing options...
Cydh Posted August 7, 2018 Group: Developer Topic Count: 153 Topics Per Day: 0.03 Content Count: 2285 Reputation: 748 Joined: 06/16/12 Last Seen: February 21 Author Share Posted August 7, 2018 On 7/9/2018 at 3:13 PM, crazyarashi said: There are lots of interesting release lately, thanks for this :)) glad u like it just update the file for Git Hash: 65df844d (2018-08-06) Since aleos added BL to script constants in previous mapflag cleanups, I just removed mine and add back BL_NPC Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.