randomopt.txt 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //===== rAthena Script =======================================
  2. //= Sample Random Option Script
  3. //===== Description: =========================================
  4. //= Enchant a weapon with a random element option
  5. //= to a weapon with no random option.
  6. //===== Changelogs: ==========================================
  7. //= 1.0 First version. [Secretdataz]
  8. //============================================================
  9. prontera,162,195,4 script Elemental Master 1_M_WIZARD,{
  10. disable_items;
  11. mes "[Elemental Master]";
  12. mes "I could enchant your weapon with an element.";
  13. mes "Are you interested?";
  14. next;
  15. if(select("Yes, I'm interested in that.") == 1){
  16. .@id = getequipid(EQI_HAND_R);
  17. for(.@i = 0; .@i < .sz; ++.@i){
  18. if(.@id == .alloweditems[.@i])
  19. .@allowed = 1;
  20. }
  21. mes "[Elemental Master]";
  22. if(.@id == -1) {
  23. mes "You are not holding anything in your hand.";
  24. close;
  25. } else if(!.@allowed){
  26. mes "Your item can't be enchanted.";
  27. close;
  28. } else if(getequiprandomoption(EQI_HAND_R,0,ROA_ID)){
  29. mes "Your weapon has already been enchanted.";
  30. close;
  31. }
  32. mes "Do you want to enchant your " + getitemname(.@id) + " with a random element?";
  33. next;
  34. if(select("Yes, proceed.") == 1){
  35. mes "[Elemental Master]";
  36. mes "*mumble mumble*";
  37. progressbar "#00FF00",2;
  38. next;
  39. setrandomoption(EQI_HAND_R,0,RDMOPT_WEAPON_ATTR_NOTHING + rand(10),0,0);
  40. mes "[Elemental Master]";
  41. mes "Here's your weapon";
  42. close;
  43. }
  44. close;
  45. }
  46. else{
  47. close;
  48. }
  49. OnInit:
  50. setarray .alloweditems[0],1201,1202; // Add more item ids here
  51. .sz = getarraysize(.alloweditems);
  52. }