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 end game when all enemies are destroyed?

Currently I'm trying to end the level once all enemies are destroyed "Cube enemy" and currently the system I have in place is on a Game Mode Blueprint, and I think my largest issue is not knowing how to make this blueprint register a destroyed enemy. Any ideas/help? alt text

Product Version: UE 4.8
12.png (240.3 kB)
more ▼

asked Jul 25 '15 at 10:13 AM in Blueprint Scripting

avatar image

18 5 6 7

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

2 answers: sort voted first

This is how i did it:

alt text alt text

Tell me if something is not clear and i will explain you. I reproduced your idea, so i putted the control of the there is at least 1 enemy on the map in the "Gamemode" blueprint. Where i control if "Lenght>1" is not a error, if you insert "Lenght>0" it will never fires.

Ah, i forgot. The "Damaged" event fires everytimes i click on a cube.

Click the vote button and accept this as answer if is what you was looking for, thank you

cubeenemy.png (320.1 kB)
gamemode.png (238.5 kB)
more ▼

answered Jul 25 '15 at 12:12 PM

avatar image

318 23 15 28

avatar image Santeon Jul 26 '15 at 12:53 AM

Thank you so much for your straight forward answer it's awesome :D currently I have tried to copy this system but part wont fit inside my "Basic Enemy" AKA Cube Enemy Blueprint. Again thx for the help! alt text

alt text

alt text

13.png (221.5 kB)
14.png (245.8 kB)
15.png (362.1 kB)
avatar image Fanto88 Jul 26 '15 at 01:33 AM

Could you tell me what doesn't work of your script?

The "destroyed" event?

If you put some "print" node we can see where the script stops and then fix it

Ps: could you show me where you call the "apply damage" node?

avatar image Santeon Jul 26 '15 at 07:12 AM

Down below is what my blueprint used to be; this system did work - taking 1 point each time the enemy dies, but the only problem is that the blueprint would be destroyed with the enemy so it could never count down past 1. I was told to transfer the system to a Game Mode Blueprint so it counts every time a enemy dies without being destroyed with it. Largest problem is it does not register when the enemy dies. I relies you have supplied me with that knowledge and I thank you. But it does currently conflict with my damage system so if there is any way to fix this issue you would be a hero.

alt text

example.png (457.6 kB)
avatar image Fanto88 Jul 26 '15 at 11:08 AM

Could I ask you to upload your project and send me a link for download it? (via Google drive, If you can), so I can take a deeper look

PS: add me on skype so we can talk more freely ID: X-BiGBoSs-

avatar image Santeon Jul 26 '15 at 07:43 PM

No one found under the name "X-BiGBoSs-". Also thanks again for the help, i'll make sure to add you as soon as possible and send you the project! Skype name "Santeon" - Picture is a red, white and black mask

avatar image Fanto88 Jul 26 '15 at 07:53 PM

I have changed my skype id: davide.fanto

Sorry about that

avatar image Santeon Jul 27 '15 at 05:57 AM

sent the invite

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

It's really simple, make a variable called EnemyAmount.

Whatever the game type you have, just go

Whenever an enemy is spawned -> EnemyAmount == EnemyAmount + 1

Whenever an enemy is killed/defeated/whatever -> EnemyAmount == EnemyAmount - 1

Then, at the end of some loop you may have or wherever logical place it makes sense to put it, have:

If EnemyAmount == 0 -> CombatEnds (this can be a custom event or a function)

If you don't know where to put that ^

You can put it in an Event Tick, though Event Ticks take more ressource than finding a good place to place that If.

ps. "If"s are called "Branch" in Unreal.

more ▼

answered Jul 26 '15 at 08:18 PM

avatar image

13 1 2 6

(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