Hey everybody, i wanted to ask if anyone knows a good decoy/lure tutorial, something like a static/fixed machine that makes noise or emits light when turned on and then the enemy chases that lure and once it learns that its a lure doesnt go back to it.
I kinda managed to do this already the problem is that only works properly with one decoy/lure one the level, if i want do have more than one decoy/lure doesnt work.
I´m looking for a tutorial that teaches me how to create a blueprint of an object that will be use multiple times in the level and when is activated it stores the location, state (on/off) etc… of each instance and also to know how to acess that informacion of thoses instances placed in the level.
always break the problem you have in smaller one !
there is no tutorial for anything, and much stuff is based on how you want to make them!
So:
you can access information in instance placed in a level using
get all actor of class, this give you the list of the actors you select by type.
you can access their variables and events , check the “cast to” node too
You can manage all actorsdecoy singularly with the array from the get all actor of class.
you can set all off but 1, and any other thing.
for making the enemy “detect” the decoy … well it really depend on what you already made up.
basically when you set a decoy ON
the enemy should get a message/event/dispatch… that a decoy is activated and he gonna check.
Once the enemy is near the decoy, he can turn off the decoy,
and also store the decoy actor location or reference,
so if the next time the player reactive the same decoy
your enemy can check that that decoy was already used, and ignore him
I have managed to to all these things already the problem is it didnt worked once i had more than 1 decoy in the levelm but im gonna try your sugestion and use the get all actor of class.
Just one more question if i use the Parent class for this “get all actor of class” it will work for the child classes or just the parent?
You have to decide how ,
in your last image you are using “for each loop” that will make the set the world position for all the actors…
if you want to set the actor of only the active, you can add here a check
If decoy collider on/off is true---- > set actor position
if is false - do nothing
even more if you have more decoy enabled in order
and you want the enemy to chase the last one activated, or the first, or
the one with more strong signal…
you can add a variable in the decoy to store this information
So when you for example active decoy 1 with power 10 and decoy 2 with power 5
you can choose how interact
loopin and checking the variables in all decoy,
example:
Loop alll the deccoy and find the one with more power, set the actorposition to only that.
Loop all decoy and find the one with lower number_of activation
you can take a look also on how sort arrays bbut is marginal
In the tree after enemy reaches the decoy location it waits 3 seconds then the task “LeaveDecoy” call the event “leaveDecoy” on the enemy bp and after that event is called its sets the key “goingToDecoy” to false, making the enemy go back to roaming, i also add a variable “turnOnCount” to see if the decoy was ever turned on to make sure that the enemie learns that decoy and doesnt go back to it.
The behaviour tree doenst work well, it recives the decoy location but instead of going to that location it goes back to roam as if something was turning the Blackboard key “goingToDecoy” to false, it should only go back to roam after 3 seconds after reaching the decoy location and with the for each loop node it doesnt even stay 2 seconds in the going to decoy sequence in BT.
i used this tutorial to do my BT, it was working the way I wanted before I insert the “for each loop” node, but only worked for one decoy instance in level
I tried your sugestion and i notice that was very similar to what i already had on my decoy, the problem is not in the decoy bp, as i said before the BT was working well before i add this part here:
…execute before it should, this only should execute after 3 seconds after mutant reaches decoy location, this part sets the Blackboard key “goingToDecoy” to false which makes the mutant go to the roaming state in the behaviour tree
You are sending the location of all decoys actives and and taking the last one on the list.
So you will never take the one that just activated the player (except by chance)