Jump to content
  • 0
Sign in to follow this  
1steric

random item option system

Question

hello

 

I am currently writing this script.

 

This is a system that allows you to add desired options to 5 slots of all items.

 

but i have this script I would like to modify it so that only the weapon can be given the desired option with one slot.

 

Advice from seniors please. thank you

 

 

 

 

 

 

 

trin_in,30,164,4    script    잠재력 개방    4_DOG01,{ 
    callsub(StartTalking);
    end;
    
OnInit:
    /**
     * General Configuration
     */
    /* 강화 실패 확률 (0 - 99 in percent) */
    .chance_of_failure = 0;
    /* 실패 시 아이템 삭제여부 (true/false) */
    .delete_on_failure = false;
    /* 강화 필요 제니 */
    .zeny_requirement = 100000;
    /* Minimum amount of the bonus value. 
     * For negative effects or certain bonuses that require negative values
     * Maximum possible value is -INT16_MAX)
     */
    .minimum_bonus_amount = -100; // usually used with delay bonus options, although not provided in the script.
    /* Maximum amount of the bonus value. 
     * Maximum possible value is INT16_MAX */
    .maximum_bonus_amount = 10;
    /* Disable selection of bonus value (true/false) */
    .enable_random_bonus = true;
    
    /* Item Option Descriptions */
    setarray(.options$[0], "공격력", "마법 공격력", "공격속도", "시전속도", "크리티컬 데미지");
    /* Item Option Constants */
    setarray(.option_constants[0], VAR_ATKPERCENT, VAR_MAGICATKPERCENT, VAR_PLUSASPDPERCENT, DEC_SPELL_CAST_TIME, DAMAGE_CRI_TARGET);
    end;
    
StartTalking:
    [email protected]$ = _("[ ^990099잠재력 개방^000000 ]");
    disable_items();
    mes([email protected]$);
    mesf("안녕하세요 %s", strcharinfo(PC_NAME));
    mes("착용하고 계신 무기에 잠재력을 개방시킬 수 있어요.");
    mes("잠재력을 개방시키면 새로운 추가옵션을 얻을 수 있습니다.");
    next();
    mes([email protected]$);
    mes("무기 잠재력 개방을 하시겠습니까?");
    next();
    if (select("할게요!", "아뇨 다음에요..") == 2) {
        mes([email protected]$);
        mes("그래요 다음에 뵈요.");
        close();
    }
    // Build the Menu.
    setarray([email protected]$[1], "상단", "갑옷", "왼손", "오른손", "걸칠것", "신발");
    [email protected]$ = "";
    for ([email protected] = 1; [email protected] <= 6; [email protected])
        [email protected]$ += ((getequipisequiped([email protected])) ? getequipname([email protected]) : [email protected]$[[email protected]] + "-[착용하지 않음]") + ":";
    // Select the part.
    [email protected]_index = select([email protected]$);
    
    
    // Present a list of currently infused options.
    do {
        [email protected]$ = "";
        [email protected] = false;
        // Build the menu of current options.
        for ([email protected] = 1; [email protected] <= MAX_ITEM_OPTIONS; [email protected]) {
            // call getequipoption(<equip_index>, <type>, <slot>);
            // if the return is <0, it's a script error.
            // if the return is 0, the slot is empty.
            // if the return is >0, the slot is unavailable.
            [email protected] = getequipoption([email protected]_index, [email protected], IT_OPT_INDEX);
            if ([email protected] > 0)
                [email protected]$ += ([email protected]) + ") " + .options$[[email protected] - 1] + ":";
            else
                [email protected]$ += ([email protected]) + ") ^999999Empty^000000" + ":";
        }
        // Option Slot is the actual option slot 0-MAX_ITEM_OPTIONS (@see mmo.h)
        [email protected]_slot = select([email protected]$);
        
        // Check for used slot and request user action if found.
        if (getequipoption([email protected]_index, [email protected]_slot, IT_OPT_INDEX) > 0) {
            mes([email protected]$);
            mes("This slot is already used up!");
            if (select("^990000Override the slot.^000000", "Choose again.") == 2)
                [email protected] = true;
            next();
        }
    } while ([email protected]); // loop if the slot is not to be overridden
    
    // Present a list of available bonuses.
    mes([email protected]$);
    mes("Which of the following item bonuses would you like to add to this item?");
    next();
    // Build the Options!
    [email protected]$ = "";
    for ([email protected] = 0; [email protected] < getarraysize(.options$); [email protected])
        [email protected]$ += ([email protected] + 1) + ") " + .options$[[email protected]] + ":";
        
    do {
        // Select the options!
        [email protected]_variable = select([email protected]$);
        next();
        mes([email protected]$);
        mesf("You chose ^009900%s^000000!", .options$[[email protected]_variable - 1]);
        mes("Are you sure?");
        next();
    } while (select("Fo Shizzle.", "I'ma re-evaluate, brah.") == 2);
    
    // Select a bonus or randomise.
    if (.enable_random_bonus) {
        [email protected] = rand(.maximum_bonus_amount);
    } else {
        do {
            mes([email protected]$);
            mesf("Please input the bonus amount of ^009900%s^000000 you want to add!", .options$[[email protected]_variable - 1]);
            mesf("(Min: %d, Max: %d)", .minimum_bonus_amount, .maximum_bonus_amount);
            [email protected] = input([email protected], .minimum_bonus_amount, .maximum_bonus_amount);
            next();
        } while ([email protected]);
    }
    
    // If there's a chance of failure, inform the user.
    if (.chance_of_failure) {
        mes([email protected]$);
        mes("Alright so,");
        mes("I'll have you know...");
        mesf("There's a ^990000%d%% chance of failure^000000.", .chance_of_failure);
        mes("Because, well... I didn't go to school.");
        next();
        mes([email protected]$);
        if (.delete_on_failure) {
            mes("If I fail, your item will break and it ^990000will be destroyed^000000!");
        }
        mes("Are you still ready to go forward with this?");
        next();
        if (select("Fo shizzle.", "Hells naw, go back to school.") == 2) {
            mes([email protected]$);
            mes("Geez, you don't have to be so harsh about it.");
            close();
        }
        next();
    }
    
    // If there's a Zeny Requirement, perform the usual.
    if (.zeny_requirement > 0) {
        mes([email protected]$);
        mesf("You also have to pay %dZ.", .zeny_requirement);
        next();
        if (select("Of course!", "No way!") == 2) {
            mes([email protected]$);
            mes("Well, see you around then...");
            close();
        }
        if (Zeny < .zeny_requirement) {
            mes([email protected]$);
            mes("You don't have enough Zeny!");
            close();
        }
        Zeny -= .zeny_requirement;
    }
    
    // Check if there's a chance of failure, set and roll the dice.
    if (.chance_of_failure && rand(100) <= .chance_of_failure) {
        mes([email protected]$);
        mes("^990000I failed!^000000");
        mes("Guess I should go back to school.");
        // Delete the item if flagged.
        if (.delete_on_failure)
            failedrefitem([email protected]_index); // Simulate failed refinement of the item and delete.
    } else {
        // Set the Item Option bonuses in the slot see db/item_options.conf for more info.
        setequipoption([email protected]_index, [email protected]_slot, .option_constants[[email protected]_variable - 1], [email protected]);
        mes([email protected]$);
        mes("^009900Praise Jesus^000000");
        mes("I have added an option to your item.");
        mes("My skills are flawless!");
    }
    next();
    mes([email protected]$);
    mes("See you around!");
    close();
}
 

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.