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 Michael_-01-_ · May 19, 2015 at 07:46 PM · multiplayerpunmessage

Finding the player who killed you (Multiplayer)

Hi guys, so i have a multiplayer game setup and so far you can shoot and kill your enemies. So the problem is that i am trying to get the name of the player who killed you, as well as send a message to that gameobject to add a score to the players' kill streak. It is not done with raycast, bullets are instantiated and then move forward, if that info helps. So please can anyone please help me, i am using photon unity networking. Thanks guys!

Comment
Add comment · Show 4
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 hu90 · May 19, 2015 at 07:50 PM 1
Share

Each bullet should contain an information allowing to identify the shooter (a name / a numeric id / an object reference). Then on hit you can find the killer and send a message or do whatever you like.

avatar image Michael_-01-_ · May 20, 2015 at 02:00 PM 0
Share

Could you maybe help me on how to do this, I have no idea on how to implement this

avatar image hu90 · May 21, 2015 at 03:50 PM 1
Share

Without seeing your code, I don't think anyone can guess what to do.

avatar image daleth90 · May 22, 2015 at 04:22 AM 0
Share

Is using Tag an optional choice?

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by abhi_360 · May 22, 2015 at 05:45 AM

ok i dont know your code so all of this is a big guess. All your network players if instantiated by Network.Instantiate will have a networkviewid which is unique.

Add a NetworkViewId playerId variable to your Gun In your Gun script which will have a bullet prefab get the playerId from the the parent players NetworkView OnStart() and when instantiating the bullet in your gun script use GameObject bullet = Network.Instantiate(//add your args)

Your bullet script should have a NetworkViewId playerID variable. So after instantiating say bullet.playerId = playerId

//Maintain a List of all players for this to work Now OnHit check the list of players for there NetworkViewId if it matches the bullets playerId then add to his score

Without the actual code this is the best i can help you with

Comment
Add comment · Show 2 · Share
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 Michael_-01-_ · May 22, 2015 at 06:31 AM 0
Share

I actually don't need such a complicated method, all I need is to know if the player killed someone to add points to the killstreak

avatar image abhi_360 · May 22, 2015 at 09:14 AM 1
Share

//That was the least complicated solution without your reference code //T_T

Try to find way to tell the bullet like dude your xyz player's bullet don't kill xyz and kill everyone else. So if your bullet knows it belongs to xyz player bullet->damage->Enemy and bullet->score->xyz

//Normally in professional projects these things are accounted for b4 //hand have look at How to make Class Diagrams and prepare one b4 //initiating with your project.$$anonymous$$ultiplayer is a huge topic (like if u //send too much packets to the server the server socket might may fail //as each LAN card has its max data reception speed)

Best of Luck

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

[PUN2] Problem at pushing the other players 1 Answer

Photon PUN 2 RTS one time information sharing 0 Answers

MMO server side programming 0 Answers

Send Custom Network Message Unity Multiplayer 0 Answers

,Unity Multiplayer - Instantiate prefab 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