ooGubAoo Posted July 27, 2023 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 July 27, 2023 This my script function function script Test { bonus bMaxHP,100; end; } If i need to add item ID to use this function. Ex. i want item ID 1101 and 1102 to use this script. How to add it. Thank you to help. Quote Link to comment Share on other sites More sharing options...
0 Winterfox Posted July 27, 2023 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 245 Reputation: 93 Joined: 06/30/18 Last Seen: November 27, 2024 Share Posted July 27, 2023 You have to put the script in the item you want to use it on in the item_db_equip.yml. - Id: 1101 AegisName: Sword Name: Sword Type: Weapon SubType: 1hSword Buy: 100 Weight: 500 Attack: 25 Range: 1 Slots: 3 Jobs: Alchemist: true Assassin: true Blacksmith: true Crusader: true Knight: true Merchant: true Novice: true Rogue: true SuperNovice: true Swordman: true Thief: true Locations: Right_Hand: true WeaponLevel: 1 EquipLevelMin: 2 Refineable: true Script: | bonus bMaxHP,100; - Id: 1102 AegisName: Sword_ Name: Sword Type: Weapon SubType: 1hSword Buy: 100 Weight: 500 Attack: 25 Range: 1 Slots: 4 Jobs: Alchemist: true Assassin: true Blacksmith: true Crusader: true Knight: true Merchant: true Novice: true Rogue: true SuperNovice: true Swordman: true Thief: true Locations: Right_Hand: true WeaponLevel: 1 EquipLevelMin: 2 Refineable: true Script: | bonus bMaxHP,100; Quote Link to comment Share on other sites More sharing options...
0 ooGubAoo Posted July 27, 2023 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 July 27, 2023 24 minutes ago, Winterfox said: You have to put the script in the item you want to use it on in the item_db_equip.yml. - Id: 1101 AegisName: Sword Name: Sword Type: Weapon SubType: 1hSword Buy: 100 Weight: 500 Attack: 25 Range: 1 Slots: 3 Jobs: Alchemist: true Assassin: true Blacksmith: true Crusader: true Knight: true Merchant: true Novice: true Rogue: true SuperNovice: true Swordman: true Thief: true Locations: Right_Hand: true WeaponLevel: 1 EquipLevelMin: 2 Refineable: true Script: | bonus bMaxHP,100; - Id: 1102 AegisName: Sword_ Name: Sword Type: Weapon SubType: 1hSword Buy: 100 Weight: 500 Attack: 25 Range: 1 Slots: 4 Jobs: Alchemist: true Assassin: true Blacksmith: true Crusader: true Knight: true Merchant: true Novice: true Rogue: true SuperNovice: true Swordman: true Thief: true Locations: Right_Hand: true WeaponLevel: 1 EquipLevelMin: 2 Refineable: true Script: | bonus bMaxHP,100; Oh i think i will use script too mush item. If i put script like this. It will long to finish. Quote Link to comment Share on other sites More sharing options...
0 Winterfox Posted July 28, 2023 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 245 Reputation: 93 Joined: 06/30/18 Last Seen: November 27, 2024 Share Posted July 28, 2023 Well in this case you will have to use a script to add the itemscript to the items. setarray(.@itemIds[0], 1101, 1102); for (.@i; .@i < ; .@i++) setitemscript(.@itemIds[.@i], "{ bonus(bMaxHP, 100); }"); Quote Link to comment Share on other sites More sharing options...
0 ooGubAoo Posted August 17, 2023 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 August 17, 2023 (edited) On 7/29/2023 at 1:20 AM, Winterfox said: Well in this case you will have to use a script to add the itemscript to the items. setarray(.@itemIds[0], 1101, 1102); for (.@i; .@i < ; .@i++) setitemscript(.@itemIds[.@i], "{ bonus(bMaxHP, 100); }"); Do like this? // Weapon // function script test { setarray .@itemIds[2], 440008, 480058; // ประกาศอาร์เรย์ itemIds ขนาด 2 for (.@i = 0; .@i < getarraysize(.@itemIds); .@i++) { setitemscript .@itemIds[.@i], "bonus2 bMaxHP, 100000;"; } } When run server dont have error. But dont get bonus Edited August 17, 2023 by ooGubAoo Quote Link to comment Share on other sites More sharing options...
0 Winterfox Posted August 17, 2023 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 245 Reputation: 93 Joined: 06/30/18 Last Seen: November 27, 2024 Share Posted August 17, 2023 (edited) 7 hours ago, ooGubAoo said: setitemscript .@itemIds[.@i], "bonus2 bMaxHP, 100000;"; That is wrong. You should take a better look at my example. setitemscript(.@itemIds[.@i], "{ bonus(bMaxHP, 100); }"); You need to add the {} and bonus is enough since you only need 1 value to set the max hp bonus. Edited August 17, 2023 by Winterfox Quote Link to comment Share on other sites More sharing options...
0 ooGubAoo Posted August 17, 2023 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 August 17, 2023 16 minutes ago, Winterfox said: That is wrong. You should take a better look at my example. setitemscript(.@itemIds[.@i], "{ bonus(bMaxHP, 100); }"); You need to add the {} and bonus is enough since you only need 1 value to set the max hp bonus. i read in doc to use setarray. i do like this T^T But dont work // Weapon // prontera,160,190,3 script TestBonus 847,{ setarray(.@itemIds[0], 440008, 1102); // ประกาศอาร์เรย์ itemIds ขนาด 2 for (.@i = 0; .@i < getarraysize(.@itemIds); .@i++) { setitemscript(.@itemIds[.@i], "{ bonus(bMaxHP, 100000); }"); } } Quote Link to comment Share on other sites More sharing options...
0 Winterfox Posted August 17, 2023 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 245 Reputation: 93 Joined: 06/30/18 Last Seen: November 27, 2024 Share Posted August 17, 2023 (edited) 16 minutes ago, ooGubAoo said: i read in doc to use setarray. i do like this T^T But dont work // Weapon // prontera,160,190,3 script TestBonus 847,{ setarray(.@itemIds[0], 440008, 1102); // ประกาศอาร์เรย์ itemIds ขนาด 2 for (.@i = 0; .@i < getarraysize(.@itemIds); .@i++) { setitemscript(.@itemIds[.@i], "{ bonus(bMaxHP, 100000); }"); } } You can use a floting npc. The npc doesn't need to be visible. You als should call the code using the OnInit label, so you don't have to call it manually. - script TestBonus FAKE_NPC,{ OnInit: setarray(.@itemIds[0], 440008, 1102); // ประกาศอาร์เรย์ itemIds ขนาด 2 for (.@i = 0; .@i < getarraysize(.@itemIds); .@i++) setitemscript(.@itemIds[.@i], "{ bonus(bMaxHP, 100000); }"); } Edited August 17, 2023 by Winterfox 1 Quote Link to comment Share on other sites More sharing options...
0 ooGubAoo Posted August 17, 2023 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 August 17, 2023 21 minutes ago, Winterfox said: You can use a floting npc. The npc doesn't need to be visible. You als should call the code using the OnInit label, so you don't have to call it manually. - script TestBonus FAKE_NPC,{ OnInit: setarray(.@itemIds[0], 440008, 1102); // ประกาศอาร์เรย์ itemIds ขนาด 2 for (.@i = 0; .@i < getarraysize(.@itemIds); .@i++) setitemscript(.@itemIds[.@i], "{ bonus(bMaxHP, 100000); }"); } It Work Thank You very much Quote Link to comment Share on other sites More sharing options...
0 ooGubAoo Posted August 17, 2023 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 August 17, 2023 28 minutes ago, Winterfox said: You can use a floting npc. The npc doesn't need to be visible. You als should call the code using the OnInit label, so you don't have to call it manually. - script TestBonus FAKE_NPC,{ OnInit: setarray(.@itemIds[0], 440008, 1102); // ประกาศอาร์เรย์ itemIds ขนาด 2 for (.@i = 0; .@i < getarraysize(.@itemIds); .@i++) setitemscript(.@itemIds[.@i], "{ bonus(bMaxHP, 100000); }"); } And 1 Qution If i need 2 bonus. i can put like this ? setitemscript(.@itemIds[.@i], "{ bonus(bMaxHP, 100000),bonus(bCritical, 100); }"); Quote Link to comment Share on other sites More sharing options...
0 Winterfox Posted August 17, 2023 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 245 Reputation: 93 Joined: 06/30/18 Last Seen: November 27, 2024 Share Posted August 17, 2023 4 minutes ago, ooGubAoo said: And 1 Qution If i need 2 bonus. i can put like this ? setitemscript(.@itemIds[.@i], "{ bonus(bMaxHP, 100000),bonus(bCritical, 100); }"); It needs to be ";" instead of ",". setitemscript(.@itemIds[.@i], "{ bonus(bMaxHP, 100000); bonus(bCritical, 100); }"); Quote Link to comment Share on other sites More sharing options...
0 ooGubAoo Posted August 17, 2023 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 August 17, 2023 (edited) setitemscript(.@itemIds[.@i], "{ bonus(bMaxHP, 100000); bonus(bCritical, 100); }"); i can use bonus4 in this script? ex bonus4 bAutoSpellOnSkill,"MG_FIREBOLT","MG_FIREBOLT",5,400 to bonus4(bAutoSpellOnSkill,"MG_FIREBOLT","MG_FIREBOLT",5,400) like this setitemscript(.@itemIds[.@i], "{ bonus(bMaxHP, 100000); bonus(bCritical, 100); bonus4(bAutoSpellOnSkill,"MG_FIREBOLT","MG_FIREBOLT",5,400); }"); Edited August 17, 2023 by ooGubAoo Quote Link to comment Share on other sites More sharing options...
0 Winterfox Posted August 17, 2023 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 245 Reputation: 93 Joined: 06/30/18 Last Seen: November 27, 2024 Share Posted August 17, 2023 42 minutes ago, ooGubAoo said: setitemscript(.@itemIds[.@i], "{ bonus(bMaxHP, 100000); bonus(bCritical, 100); }"); i can use bonus4 in this script? ex bonus4 bAutoSpellOnSkill,"MG_FIREBOLT","MG_FIREBOLT",5,400 to bonus4(bAutoSpellOnSkill,"MG_FIREBOLT","MG_FIREBOLT",5,400) like this setitemscript(.@itemIds[.@i], "{ bonus(bMaxHP, 100000); bonus(bCritical, 100); bonus4(bAutoSpellOnSkill,"MG_FIREBOLT","MG_FIREBOLT",5,400); }"); Why don't you simply try it before asking if it works? Everything inside the {} works like in any other script. So of course you can simply chain commands after each other. 1 Quote Link to comment Share on other sites More sharing options...
0 ooGubAoo Posted August 17, 2023 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 August 17, 2023 40 minutes ago, Winterfox said: Why don't you simply try it before asking if it works? Everything inside the {} works like in any other script. So of course you can simply chain commands after each other. Thank you to help every time. Quote Link to comment Share on other sites More sharing options...
Question
ooGubAoo
This my script function
If i need to add item ID to use this function.
Ex. i want item ID 1101 and 1102 to use this script.
How to add it.
Thank you to help.
Link to comment
Share on other sites
13 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.