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"

Show map objects depending on game mode


This is my first post here so sorry if I'm doing something wrong. :)

I'm currently coding a Capture The Flag game mode in c++, using the ShooterGame as a base project. I'd like to know what is the best way, without using blueprints if possible, to show / hide map objects on different maps depending on the game mode. e.g I want CTF flag bases to be visible in CTF game mode but not in TDM, and so on.


Product Version: Not Selected
more ▼

asked Sep 19 '14 at 03:01 PM in C++ Programming

avatar image

8 1 2 4

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

1 answer: sort voted first

I'll answer here for anyone who wasn't on the IRC channel when we discussed this :)

Possibility 1:

For your CTF flags, say you have an AFlag object that you (or a map-maker) places in the world. Inside of this, you could check if it's in a world where a CTF-type gamemode is active, and if not, the AFlag class will disable/destroy itself. For example:

If you have multiple gamemode classes, i.e. AGameMode -> BaseShooterGameMode -> CTFGameMode, you could just call GetWorld()->GetAuthGamemode(), and try to cast that to your CTFGameMode. If it fails, you run the above logic.

Possibility 2:

You could also have map-makers place an AFlagHolder or AFlagSpawn object, which is always present in the level, and which spawns an AFlag object when instructed. Using similar logic to the previous idea, you could enable/disable those spawns without having to delete anything. This would mean you wouldn't have a flag appear at the start and then suddenly disappear when it realizes it's not in the right gamemode.

This could be controlled either internally to the AFlagHolder/AFlagSpawn or in the CTFGameMode itself, which could find all flag-spawns via the GetAllActorsOfClass function. Additionally, if those spawners only executed when externally instructed, the non-CTF gamemodes would just never call AFlagSpawn->SpawnFlag(...), and thus having them appear is never an issue.

Let me know how you go!

more ▼

answered Sep 19 '14 at 03:54 PM

avatar image

453 41 47 72

avatar image Barbatos Sep 19 '14 at 04:10 PM

Thank you, will do!

(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