Jump to content
  • 0

Requesting NPC - require x to get y with fail chance


PandaLovesHamster

Question


  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  452
  • Reputation:   33
  • Joined:  12/18/14
  • Last Seen:  

Hi, I tried to make my own script for this NPC and failed miserably. I'd like to ask for a little help on this part.

What I need is an NPC that will ask players 100 Gold and 10m zeny to create one random castle drop. It will have at least 40% success rate.

 

Progressbar would be really appreciated and with accompanying upgrading/forging sound.
 

Thank you in advance :)

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

Maybe this will help you out enough with your script.

prontera,100,100,1	script	chance_get	101,{
	mes "[ Chancy ]";
	mes "Oh hello would you like to try my game?";
	next;
	if( select( "Yes:No" ) == 2 ) {
		mes "[ Chancy ]";
		mes "I'm sorry to hear that. Maybe next time then.";
		close;
	}
	mes "[ Chancy ]";
	if( countitem( .gold ) < .gold_amount ) {
		mes "You don't have enough "+getitemname( .gold )+".";
		mes "I require at least "+.gold_amount+".";
		close;
	} else if( Zeny < .zeny ) {
		mes "It looks like you don't have enough zeny...";
		mes "You need at least "+.zeny+".";
		close;
	}
	Zeny = Zeny - .zeny;
	delitem .gold, .gold_amount;
	if( rand( 101 ) <= .chance ) {
		.@rand = rand( .length );
		getitem .rewards[.@rand], .reward_amounts[.@rand];
		mes "Congratulations you got "+getitemname( .rewards[.@rand] )+" x"+.reward_amounts[.@rand]+"!!!";
	} else
		mes "I'm sorry you didn't get anything. Come back and try again!";
	close;
	
OnInit:
	.gold = 617;
	.gold_amount = 100;
	.zeny = 10000000;
	.chance = 40;
	setarray .rewards, 501, 502, 503, 504, 506;
	setarray .reward_amounts, 1, 1, 1, 2, 2;
	.length = getarraysize( .rewards );
}
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  452
  • Reputation:   33
  • Joined:  12/18/14
  • Last Seen:  

Thank you sir Skorm. I'll test it right away. But reading through it, I think it's gonna work. Thank you so much.

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