I want to make a player retrieve the item from the item granter once the trigger is activated.
But the trigger event needs a ?agent and the item granter needs an agent, and I can’t pass arguments to the function properly.
How can I do this?
The code is as follows.
Thank you in advance for your help.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
sample_granter_device := class(creative_device):
@editable
ItemGranter:item_granter_device=item_granter_device{}
@editable
PlayerSpawners:[]player_spawner_device = array{}
@editable
Trigger:trigger_device = trigger_device{}
OnBegin<override>()<suspends>:void=
Players := GetPlayspace().GetPlayers()
for (Player : Players):
Trigger.TriggeredEvent.Subscribe(ItemGrant)
ItemGrant(Player:agent):void =
ItemGranter.GrantItem(Player)