Event Dispatchers
- If you notice in the BP_Pickup_Parent they have used a Event Dispatcher
- These are documented here
- The basic problem:
- The parent class does not know what to do when the item is picked up.
- For health types, we change health.
- For ammo types, we change ammo
- For a portkey from Harry Potter, we would change the player's location.
- But we do know that Something will need to happen when the item is picked up.
- Declare an event dispatcher.
-
- You can add input parameters if you wish.
- Or copy the function signature from another event.
- They then call it in the parent.
- If it is not set nothing happens.
-
- This node can be added by typing call
- In the child (ammo in this case)
- Declare the function
- And register the callback.
-
- You can apparently have multiple events listed.
- In my probability spawner
-
- I register this event to be called as well.
- So when you pickup something from the spawner
- The amount is modified in the HUD
- The Spawner is called to generate a new item.