Jump to content
  • 0

Script with Random Percentage - Help to define


iraciz

Question


  • Group:  Members
  • Topic Count:  140
  • Topics Per Day:  0.03
  • Content Count:  562
  • Reputation:   108
  • Joined:  10/05/12
  • Last Seen:  

Good Night, I'm asking help for my script, 

Between only two choices, I need to call one case at 75%  and the other at 25%

Example:

//-----------This is lose case 75% percent of the times

case 1:
specialeffect 540; specialeffect 500; sleep2 150; cutin "StartP0",2; sleep2 250; 
specialeffect 18; cutin "StartOCA1",2; sleep2 250; cutin "StartOCA2",2; sleep2 350;
soundeffectall "rafflesia_attack.wav",0; cutin "StartOCAL",2; specialeffect2 191; sleep2 300; 
cutin "",255; makeitem 7539,1,"prontera",140,172; npctalk "Perdiste"; 
specialeffect 584; sleep2 250; specialeffect2 1; specialeffect2 426; sleep2 250; heal -7000,0; break;

//-------------- Win case 25% of the times

case 2: 
specialeffect 540; specialeffect 500; sleep2 150; cutin "StartP0",2; sleep2 200; 
specialeffect 18; cutin "StartOCA1",2; sleep2 150; cutin "StartOCA2",2; sleep2 150; specialeffect 40; cutin "StartOCA3",2; sleep2 200; 
specialeffect 18; cutin "Pwin",2; sleep2 150; cutin "Pwin1",2; sleep2 150; cutin "Pwin2",2; sleep2 150; 
cutin "Pwin3",2; sleep2 150; specialeffect2 100; specialeffect 18;  cutin "StartOCA3",2; 
npctalk "Ganaste un Old Card Album"; sleep2 200; getitem 616,1; cutin "",255; specialeffect 500; 
break; }
end;

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 1

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   703
  • Joined:  12/21/14
  • Last Seen:  

it look for me in the video your script all about chances , so i am not sure what you are asking about

its as simple as

	if(rand(1,100) < 76){
		//75% chance (the result is between and includes 1 and 75)
	}else{
		//25% chance (the result is else)
	}

 

Edited by sader1992
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  140
  • Topics Per Day:  0.03
  • Content Count:  562
  • Reputation:   108
  • Joined:  10/05/12
  • Last Seen:  

Dear Sadder1992
 

Quote

it look for me in the video your script all about chances , so i am not sure what you are asking about


Yes, you are right, chances In the last video were a sort of 6 array cases to win any stat food, shown as:

switch( rand(6) ) {
case 1: getitem 12202,1; break;
case 2: getitem 12203,1; break;
case 3: getitem 12204,1; break;
case 4: getitem 12205,1; break;
case 5: getitem 12206,1; break;
case 6: getitem 12207,1; break;
}

But same were not defined by rates, Its all kinda random. I was asking about chances, 25% win versus 75% loose for a separate case between two choices. 

Update:
Script worked well as intended, I the video I won the 25% chance. I tested many times and after many tries I caught the prize. 

Many thanks for the support.

Edited by iraciz
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...