All this is built on Topdown controller blueprint. what it does now is, when I left click the player moves to the location of the mouse at that moment, cast a ray to trace if there is an actor and if there is an actor and the player is in less than 200 units, add this actor to inventory ( then destroy it ). the problem is if I click when the player is in more than 200 units, when the player gets to the location it does not pick the actor I have to click again ( im in range on the second click ). I have no previous experience and im finding very dificult to solve this problem.
The ideal scenario is: if I click when im not in 200 units or less the player goes there and picks the item as soon as I am in 200 units range.
I’ve looked at the setup and there might be a better way to do this that will probably make this also work.
Make a function called pickup, in there do a line trace for objects, make your own object channel in the project settings → Colission, trace ONLY for that object type, then branch if hit, cast to the inventoryitem and then do the addtoinv function. Do this all on left mouse button, not on tick.
Thanks for the tip, it helped me to think in a solution, I changed the “addtoinv” funcion to the “event tick” so every frame it checks if the traced items is on range, and if is on range it picks it. whitout a branch, this may be not the optimal solution, but I inly wanted it for my own purpuse, when I get a programmer to do it he will make it the propper way I guess.
Thanks anyway Panda Studios really apreciate your time.