Jump to content

Mumbles

Retired Staff
  • Content Count

    618
  • Joined

  • Last visited

  • Days Won

    15

Posts posted by Mumbles


  1. Utility: Variant Mining

    As per xienne15's request: http://herc.ws/board/topic/1886-simple-mining/

     

    Description:

    A simple mining system; allows for interacting players to excavate minerals by "mining" them with special equipment and tools. Minerals disappear and respawn randomly; chance is determined by configuration.

     

    Configuration is mostly done in arrays so that settings may be changed with no modifications to the script. Duplicate in additional locations as needed; update the value of '.var_amount' correspondingly.

     

    Download:

    https://github.com/datmumbles/Scripts/raw/master/util/mining.txt


  2. Your left curly on line 61 is mismatched. It shouldn't even be there. Also, you're checking if the player has -1 of the item 26131; I think it's safe to assume you meant to check if the player had at least 1 of the item.

     

     

    if (countitem(26131) < 0) { goto noring;

     

    I could rant about why you shouldn't use goto, but to put it simply: it's just bad code - and wasn't used properly, at that. You can't (or shouldn't, if for some reason you can) use a goto within a function.

     

    Instead, remove the checks from each case and place it outside of the function call. I added the check after line 26, before the player is given the shop menu selection. You can replace the contents of the check's script with what you had in your noring label.

     

     

    mes "[Training Trader]";mes "Each shop use different training points acquired from your training";next;    // <- Line 26 [Via] .@coin = 26131;    // Coin item ID.@amount = 1;	  // Amount required // Check coinsif (countitem(.@coin) < .@amount) {    mes "[Training Trader]";    mes "You need at least "+ .@amount +" "+ getitemname(.@coin) +" to access these shops. Come back later.";    close;}

  3. it warps players too? how can i make it only monsters?

     

    My mistake; I used OnTouch instead of OnTouchNPC; here's an updated version:

    // Since this script should only be triggered by touch, we can set the Sprite ID to -1 (invisible)// The extra "5,5," signifies a 5-by-5 cell area around the NPC that will trigger the 'OnTouch' labelprontera,151,172,0    script    no_mob_walk    -1,5,5,{        //end;    // Uncomment this line if you use a visible sprite    OnTouchNPC:    // Triggers when the defined area is walked into        unitwarp 0, "this", -1, -1;    // Warps invoking monster to random cell on the same map        end;}

  4. Since im a beginner to this, how can i implement this? for example im using prontera map and the monster is poring. Can you do a sample?

     

    Here's an example:

    // Since this script should only be triggered by touch, we can set the Sprite ID to -1 (invisible)// The extra "5,5," signifies a 5-by-5 cell area around the NPC that will trigger the 'OnTouch' labelprontera,151,172,0    script    no_mob_walk    -1,5,5,{        //end;    // Uncomment this line if you use a visible sprite    OnTouch:    // Triggers when the defined area is walked into        unitwarp 0, "this", -1, -1;    // Warps invoking player/monster to random cell on the same map        end;}

  5. off topic though

     

    arrays are 128, but a small hack is that it can use negative values too :P

    -128 to 128.

     

    but i think there is some secret plans to make the arrays unlimited, shhh, secret

     

    Oh wow. I hadn't quite thought of using negative values. While 256-ish is great, unlimited arrays would be amazing. *__*


  6. The problem right off the bat is how you're writing the expression for your if statement. You can't separate expressions in parentheses and compare them that way; you'd have to have another set of parentheses enclosing the entire expression. The proper way to write your (improper) check would be:

     

    if(.@disguise == 0 || .@disguise < 1001 || .@disguise > 2082 || .@disguise == .@blacklist[0])

     

    Now, this is still wrong because the blacklist isn't being checked the way you want it to. Here, you should use a loop and a variable to keep count of incrementation. By this, I mean changing .blacklist[0] into .blacklist[.@i].

     

    Replace this:

    if( .@disguise == 0 ) || ( .@disguise <= 1001 ) || ( .@disguise >= 2082 ) || ( .@disguise == .@blacklist[0] ){goto choose_one;close;}

     

    With this:

    for(.@i = 0; .@i < getarraysize(.blacklist); .@i++){    if(.@disguise == 0 || .@disguise < 1001 || .@disguise > 2082 || .@disguise == .@blacklist[.@i])    {        mes "[ ^ffa500Master of Disguise^000000 ]";        mes "Sorry, the ID you chose is either unavailable or blacklisted.";        close;    }}

     

    Here, we're enclosing our if statement inside of a for loop. What this for loop does is check each value of your .blacklist array until it has gone through each and every value.

     

    Fill your array with monster IDs, like this:

    .blacklist[0], 1001, 1002, 1003, 1004, 1005;

     

    Keep in mind that you can only store up to 128 values in an array (though if this has changed, someone please correct me).

     

    For more on the if statement, loops, and arrays, please refer to the Wiki; it's quite useful for referencing.

     

    http://herc.ws/wiki/If

    http://herc.ws/wiki/Loops

    http://herc.ws/wiki/Array


  7. You could change 50 to 70 in this line:

     

    setarray .Rebirth[0],99,50;    // Minimum base level, job level to rebirth OR change to third class

     

    The problem with this, however, is that it (more likely than not) will cause the script to require that you Rebirth with 50 Job Levels, where (in common cases), 50 is the maximum Job Level for Second and Advanced classes. You'd probably be better off modifying the script to take a third value from the .Rebirth array and adding a check for that value.

     

    Example modifications:

     

    setarray .Rebirth[0],99,50;    // Minimum base level, job level to rebirth OR change to third class

     

    setarray .Rebirth[0],99,50,70;    // Minimum base level, job level to rebirth OR change to third class

     

     

    if (Class > 21) { Job_Menu(roclass(.@eac|EAJL_THIRD)); close; }

     

    if (Class > 21 && BaseLevel >= Rebirth[0] && JobLevel == .Rebirth[2]) { Job_Menu(roclass(.@eac|EAJL_THIRD)); close; }

     

    Idk, this script is pretty messy to begin with and is kind of hellish to read, but a proper modification can be made if you punch in your check at the right spot. The second part of my example modifications is purely in theory; I have not tested it.


  8. Utility: Hercules Radio
    As per youtube's request: http://herc.ws/board/topic/1676-rhelp/
     
    Description:
    A radio NPC that plays preset selection of client-side songs (these songs are to be placed in the 'BGM' folder).
     
    The command '@radio' was added as a convenience, to allow songs to be played wherever the invoking player may be. Songs are played on the map in which the NPC was invoked, meaning that if a player is in pay_gld and types '@radio', (s)he and everyone on the map will hear the selected song. Each time a song is played, a lock is set for the preset minutes; this lock prevents the NPC from being accessed. A countdown in minutes and seconds is be displayed to reflect the remaining time until the next song can be played.
     
    Download:
    https://github.com/datmumbles/Scripts/raw/master/util/radio.txt


  9. Use message. I'm assuming your script contains a variable in which the target player's name is stored (i.e. .@playerName$), so you can include a message for them after the script has sent a gift - regardless of whether or not they are online (if they're online, they'll receive it).

     

    Example:

    message .@playerName$, "A GM has sent you a gift. Please relog to receive it.";

  10. Napster:

     

    Since the use of Hercules requires MySQL to be installed, we don't update the files in the 3rdparty folder (actually, there were talks of getting rid of that directory, probably back on rAthena). Since when MySQL-server is installed, it includes the mysql.h file in the correct place, the files in the 3rd party folder are not required.

     

    I'll bring this up in a meeting soon and see what the fate of this folder might be. We realize they're out of date but there's been no reason to update them as no one uses them.

     

    If for some reason you don't have mysql-server on the same machine that you plan on running Hercules on, then you can install the libraries seperately, and is actually recommended as they are put in the right place and other scripts/programs can access them. For most Linux distributions this is package libmysqlclient-dev.

     

    Just to clarify, does the obsolescence of the 3rdparty folder mean that tables are created automatically (so long as MySQL is installed)?


  11.  

    Utility: Automatic Third-Class Jobs

    As per spectator's request: http://herc.ws/board/topic/882-rinstant-job-changer/

     

    Description:

    Allows player to choose a third-class job upon initial login; if the player fails to choose a class for any reason, (s)he will be prompted again upon next login.

     

    Video and download:

    http://dev.are-o.net/dl/scripts/thirds/

     

    switch(select("Rune Knight:High Wizard:Arch Bishop:Ranger:Mechanic:Guillotine Cross:Royal Guard:Sorcerer:Sura:Minstrel/Wanderer:Genetic:Shadow Chaser"))

    High wizard? :blink:

     

    Whoa, thanks for pointing that out. Forgot to swap that name out in that menu. Updated and fixed; thanks!


  12.  

    bonus2 bMagicAddRace,n,x;		+x% magical damage against race n 

     

    I think you misunderstood. The suggestion was to add an option to increase the damage of a specific skill based on race. For example, should this be implemented:

     

    bonus3 bSkillAtk,"MO_EXTREMITYFIST",-80,RC_Boss;

     

     

    This item script, in theory, would reduce the amount of damage that Asura Strike does on Boss monsters.


  13. Right now, the skill bonus command bSkillAtk is only generically applicable. It'd be pretty awesome to be able define a monster's race as a value to determine the bonus of a skill.

     

    i.e. bonus3 bSkillAtk,n,x,y;      Increase damage of skill n by x% against y race mobs (supports skill names)


  14. Wouldn't enablenpc serve the same purpose? I mean, it literally triggers an existing NPC. You could disable the NPC by default by using disablenpc under an OnInit label and re-enable it once a certain condition has been met. I'd recommend adding an extra check for the quest's variable(s) so as to avoid exploitation, but enablenpc will do just what you need.

×
×
  • Create New...

Important Information

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