Jump to content
  • 0

Check Monster Level on OnNPCKillEvent:


mawjustin

Question


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  121
  • Reputation:   6
  • Joined:  09/26/14
  • Last Seen:  

Hi Team,

 

Is there a way to check for monster level for every monster kill?

I would like to give a reward to player based on monster level.

ie. If player kills a Kobold (Level 31), they will have a chance to get a reward for level 30-40 monsters.

image.png.3a5558be50a8cbffe7dccca9542e8dc5.png

Thank you.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  431
  • Reputation:   164
  • Joined:  12/12/17
  • Last Seen:  

Never tried this but I think this should work.

*strmobinfo(<type>,<monster id>);

This function will return information about a monster record in the database, as
per 'db/(pre-)re/mob_db.yml'. Type is the kind of information returned. Valid types are:
It will return 0 if there is no such monster (or the type value is invalid),
or an empty string if you requested the monster's name.

 1 - 'english name' field in the database, a string.
 2 - 'japanese name' field in the database, a string.
     All other returned values are numbers:
 3 - Level.
 4 - Maximum HP.
 5 - Maximum SP.
 6 - Experience reward.
 7 - Job experience reward.
-	script	test	-1,
OnNPCKillEvent:
	if ( killedrid == 1134 && strmobinfo(3,killedrid) == 31 ) { // Check if kobold lv 31
		if (rand(100) > 50) getitem 501, 1; // get a 50% chance to have reward
	}
	end;
}

you can expand this by adding variables and loops..

Link to comment
Share on other sites

  • 1

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

Quote
OnNPCKillEvent:
	set .@monsterlv,getmonsterinfo(killedrid,MOB_LV);
	if ( .@monsterlv >= 41)
    {
      dispbottom "You just kill monster above lv 41";
    }
	else
    {
      dispbottom "You just kill monster below lv 41";
    }
end;

 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  121
  • Reputation:   6
  • Joined:  09/26/14
  • Last Seen:  

Thanks, both worked!

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
Answer this question...

×   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...