Jump to content

meko

Core Developers
  • Content Count

    363
  • Joined

  • Days Won

    46

Posts posted by meko


  1. For this simply make a new item and in the script<> section use getitem() for each item you want to give, then use doevent() to call your npc script and in this npc before any dialog use delitem() to remove the box, then put your dialog that asks which item you want


  2. One could make a script command ("buildin") for this, but iterating through every single player every time this command is called would be very slow, especially if there's like 2k players online. One solution could be to have a separate property of map besides map->users that would count just like map->users but would be updated every time a player's vending state changes... but this would not be general-purpose so I don't think it should be in the core engine, this should rather be a plugin


  3. For the cheapest VPS offers have a look at LowEndBox.

    Keep in mind that most of those cheep providers advertised on LowEndBox do not offer DDOS protection.

     

     

     

    As for a guide to setting up a VPS running Hercules, I would first advise you to learn the basics of Linux:

    https://www.linux.com/learn/complete-beginners-guide-linux

    https://opensource.com/education/14/4/windows-to-linux-system-administration

    http://linuxsurvival.com/linux-tutorial-introduction/

     

    For the distribution, I recommend Debian, or Ubuntu Server (which is itself based on Debian)

     

     

    What is a VPS, what are the limitations:

    http://www.webhostingsecretrevealed.net/vps-hosting-guide/

     

     

    How to use SSH:

    https://support.suso.com/supki/SSH_Tutorial_for_Linux

    https://www.ssh.com/ssh/putty/windows/

     

     

    How to use git:

    https://try.github.io

    https://git-scm.com/documentation

     

     

    How to compile Hercules:

    https://github.com/HerculesWS/Hercules/blob/master/README.md#prerequisites

     

    How to use SQL:

    https://www.amazon.com/dp/1593271905/


  4. La documentation de Hercules est toujours à jour, puisqu'elle est aussi versionnée dans le répertoire git. Donc peut importe quelle version tu as, tu as toujours la documentation qui va avec.

     

    Regarde ce lien pour savoir comment compiler (dans Visual Studio 2015):

    https://github.com/HerculesWS/Hercules/blob/master/README.md#prerequisites

     

    Et ce lien pour savoir comment scripter:

    https://github.com/HerculesWS/Hercules/blob/master/doc/script_commands.txt

     

    Pour la documentation intégrale:

    https://github.com/HerculesWS/Hercules/tree/master/doc

     

     

    Et pour l'amour de tout ce qui existe, pitié, rends service à l'Humanité toute entière et n'utilises plus jamais Comic Sans.


  5. @True Zeal

    thanks for that info

     

    For commands introduced by plugins I believe you can simply add them to groups.conf like any other command. For commands introduced by scripts though you have to set the group in bindatcmd, but soon you'll be able to specify for each individual group.

     

    ----------------------------------------------------------------

    @CraftNCheez

    simply add the following to your groups.conf, in the Commands section of the Player group:

     

    feelreset: true
    allskill: true
    hatredreset: true
    

     

    Hope it helps


  6. Here, I made this for you:

    -	script	@give	FAKE_NPC,{
        end;
    
    OnCall:
        .@full$ = implode(.@atcmd_parameters$[0], " "); // put the string back together
    
        if ((.@full$ ~= "^([1-9]{1,10}) ([Zz]enys?|[Ii]tems? ([0-9]+)|[Cc]ash(?: ?point)?s?) to (.{1,23})$") == false) {
            dispbottom("@give : Invalid syntax!");
            dispbottom("@give : Proper syntax is @give <amount> <zeny | item <name> | cash> to <player name>");
            end;
        }
    
        .@amount = max(1, atoi($@regexmatch$[1]));
        .@type = ord(strtolower($@regexmatch$[2]));
        .@item = atoi($@regexmatch$[3]);
        .@player$ = escape_sql($@regexmatch$[4]);
        .@player = getcharid(CHAR_ID_ACCOUNT, .@player$);
        .@char = getcharid(CHAR_ID_CHAR, .@player$);
    
        .@count = query_sql(sprintf("SELECT `name`, `char_id`, `account_id` "
                                    "FROM `char` "
                                    "WHERE `name` = '%s' LIMIT 1;",
                                    .@player$), .@player$, .@char, .@player);
    
        if (.@count < 1 || .@player < 1 || .@char < 1) {
            dispbottom("@give : Player not found in database!");
            end;
        }
    
        switch (.@type) {
        case 122: // ZENY
            if (isloggedin(.@player, .@char)) {
                charcommand(sprintf("#zeny \"%s\" %i", .@player$, .@amount));
            } else {
                query_sql(sprintf("INSERT INTO `mail` (send_name,dest_name,dest_id,title,time,zeny) "
                            "VALUES ('%s','%s',%i,'%s',%i,%i);",
                            "SRV", .@player$, .@char, "Event Reward", gettimetick(2), .@amount));
            }
            break;
    
        case 105: // ITEM
            if (.@item < 1 || getiteminfo(.@item, 0) < 0) {
                dispbottom("@give : Item not found!");
                end;
            }
    
            if (isloggedin(.@player, .@char)) {
                getitem(.@item, .@amount, .@player);
            } else {
                query_sql(sprintf("INSERT INTO `mail` (send_name,dest_name,dest_id,title,time,amount,nameid) "
                                "VALUES ('%s','%s',%i,'%s',%i,%i,%i);",
                                "SRV", .@player$, .@char, "Event Reward", gettimetick(2), .@amount, .@item));
            }
            break;
    
        case 99: // CASH
            if (isloggedin(.@player, .@char)) {
                set(getvariableofpc(#CASHPOINTS, .@player), getvariableofpc(#CASHPOINTS, .@player) + .@amount);
            } else {
                query_sql(sprintf("UPDATE `acc_reg_num_db` "
                                "SET `index` = `index` + %i "
                                "WHERE `account_id` = %i AND `key` = '#CASHPOINTS';",
                                .@amount, .@player));
            }
        }
    
        dispbottom(sprintf("@give : Reward has been delivered to `%s`.", .@player$));
        end;
    
    OnInit:
        bindatcmd("give", "@give::OnCall", 0, 99, 0); // <<< MAKE SURE YOU CHANGE THE GROUP ID HERE
    }
    

     

    Example usage:

    @give 50 zeny to meko
    @give 69 cash to meko
    @give 1 item 508 to meko
    

     

    If the player is online the reward is delivered instantly; If the player is offline the reward is delivered via the mail system (except for Cash rewards)


  7. This will just encourage people making spam posts to increase their post count, and encourage creating other accounts to increase reputation. It makes everything cumbersome for everyone. You cannot and should not force people to contribute. You'll just end up driving away possible contributors to other projects (ie rAthena). Most people nowadays prefer to try first, then if they like it they come back and contribute. If people feel forced they just bail.


  8. You want the player to get only one item? Your percents make a total of 154% ...

     

    list of items,qty / Chance

    607,5         50%

    608,6         52%

    678,4         50%

    672,1         2%

     

     

    Try this:

    .@rnd = rand(154);
    
    if (.@rnd < 50) {
    	getitem(607, 5);
    } else if (.@rnd < 102) {
    	getitem(608, 6);
    } else if (.@rnd < 152) {
    	getitem(678, 4);
    } else {
    	getitem(672, 1);
    }
    

  9. Very hard to understand what you're saying... Try to just say it in Spanish and I'll use Google Translate on my side.

     

    Also why did you remove all the parentheses? o_o

    Not using them is the legacy syntax and is deprecated.

    And if you do remove them you can't omit the space and do things like

    input.@input;
    

    And you can't just turn a mesf() into a mes(), there's extra parameters

     

    Do you happen to be using rAthena and not using the right forums? I can't think of any other reason why you would turn a properly formatted script back to a horror show otherwise.

     

     

     

    If what you want is to prevent the quest from being done again I had already added in the script a method to prevent it, just uncomment the line:

    .quest_tratoa = 2;
    

    If what you're saying is you can't get it to work at all, well in your modified version there is a ton of malformed lines, so fix that first.


  10. first you might want to change this

    setunitdata(.@unitID, UDT_MODE, getunitdata(.@mobGID, UDT_MODE) &~ 1); 

    to this (mobGID is unused here)

    setunitdata(.@unitID, UDT_MODE, getunitdata(.@unitID, UDT_MODE) &~ 1);
    

     

    to set the AI to zero you don't need to do any bitwise operation, you can just do this:

    setunitdata(.@unitID, UDT_AI, 0); 

     

    to prevent skill use I'm not sure, you could try setting UDT_ATKMAX and UDT_MATKMAX to 0, or setting UDT_CANMOVETICK to 2147483647 (but that's just an ugly workaround, if it works at all)


  11. First of all, I would encourage you to read the whole documentation to understand how the herc language works. If you still have problems then, here's something that could help you get started:

     

    <map>,<x>,<y>,<dir>	script	<name>	<sprite>,{
    
        // YOUR INPUT FUNCTIONS GO HERE
    
        function input_mob_id {
            do {
                mes("Please enter the desired mob ID.");
                input(.@id, 1001, 10000);
            } while(getmonsterinfo(.@id, MOB_LV) < 0);
    
            // ^ the above will keep asking the player over and over until
            //   they enter the ID of a monster that exists
    
            next();
            return .@id;
        }
    
        function input_mob_agi {
            mes("Please enter the desired AGI.");
            input(.@agi, 1, 99);
    
            // ^ the above will ask the player once, but cap the value
    
            next();
            return .@agi;
        }
    
    
    
    
        // YOUR MAIN SCRIPT GOES HERE
    
        do {
            mes("Hi there, please enter the desired values."); // print a message
            next(); // require the player to click "next"
    
            .@mobID = input_mob_id(); // call the mob id menu, store the value
            .@mobAGI = input_mob_agi(); // call the mob AGI menu, store the value
    
            // ^ HERE ADD MORE CALLS AS NEEDED
             
            mes("Do you wish to proceed?"); // print a message
            select("Start over.", "Proceed."); // ask the player if they wish to continue
    
        } while (@menu != 2);
    
        mes("Please close the dialog to continue.");
        close2(); // require the player to close the dialog
    
        // HERE SPAWN YOUR MONSTER
        .@unitID = monster("<map name>", <x>, <y>, getmonsterinfo(.@mobID, MOB_NAME), .@mobID, 1); // MAKE SURE TO CHANGE THE map, x and y
    
        // NOW MANIPULATE THE MONSTER WITH THE DATA YOU GATHERED
        setunitdata(.@unitID, UDT_AGI, .@mobAGI);
    
        end; // terminate the script
    }
    

  12. here, I made this for you:

     

    <map>,<x>,<y>,<dir>	script	<name>	<sprite>,{
    
        mes("Hi there.");
        mes("Can I help you?");
        next();
    
        select("claim reward");
    
        mes("...");
        next();
    
        for (.@i = 0; .@i < .reward_len; .@i += 3) {
            if (rand(100) < .reward[.@i + 2]) {
                getitem(.reward[.@i], .reward[.@i + 1]);
                mesf("You obtained %i %s.", .reward[.@i + 1], getitemname(.reward[.@i]));
                .@reward = true; // got at least one reward
                next();
            }
        }
    
        if (.@reward != true) {
            mes("It seems you're out of luck.");
            next();
        }
    
        mes("Come back anytime!");
        close;
    
    OnInit:
        setarray(.reward[0],
            //ID,QTY,%
            607, 5, 50,
            608, 6, 52,
            678, 4, 50,
            672, 1,  2);
    
        .reward_len = getarraysize(.reward);
    }
    

     

    hope it helps

     

    UPDATE: added reward_len (sorry, forgot that)

×
×
  • Create New...

Important Information

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