Jump to content

@itemoption Command


Keitenai

Recommended Posts


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  98
  • Reputation:   77
  • Joined:  12/04/14
  • Last Seen:  

File Name: itemoption
File Submitter: keitenai
File Submitted: 21 Nov 2016
File Category: Utilities
Content Author: keitenai

 

@ command itemoption

Script Information:
     This script allows you to apply random option on a selected equipped item.
 

  • The Option types can be found in const.txt : LINK!!
  • The Value is the rate of the option type effect.
    • eg: `10` = 10% bonus attack
  • Index location is the Option Slot location.
    • 0 = First item option slot
    • 1 = Second item option slot
    • 2 = Third item option slot
    • 3 = Fourth item option slot
    • 4 = Fifth item option slot
      • NOTE that you will not see the Option type's description (Client Side) if the Option Slots are not filled by sequence (missed a slot).
      • With this i added a security check that if you missed/jump an index slot, the script will automatically fix it for you.

 

@ itemoption makes it easier to apply random option in your item quite easily.

 

Compatible with : rAthena  633a642

Download : itemoption.txt 

itemoption-1.PNG      itemoption-2.PNG

Hope you find this useful ^_^

 

itemoption.txt

Edited by Keitenai
  • Upvote 1
  • Love 1
  • Like 1
Link to comment
Share on other sites

  • 1 month later...

  • Group:  Developer
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  588
  • Reputation:   439
  • Joined:  01/26/16
  • Last Seen:  

Cleaned up the script.

Got rid of some eA-style code.

Removed the index selection dialogue and made the script automatically detect free option slot.

itemoption.txt

  • Love 1
  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   23
  • Joined:  06/14/16
  • Last Seen:  

I can't make this work :(

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   23
  • Joined:  06/14/16
  • Last Seen:  

[Error]: buildin_setrandomoption: Random option ID 9 does not exists.
[Debug]: Source (NPC): OptCmd (invisible/not on a map)
[Error]: buildin_setrandomoption: Random option ID 3 does not exists.
[Debug]: Source (NPC): OptCmd (invisible/not on a map)
[Error]: buildin_setrandomoption: Random option ID 0 does not exists.
[Debug]: Source (NPC): OptCmd (invisible/not on a map)
[Error]: buildin_setrandomoption: Random option ID 94 does not exists.
[Debug]: Source (NPC): OptCmd (invisible/not on a map)

 

Fixed it. I copied the item_randomopt_db.txt from renewal to pre-renewal :)

 

Link to comment
Share on other sites

  • 8 months later...

  • Group:  Members
  • Topic Count:  271
  • Topics Per Day:  0.08
  • Content Count:  794
  • Reputation:   21
  • Joined:  11/21/15
  • Last Seen:  

thnx to this one

Link to comment
Share on other sites

  • 3 years later...

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  04/14/18
  • Last Seen:  

Hi. Sorry I'm a noob at this. Where shoudl I place these codes? thx

Link to comment
Share on other sites

  • 1 year later...

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  1
  • Reputation:   0
  • Joined:  06/19/22
  • Last Seen:  

Thank you for this.

Link to comment
Share on other sites

  • 2 years later...

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   1
  • Joined:  02/04/24
  • Last Seen:  

I took the liberty of modifying your script a little @Keitenai
Take a look and see if it looks good?
 

-    script    OptCmd    -1,{

OnInit:
    .allowed = 90;                       // nível/grupo mínimo de GM
    bindatcmd("itemoption",strnpcinfo(0)+"::OnOptCmd");
    end;

OnOptCmd:
    if (getgmlevel() < .allowed) end;    // bloqueia quem não for GM suficiente

    disable_items;

    //-------------------------------------
    // 1. PARTES EQUIPÁVEIS
    //-------------------------------------
    setarray .@eq[1], EQI_HEAD_TOP, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R,
                       EQI_GARMENT,  EQI_SHOES, EQI_ACC_L,  EQI_ACC_R,
                       EQI_HEAD_MID, EQI_HEAD_LOW;

    //-------------------------------------
    // 2. IDs DE RANDOM-OPTION ACEITOS
    //-------------------------------------
    setarray .@valid_opts[0],
        1,2,3,4,5,6,7,8,9,10,
        11,12,13,14,15,16,17,18,19,20,
        21,22,23,24,25,26,27,28,29,30,
        31,32,33,34,35,94,104,114,124,134,
        144,147,148,149,150,151,152,153,154,155,
        156,163,164,165,166,167,168,169,170,171,
        172,185,186;

    //-------------------------------------
    // 3. MENU DE EQUIPAMENTOS EQUIPADOS
    //-------------------------------------
    for (.@i = 1; .@i < getarraysize(.@eq); ++.@i) {
        if (getequipisequiped(.@eq[.@i])) {
            .@menu$ += F_getpositionname(.@eq[.@i]) + " ^FF0000~^000000 [ ^0000FF"
                       + getequipname(.@eq[.@i]) + "^000000 ]:";
        }
    }
    if (.@menu$ == "") {
        mes "[^FF8C00 System ^000000]";
        mes "You do not have any eligible items equipped..";
        close;
    }
    .@part = .@eq[select(.@menu$)];

    //-------------------------------------
    // 4. INPUT DO ID DA OPÇÃO
    //-------------------------------------
L_opt_input:
    mes "[^FF8C00 System ^000000]";
    mes "Enter the number of the desired option:";
    next;
    mes "#1:MaxHP +";
    mes "#2:MaxSP +";
    mes "#3:Str +";
    mes "#4:Agi +";
    mes "#5:Vit +";
    mes "#6:Int +";
    mes "#7:Dex +";
    next;
    mes "#8:Luk +";
    mes "#9:MaxHP %";
    mes "#10:MaxSP %";
    mes "#11:Natural HP regeneration %";
    mes "#12:Natural SP regeneration %";
    mes "#13:ATK %";
    mes "#14:MATK %";
    next;
    mes "#15:ASPD +";
    mes "#16:Reduces delay after attack by %";
    mes "#17:ATK +";
    mes "#18:Hit +";
    mes "#19:MATK +";
    mes "#20:DEF +";
    mes "#21:MDEF +";
    next;
    mes "#22:Flee +";
    mes "#23:Perfect Dodge +";
    mes "#24:Critical +";
    mes "#25:Resistance against Neutral element %";
    mes "#26:Resistance against Water element %";
    mes "#27:Resistance against Earth element %";
    mes "#28:Resistance against Fire element %";
    next;
    mes "#29:Resistance against Wind element %";
    mes "#30:Resistance against Poison element %";
    mes "#31:Resistance against Holy element %";
    mes "#32:Resistance against Dark element %";
    mes "#33:Resistance against Ghost element %";
    mes "#34:Resistance against Undead element %";
    mes "#35:Resistance against All element %";
    next;
    mes "#94:Resistance against Demihuman moster %";
    mes "#104:Physical damage against Demihuman monster %";
    mes "#114:Magical damage against Demihuman monster %";
    mes "#124:CRIT +/10 against Demihuman monster";
    mes "#134:Ignores % physical defense of Demihuman monster";
    mes "#144:Ignores % magical defense of Demihuman monster";
    mes "#147:Physical damage against Normal monster %";
    next;
    mes "#148:Physical damage against Boss monster %";
    mes "#149:Resistance against Normal monster %";
    mes "#150:Resistance against Boss monster %";
    mes "#151:Magical damage against Normal monster %";
    mes "#152:Magical damage against Boss monster %";
    mes "#153:Ignores % physical defense of Normal monster";
    mes "#154:Ignores % physical defense of Boss monster";
    next;
    mes "#155:Ignores % magical defense of Normal monster";
    mes "#156:Ignores % magical defense of Boss monster";
    mes "#163:Nullify weapon's damage size penalty";
    mes "#164:Increases critical damage %";
    mes "#165:Descreases critical damage %";
    mes "#166:Increases ranged physical damage %";
    mes "#167:Descreases ranged physical damage %";
    next;
    mes "#168:Increases Healing skills %";
    mes "#169:Increases restoraton gained from Healing skills";
    mes "#170:Reduces variable cast time %";
    mes "#171:Reduces after cast delay %";
    mes "#172:Descreases SP consumption %";
    mes "#185:Indestructible Weapon";
    mes "#186:Indestructible Armor";
    next;
    input .@opt;

    // Verifica se a opção é válida manualmente (sem usar inarray)
    .@found = 0;
    for (.@i = 0; .@i < getarraysize(.@valid_opts); .@i++) {
        if (.@valid_opts[.@i] == .@opt) {
            .@found = 1;
            break;
        }
    }
    if (!.@found) {
        mes "^FF0000Invalid option.^000000";
        next;
        goto L_opt_input;
    }

    mes "[^FF8C00 System ^000000]";
    mes "Option ^6A01A1Type^000000 : " + .@opt;
    mes " ";
    mes "Please indicate the ^B91E1Evalue^000000 that you want to apply.";
    mes " ";
    mes "This will be the effect ^B91E1Erate^000000 or ^B91E1Evalue^000000 of your selected option ^6A01A1type^000000.";
    mes " ";

    //-------------------------------------
    // 5. INPUT DO VALOR (1~9999)
    //-------------------------------------
L_val_input:
    mes "[^FF8C00 System ^000000]";
    mes "Enter the option ^B91E1Evalue^000000 (^B91E1E1^000000 ~ ^B91E1E9999^000000):";
    input .@val;

    if (.@val < 1 || .@val > 9999) {
        mes "^FF0000Value out of range.^000000";
        next;
        goto L_val_input;
    }

    //-------------------------------------
    // 6. ENCONTRAR SLOT LIVRE (0-4)
    //-------------------------------------
    for (.@idx = 0; .@idx < 5; ++.@idx)
        if (!getequiprandomoption(.@part, .@idx, ROA_ID, getcharid(0)))
            break;

    if (.@idx == 5) {
        mes "[^FF8C00 System ^000000]";
        mes "^FF0000This item already has 5 options.^000000";
        close;
    }

    //-------------------------------------
    // 7. APLICAR A OPÇÃO
    //-------------------------------------
    mes "[^FF8C00 System ^000000]";
    mes "Applying option:";
    mes "ID: ^6A01A1" + .@opt + "^000000";
    mes "Value: ^B91E1E" + .@val + "^000000";
    mes "Slot: ^0C9610" + .@idx + "^000000";
    close2;

    setrandomoption(.@part,.@idx,.@opt,.@val,.@idx,getcharid(0));
    end;
}

 

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
Reply to this topic...

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