Page 1 of 1

Is there a way to get someone's killer and assign it an inventory?

Posted: Fri Dec 01, 2017 7:26 pm
by FranckyFox2468
Cause i was having the idea of having class specific voicelines when a character kills a specific monster or player class, but im not exactly sure if, in ACS or Decorate, there is a way to get someone's killer.

Usually zdoom's forums just go "Meh, just get the monster's target and give it an inventory" but the problem with this logic is that in zdoom, there is only one player to care about. In zandronum, the player that the monster will be engaging is not necessarily the one that will be killing it. And it does not exactly solve the problem on a PVP situation.

So basically i am wondering if there is a way to give a character's killer a certain inventory, including in pvp, that could make a certain character trigger a sound or something.

Re: Is there a way to get someone's killer and assign it an inventory?

Posted: Fri Dec 01, 2017 8:15 pm
by Ivan
There are DEATH scripts for players. There are also KILL scripts for monsters. Monsters have to have "USEKILLSCRIPTS" flag on them for the script to run for them. You can do any kind of inventory check there.

Re: Is there a way to get someone's killer and assign it an inventory?

Posted: Fri Dec 01, 2017 8:33 pm
by FranckyFox2468
Ivan wrote:
Fri Dec 01, 2017 8:15 pm
There are DEATH scripts for players. There are also KILL scripts for monsters. Monsters have to have "USEKILLSCRIPTS" flag on them for the script to run for them. You can do any kind of inventory check there.
Okay but how to you get who's the killer? Cause said script still appears to take in account their last target and not the killer, and thus does not solve the problem i have mentionned above.

Re: Is there a way to get someone's killer and assign it an inventory?

Posted: Fri Dec 01, 2017 8:38 pm
by Ivan
Uh, the target is the killer in both cases.

Re: Is there a way to get someone's killer and assign it an inventory?

Posted: Fri Dec 01, 2017 8:39 pm
by FranckyFox2468
Ivan wrote:
Fri Dec 01, 2017 8:38 pm
Uh, the target is the killer in both cases.
Wait really? Cause i did some testing involving target-based trigger on death at somepoint and the item was given to the player it was last attacking/facing rather than the killer.
Are you sure there isn't something more to it?

EDIT:

Oh wait... SetActivatorToTarget... nevermind. Thanks for the help.

Re: Is there a way to get someone's killer and assign it an inventory?

Posted: Fri Dec 01, 2017 8:59 pm
by Ivan
FranckyFox2468 wrote:
Fri Dec 01, 2017 8:39 pm
Ivan wrote:
Fri Dec 01, 2017 8:38 pm
Uh, the target is the killer in both cases.
Wait really? Cause i did some testing involving target-based trigger on death at somepoint and the item was given to the player it was last attacking/facing rather than the killer.
Are you sure there isn't something more to it?

EDIT:

Oh wait... SetActivatorToTarget... nevermind. Thanks for the help.
Yes, you can use that or GetActorProperty(0, APROP_TARGETTID), which should do the same thing if your actors have unique TIDs. I'd use the latter as the former can cause problems when you want to revert back to the activator and if you don't have unique TIDs distributed.