What setup should i use to say… add ammo to player through a ground pickup.
I want to be able to walk over a pickup and have it resupply ammo.
If i cast to say a sepcific blueprint… then… when another blueprint runs over it… some guy across the map is going to be like… “Wow… i just Got Ammo for nothing… sweet”
So how can i make an overlap event do its work to the specific blueprint that is overlapping it?
That’s not quite how casting works. Casting is kinda like saying “try to use this object as this other type”, it doesn’t refer to another object elsewhere. It’s generally used in cases where you have a reference to an object’s parent type (like how Event ActorBeginOverlap gives you an Actor reference) but you want to use that reference as a specific child type of that type (for example, SoldierActor). If every actor that can pick up your ammo has a common parent you’ve defined which should ideally have your ammo variable in it, you can cast to that type, and apply the extra ammo to the variable via that reference.
You still feed the overlapped actor reference into the cast, so there’s no danger of referencing a random object somewhere else. The only issue is if you try to cast to the wrong type it’ll trigger the ‘failed’ pin instead of the regular top one.