ooGubAoo Posted December 22, 2024 Group: Members Topic Count: 22 Topics Per Day: 0.03 Content Count: 55 Reputation: 1 Joined: 06/08/23 Last Seen: April 7 Share 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 Link to comment Share on other sites More sharing options...
0 AllanPfeffer Posted January 2 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 1 Reputation: 0 Joined: 01/02/25 Last Seen: February 15 Share 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 Link to comment Share on other sites More sharing options...
0 ooGubAoo Posted January 8 Group: Members Topic Count: 22 Topics Per Day: 0.03 Content Count: 55 Reputation: 1 Joined: 06/08/23 Last Seen: April 7 Author Share 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 Link to comment Share on other sites More sharing options...
0 Mice Posted January 8 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 78 Reputation: 19 Joined: 12/24/18 Last Seen: 5 hours ago Share 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 Link to comment Share on other sites More sharing options...
0 ooGubAoo Posted January 9 Group: Members Topic Count: 22 Topics Per Day: 0.03 Content Count: 55 Reputation: 1 Joined: 06/08/23 Last Seen: April 7 Author Share 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 Link to comment Share on other sites More sharing options...
Question
ooGubAoo
It Dont Error and Dont work too.
Edited by RynbefUninformative topic title
Link to comment
Share on other sites
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.