Split screen shooter how to tell who has killed who
I have recently been working on a split screen free for all shooter and need to be able to tell who has shot and killed who so i can add scores.
Currently bullets are instantiated in the gun script which is a child of the player. I have the player tag by doing
if (this.transform.parent.parent)
ID = this.transform.parent.parent.parent.tag;
This is stored in a string but i don't know how to pass it onto the bullets the gun creates
Rigidbody BulletCreate = Instantiate(bulletRB, transform.GetChild(0).transform.position,
transform.GetChild(0).transform.rotation;
BulletCreate.velocity = transform.TransformDirection(new Vector3(bulletspeed, 0, 0));
I need help putting the tag info into the bullet.
The character controller detects when it collides with a bullet tag and takes damage/dies accordingly.
if (collision.gameObject.tag == "Bullet")
{
curhealth = curhealth - bulletStrength;
}
I will also need help on how to make the player store the last person it was hit by, through taking the id from the bullet it dies too. Then i need to apply a score up to the player who got the killing blow.
Your answer
Follow this Question
Related Questions
RPC sending Failed 0 Answers
Bullets not moving on client screen. 0 Answers
Cant Shoot client, Unet 0 Answers
Unity Multiplayer - Projectile hits owner 0 Answers
Raycast Weapon not cause damage 1 Answer