Jump to content
  • 0

how add requirments on script gatcha event


BlindRO

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.01
  • Content Count:  25
  • Reputation:   0
  • Joined:  01/28/22
  • Last Seen:  

prontera,176,177,4    script    Gacha Machine    563,{
    .@name$ = strcharinfo(0);
    .@rand = rand(.chances);
    .@i = 0;
    
    if( countitem(.itm_p) < .itm_a ){
        mes .n$;
        mes "You don't have any";
        mes "^FF0000"+getitemname(.itm_p)+" x "+.itm_a+"^000000";
        mes "in your inventory.";
        mes " ";
        mes "Please come back to me if you have it already.";
        close;
    }
    mes .n$;
    mes rand(2) ? ""+callfunc("F_Hi")+" ^0000FFGacha Machine^000000." 
    : ""+callfunc("F_Hi")+" ^0000FFI'm Gacha Machine^000000"; 
    mes "Required Item: ^CC00FF"+getitemname(.itm_p)+" x1 ^000000";
    mes " ";
    next;
    mes .n$;
    mes "Prizes are:";
    mes "^CC00FF-^000000 Red Potion";
    mes "^CC00FF-^000000 Yggdrasil Berry";
    mes "^CC00FF-^000000 Yggdrasil Seed";
    next;

    mes "Would you risk to play this game?";
    next;
    if( select("- Play Game","- Cancel") == 2 ) {
        mes .n$;
        mes "Alright! "+ strcharinfo(0) +" come back anytime you want.";
        close;
    }
    while (( .@rand -= .item_Rate[.@i] ) >= 0 ) .@i++;
    progressbar "0x11CC99",.loading; specialeffect2 EF_REMOVETRAP;
    if (.item_Rate[.@i] <= 10) {
    announce "[ Gacha Machine ]: Player "+ .@name$ +" obtained "+.item_Amt[.@i]+"x "+ getitemname(.item_ID[.@i]) +"",0;
    getitem .item_ID[.@i], .item_Amt[.@i];
    delitem .itm_p, .itm_a;
    mes .n$;
    mes "You have obtained "+.item_Amt[.@i]+"x ^FF3000"+ getitemname(.item_ID[.@i]) +"^000000";
    close;
    }else{
    getitem .item_ID[.@i], .item_Amt[.@i];
    delitem .itm_p, .itm_a;
    mes .n$;
    mes "You have obtained "+.item_Amt[.@i]+"x ^FF3000"+ getitemname(.item_ID[.@i]) +"^000000";
    close;
}
OnInit:
    .n$ = "[ Gacha Machine ]";
    .loading = 1;     // 0 = No Delay
    .itm_p = 33017;608;607;    // Required Item
    .itm_a = 1;1;1;    // Required Amount
    setarray .item_ID, 12074,12075,12089,12090,12084,12085,12079,12080,12094,12095,12099,12100,6286,6293,12214,38802,12429,12430,12431,12432,12433,12434,14601,14601,6292,6291,33017,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501; // Item ID List
    setarray .item_Amt, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1; // Item ID List
    setarray .item_Rate, 99,99,99,99,99,99,99,99,99,99,99,99,60,60,50,50,40,40,40,40,40,40,35,35,30,30,30;    // Item ID Chances
    .@i = 0;
    while ( .item_ID[.@i] ) {
        .chances += .item_Rate[.@i];
        .@i++;
    }

    end;
}

 

Edited by Emistry
codebox
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

10 hours ago, BlindRO said:

 .itm_p = 33017;608;607;    // Required Item

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.01
  • Content Count:  25
  • Reputation:   0
  • Joined:  01/28/22
  • Last Seen:  

not working

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  


    .itm_p = 33017;608;607;    // Required Item
    .itm_a = 1;1;1;    // Required Amount

change to


    .itm_p = 33017;    // Required Item
    .itm_a = 1;    // Required Amount

that isn't an array.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...