Jump to content
  • 0

Item Effect Stacking Edit.


crazyarashi

Question


  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

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

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  249
  • Reputation:   72
  • Joined:  10/20/12
  • Last Seen:  

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 by Jey
  • Upvote 2
Link to comment
Share on other sites

  • 1

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

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 :))

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  249
  • Reputation:   72
  • Joined:  10/20/12
  • Last Seen:  

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)

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

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 :))

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

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 :D

Thanks for the help :))

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  62
  • Topics Per Day:  0.02
  • Content Count:  217
  • Reputation:   16
  • Joined:  01/28/15
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  148
  • Reputation:   10
  • Joined:  12/03/18
  • Last Seen:  

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?

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