• 0
Sign in to follow this  
Rizz

How to configure if (rand(1,100) in fishing script?

Question

I have a problem with the fishing script, I just want to make it grants player 40% to get the fish, and 10% being teleported to the iz_dun05. I have modified it several times but it did not grant a 40% chance to get the fish etc. So I would be grateful if someone tells me how to edit the if random(1,100) function. Here's the script

dewata,246,60,0	script	Fishing Hole	844,{
	
//Fishing rod
set [email protected],2764;
//Fishing Lure
set [email protected],2775;
//Auto-Fish
set [email protected],1;
//Auto-Fish on Fail
set [email protected],1;
Fish:
	if (isequipped([email protected])) && (isequipped([email protected])){
		specialeffect EF_BUBBLE,"Fishing Hole";
		//soundeffect "fishingrod.wav",0;
		dispbottom "[Fishing] Casting...";
		set [email protected],15;
			if (isequipped(2550)) { //Fisher's Muffler
				set [email protected],[email protected] - 2;
			}
			if (isequipped(2443)) { //Fisher's Boots
				set [email protected],[email protected] - 2;
			}
			if (isequipped(2764)) { //Fishing Pole
				set [email protected],[email protected] - 3;
			}
			if (isequipped(2775)) { //Fishing Lure
				set [email protected],[email protected] - 1;
			}
		progressbar "ffffff",[email protected];
		if (rand(1,10) == 7){
		getitem 6096,1; //Fish with Blue Back
		specialeffect2 EF_TEMP_OK;
		//soundeffectall "success.wav",0,strcharinfo(3);
		mapannounce strcharinfo(3),strcharinfo(0)+" has caught a fish!",bc_map,"0xff77ff";
		if([email protected]==1){
		goto Fish;}else{
		end;}
		}
			if (rand(1,10) == 1) {
			dispbottom "[Fishing] Kraken drags your feet!!!";
			warp "iz_dun05",0,0;
			}
			else {
			dispbottom "[Fishing] Nothing was caught...";
			if([email protected] == 1){
			goto Fish;} else{
			end;}
			}
		if (rand(1,100) == 1){
		setarray [email protected][0],13890,616,17229;
		set [email protected], [email protected][rand(getarraysize([email protected]))];
		getitem [email protected],1; //Reward
		mapannounce strcharinfo(3),strcharinfo(0)+" has got a "+getitemname([email protected])+"!",bc_map,"0x33CC00";
		}
		if([email protected] == 1){
		goto Fish;} else{
		end;}
		}
	else {
	dispbottom "[Fishing] You need a Rod and Lure.";
	end;
	}
}


 

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0
Posted (edited)
if (rand(1,10) == 7){ 10%
TO
if (rand(1,10) >= 6){ 40%

if (rand(1,10) == 1) { 10%
	dispbottom "[Fishing] Kraken drags your feet!!!";

if (rand(1,10) >= 5) { 50%
	dispbottom "[Fishing] Kraken drags your feet!!!";

Well if you apply basic math to it you can just simply increase it or reduce it.

Edited by crazyarashi
  • MVP 1

Share this post


Link to post
Share on other sites
  • 0
59 minutes ago, crazyarashi said:
if (rand(1,10) == 7){ 10%
TO
if (rand(1,10) >= 6){ 40%

if (rand(1,10) == 1) { 10%
	dispbottom "[Fishing] Kraken drags your feet!!!";

if (rand(1,10) >= 5) { 50%
	dispbottom "[Fishing] Kraken drags your feet!!!";

Well if you apply basic math to it you can just simply increase it or reduce it.

it means, if I want to make it 20%, it would be like this, if (rand(1,10) >=8) ?
thanks for your respond..

Share this post


Link to post
Share on other sites
  • 0

pretty much so. it can also be like this 

if (rand(1,10) <= 2 ){

 

  • Love 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this