SpawnNewItem
BP_Spawner
Actor[] ClassToSpawn{BP_Pickup_Child_Damage, BP_Pickup_Child_Health, BP_Pickup_Child_Ammo};
New Event: ChildDiedEvent (an event dispatcher)
BeginPlay()
BindEventTo(ChildDiedEvent, ChildDiedEvent_Event);
SpawnNewItem();
ChildDiedEvent( )
Set A Timer to Call SpawnNewItem(rand(1...5));
BP_Spawner (continued) SpawnNewItem()bounds = Box.GetComponentBounds(); newLoc = RandomPointinBoundingBox(bounds)
class = ClassToSpawn[rand(0..ClassToSpawn.Size()-1)] newItem = SpawnActor(class,newLoc) newItem.MySpawner = this;
Event FinalDestruction DestroyActor() mySpawner.CallChildDiedEvent()
PickupGrabbed // local code for action ... // this is a call to the event created above. invoke FinalDestruction()