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"

Enemy to attack random player pawn

Hello here!

I'm creating classical jrpg combat game (that is like Final Fantasy, chrono trigger and etc.) just for training but hitted wall recently.

I have to spawn player pawns cause I got 3 characters in combat but 6 characters in total what player can select witch ones is in combat (also can select locations from 6 different locations front row 3 and back row 3).

But if I got multiple enemies how I can make enemies to attack random target pawn? And how I can cast to that pawn to take damage?

Can be I'm thinking too hard and looking too far how to do it but I don't have got it to work no matter how hard I have tried.

Biggest problem for me is that I don't quite get casting to spawned pawn how it works.

I don't have found any tutorial for this kinda game so I need little help. Combat is mostly done otherwise and gonna make tutorial how to do it when I get it working.

Than you for reading my problem!

Product Version: Not Selected
more ▼

asked Jan 16 '15 at 04:07 PM in Blueprint Scripting

avatar image

42 5 7 13

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

1 answer: sort voted first

If you store references to the 3 enemies you can just store them in an array, then generate a random int between 0 and 2 and access that enemy in the array.

Or you could use a 'find all objects of class' node set to your enemy type.

OR if they're different enemies I would recommend that they all inherit from the same base class to make the above suggestion work.

there is another option, but I don't think it's as elegant in this case as inheritance - they could all contain a common blueprint interface to let you act on them in the same way. And this is actually how i'd recommend you implement damage. They all have an interface that allows the aggressor to access them and reduce their health.

You can even do things like find all characters that implement said interface.

Having said all this I think there may be some stuff already in UE4 specifically to deal with damage, i'v come across a few things while browsing the list of nodes. It may be worth a google first.

more ▼

answered Jan 24 '15 at 12:14 PM

avatar image

Asher S Einhorn
650 94 80 182

(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