Jump to content
  • 0

Simple random getitem script fix


c2greentea

Question


  • Group:  Members
  • Topic Count:  68
  • Topics Per Day:  0.02
  • Content Count:  173
  • Reputation:   0
  • Joined:  06/07/14
  • Last Seen:  

Can someone check what to fix here? This script supposedly will check if a player has either item ids 7784 to 7786 and they must have at least 1. Then the script will read if they got 7784, they will receive a random rental item. Same goes with 7785 and 7784. Can someone check what I did wrong here hahaha. Thank you

P_Yes4:
    next;
    if(#cgp == 0 && countitem(7784) = 0) goto Lnenough;
    else if(#cgp == 1 && countitem(7785) = 0) goto Lnenough;
    else if(#cgp == 2 && countitem(7786) = 0) goto Lnenough;
    if(#cgp == 0) delitem 7784,1;
    mes "[Freebies NPC]";
    mes "Well, here you go! Thanks and enjoy the game!";
        switch(rand(15)){
        case 0:
            rentitem 5776,86400;
            break;
        case 1:
            rentitem 19517,86400;
            break;
        case 2:
            rentitem 19515,86400;
            break;
        }

    set #costumegpack,1;

    else if(#cgp == 1) delitem 7785,1;
    mes "[Freebies NPC]";
    mes "Well, here you go! Thanks and enjoy the game!";
        switch(rand(15)){
        case 0:
            rentitem 19510,86400;
            break;
        case 1:
            rentitem 19522,86400;
            break;
        case 2:
            rentitem 19521,86400;
            break;
        }

    set #costumegpack,1;

    else if(#cgp == 2) delitem 7786,1;
    mes "[Freebies NPC]";
    mes "Well, here you go! Thanks and enjoy the game!";
        switch(rand(15)){
        case 0:
            rentitem 19516,86400;
            break;
        case 1:
            rentitem 19513,86400;
            break;
        case 2:
            rentitem 19509,86400;
            break;
        }
    set #costumegpack,1;
    close;
Link to comment
Share on other sites

1 answer to this question

Recommended Posts


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

you mean your player didnt get the rental item ??

switch(rand(15)){   // <-- you use 15 ... but you only have 3 cases. ( 0-2 )

change to

switch(rand(3)){

or add a default case.

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...