Jump to content
  • 0

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


Rizz

Question


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  72
  • Reputation:   0
  • Joined:  07/29/17
  • Last Seen:  

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 .@Rod,2764;
//Fishing Lure
set .@Lure,2775;
//Auto-Fish
set .@Auto,1;
//Auto-Fish on Fail
set .@AutoFail,1;
Fish:
	if (isequipped(.@Rod)) && (isequipped(.@Lure)){
		specialeffect EF_BUBBLE,"Fishing Hole";
		//soundeffect "fishingrod.wav",0;
		dispbottom "[Fishing] Casting...";
		set .@fcast,15;
			if (isequipped(2550)) { //Fisher's Muffler
				set .@fcast,.@fcast - 2;
			}
			if (isequipped(2443)) { //Fisher's Boots
				set .@fcast,.@fcast - 2;
			}
			if (isequipped(2764)) { //Fishing Pole
				set .@fcast,.@fcast - 3;
			}
			if (isequipped(2775)) { //Fishing Lure
				set .@fcast,.@fcast - 1;
			}
		progressbar "ffffff",.@fcast;
		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(.@Auto==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(.@AutoFail == 1){
			goto Fish;} else{
			end;}
			}
		if (rand(1,100) == 1){
		setarray .@Rare[0],13890,616,17229;
		set .@RareCatch, .@Rare[rand(getarraysize(.@Rare))];
		getitem .@RareCatch,1; //Reward
		mapannounce strcharinfo(3),strcharinfo(0)+" has got a "+getitemname(.@RareCatch)+"!",bc_map,"0x33CC00";
		}
		if(.@Auto == 1){
		goto Fish;} else{
		end;}
		}
	else {
	dispbottom "[Fishing] You need a Rod and Lure.";
	end;
	}
}


 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  72
  • Reputation:   0
  • Joined:  07/29/17
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

pretty much so. it can also be like this 

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

 

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