Jump to content
Sign in to follow this  
Paulus141

Counting killed players

Recommended Posts

Hi, I created a simple PvP shooter game, but there is still one thing I want to implenemt:

Have anybody any idea, how to show to player, how many kills he/she has?

It would include some custom hud...

Thanks for any opinion.

 

Edited by Paulus141

Share this post


Link to post
Share on other sites

There's a Custom UI object in the game.  You can drop one in, like dropping in a trigger zone or spawn point.  You can then open the properties for it, click to Edit the UI, and add text objects on the screen where you want them to appear.

Then in the script you can set the text in each one for each player.  If it's different for each, then just set each one's separately.  If you want one to show the same thing to everybody, then you make a loop that goes through the players and sets each one with the same value.

There's a bit of detail involved in making and using a custom HUD, and some pro tips that people on this board can give you, but once you know what you're doing it's not that hard.

I would add screenshots and step-by-step details, but I don't have access to the game right now and I know I would miss something.  And by the time I get home, somebody else will probably give you a solid answer.

Edited by Indomitus
  • Thanks 1

Share this post


Link to post
Share on other sites

That is more than enough, thank you for description. ?

But I dont know the script, that will recognize death by the player.

 

Edited by Paulus141

Share this post


Link to post
Share on other sites

You need to consider first, if the kills is only shown to that player, or if each player can also see the other players kills.

Is the target destructible or it just get hits for scoring? Etc etc

Anyway, a solution would be having an array in which you store all kills, remembering that array.Index[0] is for player 1, array.Index[1] is for player 2, and so on. 

Share this post


Link to post
Share on other sites
35 minutes ago, jchob said:

You need to consider first, if the kills is only shown to that player, or if each player can also see the other players kills.

Is the target destructible or it just get hits for scoring? Etc etc

Anyway, a solution would be having an array in which you store all kills, remembering that array.Index[0] is for player 1, array.Index[1] is for player 2, and so on. 

You're better off using a variable inside an Entity Storage, with one storage for each player.  If a player leaves, you would have to manually adjust the array to keep everything lined up.

Share this post


Link to post
Share on other sites
3 hours ago, Indomitus said:

You're better off using a variable inside an Entity Storage, with one storage for each player.  If a player leaves, you would have to manually adjust the array to keep everything lined up.

True, I would go with the storage. As he doesn't know how to make a script, that was just a basic idea ?

Share this post


Link to post
Share on other sites

OK, I want that you can see only your kills, and the target (another player) is destructible.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×