Download

Spawned Enemy Issues

I am having problems with getting a spawned enemy to change animations on overlap (attack). I have done it with Pawn Sense, but I am trying to do this through the anim bp and all enemies change animations at the same time that are spawned. What am I doing wrong? They don’t seem to individualize anymore. Is this just a version issue? This used to work in 4.20, 4.21, 4.22.

My blueprints, let me know if you need more. thanks.

Okay, just ran a test on a blank project and I noticed something. The current project I have problems in is not recognizing my actors or something like that. When I spawn actors in current project, they do not show up in the world outliner. In the new blank project they do show up and I can kill or adjust anim individually with one actor. I am obviously thinking my project glitched out somehow. I have spent weeks working on this project and migrating it now will only retain about 1/3rd of my work. Is there any way to fix this issue.

Blueprint corruption is common, but there are things you can try. Create a dummy FPS / TPS project from the new project menu (choose whichever is closest to your actual game type). Then use the Migrate option to migrate your assets to the new target project (you must have your own project open). Try it, it works sometimes. Remember that Inputs and Maps & Modes Project Settings must be setup up again manually. But you can Export / Import these as INI files… Next up, is brute force copying files / folders / assets belonging to your core game over to the new template project using Windows File Explorer. Lastly, if all else fails, open 2 UE4 editor sessions, and just copy / paste core parts of your blueprints over. Using Bruno’s Property Transfer Tool can help here…

Apart from that… Go back through the Backup folder in Saved, to see if you can find a version of your Blueprints that aren’t corrupted. Then try to merge that manually with the latest version. Its time consuming, but it can work if nothing else does. Also remember to package your game regularly to avoid these issues, as packaging with UBT highlights many errors the editor misses. Good luck!

Thanks, I’ll go through your options to see what I can get to work.

I do have a question though to any who can answer. I am not using a template. I am using a blank project with starter content. I know I shouldn’t, but hell I’m sure I am not the only one with extra packaged nonsense. Is this a problem with making a tower defense game where you are only a camera? Your mouse has more function than anything. It’s seeming like there are more things applied with using FPS/TPS in engine function. Should I migrate to a FPS and eliminate the first person and use camera? Maybe if I can iron out a better workflow on this, I might be alright. Thanks

When you’re debugging it can help to have a 3rd-Party Character / Camera system in the project to see what’s going on… Apart from that, I would avoid the bloat. It takes a while to thin it out using the Reference Viewer / Migrate. Again, Migrating regularly especially just before packaging, will drop the bloat anyway. So empty project vs template, does it ultimately matter? Not really.

Okay, made the move over to a new project and can see and verify the spawned enemy is counted as well as a spawned ai controller for each enemy. But when I switch the first enemy’s animation to attack by overlapping, all change animation. How do I not do that, and separate their animation switches?

Okay, so I feel like an idiot sometimes and I might not know exactly why. But as you can see in the image above, I am using a bool from the tower and asking about it in the enemy. After I literally reversed it to a bool from the enemy and set in the tower now allows each spawned actor to act separately. But at least my project is functioning better.

Bools are dangerous anyway even if you don’t get the instancing context wrong… As they default to a state that may never have been properly initialized at start. Both False and True (True when NOT is being used somewhere). Enums or Gates are safer imo…

With that in mind, what should I do then about this?

I can get this line overlap BP to function and only fire the tower if the enemy is in its line. But I can not recreate it. It wont function. lol talk about lost. lol

2c… Take a deep breath, as I had to… :smiley:

Your explanation of the problem isn’t great dude. For example, what does this statement actually mean ‘I can not recreate it. It wont function’… Its too ambiguous. :confused: I don’t have a good idea what your code is ever really trying to do… You need to fundamentally look at the way you’re coding as well… Take a step back for a sec, and evaluate your own approach to things…

For starters I would encourage you to almost never use Casts (except for trivial things that can’t fail)… Instead use Interfaces or HasTag etc. Now, looking at the code above… You are casting to DarkKnight_BP… But then you completely IGNORE the returned value… Why? You never test for failure either! For me this is all wrong. Its also why casts are often a bad choice a lot the time. This is a key point of failure…

Next alarm bells… You hardcode a ‘Get’ for the first value returned from Get All Actors. …WAIT… How do you ever expect this to work reliably regarding instancing? You need to focus on breaking problems down into simpler chunks, that you can explain to yourself and others simply. I’m not even sure Line Traces are the way to go here, but I have no real idea what you’re trying to achieve either…:wink:

Okay, I will better explain everything here.
In my Arrow Tower BP (Arrow Fire BP), I reference an arrow that is fired from the tower’s socket.
I have a Boolean that asks if the Arrow Tower is set on board.
Next, I have a Tower Line BP, I accidentally named it only Tower BP above.
This is an overlap only actor. When the Dark Knight overlaps it (hence the cast to Dark Knight without return value), This means only Dark Knight can trigger it.
I get my Arrow Tower actor to get a copy of its data and use the bool reference to it, since casting in this way wont work without object target.
The editor is forcing me to use is valid on everything.
Then I am setting true or false whether or not Dark Knight is overlapping which can trigger the Arrow Tower to fire, if set to true.

This is what is pushed to all noobs ever starting in Unreal from the last 7 years. This is YouTube assistance. I have asked, pleaded and begged for real game devs to teach me a better way, but no one seems to know how to show the work part of what I would need to learn. They send me a link to a YouTube video they are saying is incorrect, or give a link to a site with UE Node images, like suddenly, poof, now that I see one node, I know all of it… lol Methods are taught. If I do it wrong, teach me right as I have asked before. I have done this work for 4 years straight. It has worked until now, which kind of tells me UE4 has adjusted the way it should be done vs the way it was taught.

When it comes down to this game, It is almost done, just some tiny issues I am hoping to get around or adjust to work right. But I know only what I have been taught for the last 4 years.

Also here is a video to help show my issue.

https://youtu.be/NrENoLuQGaA

As you’ll see, the first tower only fires. I fixed it from firing out of every tower set. But what I meant by “I can’t recreate it” is, I can’t make another BP actor for this and it work. I can’t duplicate actor and set on stage and it work. I can’t duplicate on stage and it work.

In case I need to show more or explain more, here is a drawing of my game build. (Also, sorry I left out an “n” and misspelled “individually”. And yes I did make the board shorter to 40 squares instead of 60.)

Explain again, which BP moves the enemy character in black, and which moves the arrow being fired? Name them, and explain how they’re supposed to work!

Overall, a projectile may be your friend here… But you need to be clear in your mind as well as this thread, how you differentiate each individual arrow IN EACH LANE or LINE, from each enemy character in black in the same LANE or LINE. This isn’t clear in the thread. Maybe because its not clear in your own head, or maybe it is and you’re just not articulating it… But this is likely the source of all your problems right now: INSTANCING…

As regards the other stuff… I feel relying on videos is full of pitfalls… In UE4 there’s 10 ways to do things, but 9 of them aren’t best practice for ensuring sustainable code. That’s the lie of tutorials. Video makers choose the easiest path to get across info in a 1-60 minute time frame. Lots of devs and Epic too, push YouTube / Vimeo channels as a solid learning path. But its not the best route for coding, whatever about Material / FX Tips & Tricks etc.

For me, sample projects are a far better path, especially when Epic or senior devs create the projects. As they help highlight the problems a dev will run into over time - upfront… When you get the current game done, stop for a while. Don’t make any new games. Instead go back and look at the solutions you’ve worked on so far. Then dissect projects from experienced devs in Community Tools / Marketplace. See if you can fundamentally find better ways to do things… Think long term…

Okay thanks, My head is good. I don’t need so many insults with no actual help. That’s not constructive. Sorry