Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to compare multiple players that are using the same type of actor?

Lets say you wanted to make a online first person shooter game and used a integer variable to keep track of score. And after a certain amount of time you wanted to give the player with the highest score a weapon, how would you go about getting that actor alone?

Right now the score value is stored in my actor, And I'm trying to compare them in my gamemode.

alt text

Also would it be more optimal to save it to a playerstate/player controller? But even then how would you get the highest value of them and compare it?

Product Version: UE 4.20
compare.png (83.2 kB)
more ▼

asked Feb 25 '19 at 01:54 PM in Blueprint Scripting

avatar image


(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Score is typically a PlayerState variable.

The logic to select the maximum score is something like this:

maximum select

Of course you can handle separately if the PlayerArray is empty, you can avoid checking the first element by starting with index 1 ( ForLoop ), etc, I just made it fast so you can understand the logic behind selecting a maximum element from a list.

max.png (184.2 kB)
more ▼

answered Feb 25 '19 at 03:56 PM

avatar image

1.4k 6 5 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question