crazyarashi Posted April 8, 2017 Group: Developer Topic Count: 50 Topics Per Day: 0.02 Content Count: 776 Reputation: 239 Joined: 02/11/17 Last Seen: Friday at 07:27 AM Share Posted April 8, 2017 Hi, Good Day Rathena I want to know how to limit an accessory effect to 1 only. For example of you wear 2 Glorious Ring Only 1 will effect. and the other wont have effect. Is it in the item script? or others.. Quote Link to comment Share on other sites More sharing options...
0 Jey Posted April 8, 2017 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 249 Reputation: 73 Joined: 10/20/12 Last Seen: August 16, 2018 Share Posted April 8, 2017 (edited) Oh I just realized: *isequippedcnt is for counting cards only. Sorry didn't see it correctly. I thought it will count equipped items by a given nameid. So a command to count equipped items is missing. There are now other possible solutions: As I mentioned above change the equip loc of the accessory to either right or left. (easiest method) Write a custom script-command like *countequipped(<itemid>) (most efficient solution) Write a custom script-function by using getinventorylist to count equipped items. Example: # Careful! Not tested. function script countequipped { getinventorylist(); .@nameid = getarg(0,0); .@count = 0; for( .@i = 0; .@i < @inventorylist_count; .@i++) { if( @inventorylist_id[.@i] == .@nameid && @inventorylist_equip[.@i] > 0 ) .@count++; } return .@count; } Use countitem as a workaround for countequipped (Note: every inventory item will be counted) Example DB entry for Clip: 2607,Clip,Clip,4,30000,,100,,0,,1,0xFFFFFFFF,63,2,136,,0,0,0,{ bonus bMaxSP,10; },{},{} #standard 2607,Clip,Clip,4,30000,,100,,0,,1,0xFFFFFFFF,63,2,136,,0,0,0,{ if( callfunc("countequipped",2607) > 1 ) { bonus bMaxSP,5; } else { bonus bMaxSP,10; } },{},{} If you're interested in using the command "countequipped", I'll create a pull request for it as a script command, since I wouldn't recommend the inflationary use of getinventorylist. Edited April 8, 2017 by Jey 2 Quote Link to comment Share on other sites More sharing options...
1 crazyarashi Posted August 20, 2018 Group: Developer Topic Count: 50 Topics Per Day: 0.02 Content Count: 776 Reputation: 239 Joined: 02/11/17 Last Seen: Friday at 07:27 AM Author Share Posted August 20, 2018 13 hours ago, OscarScorp said: @crazyarashi , does that function works as intended? Only 1 effect from both accessories equipped will be on effect? I ask because of the "Caerful! Not tested." comment. i used only once but it worked fine :)) Quote Link to comment Share on other sites More sharing options...
0 Jey Posted April 8, 2017 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 249 Reputation: 73 Joined: 10/20/12 Last Seen: August 16, 2018 Share Posted April 8, 2017 The easiest way is to set the accessory either as "left" or "right" accessory in the database, so you simply can't equip multiple of them. Another way is to use isequippedcnt(<id>) in the item script and divide the effect into half if there is more than one equipped. (Not really pretty imo) 1 Quote Link to comment Share on other sites More sharing options...
0 crazyarashi Posted April 8, 2017 Group: Developer Topic Count: 50 Topics Per Day: 0.02 Content Count: 776 Reputation: 239 Joined: 02/11/17 Last Seen: Friday at 07:27 AM Author Share Posted April 8, 2017 25 minutes ago, Jey said: The easiest way is to set the accessory either as "left" or "right" accessory in the database, so you simply can't equip multiple of them. Another way is to use isequippedcnt(<id>) in the item script and divide the effect into half if there is more than one equipped. (Not really pretty imo) Hi do you mind if i ask for an example if the script. isequippedcnt :)) Quote Link to comment Share on other sites More sharing options...
0 crazyarashi Posted April 8, 2017 Group: Developer Topic Count: 50 Topics Per Day: 0.02 Content Count: 776 Reputation: 239 Joined: 02/11/17 Last Seen: Friday at 07:27 AM Author Share Posted April 8, 2017 15 minutes ago, Jey said: Oh I just realized: *isequippedcnt is for counting cards only. Sorry didn't see it correctly. I thought it will count equipped items by a given nameid. So a command to count equipped items is missing. There are now other possible solutions: As I mentioned above change the equip loc of the accessory to either right or left. (easiest method) Write a custom script-command like *countequipped(<itemid>) (most efficient solution) Write a custom script-function by using getinventorylist to count equipped items. Example: # Careful! Not tested. function script countequipped { getinventorylist(); .@nameid = getarg(0,0); .@count = 0; for( .@i = 0; .@i < @inventorylist_count; .@i++) { if( @inventorylist_id[.@i] == .@nameid && @inventorylist_equip[.@i] > 0 ) .@count++; } return .@count; } Use countitem as a workaround for countequipped (Note: every inventory item will be counted) Example DB entry for Clip: 2607,Clip,Clip,4,30000,,100,,0,,1,0xFFFFFFFF,63,2,136,,0,0,0,{ bonus bMaxSP,10; },{},{} #standard 2607,Clip,Clip,4,30000,,100,,0,,1,0xFFFFFFFF,63,2,136,,0,0,0,{ if( callfunc("countequipped",2607) > 1 ) { bonus bMaxSP,5; } else { bonus bMaxSP,10; } },{},{} If you're interested in using the command "countequipped", I'll create a pull request for it as a script command, since I wouldn't recommend the inflationary use of getinventorylist. Please do Thanks for the help :)) Quote Link to comment Share on other sites More sharing options...
0 OscarScorp Posted August 19, 2018 Group: Members Topic Count: 62 Topics Per Day: 0.02 Content Count: 217 Reputation: 16 Joined: 01/28/15 Last Seen: February 25, 2022 Share Posted August 19, 2018 @crazyarashi , does that function works as intended? Only 1 effect from both accessories equipped will be on effect? I ask because of the "Caerful! Not tested." comment. Quote Link to comment Share on other sites More sharing options...
0 PsyOps Posted September 1, 2020 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 150 Reputation: 12 Joined: 12/03/18 Last Seen: 10 hours ago Share Posted September 1, 2020 On 4/9/2017 at 7:09 AM, Jey said: Oh I just realized: *isequippedcnt is for counting cards only. Sorry didn't see it correctly. I thought it will count equipped items by a given nameid. So a command to count equipped items is missing. There are now other possible solutions: As I mentioned above change the equip loc of the accessory to either right or left. (easiest method) Write a custom script-command like *countequipped(<itemid>) (most efficient solution) Write a custom script-function by using getinventorylist to count equipped items. Example: # Careful! Not tested. function script countequipped { getinventorylist(); .@nameid = getarg(0,0); .@count = 0; for( .@i = 0; .@i < @inventorylist_count; .@i++) { if( @inventorylist_id[.@i] == .@nameid && @inventorylist_equip[.@i] > 0 ) .@count++; } return .@count; } Use countitem as a workaround for countequipped (Note: every inventory item will be counted) Example DB entry for Clip: 2607,Clip,Clip,4,30000,,100,,0,,1,0xFFFFFFFF,63,2,136,,0,0,0,{ bonus bMaxSP,10; },{},{} #standard 2607,Clip,Clip,4,30000,,100,,0,,1,0xFFFFFFFF,63,2,136,,0,0,0,{ if( callfunc("countequipped",2607) > 1 ) { bonus bMaxSP,5; } else { bonus bMaxSP,10; } },{},{} If you're interested in using the command "countequipped", I'll create a pull request for it as a script command, since I wouldn't recommend the inflationary use of getinventorylist. So it means that if the player is wearing one ring and has the same ring on his inventory, then the script will count it as having two items? Quote Link to comment Share on other sites More sharing options...
Question
crazyarashi
Hi, Good Day Rathena I want to know how to limit an accessory effect to 1 only.
For example of you wear 2 Glorious Ring Only 1 will effect. and the other wont have effect.
Is it in the item script? or others..
Link to comment
Share on other sites
7 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.