Author Topic: Encounter Accessor OnExhausted question  (Read 320 times)

Legacy_Tiggers.no.tail

  • Jr. Member
  • **
  • Posts: 82
  • Karma: +0/-0
Encounter Accessor OnExhausted question
« on: July 11, 2011, 11:26:48 pm »


                I'm writing a script that rewards the player for killing all the monsters in an encounter. It is called from the OnExhausted() script inside the encounter properties. I'm just wondering what is the proper accessor to get the player who finished the encounter. I *could* use GetFirstPC() since it's single player, but it seems like there should be some other way. Any help would be greatly appreciated. thanks.
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Encounter Accessor OnExhausted question
« Reply #1 on: July 12, 2011, 01:35:50 pm »


               Isn't there a GetLastAttacker() or GetLastHostileSomethingOrOther ?
               
               

               
            

Legacy_Axe_Murderer

  • Full Member
  • ***
  • Posts: 199
  • Karma: +0/-0
Encounter Accessor OnExhausted question
« Reply #2 on: July 12, 2011, 06:41:48 pm »


               There isn't one. You have to do it thru the OnDeath event of the creatures. When they die, set an object type variable on the encounter to keep track of the last player to kill one of the encounter spawns. If a pet makes the kill you should determine who his master is first and use that. When OnExhausted fires, the variable will be pointing to the PC (or master if it was a pet) who killed the last one. So simply read the PC from the variable, give him his XP, then destroy the variable for the next time the encounter spawns (assuming it repeats).

Of course in MP, if there are 2 PCs and one of them kills 6 of the 7 creatures spawned and then the other PC kills the last one, the second PC will get credit for the whole encounter even though he did hardly anything compared with the first guy...so IMHO that isn't a particularly fair thing to do, and it would encourage players to put little effort into the battle until only one is left because that's where all the XP is. More PCs = more complex to determine who did the most work. Also, unless all the monsters are identical, the last one killed may or may not have been the toughest one, so that adds another level of complexity to it. Because of this, in MP I would advise against trying to figure out who should get credit for the whole encounter. Just award everyone in the area the same amount if you must award XP for killing them all.

Since you're doing SP the simplest way to handle it is GetFirstPC and there is no good reason not to do that in SP I can think of.
               
               

               


                     Modifié par Axe_Murderer, 12 juillet 2011 - 05:50 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Encounter Accessor OnExhausted question
« Reply #3 on: July 12, 2011, 08:58:56 pm »


               that has no sense to get a "encounter cleaner" if its single player it will be first pc in module, if its multi you will want to update quest for all PCs in some distance...
               
               

               
            

Legacy_Tiggers.no.tail

  • Jr. Member
  • **
  • Posts: 82
  • Karma: +0/-0
Encounter Accessor OnExhausted question
« Reply #4 on: July 12, 2011, 11:19:40 pm »


               I've been using GetFirstPC() without any problem. I think it *should* work for what I want it to do.