Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 asadsohail · Dec 10, 2012 at 12:29 PM · networkingmultiplayerscoreboardfirstpersonshooter

FPS Multiplayer Scoreboard Problem

Hi guys, I am using M2H networking code (Leepo) for my FPS Multiplayer. And I am facing some problems. The kills and deaths in the playerList of FPSPlayerNode are not updating in foreach loop. In fact, unity doesn't execute that piece of foreach I think. I am giving the code of ApplyDamage() method where I am using foreach loop. Please help guys. Waiting for your friendly opinions. Thanks

 void ApplyDamage(string[] info)
     {
         float damage = float.Parse(info[0]);
         string enemyName = info[1];
         ScoreBoardScript.killer = enemyName;
         hp -= (int)damage;
 
         if (hp <= 0)
         {
             foreach (FPSPlayerNode entry in oSetup.playerList)
             {
                 if (entry.playerName == enemyName)
                 {
                     entry.kills += 1;
                 }
             }
             ScoreBoardScript.deaths += 1;
             networkView.RPC("isDead", RPCMode.All);
         }
         else
         {
             networkView.RPC("SetHP", RPCMode.Others, hp, damage);
         }
     }
Comment
Add comment · Show 5
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 IT_Criminal · Dec 10, 2012 at 12:55 PM 0
Share

from what i see you are not sending the death-count to your clients...

avatar image asadsohail · Dec 10, 2012 at 01:47 PM 0
Share

No actually the RPC "isDead" is doing what you are saying.

avatar image IT_Criminal · Dec 10, 2012 at 01:57 PM 0
Share

well ... i see you send "isDead" ... but it contains no information about the person that was killed ... so how does the client know to which player he has to add score ?

...also ... is this function server-side or client-side?

avatar image asadsohail · Dec 11, 2012 at 04:14 AM 0
Share

This ApplyDamage function is client side. It is not a RPC. But I am confusing how to add death score. In short, how to find the person that was killed?

avatar image IT_Criminal · Dec 11, 2012 at 12:58 PM 0
Share

from what i know clients can only call RPCs on the server ... but the applydamage function is client-side ...

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.

Follow this Question

Answers Answers and Comments

10 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

Related Questions

Unity networking tutorial? 6 Answers

Can I add a network prefab at runtime? 1 Answer

Where to find the demo project mentioned in the Unity docs in the Networking? 1 Answer

Confusing in Multiplayer Networking uNet Client-Server 0 Answers

Unet spawn a camera? 0 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