Plz no judgement i have very little experience with code, I can stutter my way through html and css, and the best I can do is a console calculator in c++…
What I’m trying to make is Basically a mutator zone, which, every 2 seconds heals the player inside it with 45 health. What I’m struggling with is the last part of the code (what any experienced programmer would probably notice). I originally wanted to write this like this:
Heal(Agent : agent) : void =
Instigator : agent = HealingZone.GetInstigatorAgent()
HealthPowerup.Pickup(Instigator)
but then I found some simmilar forum question, and i tried applying the responses to it in my own code, but it still doesnt work.
Heal(Agent : agent) : void =
if (Agent := Heal.GetInstigatorAgent[]):
HealthPowerup.Pickup(Agent)
I tried every possible combination i could think of haha (like HealingZone.AgentEntersEvent.GetInstigatorAgent() and so on), but I honestly have no idea what I’m doing. I took the time to learn the very basics of this language, and I got that, but only that.
Here’s my full code for more context:
using { /Fortnite.com/Playspaces }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# TODO: Heal players inside the zone 45 health per 2 seconds, excluding hero classes
medical_droid_device := class(creative_device):
#A zone, within all Players will receive health
@editable
HealingZone : mutator_zone_device = mutator_zone_device{}
#the poweup, which wil be activated for players inside the zone
@editable
HealthPowerup : health_powerup_device = health_powerup_device{}
OnBegin<override>()<suspends>:void=
HealingZone.AgentEntersEvent.Subscribe(Heal)
Heal(Agent : agent) : void =
if (Agent : agent := HealingZone.GetInstigatorAgent[]):
HealthPowerup.Pickup(Agent)
Here’s my errors
and if anyone would be kind enough, I also need to make a loop with sleep 2, to make the every 2 seconds healing thing, but I have no idea how can I make the AgentExitsEvent break the loop? do i cal it in the loop? On begin? (this came to my mind as of writing this) can I write:
loop:
HealingZone.AgentExitsEvent.Subscribe(break)
#heal
#sleep
?
I’m asking because I cant check it right now. thanks to anyone who takes the time to read this and responds. I just really wanna learn this language