Advertisement
Sehrentos

rAthena NPC script atcmd_minions

Sep 27th, 2018
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.91 KB | None | 0 0
  1. //===== rAthena Script =======================================
  2. //= At Command
  3. //===== By: ==================================================
  4. //= Sehrentos
  5. //===== Current Version: =====================================
  6. //= 1.0
  7. //===== Compatible With: =====================================
  8. //= rAthena Project
  9. //===== Description: =========================================
  10. //= Custom summon command: Army of the Baphomet
  11. //= @minions <Number> - 0)disable 1)Enable 2)Stats
  12. //===== Additional Comments: =================================
  13. //= 1.0 Initial script.
  14. //============================================================
  15. - script #atcmd_aotb -1,{
  16. OnInit:
  17. .delay = 3 * 60; // Seconds
  18. .update = 2 * (60 * 1000); // Miliseconds (120000=2-min)
  19. .amount = 5; // Note: below 5, you must edit buffs
  20. bindatcmd "minions", strnpcinfo(3)+"::OnAtMinions";
  21. end;
  22.  
  23. OnAtMinions:
  24. if ( .@atcmd_numparameters != 1 ) {
  25. message strcharinfo(0), "Usage: "+ .@atcmd_command$ +" <1=On / 0=Off / 2=Stats>";
  26. end;
  27. }
  28. .@param = atoi( .@atcmd_parameters$[0] );
  29. if ( .@param == 1 ) {
  30. callsub S_Start;
  31. } else if ( .@param == 2 ) {
  32. callsub S_Stats;
  33. } else {
  34. callsub S_Stop;
  35. }
  36. end;
  37.  
  38. OnMinionDeath:
  39. end;
  40.  
  41. OnTimer:
  42. if (!playerattached()) end;
  43. callsub S_Update;
  44. showscript "Updated ( "+ getarraysize(@aotb_gid) +" ) minions attributes.", getcharid(3), SELF;
  45. addtimer .update, strnpcinfo(3) + "::OnTimer"; // 60000(1 minute)
  46. end;
  47.  
  48. // callsub S_Stop; Remove all minions and stop timers
  49. S_Stop:
  50. .@size = getarraysize(@aotb_gid);
  51. if (!.@size) end;
  52. message strcharinfo(0), "Army of the Baphomet stopped.";
  53. for ( .@i = 0; .@i < .@size; .@i++ ) {
  54. if (unitexists(@aotb_gid[.@i])) unitkill(@aotb_gid[.@i]);
  55. }
  56. deletearray @aotb_gid[0], .@size;
  57. @aotb_active = 0;
  58. deltimer strnpcinfo(3)+"::OnTimer";
  59. awake strnpcinfo(3);
  60. return;
  61.  
  62. // callsub S_Start; Summon all minion's
  63. S_Start:
  64. if (@aotb_active) {
  65. message strcharinfo(0), "Army of the Baphomet is already active.";
  66. end;
  67. }
  68. if (gettimetick(2) < @aotb_delay) {
  69. message strcharinfo(0), "Army of the Baphomet is on cooldown ("+ (@aotb_delay - gettimetick(2)) +" seconds).";
  70. end;
  71. }
  72. @aotb_active = 1;
  73. @aotb_delay = gettimetick(2) + .delay;
  74. // Remove previous minions
  75. for ( .@i = 0; .@i < getarraysize(@aotb_gid); .@i++ ) {
  76. if (unitexists(@aotb_gid[.@i])) unitkill(@aotb_gid[.@i]);
  77. }
  78. deletearray @aotb_gid[0], getarraysize(@aotb_gid);
  79. // Summon new minions
  80. message strcharinfo(0), "Army of the Baphomet!";
  81. while (@aotb_active && Hp && getarraysize(@aotb_gid) < .amount) {
  82. getmapxy(.@map$, .@x, .@y, UNITTYPE_PC); // 0 = UNITTYPE_PC
  83. monster strcharinfo(3), rand(.@x, .@x-3), rand(.@y-3, .@y), "--ja--", 1101, 1, strnpcinfo(3)+"::OnMinionDeath";
  84. .@gid = $@mobid[0];
  85. setarray @aotb_gid[getarraysize(@aotb_gid)], .@gid;
  86. setunitdata .@gid, UMOB_MASTERAID, getcharid(3); // Master AID
  87. //setunitdata .@gid, UMOB_CLASS, 1101; // Class ID (4012)Sniper (With no skills)
  88. setunitdata .@gid, UMOB_SIZE, 0; // Size 0=Small, 1=Medium, 2=Large
  89. setunitdata .@gid, UMOB_LEVEL, BaseLevel - 1; // Level
  90. setunitdata .@gid, UMOB_MAXHP, BaseLevel * 1000; // Max HP (175lv = 175.000)
  91. setunitdata .@gid, UMOB_SPEED, 70; // Movement speed
  92. setunitdata .@gid, UMOB_CANMOVETICK, 80; // Move delay seconds * 1000
  93. setunitdata .@gid, UMOB_CRIT, 450; // Crit rate (1000=100%)
  94. setunitdata .@gid, UMOB_HIT, 500; // Hit rate (1000=100%)
  95. setunitdata .@gid, UMOB_MODE, 4089; // Mode (Can move, attack, assist, target weak)
  96. setunitdata .@gid, UMOB_DMGIMMUNE, 0; // Immune to damage
  97. setunitdata .@gid, UMOB_ATKRANGE, 1; // Attack range
  98. setunitdata .@gid, UMOB_RACE, 6; // Race (See doc/mob_db) 6=Demon
  99. setunitdata .@gid, UMOB_ELETYPE, 80; // Element (See doc/mob_db) 80=(4)Neutral 89=(4)Undead
  100. setunitdata .@gid, UMOB_ELELEVEL, 4; // Element level
  101. setunitdata .@gid, UMOB_AMOTION, 500; // Attack animation motion
  102. setunitdata .@gid, UMOB_ADELAY, 500; // Attack delay (ASPD)
  103. setunitdata .@gid, UMOB_DMOTION, 500; // Damage animation motion
  104. setunitdata .@gid, UMOB_ATKMIN, (readparam(bStr) + readparam(bDex)) * 4; // 125 x 5 = 625
  105. setunitdata .@gid, UMOB_ATKMAX, (readparam(bStr) + readparam(bDex)) * 30; // 125 x 60 = 7500
  106. setunitdata .@gid, UMOB_MATKMIN, (readparam(bInt) + readparam(bDex)) * 4; // 125 x 5 = 625
  107. setunitdata .@gid, UMOB_MATKMAX, (readparam(bInt) + readparam(bDex)) * 30; // 125 x 60 = 7500
  108. setunitdata .@gid, UMOB_DEF, readparam(bDef);
  109. setunitdata .@gid, UMOB_MDEF, readparam(bMdef);
  110. setunitdata .@gid, UMOB_FLEE, readparam(bFlee);
  111. setunitdata .@gid, UMOB_PDODGE, readparam(bFlee2);
  112. setunitdata .@gid, UMOB_STR, readparam(bStr);
  113. setunitdata .@gid, UMOB_AGI, readparam(bAgi);
  114. setunitdata .@gid, UMOB_VIT, readparam(bVit);
  115. setunitdata .@gid, UMOB_INT, readparam(bInt);
  116. setunitdata .@gid, UMOB_DEX, readparam(bDex);
  117. setunitdata .@gid, UMOB_LUK, readparam(bLuk);
  118. setunitname .@gid, strcharinfo(0)+"'s minion";
  119. //unittalk .@gid, "Murlr mrul!!", bc_self;
  120. //specialeffect2 EF_FIRESPLASHHIT;
  121. // Buff minion
  122. //unitskilluseid .@gid,157,1; // MG_ENERGYCOAT on the minion 300000(5-min) duration
  123. // Buff player. Each minion give different buffs
  124. switch(getarraysize(@aotb_gid)) {
  125. case 1: unitskilluseid .@gid,29,10,getcharid(3); break; // AL_INCAGI
  126. case 2: unitskilluseid .@gid,33,10,getcharid(3); break; // AL_ANGELUS
  127. case 3: unitskilluseid .@gid,34,10,getcharid(3); break; // AL_BLESSING
  128. case 4: unitskilluseid .@gid,73,10,getcharid(3); break; // PR_KYRIE
  129. case 5: unitskilluseid .@gid,113,10,getcharid(3); break; // BS_OVERTHRUST
  130. default: break;
  131. }
  132. deltimer strnpcinfo(3)+"::OnTimer";
  133. addtimer .update, strnpcinfo(3)+"::OnTimer";
  134. //message strcharinfo(0), "( "+ getarraysize(@aotb_gid) +" ) minions released !!";
  135. showscript "( "+ getarraysize(@aotb_gid) +" ) minions released!!", getcharid(3), SELF;
  136. sleep2 1500;
  137. }
  138. @aotb_active = 0;
  139. //message strcharinfo(0), "Army of the Baphomet is complete.";
  140. return;
  141.  
  142. // callsub S_Stats; Print minion's status
  143. S_Stats:
  144. if (!getarraysize(@aotb_gid)) end;
  145. .@player$ = strcharinfo(0);
  146. for ( .@i = 0; .@i < getarraysize(@aotb_gid); .@i++ ) {
  147. if (unitexists(@aotb_gid[.@i])) {
  148. getunitdata(@aotb_gid[.@i], .@unit);
  149. message .@player$, "Minion "+ (.@i + 1) +": " + getunitname(@aotb_gid[.@i]) +"("+ .@unit[UMOB_CLASS] +")";
  150. message .@player$, "Lv:" + .@unit[UMOB_LEVEL] + " HP:" + .@unit[UMOB_HP] +"/"+ .@unit[UMOB_MAXHP];
  151. message .@player$, "Str:" + .@unit[UMOB_STR] + " Agi:" + .@unit[UMOB_AGI] + " Vit:" + .@unit[UMOB_VIT] + " Int:" + .@unit[UMOB_INT] + " Dex:" + .@unit[UMOB_DEX] + " Luk:" + .@unit[UMOB_LUK];
  152. message .@player$, "Atk:" + .@unit[UMOB_ATKMIN] +"/"+ .@unit[UMOB_ATKMAX] + " Matk:" + .@unit[UMOB_MATKMIN] +"/"+ .@unit[UMOB_MATKMAX];
  153. //message .@player$, "Current target:" + .@unit[UMOB_TARGETID];
  154. }
  155. }
  156. return;
  157.  
  158. // callsub S_Update; Update all minion's stats and buffs
  159. S_Update:
  160. .@size = getarraysize(@aotb_gid);
  161. if (!.@size) end;
  162. for ( .@i = 0; .@i < .@size; .@i++ ) {
  163. if (!Hp) end;
  164. if (unitexists(@aotb_gid[.@i])) {
  165. setunitdata @aotb_gid[.@i], UMOB_LEVEL, BaseLevel - 1;
  166. setunitdata @aotb_gid[.@i], UMOB_MAXHP, BaseLevel * 1000;
  167. setunitdata @aotb_gid[.@i], UMOB_ATKMIN, (readparam(bStr) + readparam(bDex)) * 4;
  168. setunitdata @aotb_gid[.@i], UMOB_ATKMAX, (readparam(bStr) + readparam(bDex)) * 30;
  169. setunitdata @aotb_gid[.@i], UMOB_MATKMIN, (readparam(bInt) + readparam(bDex)) * 4;
  170. setunitdata @aotb_gid[.@i], UMOB_MATKMAX, (readparam(bInt) + readparam(bDex)) * 30;
  171. setunitdata @aotb_gid[.@i], UMOB_DEF, readparam(bDef);
  172. setunitdata @aotb_gid[.@i], UMOB_MDEF, readparam(bMdef);
  173. setunitdata @aotb_gid[.@i], UMOB_FLEE, readparam(bFlee);
  174. setunitdata @aotb_gid[.@i], UMOB_PDODGE, readparam(bFlee2);
  175. setunitdata @aotb_gid[.@i], UMOB_STR, readparam(bStr);
  176. setunitdata @aotb_gid[.@i], UMOB_AGI, readparam(bAgi);
  177. setunitdata @aotb_gid[.@i], UMOB_VIT, readparam(bVit);
  178. setunitdata @aotb_gid[.@i], UMOB_INT, readparam(bInt);
  179. setunitdata @aotb_gid[.@i], UMOB_DEX, readparam(bDex);
  180. setunitdata @aotb_gid[.@i], UMOB_LUK, readparam(bLuk);
  181. // Buff minion
  182. //unitskilluseid @aotb_gid[.@i],157,1; // MG_ENERGYCOAT 300000(5-min) duration
  183. // Buff player. Each minion give different buffs
  184. switch(.@i) {
  185. case 0: unitskilluseid @aotb_gid[.@i],29,10,getcharid(3); break; // AL_INCAGI
  186. case 1: unitskilluseid @aotb_gid[.@i],33,10,getcharid(3); break; // AL_ANGELUS
  187. case 2: unitskilluseid @aotb_gid[.@i],34,10,getcharid(3); break; // AL_BLESSING
  188. case 3: unitskilluseid @aotb_gid[.@i],73,10,getcharid(3); break; // PR_KYRIE
  189. case 4: unitskilluseid @aotb_gid[.@i],113,10,getcharid(3); break; // BS_OVERTHRUST
  190. default: break;
  191. }
  192. sleep2 1500;
  193. }
  194. }
  195. return;
  196. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement