Author Topic: XP OnDeath Only awarded for Participants in Combat  (Read 1095 times)

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
XP OnDeath Only awarded for Participants in Combat
« on: April 24, 2014, 07:20:08 am »


               

I have long wanted only to reward XP to actual participants of a combat. Typically rewards are handed out only to the killer of a creature, or alternatively only to party members, or possibly nearby enemy PCs. I think all of these are kludgey, and would like a better solution.


 


Are there any solutions to this posted anywhere?


 


Whats a good way to go about it?


 


I've decided to try to tackle this in the following way:


  • Whenever a harmful spell is cast at an NPC, time stamp the NPC with the ID of the spell caster.

  • Whenever an NPC is damaged, time stamp the NPC with the ID of the damager.

  • When an NPC dies, loop though all PCs in the module, and check for time stamps for the IDs of each PC on the NPC. If any timestamps are recent enough for a given PC, reward them.


               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
XP OnDeath Only awarded for Participants in Combat
« Reply #1 on: April 24, 2014, 08:12:17 am »


               

What about simply setting setting each PC that damages/casts a spell/attacks (otherwise a wizard could shoot a crossbow and keep missing and thus never get XP) as a local object on the NPC with a local int to track how many PCs have been assigned so far?  So after 3 PCs you'd have...


 


sPC1 = Bob


sPC2 = Jill


sPC3 = Mark


nPCs = 3


 


Then loop through that psuedo-array of objects OnDeath for the XP.  Can also clear the array if the NPC exits combat for 2+ rounds or something.



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
XP OnDeath Only awarded for Participants in Combat
« Reply #2 on: April 24, 2014, 02:24:02 pm »


               

The problem with the pseudo-array is the lack of a timestamp. I can look into your suggestion about measuring time out of combat as an alternative to a timestamp. Perhaps that would be best.


 


I considered using the attack event as well, but don't see how a character can be considered to have meaningfully contributed if they attack but never damage the NPC. More important would be to include PCs who have been attacked.



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
XP OnDeath Only awarded for Participants in Combat
« Reply #3 on: April 24, 2014, 06:32:42 pm »


               

Okay, a few things to think about:


 


1) I am a high AC build.  I go into improved expertise mode and begin fighting a creature.  I score no hits on it, and it does not hit me, but others are able to take down the creature from a distance with ranged weapons.  Do they get all the XP?


 


2) I am a cleric. I buff my friends and heal them during combat.  Because I have the healing domain, I have a large assortment of spells able to aid others.  Do I get any XP in these fights?


 


3) I am a summoner.  Due to the way my PW is scripted, I can summon many creatures and buff them.  My creatures fight for me.  Do I get XP from their kills or should I just cast a single AoE spell to secure that I am properly registered as a killing factor for many enemies?


 


4) I am a bored player that loves to leave lingering AoEs across the server to make things look pretty.  Here a darkness there a vine mine; but I am really not about fighting anything.  If a battle should occur in one of the AoEs that I left a while ago, well I guess I get XP rewards for the kills. Right?



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
XP OnDeath Only awarded for Participants in Combat
« Reply #4 on: April 24, 2014, 06:46:51 pm »


               

Thanks Whizard. I have considered those.


 


As for #1, I mentioned to MM that recording when a creature attacks a PC is important. I'm just not sure where the best place to capture this is. I wish PCs had the same events that creatures do. Thoughts on how to achieve this?


 


#2: yes I need to figure out how best to use spell hooking when a caster buffs a PC in combat, and connect them with the creature(s) that are engaged with that PC. Not easy to do. I'm thinking that I would time stamp one PC as 


 


#3: already handled with what I outlined above.


 


#4: The character gets no XP for kills in this fashion. But this raises a problem I have not considered AOEs. They do not trigger the spell cast at event. This means that I need to capture AOE effects on NPCs in combat and timestamp those NPC with the ID of the caster of the AOE.



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
XP OnDeath Only awarded for Participants in Combat
« Reply #5 on: April 24, 2014, 06:53:48 pm »


               


#4: The character gets no XP for kills in this fashion. But this raises a problem I have not considered AOEs. They do not trigger the spell cast at event. This means that I need to capture AOE effects on NPCs in combat and timestamp those NPC with the ID of the caster of the AOE.



 


 


Odd, darkness does a signal event in its on enter event, and vine mine does this on enter and on heartbeats.


 


EDIT: Pretty much all AoEs do signal the OnSpellCastAt event.  Some (like darkness, Evard's) will have the AoE object as the signaler while others (like vine mine) will have the AoE creator as the signaler.  If you are storing objects in the OnSpellCastAt event you should check the object type there (before the AoE expires) and if it is an AoE calling the event, find the creator and store that object.  Same procedure as with NPC summons, basically.  If a summon deals damage you should record the PC summoner before the summon dies.  If a summon casts a lingering AoE and dies before the AoE expires, and a creature enters the AoE....  checked looks like the AoE no longer runs its scripts is able to apply effects after the summon's death.


 


EDIT2: Edited the previous edit as I was able to capture Evard's scripts still running (I inserted a feedback string) but doing nothing as far as applying effects.



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
XP OnDeath Only awarded for Participants in Combat
« Reply #6 on: April 24, 2014, 08:22:39 pm »


               


The problem with the pseudo-array is the lack of a timestamp. I can look into your suggestion about measuring time out of combat as an alternative to a timestamp. Perhaps that would be best.




So you're concerned about someone damaging a mob, running away, the mob not getting despawned, and then someone else killing the mob but the original player gets XP too?  I'd just do a semi-recursive script on the EndCombat event -- delay 6 seconds and see if we're in combat.  If so, return.  Otherwise, delay another 6 seconds and if we're still not in combat then clear the pseudo-array.  Could adjust the time as needed, ideally could just clear the array as soon as combat drops for the NPC but if that happens accidentally while the PCs are still fighting it somehow then a failsafe would be nice.




I considered using the attack event as well, but don't see how a character can be considered to have meaningfully contributed if they attack but never damage the NPC. More important would be to include PCs who have been attacked.




Whizard gave some examples there -- and if you're a low level wizard attacking with a crossbow you very well might not ever hit the NPC OR get attacked by the NPC (since it's attacking the fighter).




As for #1, I mentioned to MM that recording when a creature attacks a PC is important. I'm just not sure where the best place to capture this is. I wish PCs had the same events that creatures do. Thoughts on how to achieve this?




The way you're trying to do this now causes a whole host of problems.


 


1. A fighter and wizard are killing a group of six mobs.  The fighter rounds them up and the wizard nukes them down -- but the fighter only has the chance to attack one out of the six so he only gets credit for one out of the six.


 


But let's say you fix that given your quote.


 


2. A fighter, rogue, and wizard are killing a group of six mobs.  The fighter rounds them up, the wizard starts AoEing, and the rogue picks them off one by one.  But the rogue only has the chance to attack three of the six mobs (and never gets attacked by any) and only gets credit for half of them as a result.


 


So here's an idea.  When the NPCs gets attacked/damaged/spellcastat/etc, see if a local object exists for an enemy PC.  If not, set it to the enemy PC.  If there is, the mob is "tagged" and we ignore another PC attacking it in terms of XP.  Then when it dies check the PCs for all PCs in the same faction of the local object who are within 40 yards and give them the XP.  We clear the local object when combat ends (or after a 6/12/whatever second delay to prevent oddities) to allow re-tagging.


 



This means all members of a party within 40 yards of an NPC will receive XP if a member of their party was the first to attack/damage/spellcastat/etc a given mob -- can't swoop in and steal XP on kills.



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
XP OnDeath Only awarded for Participants in Combat
« Reply #7 on: April 24, 2014, 08:41:01 pm »


               

Whizard, thanks for the investigation. So while the casting of AOE spells does not trigger a spell cast event, the enter/exit events of the AOE typically (almost always) call it. I'll take a look. Thanks.


 


MM, a lot to respond to there, thanks, but I unfortunately can't right now. Instead I'll need to digest it later as I am working toward this goal. But I do want to speak to your suggestion that I capture all party members to hand out XP for kills.


 


I am revising a module that has handled things that way for many years, and I'd prefer not to. One reason is that I don't want to require players to party up, and another is that I prefer not to reward PCs merely for tagging along. I do see your points that some instances of contribution will slip through the cracks, but I would rather shore up the leaks as best I can rather than just do things the way we have been.



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
XP OnDeath Only awarded for Participants in Combat
« Reply #8 on: April 24, 2014, 08:50:06 pm »


               

I am revising a module that has handled things that way for many years, and I'd prefer not to. One reason is that I don't want to require players to party up, and another is that I prefer not to reward PCs merely for tagging along. I do see your points that some instances of contribution will slip through the cracks, but I would rather shore up the leaks as best I can rather than just do things the way we have been.



 


If you don't want to require people to party up then how do you plan to not reward PCs for merely tagging along?


 


I mean, right now you could have Bob, Bill, and Bethany working as a team to kill tough mobs and Mark tags along at a distance shooting mobs with a bow a single time when they're at 10% HP in order to get the kill experience.  Leeching the XP while not contributing.


 


And if you base the XP gained based on a percentage of damage done to the mob or something then that screws over tanks and healers (and single target classes in AoE situations).


 


What are you actually trying to accompish in this situation?  What do you want to AVOID?



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
XP OnDeath Only awarded for Participants in Combat
« Reply #9 on: April 24, 2014, 08:59:29 pm »


               

You misunderstood me.


 


By tagging along I mean a PC who joins a party to gain XP from combat without engaging those monsters or doing much of anything other than site seeing.



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
XP OnDeath Only awarded for Participants in Combat
« Reply #10 on: April 24, 2014, 09:11:41 pm »


               

But your proposed system lets a PC get the XP for not doing anything other than sight seeing (1 attack or spell is all that's required), no?  And they can do it without even joining the party.



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
XP OnDeath Only awarded for Participants in Combat
« Reply #11 on: April 24, 2014, 09:30:03 pm »


               

Yes, you are bringing up an edge case that is possible, but still involves participation - targeting the enemy with a hostile spell, damaging the enemy, or being attacked by the enemy (something which I am working on getting incorporated). And in any case even the rare instance that you bring up passes the criteria that I am setting so I don't have a problem with it.


 


Anyway, I am not interested in explaining my motives. I am interested in solving the technical problems.



               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
XP OnDeath Only awarded for Participants in Combat
« Reply #12 on: April 24, 2014, 09:41:37 pm »


               

This is something I've wrangled with quite a lot. At present, I'm still working on how best to do a 'GetIsBot' function, to detect active combat participants. I could post our current ondeath checks, but I'd prefer to see what this thread produces first, since while that script does some of what you describe, and covers some of the cases that you outline later (#1-#4), but it doesn't go nearly far enough in my book.


 


Funky



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
XP OnDeath Only awarded for Participants in Combat
« Reply #13 on: April 24, 2014, 09:42:48 pm »


               


Anyway, I am not interested in explaining my motives. I am interested in solving the technical problems.




 


And those technical problems are entirely dependent on your motives so it is necessary to explain what your motives are (which is different from explaining why they are that way).  So far we have...

 


1. No party requirement


2. Attacking the mob, damaging the mob, casting a spell at the mob, or healing a person fighting the mob makes you eligible for experience


 


So what about my example above with the group of three?  Let's make it even simpler: Bob the fighter and Chris the rogue are fighting 3 mobs.  Bob kills one and Chris kills two.  Bob gets credit for his one and Chris gets credit for his two since they attacked those mobs.


 



Should Bob get credit for the two Chris killed?  Presumably yes since those two mobs were attacking him, though we'd need to figure out how to flag it.


 



Should Chris get credit for the one Bob killed?  Presumably yes -- but he never attacked that mob and he never got attacked by that mob.  Which means we need to either use party or we need to have something like a mob that takes damage also flags all other mobs within 20 yards as being "attacked" by the PC so he gets XP on death even if he never attacks or gets attacked the other mobs.


 


But I don't KNOW your answers for those two cases, and those are two simple cases off the top of my head.  Maybe you DON'T Chris to get credit for the mob he never interacted with -- so your motives are entirely relevant.



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
XP OnDeath Only awarded for Participants in Combat
« Reply #14 on: April 24, 2014, 09:58:49 pm »


               

MM, I merely want to capture those that actively participated in an encounter. And while I may not be able to catch everything. I'm simply shooting for doing this the best I can. If there are other means to track participation then bring those up. Thats what I asked for at the top - or at least thats what I was trying to ask for in my usual not so clear way. '<img'>


 


So in response to you last comment:


In addition to the criteria you mention above I also plan on tracking the event when a PC (or minion of PC) is targeted by an NPC. That counts as participation as far as I am concerned. We called this being attacked earlier, but I don't know how to track that. I think I can however track the targeting of a PC.


 


So in the example of the rogue and fighter above credit for each kill depends on the amount of interaction that each PC has with each NPC. So if say the rogue was spotted by the creatures while scouting and targeted, then the rogue would be flagged as a participant in combat with each of those creatures that targeted them. Then when the PCs attack they'll get credit for each one they damage, or target with a hostile spell.