So I intend to implement a blueprint system so that when the character collects the keys strewn around the map the monster becomes faster by a set amount. So far all my attempts have failed and I’m really stuck for what to do
First create a function on your monster called something like handleNewKeyCollected
When a key is collected you need the key to call that function. Your options for getting a pointer to the monster are:
GetAllActorsOfClass
Use a design-time pointer. (Requires having the keys and monster as actors sitting in the level at design time)
Store a reference to the monster somewhere globally when you spawn it and request it from the keys(like in the gamemode). Example: get GameMode → Cast to your gamemode → get monsterReferenceVariable
For simplicity here I would use GetAllActorsOfClass.and for the class use your monster’s. Then from that array you can loop through them and for each one call handleNewKeyCollected.
handleNewKeyCollected will take the previous speedUp and add some pre-desired amount to it. The key to remember is that after you add them you store the new value back into speedUp or it won’t continuously get faster.
Also as a note, your second screenshot has you setting the PickupItem integer but the value you are passing in comes from an add node that is connected to functionality that never gets called. This will have bad results. Either plug your execution chain into the newFunction node or skip pickup item. I’m sure this is just from messing around but it will cause issues if you are relying on it.