Send Message to Players On Death Event

Arachai

Member
I am wondering if you are able to send a message to players (using PUN add-on) when a Death Event is activated? I know it's possible but should it be done on the players death as an event like the code below? The code works fine but for some reason is displaying the same message twice? How can I get it to only show the message once?

On the Death Event I am sending the player and attacker names:
Code:
var attackerPhotonView = attacker.GetComponent<PhotonView>();
            var playerPhotonView = this.gameObject.GetComponent<PhotonView>();
            attackerPhotonView.Owner.AddKill(killPoint);
            playerPhotonView.Owner.AddDeath(deathPoint);
            KillFeedManager.instance.AddNewKillListing(attackerPhotonView.Owner.NickName, playerPhotonView.Owner.NickName);

The KillFeed Manager Script:
Code:
public void AddNewKillListing(string killer, string killed)
    {
        GameObject temp = Instantiate(killListingPrefab, transform);
        temp.GetComponent<KillListing>().SetNames(killer, killed);
        temp.transform.SetAsFirstSibling();

        Destroy(temp, 10f);
    }

And that is sent to The Kill List:
Code:
public void SetNames(string killerName, string killedName)
    {
        killerDisplay.text = killerName;
        killedDisplay.text = killedName;
    }
 
I am not familiar with the AddKIll/AddDeath methods within PUN - I recommend posting on the PUN forums about this.
 
Top