Jump to content
  • 0

Cluckers winning chance.


caspa

Question


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

How do you increase the chance rate to get the reward on the cluckers npc event? 

    if (.startcluck) {
        specialeffect2 EF_HIT3;
        switch(rand(15)) {
            case 0: npctalk "CLUUUUUUCK!!!"; sc_start SC_Sleep,10000,0; emotion e_gg; break;
            case 1: npctalk "Cluuuuuck!~"; break;
            case 2: sc_start SC_Sleep,10000,0; emotion e_omg;break;
            case 3: sc_start SC_Freeze,10000,0; break;
            case 4: npctalk "CLUUUUUUUUUCK!!!"; sc_start SC_Freeze,10000,0; break; emotion e_omg; break;
            case 5: sc_start SC_Sleep,10000,0; break;
            case 6: sc_start SC_Stone,10000,0; emotion e_gg; break;
            case 7: npctalk "CLUUUUUUCK!!!"; sc_start SC_Sleep,10000,0; emotion e_gg; break;
            case 8: npctalk "Cluck! CLUUUCK!!"; sc_start SC_Sleep,10000,0; emotion e_gg; break;
            case 9: sc_start SC_Stun,10000,0; break;
            case 10: sc_start SC_Sleep,10000,0; emotion e_gg; break;
            case 11: npctalk "Cluck! Cluck!"; emotion e_omg; break;
            case 12: sc_start SC_Stun,10000,0; break;
            case 13: npctalk "Cluuuuuck!~"; sc_start SC_Stun,10000,0; break;
            default:
                if (rand(50) < 4) {
                    npctalk "Woof!... Wooff!...";
                    specialeffect2 EF_SPHERE;
                    announce "[Cluck Cluck Boom] : '" + strcharinfo(0) + "' squeezed out the prize, Well done!",bc_map,0x00FFFF;
                    getitem $cluck_item_id,$cluck_item_amount;
                    set .startcluck,0;
                } else {
                    npctalk "Cluck! CLUUUCK!!";
                    sc_start SC_Freeze,10000,0; emotion e_omg;
                }
                break;
        }
        end;



i don't understand the rand(50) < 4 part.. what does it mean?

does it mean that in random number from 1 to 50 i have 4% chance of getting the item? or what? LOL! i don't understand T_T
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.01
  • Content Count:  208
  • Reputation:   60
  • Joined:  09/23/17
  • Last Seen:  

38 minutes ago, caspa said:

How do you increase the chance rate to get the reward on the cluckers npc event? 
 


    if (.startcluck) {
        specialeffect2 EF_HIT3;
        switch(rand(15)) {
            case 0: npctalk "CLUUUUUUCK!!!"; sc_start SC_Sleep,10000,0; emotion e_gg; break;
            case 1: npctalk "Cluuuuuck!~"; break;
            case 2: sc_start SC_Sleep,10000,0; emotion e_omg;break;
            case 3: sc_start SC_Freeze,10000,0; break;
            case 4: npctalk "CLUUUUUUUUUCK!!!"; sc_start SC_Freeze,10000,0; break; emotion e_omg; break;
            case 5: sc_start SC_Sleep,10000,0; break;
            case 6: sc_start SC_Stone,10000,0; emotion e_gg; break;
            case 7: npctalk "CLUUUUUUCK!!!"; sc_start SC_Sleep,10000,0; emotion e_gg; break;
            case 8: npctalk "Cluck! CLUUUCK!!"; sc_start SC_Sleep,10000,0; emotion e_gg; break;
            case 9: sc_start SC_Stun,10000,0; break;
            case 10: sc_start SC_Sleep,10000,0; emotion e_gg; break;
            case 11: npctalk "Cluck! Cluck!"; emotion e_omg; break;
            case 12: sc_start SC_Stun,10000,0; break;
            case 13: npctalk "Cluuuuuck!~"; sc_start SC_Stun,10000,0; break;
            default:
                if (rand(50) < 4) {
                    npctalk "Woof!... Wooff!...";
                    specialeffect2 EF_SPHERE;
                    announce "[Cluck Cluck Boom] : '" + strcharinfo(0) + "' squeezed out the prize, Well done!",bc_map,0x00FFFF;
                    getitem $cluck_item_id,$cluck_item_amount;
                    set .startcluck,0;
                } else {
                    npctalk "Cluck! CLUUUCK!!";
                    sc_start SC_Freeze,10000,0; emotion e_omg;
                }
                break;
        }
        end;

 

 


i don't understand the rand(50) < 4 part.. what does it mean?

does it mean that in random number from 1 to 50 i have 4% chance of getting the item? or what? LOL! i don't understand T_T

It means it generates a number at random 1~50 and if it lands on 1, 2, or 3 you win; You can either lower the rand(50) or increase the number less than to look for.

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

[SOLVED] thank you sir.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

17 hours ago, TheDerpySupport said:

It means it generates a number at random 1~50 and if it lands on 1, 2, or 3 you win; You can either lower the rand(50) or increase the number less than to look for.

correction ....

rand(2) actually produce number 0 or 1 ..

if ( rand(50) < 4 ) actually means 4 out 50, means land on 0,1,2,3 is true condition, 4~49 is false condition

when you quote the code ... didn't you see it has case 0: ?
and the default: case is actually case 14:

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.01
  • Content Count:  208
  • Reputation:   60
  • Joined:  09/23/17
  • Last Seen:  

13 minutes ago, AnnieRuru said:

correction ....

rand(2) actually produce number 0 or 1 ..

if ( rand(50) < 4 ) actually means 4 out 50, means land on 0,1,2,3 is true condition, 4~49 is false condition

when you quote the code ... didn't you see it has case 0: ?
and the default: case is actually case 14:

Thanks for the correction, I wasn't aware it randomizes 0 as a number /no1

  • Love 1
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...