- Home /
Question by
leonalchemist · Nov 21, 2013 at 07:17 PM ·
networkingmultiplayerfps
Bullet owner network (javascript)
I'm currently trying to create a simple system on a kill counter for a multiplayer FPS game like most FPS out there where
Player get 1 point on killing someone and opponent death count increase by 1
Save variable on which player killed who
I already have a script that shows who killed who just having problem getting those variables.
I have this on my bulletScript which is called every time a bullet is instantiated over the network
on Start
if(networkView.isMine)
{
player = gameObject.FindWithTag("GameManager").GetComponent(ScoreBoard);
killedBy = player.playerName;
}
In Update
var enemyHit : GameObject = Hit.collider.gameObject;
if(enemyHit.tag == "Player" && !networkView.isMine)
{
if(enemyHit.collider.gameObject.GetComponent(PlayerNetwork).health <= 0)
{
enemyHit.collider.SendMessageUpwards("Kill", killedBy, SendMessageOptions.DontRequireReceiver);
}
}
Destroy(gameObject);
Getting all kind of problems, Kill function doesn't seem to get called even though i put a Debug.Log(stuff); to show if anything happens. I can hit other players and they do loose health but just kinda getting lost in all this, any help would be great
Comment