Advertisement
plugandplaydev

Callmonster (@callmonster <monsterID>)

Jul 27th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. //===== Hercules Script ======================================
  2. //= @callmonster <monster_id>
  3. //= For: VNRO
  4. //====== Modified By ==================
  5. //= Added Set Item Requirements : Zhao Chow ( Plug and Play PH )
  6. //= Added Set Item Count : Zhao Chow ( Plug and Play PH )
  7. //===== By: ==================================================
  8. //= ndh
  9.  
  10. - script callmonster FAKE_NPC,{
  11. OnInit:
  12. bindatcmd "callmonster", strnpcinfo(0) + "::OnCallMonster";
  13. .callmonsterDuration = 60; // phut
  14. set .ItemID,7711; // Item needed to summon monster (Default 7711 : Event Ticket )
  15. set .ItemCount,1; // How many items needed to summon monster ( Default : 1 )
  16. end;
  17.  
  18. OnCallMonster:
  19. if(Hp == 0) {
  20. dispbottom "Can't Call if died.";
  21. end;
  22. }
  23.  
  24. if(callmonsterhaveMonster > 0) {
  25. dispbottom "Only call 1 per times.";
  26. end;
  27. }
  28.  
  29. // Proccess argument
  30. .@argument$ = "";
  31. for (.@i = 0; .@i < .@atcmd_numparameters; ++.@i) {
  32. .@argument$ += (.@i > 0 ? " " : "") + .@atcmd_parameters$[.@i];
  33. }
  34. .@monsterId = atoi(.@argument$);
  35.  
  36. // Find card ID
  37. .@cardId = .ItemID;
  38. .@ItemNeeded = .ItemCount;
  39. if(getmobdrops(.@monsterId)) {
  40. .@count = $@MobDrop_count;
  41. copyarray .@item[0],$@MobDrop_item[0],.@count;
  42.  
  43. for (.@i = 0; .@i < .@count; ++.@i) {
  44. //item type 6 la card, getiteminfo(id,2) -> get item type
  45. if(getiteminfo(.@item[.@i],2) == 6) .@cardId = .@item[.@i];
  46. }
  47.  
  48. if(.@cardId == -1) {
  49. dispbottom "Not available in db";
  50. end;
  51. }
  52. } else {
  53. dispbottom "Can't find monster";
  54. end;
  55. }
  56.  
  57. // Find card ID in inventory
  58. if(countitem(.@cardId) > .@ItemNeeded) {
  59. delitem .@cardId, .@ItemNeeded;
  60. atcommand "@summon " + .@monsterId + " " + .callmonsterDuration;
  61. callmonsterhaveMonster = 1;
  62. addtimer (.callmonsterDuration * 60 * 1000), strnpcinfo(3)+"::OnMonsterGone";
  63. dispbottom "Called monster in 60 mins!";
  64. }
  65. else {
  66. dispbottom "Can't call monster, pls check "
  67. + getitemname(.@cardId)
  68. + " in your inventory, Need "+getitemname(.@cardId)+" "+.@ItemNeeded+" to call";
  69. end;
  70. }
  71.  
  72. end;
  73.  
  74. OnMonsterGone:
  75. callmonsterhaveMonster = 0;
  76. end;
  77. OnPCDieEvent:
  78. callmonsterhaveMonster = 0;
  79. end;
  80. OnPCLogoutEvent:
  81. callmonsterhaveMonster = 0;
  82. end;
  83.  
  84. OnWhisperGlobal:
  85. set getd(@whispervar0$), atoi(@whispervar1$); // debug function
  86. end;
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement