- Home /
Keeping Score from Kills
I've got a networked game that works fine. But every kill I get goes to the Scoreboard and me on the list, what I also want to do is to add Killstreaks. Where everykill counts as a streak, but if you die your killstreak ends. One way I though off doing this is, is to attach Killstreak.cs to the playerPrefab and it counts everykill, offcourse if you die, your playerPrefab destroys itself and the script causing the Killstreak to restart by respawn. And i also already have a HealthDamage script which is in C#. Can anyone show a script(in C#) or make one?
Im typing on a Nintendo3DS, meaning I cant code on it, and my laptop is in Brazil which will be returned in May. Im also 13 dont be harsh
Cool idea, really. What I've done in my mp games is to leave the player intact (don't go through the destroy instantiate cycle), but just reset values that need to be to default. In either case you're basically just talking about resetting an int to 0; but if you already have everything working with a destroy/instantiate cycle then I'll leave that one alone.
If I understand you correctly, you're just going to throw away the kill streak value at respawn, right? Is there currently a script that tracks kills on the player? If so, just store killstreak in there as an int. Otherwise, yeah, a really simple script can be added as a member variable anywhere. Really though, it would be a waste to throw another monobehavior (or a class even) just to track a single int. Perhaps the Scoreboard should store it for all players, and it would then just reset on player death.
dont put the killstreak script on something that will be destroyed but still tell it if your killed to set streak to 0
A simple way is to not destroy your player GameObjects, but simply disable them and reinitialize when being spawned.
But if you already have a Scoreboard, I assume each score is tied to a player somehow (by name or reference)? Then it shouldn't be a problem to add another variable that tracks their killstreak, which is reset on their death?
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Desync between host and client. 0 Answers
remove spawned object from my networkView when timeScale = 0 0 Answers
How would you set up a Lobby Scene? 1 Answer