Summary
When using the GetHealth() function on a fort_vehicle its returning 0.0 health, even though I can see that the vehicle is in the world and does not have 0.0 health. I wanted to use this to check through Verse if the vehicle is destroyed or not, but this seems to only work while a player is inside the vehicle. I was using a biplane spawner when I encountered this, but it probably affects all vehicles.
Please select what you are reporting on:
Verse
What Type of Bug are you experiencing?
Verse
Steps to Reproduce
Create a Verse device to check GetHealth(). Here’s an example I made using a pickup truck spawner and a button device to trigger the checking function.
var Vehicle : [int]fort_vehicle = map{}
@editable VehicleSpawner : vehicle_spawner_pickup_truck_device = vehicle_spawner_pickup_truck_device{}
@editable Button : button_device = button_device{}
OnBegin<override>()<suspends>:void=
VehicleSpawner.SpawnedEvent.Subscribe(VehicleSpawned)
Button.InteractedWithEvent.Subscribe(CheckVehicleHealth)
VehicleSpawned(FVehicle : fort_vehicle):void=
spawn{AssignVehicle(FVehicle)}
AssignVehicle(FVehicle : fort_vehicle)<suspends>:void=
Sleep(0.0)
if(set Vehicle[0] = FVehicle):
CheckVehicleHealth(Agent:agent):void=
if(Vehic := Vehicle[0]):
Print("Vehicle Health {Vehic.GetHealth()}")
After creating the Verse device, build verse code, put the device in the world, fill out the vehicle spawner and button editables, then push changes or launch session. Then start game and press the button while you can see that the vehicle is spawned in.
Expected Result
I would expect it to always return the correct current health amount of the vehicle.
Observed Result
It returns health as 0.0 if a player isn’t in the vehicle. If a player is in the vehicle then it works fine.
Platform(s)
windows