Jump to content
  • 0

Check Monster Level on OnNPCKillEvent:


Question

Posted

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.

3 answers to this question

Recommended Posts

  • 1
Posted

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

  • 1
Posted
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;

 

 

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.

  • Recently Browsing   0 members

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