Skip to content

Bonus Party XP script??

jpsweeney94jpsweeney94 Member Posts: 98
edited March 2019 in Builders - Scripting
I was curious if someone could help with the module i host with a script that is beyond me... Right now, playing with 2 players in a party in the same area, the XP is fine. But as soon as 3+ players are in a party in the same area, the XP takes a serious dip!! Anyone have any advice on a script that will increase XP/give some bonus XP when in a party of 3+ in the same area??

Thanks!!!

Comments

  • FreshLemonBunFreshLemonBun Member Posts: 909
    The monsters fire a death event with a death script. For example a quick and very simple way to give cr based bonus experience to all party members in the area could be like so, within that death script.
    object oCreature = OBJECT_SELF;
    object oKiller = GetLastKiller();
    int nCR = FloatToInt(GetChallengeRating(oCreature));
    object oMember = GetFirstFactionMember(oKiller);
    while (GetIsObjectValid(oMember))
    {
    	if (GetArea(oMember) == GetArea(oKiller))
    	{
    		GiveXPToCreature(oMember, nCR * 100);
    	}
    	oMember = GetNextFactionMember(oKiller);
    }
    

    I haven't checked it, but you should get the idea.
  • jpsweeney94jpsweeney94 Member Posts: 98
    edited April 2019
    The monsters fire a death event with a death script. For example a quick and very simple way to give cr based bonus experience to all party members in the area could be like so, within that death script.
    object oCreature = OBJECT_SELF;
    object oKiller = GetLastKiller();
    int nCR = FloatToInt(GetChallengeRating(oCreature));
    object oMember = GetFirstFactionMember(oKiller);
    while (GetIsObjectValid(oMember))
    {
    	if (GetArea(oMember) == GetArea(oKiller))
    	{
    		GiveXPToCreature(oMember, nCR * 100);
    	}
    	oMember = GetNextFactionMember(oKiller);
    }
    

    I haven't checked it, but you should get the idea.

    thanks for the reply! will try soon.

    Are you saying this script will need to be added to the onDeath script for all NPCs in the custom palette? There are hundreds in there and many have different scripts in their "onDeath" script drop down in their creature properties scripts tab... Is their some other way to apply this to all NPCs/monsters on death without editing every creature with a unique death script?

    thanks
  • TerrorbleTerrorble Member Posts: 191
    Usually all creatures will run the same OnDeath script. I think the default one is called ..._default7.
  • FreshLemonBunFreshLemonBun Member Posts: 909
    Like Terrorble said, but it depends on the specifics, of course. If a module has a different one for everything then it would be trickier.

    Alternatively if you just want everyone to have the same experience points you could add a module heartbeat script that loops through the party for max experience points. Then adjusts party members lower than max. It would work for a module with friends, but not for persistent world. It would only really work for a co-op module between friends, for a persistent world you really want to hook into the death event script I think.

  • TragicSeriouslyTragicSeriously Member Posts: 6
    You could simply modify the existing OnDeath int BONUSXP. int BONUSXP = GetChallangeRating(OBJECT_SELF) * 100; Nice and simple. (I'm only 7 years late to the table, but better late than never, right?) ;-)
  • MelkiorMelkior Member Posts: 264
    One server I played had a totally custom XP system with the default module XP set to zero. All of the default on-death scripts would instead call the custom XP scripting. It looped through all associates of the killer who were in range and gave the same XP to all.
    The rule it followed was that you had to be in the same party as the killer, within a certain level range with the killer and be in visual contact with the killer. I could probably dig it out of the module if anyone is interested.
    (Yeah, this is a bit of a necro-post, but it's an interesting subject)
  • ForSeriousForSerious Member Posts: 537
    I'm interested, even though I've already made my own version of that same XP system.
  • MelkiorMelkior Member Posts: 264
    Here's what I dug out of an old module:
    void rewardhostile(object oTarget)
    {
      int iKillerLevel;
      if (GetXP(oTarget)<1000)                           //1
       iKillerLevel = 1;
      if (GetXP(oTarget)>999&&GetXP(oTarget)<3000)       //2
       iKillerLevel = 2;
      if (GetXP(oTarget)>2999&&GetXP(oTarget)<6000)      //3
       iKillerLevel = 3;
      if (GetXP(oTarget)>5999&&GetXP(oTarget)<10000)     //4
       iKillerLevel = 4;
      if (GetXP(oTarget)>9999&&GetXP(oTarget)<15000)     //5
       iKillerLevel = 5;
      if (GetXP(oTarget)>14999&&GetXP(oTarget)<21000)    //6
       iKillerLevel = 6;
      if (GetXP(oTarget)>20999&&GetXP(oTarget)<28000)    //7
       iKillerLevel = 7;
      if (GetXP(oTarget)>27999&&GetXP(oTarget)<36000)    //8
       iKillerLevel = 8;
      if (GetXP(oTarget)>35999&&GetXP(oTarget)<45000)    //9
       iKillerLevel = 9;
      if (GetXP(oTarget)>44999&&GetXP(oTarget)<55000)    //10
       iKillerLevel = 10;
      if (GetXP(oTarget)>54999&&GetXP(oTarget)<66000)    //11
       iKillerLevel = 12;
      if (GetXP(oTarget)>65999&&GetXP(oTarget)<78000)    //12
       iKillerLevel = 14;
      if (GetXP(oTarget)>77999&&GetXP(oTarget)<91000)    //13
       iKillerLevel = 16;
      if (GetXP(oTarget)>90999&&GetXP(oTarget)<105000)   //14
       iKillerLevel = 18;
      if (GetXP(oTarget)>104999&&GetXP(oTarget)<120000)  //15
       iKillerLevel = 20;
      if (GetXP(oTarget)>119999&&GetXP(oTarget)<136000)  //16
       iKillerLevel = 22;
      if (GetXP(oTarget)>135999&&GetXP(oTarget)<153000)  //17
       iKillerLevel = 24;
      if (GetXP(oTarget)>152999&&GetXP(oTarget)<171000)  //18
       iKillerLevel = 26;
      if (GetXP(oTarget)>170999&&GetXP(oTarget)<190000)  //19
       iKillerLevel = 28;
      if (GetXP(oTarget)>189999&&GetXP(oTarget)<210000)  //20
       iKillerLevel = 30;
      if (GetXP(oTarget)>209999&&GetXP(oTarget)<231000)  //21
       iKillerLevel = 33;
      if (GetXP(oTarget)>230999&&GetXP(oTarget)<253000)  //22
       iKillerLevel = 36;
      if (GetXP(oTarget)>252999&&GetXP(oTarget)<276000)  //23
       iKillerLevel = 39;
      if (GetXP(oTarget)>275999&&GetXP(oTarget)<300000)  //24
       iKillerLevel = 42;
      if (GetXP(oTarget)>299999&&GetXP(oTarget)<325000)  //25
       iKillerLevel = 45;
      if (GetXP(oTarget)>324999&&GetXP(oTarget)<351000)  //26
       iKillerLevel = 48;
      if (GetXP(oTarget)>350999&&GetXP(oTarget)<378000)  //27
       iKillerLevel = 51;
      if (GetXP(oTarget)>377999&&GetXP(oTarget)<406000)  //28
       iKillerLevel = 54;
      if (GetXP(oTarget)>405999&&GetXP(oTarget)<435000)  //29
       iKillerLevel = 57;
      if (GetXP(oTarget)>434999&&GetXP(oTarget)<465000)  //30
       iKillerLevel = 60;
      if (GetXP(oTarget)>464999&&GetXP(oTarget)<496000)  //31
       iKillerLevel = 65;
      if (GetXP(oTarget)>495999&&GetXP(oTarget)<528000)  //32
       iKillerLevel = 70;
      if (GetXP(oTarget)>527999&&GetXP(oTarget)<561000)  //33
       iKillerLevel = 75;
      if (GetXP(oTarget)>560999&&GetXP(oTarget)<595000)  //34
       iKillerLevel = 80;
      if (GetXP(oTarget)>594999&&GetXP(oTarget)<630000)  //35
       iKillerLevel = 85;
      if (GetXP(oTarget)>629999&&GetXP(oTarget)<666000)  //36
       iKillerLevel = 90;
      if (GetXP(oTarget)>665999&&GetXP(oTarget)<703000)  //37
       iKillerLevel = 95;
      if (GetXP(oTarget)>702999&&GetXP(oTarget)<741000)  //38
       iKillerLevel = 97;
      if (GetXP(oTarget)>740999)  //39
       iKillerLevel = 100;
      float fKillerLevel = IntToFloat(iKillerLevel);
      float fDeadLevel = GetChallengeRating(OBJECT_SELF);
      float fXP = ((fDeadLevel/fKillerLevel)*100);
      if (fXP<5.0) return;
      object oPartyMember = GetFirstFactionMember(oTarget, TRUE);
      RewardXP(oTarget);
      while (GetIsObjectValid(oPartyMember) == TRUE)
      {
        if (GetIsPC(oPartyMember)==TRUE
          &&GetObjectSeen(oTarget,oPartyMember)==TRUE
          &&(oPartyMember!=oTarget)==TRUE)
        {
          if((GetHitDice(oPartyMember)-GetHitDice(oTarget)<9)
            &&(GetHitDice(oTarget)-GetHitDice(oPartyMember)<9)
            ||(GetHitDice(oPartyMember)-GetHitDice(oTarget)>-9)
            &&(GetHitDice(oTarget)-GetHitDice(oPartyMember)>-9))
          {
            RewardXP(oPartyMember);
          }
        }
      oPartyMember = GetNextFactionMember(oTarget, TRUE);
      }
    }
    
    You call this routine from the on-death of a creature and pass in whoever scored the kill as the object.
    It doesn't reward any XP if the amount is less than 5 points.
    It rewards only PCs in the same party as the PC who got the kill.
    It rewards only PCs who are in sight of whoever got the kill.
    It rewards only PCs who are within 8 levels of whoever got the kill.
    It also works if it was a PC "pet" who got the kill, although this part could stand some improvement.

    Not my work, but I'm sure the author would be happy to know his work was useful to someone.
  • ForSeriousForSerious Member Posts: 537
    I guess there's not getting around large blocks of 'if statements'. In mine I have a bunch of them defining the challenge ratings of monsters when the killer is less than level 6.
Sign In or Register to comment.