Can't figure to make a Monster give an item called "ExpPoints" to the player every time a monster is killed.
And I tried to take from a Youtube tutorial, the idea of giving more points to the player, for every 20HP a monster has.
This is probably been answered multiple times but I have searched the forums for more than 2 hours and can't find an answer (maybe is because is too basic)
Thank you beforehand

Code: Select all
class RewardStuff : EventHandler
{
override void WorldThingDied (worldevent e)
{
int maxHealth = e.Thing.GetMaxHealth();
if (!e.thing || !e.thing.bISMONSTER || !e.thing.target || !e.thing.target.player)
return;
for (int i = 0; i < maxHealth; i += 20)
{
if (e.thing.player && !e.thing.bISMONSTER) //check the killed actor exists and is a monster
e.thing.GiveInventory("ExpPoint",1);
}
}