Jump to content

Script Command: getrandmob()


Akinari

Recommended Posts


  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.01
  • Content Count:  247
  • Reputation:   207
  • Joined:  10/23/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  567
  • Reputation:   18
  • Joined:  04/15/13
  • Last Seen:  

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
Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

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)?
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.01
  • Content Count:  247
  • Reputation:   207
  • Joined:  10/23/12
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Okay, that helps. Needed that info before I started on a script lol.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.01
  • Content Count:  247
  • Reputation:   207
  • Joined:  10/23/12
  • Last Seen:  

I updated the file.   If you put in '0', it will give you all levels.  It's untested, but should work.  Let me know.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

Well... I haven't know the purpose of the custom folder, is there a tutorial or post about it?

I might have missed that one  /hum

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   2
  • Joined:  11/06/13
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

Thanks for the explanation Talis :)

Link to comment
Share on other sites

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.

×
×
  • Create New...