If I have 2 pickup locations(target points), assume I spawn a powerup(at begin of level) on each location(target points). What would the logic be to know when to spawn another pickup when a power up has been collected by the hero at one of the target points? I wish to avoid spawning power ups if the power up is already placed on a target point on the level.
I cannot figure out how to know if a pickup point is empty and needs a power up to be spawned. Since I have the pickup event happening in the [MyCharacter Blueprint], because it modifies the players health and ammo.
Any help would be appreciated on the logic to spawn power ups in 2 target point locations and know when these target points are empty, then spawn a power up?
Thank you for explaining,
How would I check to see if TargetPoint1 or TargetPoint2 is empty?
Because when Player picks up [PowerUp], I don’t know how to tell which target point that power up is on.
When you say “pickup spawner” do you mean the target point and create an event on this target spawner? Like onOverlap… set HasBeenPickedUp = True?
Ahh brilliant, thank you. I will try this.
Without getting too specific, what you’d want is a public boolean variable in the pickup spawner like bHasBeenPickedUp that is set to true when the player picks it up - then the spawning logic would only work after checking bHasBeenPickedUp = true, plus maybe a delay so it doesn’t spawn immediately after the player picks it up.
You would have to have blueprint communication setup between the spawner and the CharacterBP so they can read/change each other’s specific public boolean variables.
This is the doc for blueprint communication:
You can always use a Sphere Overlap if you know the exact vector of the powerup.
Yep It worked, thanks a bunch! Much appreciated.
BTW each targetPoint should only have to be aware if its self if it is empty or not. If you’re using ‘self’ as the target reference, then each instance blueprint of targetPoint will only perform on itself, not both at the same time.
If you need to track them as a group, like if 2 specific TriggerPoints (out of 10 instances) have been activated, you would need a lot of evaluation logic to see which instance has been activated , for example you could compare coordinates (get location) if they are each in a different HAND PLACED location.
That’s a lot of work, instead I would assign them to a parent class that holds the evaluation logic, and give each child a unique class name (ie: TriggerPointHealthA class, TriggerPointHealthB class, TriggerPointGunPickupA, etc) as children under TriggerPointGroup parent class. Much easier to keep track of.
yes to onoverlap.
Yes spawner = target point.
If the player gets different effects from different pickups then I would make each type its own class and maybe create a blueprint interface to hold the functionality.