Jump to content

utofaery

Members
  • Content Count

    101
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by utofaery


  1.     getinventorylist();
        for ( .@i = 0; .@i < @inventorylist_count; .@i++ ) {
            setarray .@IdList[.@i],@inventorylist_id[.@i];
        }

    Q1

    For above code how would I remove duplicates item ID or extract only Unique Item ID within array of .@idList so the end result would be array with no duplicated item id in it?

    =================================================================================================================================================

    Peace dividing line!

    =================================================================================================================================================

    [Error]: buildin_countitem: Invalid item '0'.
    [Debug]: Source (NPC): Mass Junk Seller at prontera (164,175)
    [Error]: buildin_countitem: Invalid item '0'.
    [Debug]: Source (NPC): Mass Junk Seller at prontera (164,175)
    [Error]: buildin_countitem: Invalid item '0'.
    [Debug]: Source (NPC): Mass Junk Seller at prontera (164,175)

    Q2

    Above Error always happens whenever this part of function runs what can be done with it ?

    but server and client runs fine.

    Function \\// Down here:

    Spoiler
    
    function    script    F_SellEquips    {
        setarray(.@noSell0x[0], 1231, 969, 4001 );
        getinventorylist();
        for ( set .@i,0; .@i < @inventorylist_count; set .@i,.@i + 1) {
            if ( ( getiteminfo(@inventorylist_id[.@i],ITEMINFO_TYPE) == IT_WEAPON ) || ( getiteminfo(@inventorylist_id[.@i],ITEMINFO_TYPE) == IT_ARMOR ) ) && ( @inventorylist_equip[.@i] == 0 ) && ( @inventorylist_refine[.@i] == 0 ) && ( @inventorylist_card1[.@i] == 0 ) && ( @inventorylist_card2[.@i] == 0 ) && ( @inventorylist_card3[.@i] == 0 ) && ( @inventorylist_card4[.@i] == 0 ) {
                .@FinishCheck = 0;
                for( .@c = 0; .@c <  getarraysize(.@noSell0x); ++.@c ) {
                    if (  @inventorylist_id[.@i] == .@noSell0x[.@c] ) { // Yes to sell
                        .@FinishCheck++;
                    }
                }
                if ( .@FinishCheck == 0 ) {
                    setarray .@sellid[getarraysize(.@sellid)],@inventorylist_id[.@i];
                }
            }
        }
        .@sellarraysize = getarraysize(.@sellid);
        .@xTItemCount = 0;
        .@xTItemZeny = 0;
        .@over = getskilllv("MC_OVERCHARGE");
        if(.@over > 0)    
            .@plus = 5 + 2*.@over - .@over/10;
        message strcharinfo(0),( " Sell array size " + .@sellarraysize );
        if ( .@sellarraysize > 0) {
            .@i = 0;
            while (.@i <= .@sellarraysize) {
                .@SitemID = .@sellid[.@i];
                if ( ( .@sellid[.@i] != 0 ) && ( .@sellid[.@i] > 0 ) && ( countitem(.@sellid[.@i] ) > 0 ) ) {
                    .@SitemName$ = getitemname(.@sellid[.@i]);
                    .@SitemCount = countitem(.@sellid[.@i]);
                    .@SitemPrice = ( getiteminfo(.@sellid[.@i],1) * (100 + .@plus) / 100 ) ;
                    .@xTItemZeny = .@xTItemZeny + ( .@SitemPrice * .@SitemCount ) ;
                    .@xTItemCount = .@xTItemCount + .@SitemCount;
                    dispbottom ("ItemCount :: " + .@SitemCount + "  ItemPrice :: " + .@SitemPrice + " ItemID :: " + .@sellid[.@i] + "  ItemName :: " + .@SitemName$ );
                    delitem2 (.@SitemID,.@SitemCount,true,0,0,0,0,0,0);
                }
                ++.@i;
            }
            Zeny = Zeny + .@xTItemZeny ;
            dispbottom ( " Total Zeny Gained :: " + .@xTItemZeny + "  for total item sold :: " + .@xTItemCount ) ;
        }
        if ( .@sellarraysize == 0 ) {
            dispbottom ( " Nah ! no item can be sale, you liar! " );
        }
        close2;
        end;
    }

     

     


  2. Spoiler

    //===== Hercules Script ======================================
    //= Healer
    //===== By: ==================================================
    //= Euphy
    //===== Current Version: =====================================
    //= 1.2
    //===== Description: =========================================
    //= Basic healer script.
    //===== Additional Comments: =================================
    //= 1.0 Initial script.
    //= 1.1 Aligned coordinates with @go.
    //= 1.2 Fix variables and character stuck at healing
    //============================================================
     

    -    script    HealerZ    FAKE_NPC,{
        .@time = 3600000; // the buff last whole hour
        .@Delay = 5;    // Heal delay, in seconds
        if (@HD > gettimetick(2)) 
            if ( @heal_cooldown + .@cooldown > gettimetick(2) ) {
                message(strcharinfo(0), "Power are cooling down do wait for " + ( @HD + .@Delay - gettimetick(2) ) + "seconds.");
                end;
            }

            callfunc("F_Repairall");
            callfunc("F_IdentifyUnidentified");
            callfunc("F_ConvertStone");
     

    //    disable negative buffs
        sc_end SC_STONE;
        sc_end SC_FREEZE;
        sc_end SC_STUN;
        sc_end SC_SLEEP;
        sc_end SC_POISON;
        sc_end SC_CURSE;
        sc_end SC_SILENCE;
        sc_end SC_CONFUSION;
        sc_end SC_BLIND;
        sc_end SC_BLOODING;
        sc_end SC_DPOISON;
        sc_end SC_FEAR;
        sc_end SC_COLD;
        sc_end SC_BURNING;
        sc_end SC_DEEP_SLEEP;
        sc_end SC_DEC_AGI;
        sc_end SC_BROKENARMOR;
        sc_end SC_BROKENWEAPON;
        sc_end SC_NOEQUIPWEAPON;
        sc_end SC_NOEQUIPSHIELD;
        sc_end SC_NOEQUIPARMOR;
        sc_end SC_NOEQUIPHELM;
        sc_end SC__STRIPACCESSARY;
        sc_end SC_PROPERTYUNDEAD;
        sc_end SC_ORCISH;
        sc_end SC_BERSERK;
        sc_end SC_SKE;
        sc_end SC_SWOO;
        sc_end SC_SKA;

        sc_start SC_WINDWALK,.@time,5;
    //    sc_start SC_KAITE,.@time,7; 
    //    sc_start SC_KAUPE,.@time,3; 
    //    sc_start SC_KAAHI,.@time,7; 
    //    sc_start SC_KAIZEL,.@time,7;
        sc_start SC_ENDURE,.@time,10;
        sc_start SC_ANGELUS,.@time,10;
        sc_start SC_MAGNIFICAT,.@time,5;
        sc_start SC_GLORIA,.@time,5;
        sc_start SC_ADRENALINE2,.@time,1;
        sc_start SC_IMPOSITIO,.@time,5;
        sc_start SC_SUFFRAGIUM,.@time,3;
        sc_start SC_KYRIE, .@time, 10;
        sc_start SC_CONCENTRATION, .@time, 10;
        sc_start SC_ANGELUS, .@time, 10;

        sc_start SC_FOOD_STR,.@time, 1000;
        sc_start SC_FOOD_AGI,.@time, 1000;
        sc_start SC_FOOD_VIT,.@time, 1000;
        sc_start SC_FOOD_INT,.@time, 1000;
        sc_start SC_FOOD_DEX,.@time, 1000;
        sc_start SC_FOOD_LUK,.@time, 1000;
        sc_start SC_FOOD_BASICHIT,.@time,3600;
        sc_start SC_FOOD_BASICAVOIDANCE,.@time,3600;

        specialeffect(EF_HEAL2, AREA, playerattached()); percentheal 100,100;
        specialeffect(EF_INCAGILITY, AREA, playerattached()); sc_start SC_INC_AGI,.@time,10;
        specialeffect(EF_BLESSING, AREA, playerattached()); sc_start SC_BLESSING,.@time,10;

    //xsa//    sc_start SC_BLESSING,.@time,10;
    //xsa//    sc_start SC_INCAGI,.@time,10;
        sc_start SC_INCASPDRATE,.@time,0;
    //    sc_start SC_SOULLINK,3000000,5;

        specialeffect(EF_RECOVERY, AREA, playerattached());

    //    give player's soul link
        if ( .@spirit = .spirit[BaseJob] );
        else if ( Upper & 1 && BaseLevel < 70 )
            .@spirit = SL_HIGH;
        if ( .@spirit ) {
            sc_start4 SC_SOULLINK, .@time, 1, .@spirit,0,0;
            skilleffect .@spirit, 1;
        }

        if (.@Delay) @HD = gettimetick(2)+.@Delay;
        end;

    OnInit:
        .spirit[Job_Alchemist] = SL_ALCHEMIST;
        .spirit[Job_Monk] = SL_MONK;
        .spirit[Job_Star_Gladiator] = SL_STAR;
        .spirit[Job_Sage] = SL_SAGE;
        .spirit[Job_Crusader] = SL_CRUSADER;
        .spirit[Job_SuperNovice] = SL_SUPERNOVICE;
        .spirit[Job_Knight] = SL_KNIGHT;
        .spirit[Job_Wizard] = SL_WIZARD;
        .spirit[Job_Priest] = SL_PRIEST;
        .spirit[Job_Bard] = .spirit[Job_Dancer] = SL_BARDDANCER;
        .spirit[Job_Rogue] = SL_ROGUE;
        .spirit[Job_Assassin] = SL_ASSASIN;
        .spirit[Job_Blacksmith] = SL_BLACKSMITH;
        .spirit[Job_Hunter] = SL_HUNTER;
        .spirit[Job_Soul_Linker] = SL_SOULLINKER;
        end;
    }

     

     

     

     

     


    function    script    F_Repairall    {
            if( getbrokencount() > 0 ) {
                repairall;    
                specialeffect(EF_REPAIRWEAPON, AREA, playerattached()); 
            }
            return;
    }


    function    script    F_IdentifyUnidentified    {
            //identify all player's equipments
            getinventorylist();
            for( .@i = 0; .@i < @inventorylist_count; .@i++ ) {
                if ( @inventorylist_identify[.@i] == 1 ) {
                    continue;
                } else if ( getskilllv("MC_IDENTIFY") == 1 && Sp >= 10 ) {
                    heal 0,0; // lol... this is supposed to reduce their SP by 10, whatever
                    npctalk("MC_IDENTIFY");
                } else if ( countitem("Spectacles") ) {
                    delitem(Spectacles, 1); 
                    npctalk("Spectacles deleted 1!"); //debuglines
                } else if ( getskilllv("RG_COMPULSION") && Zeny >= ( 100 - ( 5 + 4 * getskilllv("RG_COMPULSION") ) )* 2/5 ) {
                    Zeny -= ( 100 - ( 5 + 4 * getskilllv("RG_COMPULSION") ) )* 2/5;
                    npctalk("RGCompulsion"); //debuglines
                } else if ( getskilllv("MC_DISCOUNT") && Zeny >= ( 100 - ( 5 + 2 * getskilllv("MC_DISCOUNT") ) )* 2/5 ) {
                    Zeny -= ( 100 - ( 5 + 2 * getskilllv("MC_DISCOUNT") ) )* 2/5;
                    npctalk("MC_DISCOUNT"); //debuglines
                } else if ( Zeny >= 40 ) {
                    Zeny -= 40;
                    npctalk("40z deducted."); //debuglines
                } else if ( Zeny <= 39 ) {
                    npctalk("Zeny < 39."); //debuglines
                    return;
                }
                    delitem2(@inventorylist_id[.@i], 1, 0, 0, 0, 0, 0, 0, 0);
                    getitem2(@inventorylist_id[.@i], 1, 1, 0, 0, 0, 0, 0, 0);
                    .@icount++;
                }
            if ( .@icount > 0 ) {
                    message(strcharinfo(0), "Identified "+ .@icount +" Items.");
            }
            return;
    }

    function    script    F_ConvertStone    {

        //    automatically turn all oridecon and elunium stone into pure stone to reduce player's weight
            .@ori = countitem(Oridecon_Stone);
            if ( .@ori >= 5 ) {
                delitem(Oridecon_Stone, .@ori / 5 * 5);
                getitem(Oridecon, .@ori / 5);
                message(strcharinfo(0), "Refined "+ ( .@ori / 5 * 5 ) +" Oridecon Stones, got "+ ( .@ori / 5 ) +" Oridecons.");
            }
            .@elu = countitem(Elunium_Stone);
            if ( .@elu >= 5 ) {
                delitem(Elunium_Stone, .@elu / 5 * 5);
                getitem(Elunium, .@elu / 5);
                message(strcharinfo(0), "Refined "+ ( .@elu / 5 * 5 ) +" Elunium Stones, got "+ ( .@elu / 5 ) +" Eluniums.");
            }

        return;
    }

     

     

     

     

     


     

    prontera,162,193,4    duplicate(HealerZ)    Healer#prt    2_M_SAGE_B //4_PORING
     

     


  3. I need help to make this npc work correctly to tell how much item count it has sell.

    Spoiler

    prontera,164,175,4    script    Mass Junk Seller    1_M_MERCHANT,{
        .@x = 0;
        getinventorylist();
        for ( set .@i,0; .@i < @inventorylist_count; set .@i,.@i + 1) {
            // Check if the Item Type is in the ignore list
            if(getiteminfo(@inventorylist_id[.@i],2) == 3 ) {
                setarray .@sellid[getarraysize(.@sellid)],@inventorylist_id[.@i];
            }
        }
        mes (.n$);
        if(getarraysize(.@sellid) > 0) {
            for ( set .@s,0; .@s < getarraysize(.@sellid); set .@s,.@s + 1) {
                set .@total,.@total + (getiteminfo(.@sellid[.@s],1)*countitem(.@sellid[.@s]));
                delitem2 .@sellid[.@s],countitem(.@sellid[.@s]),1,0,0,0,0,0,0;
                .@x = .@x + 1;//this one is not working correctly
            }
            mes ("Your items were sold.");
            mes ("and you received "+.@total+" Zeny.");
            mes ("for "+.@x+" Item Count");//Part I need help to fix.
            set Zeny,Zeny + .@total;
        } else {
            mes ("No Items were sold,");
            mes ("therefore you don't");
            mes ("receive any Zeny.");
        }
        close2;
        end;
    }

     


  4. After Testing script provided.

    According to ratemyserver.net
    Baphomet   (BAPHOMET)   Mob-ID#1039 
    is counted as mvp

    but it is not listed any section of all three
    Normal Cards
    Mini-Boss Cards
    or the 
    MVP Cards

    what can I do to make it work??


  5. I was trying to take / borrow script card seller from rathena and this MD_BOSS is not working like MD_MVP in rathena

    [Error]: script_rid2sd: fatal error ! player not attached!
    [Debug]: Source (NPC): card_seller_creation (invisible/not on a map)
    [Warning]: script_get_val: cannot access player variable 'MD_BOSS', defaulting t
    o 0

    Map-server says not working what can I do to fix that part?

    Note : Script Header was not kept 

    Spoiler


    prontera,165,169,3    script    Normal Card Seller    4W_SAILOR,{
        .@menu$ = getvariableofnpc( .alphabet_menu$, "card_seller_creation" );
        if (.@menu$ == "") {
            mes "[Card Seller]";
            mes "I am sorry, it seems like something went wrong.";
            mes "I cannot find any cards in our database at the moment.";
            mes "Please contact a game master.";
            close;
        }
        mes "[Card Seller]";
        mes "Welcome!";
        mes "I can sell you any normal monster card in the game. Would you like to have a look?";
        next;
        .@s = select(.@menu$) -1;
        close2;
        callshop "card_mob#"+ getvariableofnpc( .alphabet$[.@s], "card_seller_creation" ), 1;
        end;
    }

    -    script    card_seller_creation    -1,{
        end;
    OnInit:
    //    if (checkre(0)) {
    //        .@mob_db$  = "mob_db_re";
    //        .@item_db$ = "item_db_re";
    //    } else {
            .@mob_db$  = "mob_db";
            .@item_db$ = "item_db";
    //    }
        freeloop 1;    
        .@total = query_sql( "SELECT DISTINCT LEFT( `name_japanese`, 1 ) AS alphabets FROM `"+ .@item_db$ +"` WHERE `type` = " + IT_CARD + " AND `id` IN ( SELECT DISTINCT `dropcardid` FROM `"+ .@mob_db$ +"` WHERE (`MEXP`) <= "+0+" ) ORDER BY alphabets;", .@alphabet$ );
        for ( .@i = 0; .@i < .@total; .@i++ ) {
            .@nb = query_sql( "SELECT `"+ .@item_db$ +"`.`id` FROM `"+ .@item_db$ +"` WHERE `type` = " + IT_CARD + " AND LEFT( `name_japanese`, 1 ) = '"+ .@alphabet$[.@i] +"' AND `id` IN ( SELECT DISTINCT `dropcardid` FROM `"+ .@mob_db$ +"` WHERE (`MEXP`) <= "+0+" ) ORDER BY `name_japanese` LIMIT 128;", .@id );
            if (.@nb > 0) {
                .alphabet$[.@size_alphabet++] = .@alphabet$[.@i];
                .alphabet_menu$ = .alphabet_menu$ + .@alphabet$[.@i] +" Cards:";
                npcshopdelitem "card_mob#"+ .@alphabet$[.@i], 501;
                for ( .@j = 0; .@j < .@nb; .@j++ ) {
                    if (callfunc( "F_IsCharm", .@id[.@j] ) == true)// Skip enchants in case someone added them as card drop
                        continue;
                    npcshopadditem "card_mob#"+ .@alphabet$[.@i], .@id[.@j], 1000;
                }
            }
        }
        freeloop 0;
        end;
    }


    -    shop    card_mob#A    -1,501:1000
    -    shop    card_mob#B    -1,501:1000
    -    shop    card_mob#C    -1,501:1000
    -    shop    card_mob#D    -1,501:1000
    -    shop    card_mob#E    -1,501:1000
    -    shop    card_mob#F    -1,501:1000
    -    shop    card_mob#G    -1,501:1000
    -    shop    card_mob#H    -1,501:1000
    -    shop    card_mob#I    -1,501:1000
    -    shop    card_mob#J    -1,501:1000
    -    shop    card_mob#K    -1,501:1000
    -    shop    card_mob#L    -1,501:1000
    -    shop    card_mob#M    -1,501:1000
    -    shop    card_mob#N    -1,501:1000
    -    shop    card_mob#O    -1,501:1000
    -    shop    card_mob#P    -1,501:1000
    -    shop    card_mob#Q    -1,501:1000
    -    shop    card_mob#R    -1,501:1000
    -    shop    card_mob#S    -1,501:1000
    -    shop    card_mob#T    -1,501:1000
    -    shop    card_mob#U    -1,501:1000
    -    shop    card_mob#V    -1,501:1000
    -    shop    card_mob#W    -1,501:1000
    -    shop    card_mob#X    -1,501:1000
    -    shop    card_mob#Y    -1,501:1000
    -    shop    card_mob#Z    -1,501:1000

    function    script    F_IsCharm    { //CARD CHECKER!!! DONT REMOVE
        .@id = getarg(0);
        return ((.@id >= 4700 && .@id < 5000) || (.@id >= 29000 && .@id <= 29162));
    }

     


  6. Visual studio 2017
    Running Window 7 x32

    Compiling > Hercules-15.sln
    Retargeted solution as visual studio says 
    with Windows SDK Version 10.0.17763.0 for 
    vcproj-15\Char-server.vcxproj
    vcproj-15\Login-server.vcxproj
    vcproj-15\Map-server.vcxproj
    vcproj-15\Plugin-sample.vcxproj
    vcproj-15\plugin-HPMHooking_map.vcxproj
    vcproj-15\plugin-HPMHooking_char.vcxproj
    vcproj-15\plugin-HPMHooking_login.vcxproj


    Then build solution  get all those stuff is it normal?
    What I wanted to get done is The warning part:

    c:\users\rio\desktop\hercules\src\char\int_party.c(321): warning C4018: '<=': signed/unsigned mismatch

    Spoiler


    1>------ Build started: Project: char-server, Configuration: Debug Win32 ------
    2>------ Build started: Project: login-server, Configuration: Debug Win32 ------
    1>c:\users\rio\desktop\hercules\src\char\int_party.c(321): warning C4018: '<=': signed/unsigned mismatch
    2>   Creating library ..\login-server.lib and object ..\login-server.exp
    1>   Creating library ..\char-server.lib and object ..\char-server.exp
    2>login-server.vcxproj -> C:\Users\Rio\Desktop\Hercules\vcproj-15\..\login-server.exe
    1>char-server.vcxproj -> C:\Users\Rio\Desktop\Hercules\vcproj-15\..\char-server.exe
    1>Done building project "char-server.vcxproj".
    3>------ Build started: Project: map-server, Configuration: Debug Win32 ------
    4>------ Build started: Project: plugin-sample, Configuration: Debug Win32 ------
    4>   Creating library plugin-sample\Debug\sample.lib and object plugin-sample\Debug\sample.exp
    4>plugin-sample.vcxproj -> C:\Users\Rio\Desktop\Hercules\vcproj-15\..\plugins\sample.dll
    5>------ Build started: Project: plugin-HPMHooking_map, Configuration: Debug Win32 ------
    5>   Creating library plugin-HPMHooking_map\Debug\HPMHooking_map.lib and object plugin-HPMHooking_map\Debug\HPMHooking_map.exp
    5>plugin-HPMHooking_map.vcxproj -> C:\Users\Rio\Desktop\Hercules\vcproj-15\..\plugins\HPMHooking_map.dll
    6>------ Build started: Project: plugin-HPMHooking_char, Configuration: Debug Win32 ------
    3>   Creating library ..\map-server.lib and object ..\map-server.exp
    3>map-server.vcxproj -> C:\Users\Rio\Desktop\Hercules\vcproj-15\..\map-server.exe
    7>------ Build started: Project: plugin-HPMHooking_login, Configuration: Debug Win32 ------
    6>   Creating library plugin-HPMHooking_char\Debug\HPMHooking_char.lib and object plugin-HPMHooking_char\Debug\HPMHooking_char.exp
    6>plugin-HPMHooking_char.vcxproj -> C:\Users\Rio\Desktop\Hercules\vcproj-15\..\plugins\HPMHooking_char.dll
    7>   Creating library plugin-HPMHooking_login\Debug\HPMHooking_login.lib and object plugin-HPMHooking_login\Debug\HPMHooking_login.exp
    7>plugin-HPMHooking_login.vcxproj -> C:\Users\Rio\Desktop\Hercules\vcproj-15\..\plugins\HPMHooking_login.dll
    ========== Build: 7 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

     


  7. Was having trouble to create the line to read prev_class example

     

    player 1 has evolved homunculus 6009

    and i want to make that npc script read from sql

    it evolve from 6001 so how should I struct my script?

     

    query_sql  ( select prev_class from homunculus )

    and has a check of the player 1's char_id if it is triggered by player 1


  8. Is there any stuff I can do to make it not kick me out when reloadingscript by items?

     

    atcommand "@reloadscript";

     

    It functions like @mapexit in hercules.

    What I mean is it did not act this way before in eA.

     

    Anyone can help me out in this?


  9. I was moving from eathena 13786 to hercules master revision downloaded as zip.

     

    So here's the thing, a line like this work before in itemdb 

     

    atcommand "@reloadscript "+strcharinfo(0)+"";

     

    but cease to work now please help me to fix it

×
×
  • Create New...

Important Information

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