Quote:
Originally Posted by Projectshifter
That really doesn't seem to make much sense. You're going to have an NPC in a level that reads onPlayerKills(player)? I'm not sure you're getting the concept of all of this object orientation, onPlayerKills(player) would be a member of what object? If you're wanting to do that, whenever a player is hit you can store the attacker in a string, and if that player dies then trigger to an NPC to calculate it. Otherwise I'm really not seeing the merit of it.
|
Okay. You let me try to explain.
The "created" event handler doesn't imply a player object assignment:
PHP Code:
function onCreated() {
player.chat = "blahdeedaregarfg"; //doesn't work because no player was involved in the creating
}
On the other hand, the "playerenters" event handler does imply a player object assignment:
PHP Code:
function onPlayerEnters() {
player.chat = "blahdeedaregarfg"; //works because the player was involved in the entering
}
It would make sense for the player that was killing to be assigned to the player object of the event handler for "playerkills." However, it would also make sense to know who was killed, so it would make sense for params[0] to contain the player who died's object reference.
In clientside scripting the player object assignment is always assigned to the only clientside player.