• 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 rereverb · Aug 02, 2018 at 01:31 PM · unity 5scorekillkill playerkills

Killer + assistance id for shooter game

Hi!

I have something like ApplyDamage (hp system on enemy) and Shoot (attack system on player). Any idea to develop a killer id for +1 score to player(killer)? And for +1 (to killer and assistance) for cooperative attacks?

Thx for read. Thx for help.

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 rereverb · Aug 02, 2018 at 04:13 PM 0
Share

I think my bullets need one varible like "bulletfrom". I work in it.

avatar image Zarenityx rereverb · Aug 02, 2018 at 09:51 PM 0
Share

Are you using physical bullets? This would be needed. Raycasts are faster and more consistent for guns though, and you can call ApplyDamage directly through that.

avatar image rereverb Zarenityx · Aug 03, 2018 at 10:39 AM 0
Share

Yes. I'm using physical bullets (instantiate prefabs) and now reading raycast info. Probably work but Raycast dont have parameters for killer. Anyway thank you for opening another way of research. I will study it.

avatar image Howdlej · Aug 13, 2018 at 08:27 AM 0
Share

Could the player not just keep a small buffer of players who recently damaged them and then give score accordingly? If the player dies, then you already have the ID of the killer, then you just check the last person(s) who dealt damage to apply assist score.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by madks13 · Aug 03, 2018 at 01:17 PM

You should use an event system, similar to c#. You launch an event by giving the sender and event parameters. That way you would only have to see who fired the bullets to update the scores.

The sender can be of type System.Object, Unity.Engine.Object or Unity.Engine.GameObject, then you would get some kind of id (GetHash?) to identify the player/enemy.

Comment
Add comment · Show 4 · 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 Zarenityx · Aug 10, 2018 at 08:11 PM 0
Share

Should mention that this won't work over the network. OP didn't specify but this sounds like a multiplayer game. This is probably the best way for singleplayer though.

avatar image madks13 Zarenityx · Aug 13, 2018 at 08:12 AM 0
Share

As far as i know, in normal Unity (non ECS), the Unity player reproduces all game objects inside the server, so instantiating bullets should work fine. Also, the asynchronous multiplayer games use event systems to coordinate clients, so it should work too if implemented properly.

avatar image ahorasemosdevelopers madks13 · Aug 13, 2018 at 10:42 AM 0
Share

Thx for helps. I work in it. If I find a resolution code i will publish it, sure.

Show more comments

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

182 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image 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

Trying to get my spawn manager to respond to the current score 1 Answer

Storing high score 2 Answers

Kill Player Method Doesn't Work ? 0 Answers

Kill Counter --> Score 2 Answers

How to add score after destroying object in unity 2D? 1 Answer


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