ooGubAoo Posted December 22, 2024 Posted December 22, 2024 (edited) - script RandomWeaponOption -1,{ OnNPCKillEvent: // ตรวจสอบว่า Monster ดรอปอาวุธหรือไม่ if (getiteminfo(killmonsterloot, 2) == 4) { // เช็คว่าของดรอปเป็นประเภทอาวุธ set .@weapon_id, killmonsterloot; // เก็บ Weapon ID ที่ดรอปจากมอนสเตอร์ set .@option_rows, 1; // เริ่มต้นจำนวนแถว Option // สุ่มจำนวนแถว Option if (rand(100) < 50) set .@option_rows, 2; // โอกาส 50% สำหรับแถวที่ 2 if (rand(100) < 30) set .@option_rows, 3; // โอกาส 30% สำหรับแถวที่ 3 if (rand(100) < 10) set .@option_rows, 4; // โอกาส 10% สำหรับแถวที่ 4 // ตั้งค่าตัวแปรสำหรับ Option setarray .@option_id[0], 0, 0, 0, 0; setarray .@option_value[0], 0, 0, 0, 0; // กำหนด Option ให้กับแถวที่มีโอกาสสำเร็จ for (set .@i, 1; .@i <= .@option_rows; set .@i, .@i + 1) { set .@option_id[.@i - 1], rand(4001, 4035); // สุ่ม Option ID (ตัวอย่าง 4001-4035) set .@option_value[.@i - 1], rand(1, 10); // สุ่มค่า Option (1-10) } // สร้างอาวุธพร้อม Option makeitem2 .@weapon_id, 1, getcharid(CHAR_ID_ACCOUNT), 0, 0, .@option_id[0], .@option_value[0], .@option_id[1], .@option_value[1], .@option_id[2], .@option_value[2], .@option_id[3], .@option_value[3]; dispbottom "คุณได้รับอาวุธพร้อม Option!"; } end; } It Dont Error and Dont work too. Edited January 10 by Rynbef Uninformative topic title Quote
0 AllanPfeffer Posted January 2 Posted January 2 (edited) If it doesn't work and doesn't cause an error, the problem may lie in how the script handles specific game engine mechanics or how the OnNPCKillEvent trigger interacts with killmonsterloot among us Edited January 3 by AllanPfeffer Quote
0 ooGubAoo Posted January 8 Author Posted January 8 On 1/2/2025 at 4:17 PM, AllanPfeffer said: If it doesn't work and doesn't cause an error, the problem may lie in how the script handles specific game engine mechanics or how the OnNPCKillEvent trigger interacts with killmonsterloot among us Can you test it? i cant fix it. Quote
0 Mice Posted January 8 Posted January 8 On 12/22/2024 at 10:19 PM, ooGubAoo said: - script RandomWeaponOption -1,{ OnNPCKillEvent: // ตรวจสอบว่า Monster ดรอปอาวุธหรือไม่ if (getiteminfo(killmonsterloot, 2) == 4) { // เช็คว่าของดรอปเป็นประเภทอาวุธ set .@weapon_id, killmonsterloot; // เก็บ Weapon ID ที่ดรอปจากมอนสเตอร์ set .@option_rows, 1; // เริ่มต้นจำนวนแถว Option // สุ่มจำนวนแถว Option if (rand(100) < 50) set .@option_rows, 2; // โอกาส 50% สำหรับแถวที่ 2 if (rand(100) < 30) set .@option_rows, 3; // โอกาส 30% สำหรับแถวที่ 3 if (rand(100) < 10) set .@option_rows, 4; // โอกาส 10% สำหรับแถวที่ 4 // ตั้งค่าตัวแปรสำหรับ Option setarray .@option_id[0], 0, 0, 0, 0; setarray .@option_value[0], 0, 0, 0, 0; // กำหนด Option ให้กับแถวที่มีโอกาสสำเร็จ for (set .@i, 1; .@i <= .@option_rows; set .@i, .@i + 1) { set .@option_id[.@i - 1], rand(4001, 4035); // สุ่ม Option ID (ตัวอย่าง 4001-4035) set .@option_value[.@i - 1], rand(1, 10); // สุ่มค่า Option (1-10) } // สร้างอาวุธพร้อม Option makeitem2 .@weapon_id, 1, getcharid(CHAR_ID_ACCOUNT), 0, 0, .@option_id[0], .@option_value[0], .@option_id[1], .@option_value[1], .@option_id[2], .@option_value[2], .@option_id[3], .@option_value[3]; dispbottom "คุณได้รับอาวุธพร้อม Option!"; } end; } It Dont Error and Dont work t Find: for (set .@i, 1; .@i <= .@option_rows; set .@i, .@i + 1) { Replace: for (.@i = 1; .@i <= .@option_rows; .@i++) { Find: makeitem2 .@weapon_id, 1, getcharid(CHAR_ID_ACCOUNT), 0, 0, Replace: makeitem2 .@weapon_id, 1, getcharid(0), 0, 0, Not tested Quote
0 ooGubAoo Posted January 9 Author Posted January 9 23 hours ago, Mice said: Find: for (set .@i, 1; .@i <= .@option_rows; set .@i, .@i + 1) { Replace: for (.@i = 1; .@i <= .@option_rows; .@i++) { Find: makeitem2 .@weapon_id, 1, getcharid(CHAR_ID_ACCOUNT), 0, 0, Replace: makeitem2 .@weapon_id, 1, getcharid(0), 0, 0, Not tested Not work. It dont have option. Quote
Question
ooGubAoo
It Dont Error and Dont work too.
Edited by RynbefUninformative topic title
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.