Decoys/Lures

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.

Hope i was clear :slight_smile:

hi @Lamaral14

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?

I have this event that turns on/off when the player interacts with the decoy “decoyParent”


And send that variable to “CH_Mutant” like this:

On the “CH_Muntant” i have the event “Chase Decoy” and then i get all the actor from class “decoyParent”:

How do I get Get the world location of the actor that was last activated (on off variable)?

I tried like this but it gets me all the loactions of the all actors on level not the one that was last activated:

Hi man,

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

1 Like

The for each loop node is giving me trouble i dont know why,

I have this part that sets a behaviour tree key as true (goingToDecoy)

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.

BT:

THE PROBLEM:

Before i use the for each loop this was working kinda fine (but just for 1 decoy in level), but when i use this part:

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.

Any ideia why this is happening?

It would be better to leave most of the logic in the decoy and send only the position.

2 Likes

About the BT you should check this tutorial:

1 Like

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:

This part was supose to get the location of the activated (on/off) decoy, and it does.

The problem is that somehow (this part on the image above) makes 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

Reminder: the BT works when i remove this part:

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)

How would you handle the decoy location and the activated state on the mutante end?


You ask for that?

Man Im going crazy with this sh***, sorry the language.

If i set the location to 0 0 0
decoy loaction
The “go to decoy” on BT works

but if I set any value like this:


(these values are the world location of the decoy on level)
the goToDecoy on BT doesnt work!!!

What the hell is going on? every time i open the same project its a diferent issue, im losing it

Why does it work when the value its 0 0 0 but not when is 10 10 10 for example?

"

You ask for that?"
I had something like that before but only worked when i had only 1 decoy in the level

navMesh?

you need all my way

I dont think is a nav mesh problem since when i set the values to 0 0 0, it actually goes to 0 0 0

“you need all my way”

done your way and i have same issue as above and once crashed unreal

I got new info

If i put 1000 on X its works, but if I put -1000 it doesnt work.

Negative values are causing this bug, never happenn to me before any ideia how to fix?