Jump to content
  • 0

Why it can Fail?


ooGubAoo

Question


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.06
  • Content Count:  43
  • Reputation:   1
  • Joined:  06/08/23
  • Last Seen:  

I have Set Fail 0 but it can Fail

izlude,118,153,3	script	สุ่มออฟชั่น	700,{
	goto NPC;
end;

OnInit:
//==============================
//	CURRENCY SETTING
//	1 = Zeny
//	0 = Cashpoints
//==============================
set .Currency,1;		// Currency to buy random option
set .Price,100000;	// Prize of random option

//==============================
//	RANDOM OPTION SETTING
//==============================
	set .OverWrite,1;	// อนุญาตให้เขียนทับตัวเลือกเสริมเสน่ห์ที่มีอยู่แล้ว ( 0 เพื่อปิดใช้งาน )
	set .FailRate,0;	// เซ็ตโอกาสล้มเหลว
	set .MaxOpt,20;	// ตัวเลือกไอเท็มสูงสุดที่ผู้เล่นสามารถร่ายมนต์ได้
	set .MinOpt,1;		// ตัวเลือกไอเท็มขั้นต่ำที่ผู้เล่นสามารถร่ายมนตร์ได้
	set .MinValue,1;	// ค่าเอฟเฟกต์ตัวเลือกขั้นต่ำ
	set .MaxValue,20;	// ค่าเอฟเฟกต์ตัวเลือกสูงสุด
	set .MaxIndex,4;	// ช่องตัวเลือกสูงสุด (ค่าเริ่มต้นคือ 0 ถึง 4)
	set .Wait,1;		// แถบความคืบหน้าล่าช้าเป็นวินาที

	// Random option that will not be applied
	setarray .ignore[0],
		86,		// RDMOPT_BODY_ATTR_ALL
		173,	// RDMOPT_HP_DRAIN
		174,	// RDMOPT_SP_DRAIN
		190,	// RDMOPT_MDAMAGE_SIZE_SMALL_USER
		191,	// RDMOPT_MDAMAGE_SIZE_MIDIUM_USER
		192,	// RDMOPT_MDAMAGE_SIZE_LARGE_USER
		193;	// RDMOPT_ATTR_TOLERACE_ALL
end;

NPC:
disable_items;
	mes "[ Keitenai ]";
	mes "สวัสดีหนุ่มน้อย!";
	mes "ฉันมาจากดินแดนแห่ง";
	mes "ห่างไกลออกไปเพื่อแนะนำ";
	mes "อุปกรณ์ที่น่าทึ่ง ^FF0000สุ่ม^000000";
	mes "ตัวเลือกการร่ายมนตร์";
	next;
	mes "[ Keitenai ]";
	mes "ฉันสามารถสร้างอุปกรณ์ของคุณได้";
	mes "มีพลังมากขึ้น";
	mes "มากกว่าสภาพปัจจุบัน...";
	if(.Currency){
		mes "เพื่อรับรางวัลจำนวน ^0000FF"+.Price+" Zeny^000000,";
	} else {
		mes "เพื่อรับรางวัลจำนวน ^0000FF"+.Price+" Cashpoints^000000,";
	}
	mes "ฉันจะใช้ ^FF0000RANDOM^000000";
	mes "ตัวเลือกเสริมเสน่ห์ให้กับคุณ";
	mes "equipment. (^_^)";
	next;
	mes "[ Keitenai ]";
	mes "ฉันลืมบอกคุณไปว่า";
	mes "มีโอกาส ^FF0000"+.FailRate+"%^000000";
	mes "ว่ากระบวนการนี้อาจ ^FF0000ล้มเหลว^000000";
	mes "และสูญเสียอุปกรณ์ของคุณไปด้วย";
	mes "พร้อมกับการ์ดของมัน..."," ";
	next;
	mes "[ Keitenai ]";
	mes "ยังอยากจะเอาอยู่ไหม";
	mes "ความเสี่ยงของการร่ายมนตร์ด้วย";
	mes "^FF0000"+.FailRate+"%^000000 โอกาสที่จะ ^FF0000ล้มเหลว^000000";
	mes "และสูญเสียอุปกรณ์ของคุณไปด้วย";
	mes "พร้อมกับการ์ดของมัน?";
	next;
	if(select("ไม่นะ! ฉันไม่ต้องการ...:^0000FFฉันจะเสี่ยง! ร่ายมนตร์อุปกรณ์ของฉัน!^000000")==1) goto OnCancel;
	mes "[ Keitenai ]";
	mes "มหัศจรรย์!";
	mes "กระบวนการนี้จะใช้เวลา";
	mes "ประมาณ ^0000FF"+.Wait+"^000000 วินาที...";
	mes "อย่าขยับกล้ามเนื้อในขณะที่";
	mes "ฉันกำลังร่ายมนตร์อุปกรณ์ของคุณ!";
	close2;

	setarray .@eq[1], EQI_HEAD_TOP,EQI_ARMOR,EQI_HAND_L,EQI_HAND_R,EQI_GARMENT,EQI_SHOES,EQI_ACC_L,EQI_ACC_R,EQI_HEAD_MID,EQI_HEAD_LOW;
	for(set .@i,1; .@i<getarraysize(.@eq); set .@i,.@i+1){
		if(getequipisequiped(.@eq[.@i])){
			set .@menu$,.@menu$+F_getpositionname(.@eq[.@i])+" ~ [ " + getequipname(.@eq[.@i]) + " ]";
			set .@equipped,1;
		} set .@menu$,.@menu$+":";
	} set .@part,.@eq[select(.@menu$)];

	set .@val,rand(.MinValue,.MaxValue);

IgnoreCheck:
	set .@opt,rand(.MinOpt,.MaxOpt);
	for(set .@f,1; .@f<getarraysize(.ignore); set .@f,.@f+1)
		if(.@opt==.ignore[.@f])
			goto IgnoreCheck;

	set .@indx,rand(.MaxIndex);
	if(!.OverWrite){
		if(getequiprandomoption(.@part,4,ROA_ID,getcharid(0))) set .@x4,4;
		if(getequiprandomoption(.@part,3,ROA_ID,getcharid(0))) set .@x3,3;
		if(getequiprandomoption(.@part,2,ROA_ID,getcharid(0))) set .@x2,2;
		if(getequiprandomoption(.@part,1,ROA_ID,getcharid(0))) set .@x1,1;
		if(getequiprandomoption(.@part,0,ROA_ID,getcharid(0))) set .@x0,0;

		if(.@indx == 0 && .@x0)
			if(.@indx==.MaxIndex) goto OnMax;
			else set .@indx,1;
		if(.@indx == 1 && .@x1)
			if(.@indx==.MaxIndex) goto OnMax;
			else set .@indx,2;
		if(.@indx == 2 && .@x2)
			if(.@indx==.MaxIndex) goto OnMax;
			else set .@indx,3;
		if(.@indx == 3 && .@x3)
			if(.@indx==.MaxIndex) goto OnMax;
			else set .@indx,4;
		if(.@indx == 4 && .@x4)
			if(.@indx==.MaxIndex) goto OnMax;
	}
	if(.@indx == 4 && (!getequiprandomoption(.@part,3,ROA_ID,getcharid(0)))) set .@indx,3;
	if(.@indx == 3 && (!getequiprandomoption(.@part,2,ROA_ID,getcharid(0)))) set .@indx,2;
	if(.@indx == 2 && (!getequiprandomoption(.@part,1,ROA_ID,getcharid(0)))) set .@indx,1;
	if(.@indx == 1 && (!getequiprandomoption(.@part,0,ROA_ID,getcharid(0)))) set .@indx,0;

	progressbar "ffff00",.Wait;

	if(.Currency){
		if(Zeny < .Price)
			goto PriceFail;
		else
			set Zeny,Zeny-.Price;
	} else {
		if(#CASHPOINTS < .Price)
			goto PriceFail;
		else
			set #CASHPOINTS,#CASHPOINTS-.Price;
	}

	// Failed...
	if(.FailRate > 100) set .FailRate,100;
	if(rand(100) <= .FailRate) goto OnFailure;

	// Success!!
	setrandomoption(.@part,.@indx,.@opt,.@val,.@indx,getcharid(0));
end;

OnMax:
	mes "[ Keitenai ]";
	mes "ว้าว! อุปกรณ์ของคุณแล้ว";
	mes "เพิ่มตัวเลือกให้สูงสุด";
	mes "ช่องร่ายมนตร์!";
	mes "ขออภัยแต่ฉันไม่สามารถเพิ่มได้";
	mes "มีเสน่ห์อีกต่อไปด้วย";
	mes "อุปกรณ์ของคุณ";
close;

OnFailure:
specialeffect2 EF_PHARMACY_FAIL;
	mes "[ Keitenai ]"," ";
	mes "ฉันขอโทษจริงๆ..."," ";
	mes "^FF0000กระบวนการล้มเหลว...";
	mes "ไอเท็มของคุณถูกทำลายแล้ว^000000";
	delequip .@part;
close;

PriceFail:
	mes "[ Keitenai ]";
	mes "นี่มันอะไรกัน?";
	mes "คุณล้อเล่นกับฉันเหรอ?";
	mes "ขออภัย แต่ฉันไม่ได้ทำงาน";
	mes "ฟรี!";
	mes "ถ้าเจ้ากลับมาได้";
	mes "มีเงินพอที่จะจ่าย";
	mes "บริการของฉัน";
close;

OnCancel:
	mes "[ Keitenai ]";
	mes "เหมาะกับตัวเอง";
	mes "ถ้าเธอช่วยบอกฉันด้วย";
	mes "คุณเปลี่ยนใจไปแล้ว";
close;
}

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  132
  • Reputation:   53
  • Joined:  06/02/12
  • Last Seen:  

Hi, Your current script don't support 0% fail chance.

Find

rand(100)

and change to

rand(1,100)
  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.06
  • Content Count:  43
  • Reputation:   1
  • Joined:  06/08/23
  • Last Seen:  

42 minutes ago, Racaae said:

Hi, Your current script don't support 0% fail chance.

Find

rand(100)

and change to

rand(1,100)

Thank you it work

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