• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by DryTear · Feb 03, 2013 at 03:59 AM · c#networkkills

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

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image iwaldrop · Feb 03, 2013 at 04:34 AM 0
Share

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.

avatar image joeyaaaaa · Feb 03, 2013 at 06:42 AM 0
Share

dont put the killstreak script on something that will be destroyed but still tell it if your killed to set streak to 0

avatar image RudyTheDev · Feb 03, 2013 at 09:08 AM 0
Share

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?

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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

Flip over an object (smooth transition) 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges