npc_test_getunits.txt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //===== rAthena Script =======================================
  2. //= Sample: getunits Test
  3. //===== By: ==================================================
  4. //= rAthena Dev Team
  5. //===== Last Updated: ========================================
  6. //= 20180831
  7. //===== Description: =========================================
  8. //= An example of getunits command script
  9. //============================================================
  10. prontera,145,177,0 script getunits Test 857,{
  11. mes "server information option will take a while if there is large amount of objects";
  12. switch(select("server information:map information")){
  13. case 1:
  14. mes "server information";
  15. mes getunits(BL_PC,.@Character$[0]) + " Character Online.";
  16. mes getunits(BL_MOB,.@Monster$[0]) + " Monster.";
  17. mes getunits(BL_PET,.@Pet$[0]) + " Pet.";
  18. mes getunits(BL_HOM,.@Homunculus$[0]) + " Homunculus.";
  19. mes getunits(BL_MER,.@Mercenary$[0]) + " Mercenary.";
  20. mes getunits(BL_NPC,.@NPC$[0]) + " NPC.";
  21. break;
  22. case 2:
  23. clear;
  24. mes "input the map name.";
  25. input .@input$;
  26. clear;
  27. mes "map information : " + .@input$;
  28. mes getmapunits(BL_PC,.@input$,.@Character$[0]) + " Character Online.";
  29. mes getmapunits(BL_MOB,.@input$,.@Monster$[0]) + " Monster.";
  30. mes getmapunits(BL_PET,.@input$,.@Pet$[0]) + " Pet.";
  31. mes getmapunits(BL_HOM,.@input$,.@Homunculus$[0]) + " Homunculus.";
  32. mes getmapunits(BL_MER,.@input$,.@Mercenary$[0]) + " Mercenary.";
  33. mes getmapunits(BL_NPC,.@input$,.@NPC$[0]) + " NPC.";
  34. }
  35. mes "select for more info";
  36. setarray .@list$,"Character","Monster","Pet","Homunculus","Mercenary","NPC";
  37. .@s = select(implode(.@list$,":")) -1;
  38. clear;
  39. copyarray .@name$[0], getd(".@" + .@list$[.@s] + "$"), getarraysize(getd(".@" + .@list$[.@s] + "$"));
  40. mes "count : " + getarraysize(.@name$);
  41. freeloop(1);
  42. for(.@i=0;.@i<getarraysize(.@name$);.@i++){
  43. mes (.@i+1) + " - " + .@name$[.@i];
  44. if((.@i + 1) == 100){
  45. mes "and more ...";
  46. break;
  47. }
  48. }
  49. freeloop(0);
  50. end;
  51. }