so i tried to spawn a prop with a trigger event which is a ?agent but the spawn prop doesnt work with a ?agent, i tried adding a button i thought i can activate the button with the trigger but i cant, i tried to wrap the function to call a agent type function in a ?agent type function but i cant do it, the code works when i interact with the button
onTriggerActivatedWrapper(Agent: ?agent): void =
if(not PlayersMap[Agent]):
Print("Invalid or undefined agent triggered the event.")
else:
onButtonActivated(Agent)
onButtonActivated(Agent:agent): void =
if(CP := PlayersMap[Agent]):
if(CP.Team = 3):
onTriggerActivated(Agent)
onTriggerActivated(Agent: agent): void =
if (CP := PlayersMap[Agent]):
if (CP.gold >= CostOfProp):
CP.setGoldPerSecond(10)
set CP.gold -= CostOfProp
SpawnedProp := SpawnProp(Prop, V3, IdentityRotation())
else:
Print("Not enough gold to purchase the prop.")