Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Stagger Fire Turret Controller
- -- Use Local Weapon Controllers as usual for targeting, but set their Max_Firerate to 0
- -- SET THESE FOR USE
- turret_ID = 1 -- 1 for first turret placed, 2 for second, etc...
- interval = 0.250 -- in seconds; use multiples of 0.025s since 1 physics frame = 0.025s
- mainframe_index = 0 -- 0 for first mainframe placed, 1 for second, etc...
- -- DON'T CHANGE ANYTHING BELOW UNLESS YOU KNOW WHAT YOU ARE DOING
- -- initialize global variables
- next_weapon = 0
- weapon_count = 0
- last_fired_time = 0
- function Update(I)
- if (I:GetAIFiringMode(mainframe_index) == 'On') then
- weapon_count = I:GetWeaponCountOnSubConstruct(turret_ID)
- if (I:GetNumberOfTargets(mainframe_index) > 0) then
- if (I:GetGameTime() - last_fired_time >= interval) then
- if (I:FireWeaponOnSubConstruct(turret_ID,next_weapon,0)) then
- last_fired_time = I:GetGameTime()
- next_weapon = (next_weapon + 1) % weapon_count
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement