Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Finding out what player killed an NPC?

Asked by 8 years ago

I was wondering what the function or method is to find out what player killed an NPC/Other Player, I've tried searching the wikia's, forums, etc and I can't find anything for it. I know there's a way to do this because I've seen someone mention being able to do it, however I can't remember where I saw it.

0
I was about to say, "There was a wiki page about it!" but they have rewritten the wiki page and I understand how you can't find it EzraNehemiah_TF2 3552 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Programming this would involve creating an entire framework involving multiple scripts with many variable components, but the basics are:

--1: Find the part of the weapon script that kills the NPC
--2: Add a value to the NPC with the name of the player
--3: When the NPC is deleted, first get the name of the player from that value
0
Or... Just like the linkedsword, tag the humanoid. Put an ObjectValue inside of the humanoid and make the value, the actual player's humanoid. When the npc dies you use a died event and check what the value is, give the point to that specific player. EzraNehemiah_TF2 3552 — 8y
0
Only involves like 3 lines of code. EzraNehemiah_TF2 3552 — 8y
0
I see, thanks for all the help! I'll experiment w/ the different things and see what I can do. OneTruePain 191 — 8y
Ad

Answer this question