I have this wave system where enemies respawn. I remember that i had “increment” node put at the end and the increment to a print string which worked but the health bar widget of the enemies wasnt updating accordingly. So recently i solved the health bar updating issue but now for some reason the increment node isnt working anymore. I didnt change anything on the wave spawner. Any idea how i can make it again that the life increases when they respawn next wave ?
I have on my enemy BP on event tick “do once” node that the max life updates once and sets the max life is equal to the current life amount of the enemy when they spawn and it shows correctly on the healthbar widget
So far so good. Now i need to just increment the max life on the wave spawner so if the max life is set to +20 then it sets the life from 100 base life +20 life then i got 120 life when they spawn. This works too and is here on the spawner
The problem that i have is that after the first wave starts i got the enemy with 120 life and it print strings 120 but it is for all waves. So it should work that the next wave life of the enemy then increase by +20 and they should have 140 life and the next wave again +20 and so on.
Any idea why its not working? I use the increment node which adds +1 life so to say plugged to my max life with add +19 life. So in total thats 20 life but the increment node do not add more for each wave and is aways constant @ 120 life no matter how many waves after. I hope someone know whats going on there and can point me how to solve this thx
If you want to see exposed data on the Spawn Node while having class pin connected, ensure you’ve exposed it in the base class of whatever you’re spawning.
Ideally, every enemy should know how to increase their own health in the base class and the children override it. You tell the enemy that the level has gone up and the enemy looks up (curve / date table / tmap) how much health they need to have now.
i fixed the increment node and now i get more life with each wave but the values are somehow very wierd and it has to do with the loop some nodes back on the code.
wave 1 with this settings i get if i set the max life to 92 and connect it to increment +1 i get this results:
wave 1 =110 life the print string shows some wierd values but the top one is the one i get
like this i have the current life 100 + 5 and +1 on increment so normally you would think i will get next wave 106 life. But i get 130 life for wave 1 Then wave 2 is 154 life wave 3 is 178 life that means +24 life for each wave until a wave spawn where there is only 1 class of enemy then this +24 life breaks and i get +4 life i think… It has something to do with the looping so more enemy classes means more added life… is wierd and like this i can never make it work
Have to check your last post if i can manage to do that in a sec
Edit: i dont have child classes i had normal enemy BP which i duplicate lol so they are all the same BP and no child. Will it be better to create child BP of lets say 1 of my enemies and then move all my other enemy bp’s one by 1 till i have them all as a child of the first enemy bp ?
All my enemies are normal character BP as it seems
Can i just reparent the existing enemy’s going to this class settings and change the Parent Class “Character” to my skelet BP enemy ? So like that they should convert and use the exposed on spawn variables from the skelet bp and this is then counted as child class of the skelet bp if i do this ?
It only works as long as i have the exact same enemy classes spawn.
result is wave 1 i have 125 life wave 2 - 145 wave 3 - 165 wave 4 - 185… wave 5 - 190 life
from wave 1 to 4 i spawn 3 different enemies so it looks like this give me +20 life for each wave and wave 5 i spawn only 1 enemy class that give me +5 life its something with the loop and how many enemy classes i have… i have this get life node connected to “add” node where it is set to 5 but this results in +20 life and not +5 life. I get +5 life per wave only if i have this 1 class spawned alone. If i have more class this +5 can be 50 or more thats just not working
Increase health before you iterate through the classes.
That’s why I suggested doing this in the actual enemy class. The spawner says: get stronger, and the classes interpret it each their own way. Zombies finally get brains & skellies get even more bony.
This sounds the way i would want to do as well. Do i still need for that to make the child blueprints so i get access of the max health variable on the spawn actor node ?
Yup, you’d need to embrace inheritance. For reasons too numerous to mention. You script the shared behaviour in the base class and the unique behaviour in the child classes.
And yes, you can re-parent classes.
I mean, you could get it to work with the system you have where the spawner does all the heavy lifting. But it may become cumbersome if you want to take it far.
Ok if i go to class settings and choose to reparent all my enemies to the skelet one would that work? Or do i need from scratch a base BP with all the shared logic all my enemies will use and then start creating child BP’s of it ?
Yeah the good thing is im not very far and deep in the dev progress on this matter so better to make now a good base which will work later efficient and stable. I plan on this spawner to have a lot of enemies and waves so better this works good. With many i mean somewhere between 60-100 enemies maybe even more and it should work for an endless mode as well where there is no wave limit…
Ok man im still working on this and i’m trying to solve it…
I made new 1 Enemy BP and then i made from it a child BP’s to all my enemies now. And as it seems it works pretty well. They all share the same healthbar widget and this works with no problems for all. Life moves down when i do damage and i can set them with different life amount and it still works. Same is if i add life amount from the spawner they all get equal life increase.
Now the only problem left is that if i have the life increase on the spawner and it increases it equal to the amount of each enemy class i add to the next wave. if i have in the spawner +5 to life increase for each wave then i get +5 life and additionally for each new enemy class added to the wave… Result is then if i have 4 classes i get +20 life to all. So now im wondering how can i move this logic to the enemy classes itself so i can change there the life amount which they should get when a new wave starts.
I should somehow make in the new child enemy classes bp’s logic where in the moment they spawn i then can increase the life. Here is in the spawner itself where this happens:
Now everything works. I can set +10 life for each wave and each enemy gets +10 life and increases for the next wave. It doesnt matter anymore how many classes im spawning its aways fixed number. And with the child classes i can awso easy adjust the base health with each enemy should start so 1 can be 50 another 130 and so and it aways adds +10 or whatever fixed life amount i put there now. Really awsome and i think thats a keeper now ^^