OSDN Git Service

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