So I am turning off a turret with:
Now with this of course it should turn it off. However if the turret is locked onto someone it sometimes turns off but the animation still locks onto a player and moves. Is there any way to clear its locked on list then turn it off? Or how do you suggest I do it.Code:turret.SetFlag(BaseEntity.Flags.On, false); turret.SendNetworkUpdateImmediate();
Cannot turn a turret off if he is locked onto someone
Discussion in 'Rust Development' started by DylanSMR, Aug 4, 2016.
-
Have you tried calling SetIsOnline(bool online) on the AutoTurret?
Or if you want to play the server effect (sound), InitiateShutdown()Code:turret.SetIsOnline(false);
Code:turret.InitiateShutdown();
-
So I see where you are going. How would I go about turning a entity into Auto Turret? Im using a Vis.Entities to pull nearby entities. With those vis entities how can i convert? As I need AutoTurret to preform those.
-
If you have a BaseEntity that is actually an AutoTurret you should be able to cast it.
-
I ended up doing: if (turret is AutoTurret) turret.GetComponent<AutoTurret>().target = null;
