how to handle script for a pick invertory system on multiple iterations of the same asset?
I am working on a University research game project where the player find and pick up objects to work out math sums located on computer monitors, then place objects in front of the door to open it according to the asset, its colour and colour value requirements. but i am stuck in how to handle a pick up system but the trouble is many of the same object spawned in the world but any pick up system would only effect the one that was last spawned. I have got a collusion component around the asset with overlap event that have set Boolean to determine if in range.
How can I make it so the system to knows the different between each iteration and interact with that iteration if in range to fire some pick code. I tried also from trace by object, I run series if statement but no matter what I do it only toggle visibility of the last spawned asset and doesn't change its world location when i set new world location before toggle visibility back when i take object out of inventory. Please help me? I am attaching some of the script
alt textalt text
asked Sep 06 '18 at 10:31 PM in Blueprint Scripting
Is it just the case of not being able to specifically work out how to pick up an object, or is it more to do with inventory management? If it's just picking up the object I usually handle all interaction between classes like this with interfaces.
So I would create a base class that you want to be interacted with, in this case. picked up. and assign a custom blueprint interface to it that will execute your code when called. For instance if you create a blueprint interface and inside you create an event called "Pickup" you can then call that message from within any blueprint by doing, for example a trace in front of your character, and any actors that it hits, call the pickup message on them and the interface will fire if it is hit by the trace. If you then create a bunch of child blueprints off this base class they will all take advantage of this base code and you can add individual behaviour to each child if so desired.
For more information on this method there's an old live stream on this stuff, it's long but has a lot of information in it that should still be relevant.
Hopefully this is what you were after, otherwise I've completely misunderstood the question and I apologise.
answered Sep 06 '18 at 11:57 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here