Jump to content

Add 10% experience to kills


hdhd

Recommended Posts

I'm trying to make a script so that I get with every kill/quest 10% more experience. It would be simple if I would just change in the sys_rewards_h.nss nXP += FloatToInt(nXP * 0.01); to nXP += FloatToInt(nXP * 0.10); but then I would have to export the whole file even though I just want to change one value.

#include "sys_rewards_h"

void main()
{
   UT_AddItemToInventory(R"gen_im_acc_rng_exp.uti", 1); //Memory Band DLC
   //first problem the script checks the hero but not the other party members
   object Hero = GetHero();
   object oPartyMember = GetParty(Hero);
   if (GetTag(GetItemInEquipSlot(INVENTORY_SLOT_RING1, oPartyMember)) == "gen_im_acc_rng_exp" || GetTag(GetItemInEquipSlot(INVENTORY_SLOT_RING2, oPartyMember)) == "gen_im_acc_rng_exp")
   {
    //second problem how can I reward with every kill XP
    RewardXP(oPartyMember,FloatToInt(GetCreatureProperty(oPartyMember,PROPERTY_SIMPL
E_EXPERIENCE)/100));
   }
}

I really have no idea how I can script this, maybe with EVENT_DEATH. But somehow nothing works. I tried the last few days rather unsuccessfully creating this script but it simply won't work. :wallbash:

 

Any ideas?

 

Edit:

I've tried something new but it's still not working.

#include "wrappers_h"
#include "sys_rewards_h"
#include "creature_core"  
#include "events_h"

void my_addon()
{
 event ev = GetCurrentEvent();
 int nEventType = GetEventType(ev);
 HandleEvent(ev);

 switch (nEventType)
 {     
   case EVENT_TYPE_DYING:
   {
       object oKiller = GetEventObject(ev, 0);
       if (IsObjectValid(oKiller) && IsPartyMember(oKiller))
       {
           RewardXPParty(0 * 5,XP_TYPE_COMBAT, OBJECT_SELF, oKiller); //this is the only line I changed the rest is from create_core.nss.
           if (GetCombatantType(OBJECT_SELF) != CREATURE_TYPE_NON_COMBATANT)
           {
               HandleEvent(ev, R"sys_treasure.ncs");
           }
       }     
       break;
   }         
 }
} 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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