How do you effect one instance of a blueprint if you have multiples of the same blueprint in a level?
For example, I have a lock on system that when it locks on to the enemy it triggers a widget to overlap the enemy but it triggers on every enemy so they all have a widget overlayed on them.
So, You have âMainCharacterâ and âEnemyâ (instances of object enemy) right? Does enemy instance has some kind of interact widget?
For example. Red boxes are all of same Blueprint (class). But, letâs say OnOverlapEvent, only one shows InteractWidget, i.e. âEâ⌠Is that something youâre going for?
I will insinuate that You have a global (world instantiated) widget, and probably instancing it on every class of âenemyâ. If thatâs the case Iâd add âOverlapWidgetâ to list of Components of âenemyâ class, set itâs visibility to false, and then when event is triggered (which should be just on the enemy youâre targeting), change visibility. That helps?
I have a lock on mechanic that is a capsule component that checks if the actor has the tag âEnemyâ. When the tag is valid it also checks a boolean related to the actor and triggers the widget to display.
Well, if all enemies have the âEnemyâ tag, itâs normal that the widget is showed on all of them. What about that other BOOL?
Thats the problem. The boolean is just a check that ticks when the target is valid which triggers the widget to display. The problem is that its setting it as true in the BP_actor and reading as true for all of them. How would i make it only effect that individual enemy?
OK⌠If weâre to solve this a bit of information is needed⌠So, just one enemy_actor has âenemyâ tag?.. Whereâs the boolean declared and what is it checking?
Seem to me like all of your enemy_players share some global variable⌠Which youâre checking.
Picture 1
So this runs through the code for setting up the lock on running the sphere trace for objects. At the end is when the EnemyLocked (boolean) is set. This was made so I could set a true or false in the Enemy BP.
Picture 2
This is the enemy BP Itâs just checking if that boolean is true or not to set that widget to appear or not. Thatâs where my problem is. I know just setting it that way is whatâs causing the issue, I just donât know how to fix it or to only specifically effect the enemy thatâs actually targeted.
Well Iâm not sure I quite understand all of this, but shouldnât you just be checking if the hit_actor has tag? I mean⌠In this way, parsing that boolean to EnemyBP all of them get it as TRUE.
i. e. if the enemy is hit a. i. traced->set_true
It would be the same setup as in here but instead of a timeline, youâd fire widget visibility events:
In a nutshell, store a reference to what youâre looking at, so you can still interact with it (disable it) when youâre no longer looking at it.
And hereâs a more resource-conscious alternative:
Since we need only 1 lock-on widget visible at the same time, move the same widget from one target to another. The player owns the widget and moves it to where itâs needed.
Ok Iâll check it out thank you for your help!
Thank you for taking the time and helping me out!
Ok so this kind of thing will work for a system I already have built?
This is the system my lock on is based on.
Itâs a common, generic and pretty agnostic approach. Both of them are.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.