I’ve run into an issue with a few blueprints of mine. One is a character, the other an actor.
I’m casting to the actor blueprint from the character blueprint to check the value of a boolean. If the boolean is enabled, I set it to trigger another boolean within the character blueprint. If the boolean is not enabled in the blueprint actor, the boolean within the character blueprint is set to default.
The problem is this works fine when I put the blueprint actor in my level and test it. However when I add additional copies of the same actor, only the first one works.
How is the cast happening, like with a getAllActors node? Really meed a snapshot of that.
If I needed another actor to hold variables for all players/characters, it’d have to use a struct to hold the owning player as well as their collection of variables. Otherwise if it’s one carrier actor to every player/character, I would build it into the character blueprint’s viewport as a child actor and cast directly.
You only Get the first Actor (from the GetAllActorOfClass) which is “0”, you need to add a ForEachLoop after the Get All Actors Array is created (then run through all PoolFloor Actors). So the bottom set of values or the bool value need to be also set in the ForEachLoop (depending what you want to parse to the Floor actors).
It is unclear what exactly you want to do, this is a bit unusual. Though, If you want to trigger something in all these actors at once, you probably want to create a Master Actor (then deploy Child Actors in the level), and then have a function you call. Then you only have to edit the Master Actor if you make adjustments to this function.
If for instance the player has a DetectionSphere which is on collision channel 1 (and overlap with a custom channel called Trigger) and the Actors it should overlap are on channel 2 (Collision channel = Trigger, and overlap with Collision channel = Pawn, or Overlap with a dedicated custom DetectionSphere channel), you could call this function on Event On Overlap Begin. I think you don’t really want here a GetAllActorsOfClass.
What I’m essentially trying to do is allow a player to get within the bounds of the blueprint actor, which then gives them immunity to damage while within those bounds. So like I mentioned above it works for the initial instance/actor but duplicates aren’t. There are 6 duplicates scattered throughout the level. I’ll give your solution a try and see if that solves the problem. =)
Then you want a OnBeginOverlap Event, the GetAllActorsOfClass may work too, but it is not the elegant way, because it triggers all these actors in the level, which is not needed.
Setting up a OnEventOverlap is pretty simple. You add a Sphere or Box Collision to the Actor, then click that component, scroll down on that component panel, and select OnEventBeginOverlap. There you add the code you want to fire when an Actor enters the sphere. You can also check if it is a player with a branch and IsPlayer default function, or Is Actor == PlayerBP.
I tried the examples you gave above. The first one didn’t work at all, the second one worked just like the one in my image above in that it only allows the first instance of the BP actor to work. The Pool_Float BP works on it’s own. All of them function properly individually. The issue is that only one instance in the level is communicating with the Character BP when 6 are placed in a level.
Make a Get from the Other Actor input, cast to the player character then on that output add a == Which add a Actor bool, which you connect to the Other Actor. The bool you add to a branch.
The thing is you set the float PlayerProtected, but the player doesn’t knows this yet, since you set this variable inside the Actor. So you could add a function to your character which you call instead of the float, then set a bool on where you calculate damage, and if that bool is true, the damage is not accounted for.
So I ended up getting around this by including all 6 locations for the blueprint actor within 1 actor. Still would be interested to know how to get this to work with instances in case that may not be possible in the future. I would think the whole point of blueprint actors would be to allow this by default.
When the player enters the collision sphere I have added to the Actor who should trigger invincibility, a bool is set on the player, this bool needs to be connected with a branch (if true), where you calaculate your damage, or where you calculate health. If there are problems with the bool not correctly set on EventEndOverlap, you could add a timer which automatically removes invincibility after a given time.
Character Pawn should be the cast to your Player Character Blueprint.