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"

ForEachLoop check number of instances of a variable and execute based on amount.

Ok, this is a turn based prototype I'm working on. When a turn based character in the battle map "dies" it calls the "RemoveCharacter" event in my GameMode. This gets a reference to the character instance and removes that character from the array of other characters. As seen below:

alt text

At the end of every "turn" each character calls the GameMode to do various things, one of them being a Victory Check.

I am unsure why this does not work as the RemoveCharacter function in the first screenshot is ALWAYS being called before the CheckVictory function below. The idea is there are likely only two teams (player vs. ai) in each match. After every turn we want to check if the number of teams is <=1 since that means someone must have won.

Thanks for any help.

alt text

Product Version: UE 4.22
Tags:
turnbasedq.png (77.0 kB)
more ▼

asked Apr 12 '19 at 10:57 PM in Blueprint Scripting

avatar image

embede
5 1 2

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

1 answer: sort voted first

Is the "Number Of Teams" array a local or member variable? And if it is a member variable does it ever get cleared?

more ▼

answered Apr 12 '19 at 11:04 PM

avatar image

Lardo Deepdelver
961 6 4 6

avatar image embede Apr 12 '19 at 11:38 PM

Thank you very much again!

(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