Hello guys, I recently finished bellow tutorial for pickup/ inspect/ drop item
Seems to be working fine but if I want to drop something, it just falls down to random location.
I am despretly trying to find tutorial that would allow me to place objects to specific location.
Lets say I have a key if I am not near door it simply falls down after dropping, but when I am standing close to doors it will destroy the actor and key will appear in the key hole.
Something like sockets when you pickup a gun.
I am sure there are lots of tutorials and simple solutions but I am not able to find anything.
So please any advice would be aprecieted even if you just give me correct keywords to google it properly.
easy approach would be to check for overlapping doors when you drop the key. … get overlapping actors (door class). If result, take first index (0), get location to spawn key. etc.
thank you very much for reply.
Unfrotunatly my skills are not good enough to use this information.
Is there some youtube tutorial for dummies or picture that shows me how the blueprint looks like?
Are you talking to the objects in your game using blueprint interfaces yet?
When you drop an item, the player can use a trace of some sort to check for actors that implement a ‘use’ interface. That way, you can offer the key to the door, and the door knows what to do with it.
If you haven’t setup this up yet, that would be something to look at, but it’s quite involved and there’s no fixed way of implementing this kind of thing.
Here’s something about interfaces, but it wont say anything about inventory or keys:
I work with interfaces so i can use action button pickup objects by linetrace by channel, interact with doors etc. … so this kind of works
In this case i have a picked up key in my hand
if i go to door I can open them with it and the a key is destroyed/
if i am not close to doors I am droping it with some physics applied so it falls down moreorless randomly on the floor.
So I would like to place actor to doors not to destroy it, however the blueprints are already quite complicated so I am afraid to mess with them too much
I was thinking to cheat it …let the actor be destroyed and simply unhide static mesh of the key placed on doors blueprint
But basicly my desired functionality is to be able to pick up and drop items
on specific locations dropped item will be moved to specific position intead of random one…
like I have a flower if I drop it near vase it will be postioned inside if not it will be just simply dropped on the floor
As said best would be some step by step tutorial. RevOverDrives advice is too wise for me … i can find the function * get overlapping actors * but due to my lack of knowladge I am not sure what exactly to do with it
You have messages in your BPI. You can just add a message, add ‘UseObject’. It’s just another possible message.
Your door, though, knows what to do with the ‘UseObject’ message if you pass it a reference to a key object. It can locate it in the lock and turn it.
Again, if you press the use key with a flower anywhere, the player can drop the flower, but if you’re overlapping an actor that understands the ‘use’ interface, you can pass it a reference to the flower. Only the vase will know what to do with that message.
Like I say, there is no exact tutorial on this, because everybody does it differently.
Do you have the horror game pack? That seems quite well organized to me, I don’t actually know how it does ‘use’ though…
I just realized a better way to do what I’m saying. Put a parameter on your ‘use’ message, which can be the object you want to use.
If you walk up to a door and just say ‘use’, the door knows to open if it’s unlocked. Otherwise, you have to walk up to the door and say ‘use(key)’, and the door will decide if it likes the key. If it does, it can animate the lock etc…
You don’t need the overlap stuff, as long as you can send a BPI message to an actor, you can pass the key as a parameter…
I think you can change your ‘interact with’ call. If the player tries to interact, but there is no object to interact with, then drop the item. Otherwise, actually interact.
I notice the door destroys the key? The door can have its own copy of the key, which it animates into the lock when the inventory key is used.
Does that make sense?
PS: No, you’re not actually passing the key as a parameter. You’re sort of reaching back into the player to get at it. This works of course, but is a little messy