Author Topic: How to make a Party XP reward local?  (Read 355 times)

Legacy_Lazarus Magni

  • Hero Member
  • *****
  • Posts: 1837
  • Karma: +0/-0
How to make a Party XP reward local?
« on: August 07, 2014, 03:20:07 am »


               

I am curious how we could make a party XP reward local? By that I mean localized to party members on a specific map, rather than being applied regardless of their location?


 


This is the script we currently use for one of these rewards. Any help would be appreciated.


 


#include "x0_i0_partywide"


void main()

{

    object oPC = GetLastOpenedBy();

    effect eEffect = EffectVisualEffect(VFX_FNF_IMPLOSION, FALSE);

    location lLoc = GetLocation(OBJECT_SELF);

    GiveXPToAll(oPC, 50000);

    ApplyEffectAtLocation(DURATION_TYPE_PERMANENT, eEffect, lLoc, 0.0f);

    DestroyObject(OBJECT_SELF, 0.0f);

}



               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
How to make a Party XP reward local?
« Reply #1 on: August 07, 2014, 03:41:54 am »


               

Untested, but should work


void RewardPartyXP(int XP, object oTarget,int bAllParty=TRUE)
{
    if (bAllParty == TRUE)
    {
        object oPartyMember = GetFirstFactionMember(oTarget, TRUE);
        while (GetIsObjectValid(oPartyMember) == TRUE)
        {
            //Only give XP to party members in the same area
            if( GetArea( oPartyMember) == GetArea( oTarget)) GiveXPToCreature( oPartyMember, XP);
            oPartyMember = GetNextFactionMember(oTarget, TRUE);
        }
    }
    else
    {
     GiveXPToCreature(oTarget, XP);
    }
}
void main()
{
    object oPC = GetLastOpenedBy();
    effect eEffect = EffectVisualEffect(VFX_FNF_IMPLOSION, FALSE);
    location lLoc = GetLocation(OBJECT_SELF);
    RewardPartyXP(50000, oPC, TRUE);
    ApplyEffectAtLocation(DURATION_TYPE_PERMANENT, eEffect, lLoc, 0.0f);
    DestroyObject(OBJECT_SELF, 0.0f)
}


               
               

               
            

Legacy_Lazarus Magni

  • Hero Member
  • *****
  • Posts: 1837
  • Karma: +0/-0
How to make a Party XP reward local?
« Reply #2 on: August 09, 2014, 01:15:13 am »


               

Thank you very much Kalbaern. I will give this a try next chance I get.



               
               

               
            

Legacy_Lazarus Magni

  • Hero Member
  • *****
  • Posts: 1837
  • Karma: +0/-0
How to make a Party XP reward local?
« Reply #3 on: August 12, 2014, 03:09:43 am »


               

This works great except for missing a semi-colon on the last line. Thanks very much Kalbaern.