So i have a character class that checks lockers and i want it to check these lockers once before moving to a different locker and checking that one, i have the system set up (not very well made because i am a fairly new person to UE4) for it to check the lockers and move to them but the only problem is it checks the same lockers over and over again after it has already checked it, so i made a boolean that sets to true if the AI checks the locker and since i have multiple lockers that are just duplicates placed into the world the boolean affects all of them instead of just one of the lockers. If anyone could help me with this that would be greatly appreciated, thank you. (some screenshots of the code if neccessary):
You need to put the boolean in the locker blueprint. As the AI inspects a locker, it sets the bool for that locker.
or just save an array of searched lockers on the AI and check if it is already present. this is a bit more modular
How would i go about doing that? Sorry if this is a stupid question.
Having an array of searched lockers is not modular, BTW. Having the bool inside the locker blueprint is…
It’s just a boolean in the lock blueprint.
When the AI searches a locker, it sets the boolean to true for that locker
the reason i say its more modular is that each AI would know what it has searched, whereas if the bool is on the locker all AI will think theyve searched it, so really it just depends on your game design
Ah, yes
Depends on how you’ve setup the gameplay.
Then, the locker BP, would need an array of AIs. If a reference to the AI is in the list, they’ve searched this locker.
Sorry for repeating myself but how exactly would i implement this into my blueprint?
the locker is an actor so when the AI searches the locker addunique to an array of actors and if you need to check if its been searched just use the contains node on the array
Sorry if i am asking too much but i still don’t fully understand how to achieve this, could you perhaps provide some images for reference?
Which answer are you talking about? ( You need to use the reply button )
i was asking Auran13
change locker ref to locker array
where you currently set locker ref change that to an addunique to the locker array variable
replace the “haslockerbeenchecked bool” with (get locker array - contains node, aslocker) place this right before your sequence
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.