Here in this snippet I have a prop manipulator event “DamagedEvent” subscribed to this other function that simply prints “Gun Fired!” as a test:
sentrygun := class(creative_device):
@editable var Detector : prop_manipulator_device = prop_manipulator_device{}
OnBegin<override>()<suspends>:void=
loop:
Sleep(0.1)
Detector.DamagedEvent.Subscribe(GunFired)
GunFired(Agent : agent):void=
Print("Gun Fired!")
The only issue with this code is when I damage a prop with this prop manipulator attached, it spams the log with “Gun Fired!” many, many times instead of just once, which is what I thought it would do. Can anyone let me know if I’m doing something wrong? Thanks.