The main flag script: FlagCaptureZoneServer has a function OnRoundEnd:
function OnRoundEnd()
ResetFlag()
SetEnabled(false)
end
but when the round ends, the flag model stays where it was when the round ended and isn't going back where it's supposed to. (although the server thinks it is .. the functionality goes back, but not the model)
Here is the ResetFlag() function:
function ResetFlag()
if not flagEquipmentInstance then return end
-- Return back the flag to the zone
SetEnabled(false)
flagEquipmentInstance:Unequip()
flagEquipmentInstance:SetWorldPosition(COMPONENT_ROOT:GetWorldPosition() + SPAWN_OFFSET)
flagEquipmentInstance:SetWorldRotation(Rotation.New())
-- Reset networking properties
script:SetNetworkedCustomProperty("IsInZone", true)
script:SetNetworkedCustomProperty("IsFlagCarried", false)
script:SetNetworkedCustomProperty("FlagCarryingTeam", 0)
-- Enable back the flag if not hidden
if not HIDE_FLAG then
Task.Wait(TRIGGER_DELAY)
SetEnabled(true)
end
end
and SetEnabled():
function SetEnabled(trigger)
local currentEnabledState = script:GetCustomProperty("IsEnabled")
if trigger then
script:SetNetworkedCustomProperty("IsEnabled", true)
flagEquipmentInstance.visibility = Visibility.INHERIT
flagEquipmentInstance.collision = Collision.INHERIT
else
script:SetNetworkedCustomProperty("IsEnabled", false)
flagEquipmentInstance.visibility = Visibility.FORCE_OFF
flagEquipmentInstance.collision = Collision.FORCE_OFF
end
-- Broadcasting flag enabled state
Events.Broadcast("FlagEnabledStateChanged", flagEquipmentInstance.id, currentEnabledState, trigger)
end
Does anyone know a fix for this?
This is from the standard ctf framework that Core offers to use for your game when you start your game creation.