x

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 get current window index in editor?

Just simple question: I have 3 players started (frist is server), how to get index player window in his context via C++?

Product Version: Not Selected
Tags:
more ▼

asked Mar 01 '16 at 03:04 PM in C++ Programming

avatar image

broly
569 44 64 92

avatar image Sean L ♦♦ STAFF Mar 01 '16 at 09:11 PM

Hello,

You could try using GetWorld->GetFirstPlayerController().

 /** @return Returns the first player controller, or NULL if there is not one. */    
 APlayerController* GetFirstPlayerController() const;
 GetWorld->GetFirstPlayerController();

If this isn't what you are looking for, could you please provide some more detail on exactly what you are trying to accomplish?

avatar image broly Mar 01 '16 at 10:06 PM

When I selecting in editor number of players, I want to execute different logics for each. Server must spawn new actor. First client must say "hello" Second client must idle.

For example.

This is for debug purposes. More serious case is logging in external service with different usernames and passwords. Server as admin, And clients as other specified users.

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

1 answer: sort voted first

Hi Broly,

If I'm understanding correctly, you want each client to have some means to check what it's current index is, and perform some actions based on that.

You should be able to accomplish this by having your server register players to a collection in the GameMode. It can manage this collection by creating new entries when a new PlayerController is spawned and resorting the entries when a PlayerController vanishes. Your clients can then request their index number from the server, who can look it up and respond.

more ▼

answered Mar 08 '16 at 09:59 PM

avatar image

Cody.Albert STAFF
131 5 2 1

(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