using { /Verse.org/Simulation }
using { /Verse.org/Verse }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
healing_droid := class(creative_device):
@editable var HealthVolume : volume_device = volume_device{}
@editable var HealthEffect : vfx_spawner_device = vfx_spawner_device{}
@editable var RenewalTime : float = 3.0
@editable var RenewalSpeed : float = 1.0
var HealedMap : [agent]float = map{}
OnBegin<override>()<suspends> : void =
HealthVolume.AgentEntersEvent.Subscribe(OnHealthEnter)
HealthVolume.AgentExitsEvent.Subscribe(OnHealthExit)
OnHealthEnter(who: agent) : void =
set HealedMap[who] = 0.0
spawn:
StartHealthRenewal(who)
OnHealthExit(who: agent) : void =
set HealedMap[who] = -1.0
StartHealthRenewal(who: agent)<suspends> : void =
HealthEffect.Enable()
var initialHealth : float = 0.0
if let c0 = who.GetFortCharacter[] then
set initialHealth = c0.GetHealth()
else
set initialHealth = 0.0
loop:
if let timer = HealedMap[who] then
if timer < 0.0 then
HealthEffect.Disable()
break
if timer >= RenewalTime then
if let cZ = who.GetFortCharacter[] then
cZ.SetHealth(cZ.GetMaxHealth())
cZ.SetShield(cZ.GetMaxShield())
HealthEffect.Disable()
break
var healPerSecond : float = (100.0 - initialHealth) / RenewalTime
var amountThisTick : float = healPerSecond * RenewalSpeed
HealAgent(who, amountThisTick)
set HealedMap[who] = timer + RenewalSpeed
Sleep(RenewalSpeed)
else
HealthEffect.Disable()
break
set HealedMap[who] = -1.0
HealAgent<public>(Agent: agent, Amount: float): void =
if let fc = Agent.GetFortCharacter[] then
var HP : float = fc.GetHealth()
var Shield : float = fc.GetShield()
var MaxHP : float = fc.GetMaxHealth()
var MaxShield : float = fc.GetMaxShield()
var HPMissing : float = MaxHP - HP
var newHP : float = Clamp(HP + Amount, 0.0, MaxHP)
var spillover : float = Amount - HPMissing
if spillover < 0.0 then
set spillover = 0.0
var newSh : float = Clamp(Shield + spillover, 0.0, MaxShield)
fc.SetHealth(newHP)
fc.SetShield(newSh)
i am getting an error and im a complete noob at verse can anyone help me understand how to fix this?
Fortnite Projects/MyProjectB/Plugins/MyProjectB/Content/Verse/healing_droid.verse(31,12, 31,12) : Script error 3100: vErr:S76: Expected block, got “let” following “if”