Ah ok, yeah you’re right, at first glance it looked like you were trying to call BombDetonated
with a definition but it was actually the definition ha, the indention threw me off!
I haven’t actually used this script/tutorial but I’ve just gone through it and taken the code snippets they’ve provided and put it into a single file. Done the same with yours and formatted/indented to the same as the original. Popped it in a diff checker and noticed that this:
Print("Bomb A Armed",?Duration:5.0)
Should be:
Print("Bomb A Armed",?Duration:=5.0)
It’s missing the =
which I believe corresponds to the error you’re getting as it wouldn’t compile, but I would have thought you should have gotten an error in VSCode already?
But try that and let me know.
And just for reference, here is the full script taken from the tutorial (it doesn’t include the imports at the top using { ... }
etc though so make sure you add them back in)
# enum to determine the state of the bombs
bomb_state<public>:= enum {AllUnarmed, BombAArmed, BombBArmed}
search_and_destroy := class(creative_device):
Logger:log = log{Channel:=log_search_and_destroy}
@editable
TimedObjectiveA: timed_objective_device = timed_objective_device{}
@editable
TimedObjectiveB: timed_objective_device = timed_objective_device{}
@editable
ExplosiveBarrelsA: []explosive_device = array{}
@editable
ExplosiveBarrelsB: []explosive_device = array{}
@editable
EndGameDevice: end_game_device = end_game_device{}
@editable
BombAMapIndicators: []map_indicator_device = array{}
@editable
BombBMapIndicators: []map_indicator_device = array{}
@editable
BombABeaconArm: beacon_device = beacon_device{}
@editable
BombABeaconDisarm: beacon_device = beacon_device{}
@editable
BombBBeaconArm: beacon_device = beacon_device{}
@editable
BombBBeaconDisarm: beacon_device = beacon_device{}
var BombState:bomb_state = bomb_state.AllUnarmed
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
# The race expression is used to run a block of two or more async expressions concurrently (simultaneously). When the fastest expression completes, it "wins the race".
# https://www.fortnite.com/en-US/creative/docs/uefn/race-in-verse
race:
block:
# Wait for Bomb A to be armed
ArmingPlayer:= TimedObjectiveA.StartedEvent.Await()
Print("Bomb A Armed",?Duration:=5.0)
# Used to know which beacons to enable and barrels need to explode
set BombState = bomb_state.BombAArmed
# Disable the other Timed Objective device
TimedObjectiveB.Disable(ArmingPlayer)
# Disable map indicators for Bomb B
for (MapIndicator : BombBMapIndicators):
MapIndicator.Disable()
block:
# Wait for Bomb B to be armed
ArmingPlayer:= TimedObjectiveB.StartedEvent.Await()
Print("Bomb B Armed",?Duration:=5.0)
# Used to know which beacons to enable and barrels need to explode
set BombState = bomb_state.BombBArmed
# Disable the other Timed Objective device
TimedObjectiveA.Disable(ArmingPlayer)
# Disable map indicators for Bomb A
for (MapIndicator : BombAMapIndicators):
MapIndicator.Disable()
# Enable the correct Beacon Devices now a bomb is armed
UpdateBeacons()
# Wait for the TimedObjective to Complete or be Stopped
race:
block:
BombDetonated(TimedObjectiveA.CompletedEvent.Await())
block:
BombDetonated(TimedObjectiveB.CompletedEvent.Await())
block:
DisarmingPlayer:= TimedObjectiveA.StoppedEvent.Await()
Print("Bomb Disarmed", ?Duration:=5.0)
EndGameDevice.Activate(DisarmingPlayer)
block:
DisarmingPlayer:= TimedObjectiveB.StoppedEvent.Await()
Print("Bomb Disarmed", ?Duration:=5.0)
EndGameDevice.Activate(DisarmingPlayer)
# Disable the unarmed Beacons and enable the Beacon over the armed bomb
UpdateBeacons():void=
BombABeaconArm.Disable()
BombBBeaconArm.Disable()
if:
BombState = bomb_state.BombAArmed
then:
BombABeaconDisarm.Enable()
else:
BombBBeaconDisarm.Enable()
BombDetonated(Agent:agent):void=
Print("Bomb Detonated", ?Duration:=5.0)
# Determine which set barrels should explode
if:
BombState = bomb_state.BombAArmed
then:
ExplodeBarrels(ExplosiveBarrelsA, Agent)
else:
ExplodeBarrels(ExplosiveBarrelsB, Agent)
EndGameDevice.Activate(Agent)
ExplodeBarrels(Barrels:[]explosive_device, Agent:agent):void=
for (Barrel : Barrels):
Barrel.Explode(Agent)
Just an FYI, I haven’t tested this, I just put the snippets together…