Jump to content

Recommended Posts

Posted

File Name: Script Command: getrandmob()

File Submitter: Akinari

File Submitted: 23 Oct 2013

File Category: Source Modifications

Content Author: Akinari

Another quick package up of a small command I've had lying around for a long time. Grabs a random monster from one of the branch databases. Useful for hunter quests, disguise events, and anything else you can think of. Uses database stored in memory, so it's faster and more efficient than running SQL queries and doesn't require you to use SQL dbs for items and mobs.

/*==========================================

* Fetches a random mob_id

* getrandmob(num,type);

*

* type: Where to fetch from:

* 0: dead branch list

* 1: poring list

* 2: bloody branch list

* num: Mob level to check against (0 = all)

*------------------------------------------*/

To add, simply place the files into the src/custom folder. If you already use those files, add the new code into your existing populated files and do a clean make.

Click here to download this file

Posted (edited)

I see, so this is what it means :) i was checking lately on my src files and i notice this custom folder, by the way thanks ! great job  :meow:  more power rAthena ! and to all who built it  !

Edited by Yoona
  • 2 weeks later...
Posted

Question in regards, to the parameters, how would I enable the command to check ALL monsters in a specific list regardless of level. Would I just simply put 0?

getrandmob(0,0)?
OR //Is does it check against the level and choose all monsters lower or higher?
getrandmob(10,0)?
getrandmob(100,0)?
Posted

Question in regards, to the parameters, how would I enable the command to check ALL monsters in a specific list regardless of level. Would I just simply put 0?



getrandmob(0,0)?
OR //Is does it check against the level and choose all monsters lower or higher?
getrandmob(10,0)?
getrandmob(100,0)?

 

Higher, up to MAX_LEVEL.  If you want all mobs, just give it the max level of the server.

Posted

The only announcement / mention on the boards is here:

http://rathena.org/board/topic/87083-julyaugust-digest/?hl=a4fdc72#

 

This might not be 100% accurate since I'm new here and havn't worked with the system, but the gist is:

 

Putting source mods directly into the .c files, such as script.c and atcommands.c is messy, because it can make revision updates troublesome - often leading to manually having to merge together your custom file and the new server revision file.

 

The custom folder contains script.inc, script_def.inc, atcommand.inc and atcommand_def.inc.

 

The main part of a script ( BUILDIN_FUNC(command) ) goes into custom/script.inc

The definition of a script ( BUILDIN_DEF(command, parameters) ) goes into custom/script_def.inc

 

The main part of a atcommand ( ACMD_FUNC(command) ) goes into custom/atcommand.inc

The definition of a atcommand ( { "command",        gmlevel,gmlevel,     atcommand_command } ) goes into custom/atcommand_def.inc

 

This keeps things organized, and your main eAthena source code clean, allowing for painless revision updates.

 

Does that clear it up?

  • Upvote 1

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...