--sniper script by smallg --change value here to adjust how fast he goes up and down (2500 = 2.5secs) local peek_delay = 2500 local init_peek_delay = peek_delay local stood = {} function sniper_init(e) ai_starting_heath[e] = nil ModulateSpeed(e,1.0) CharacterControlArmed(e) CharacterControlDucked(e) LockCharacterPosition(e) stood[e] = 0 end function sniper_main(e) -- Detect player distance PlayerDist = GetPlayerDistance(e) -- Entity Object Number EntObjNo = g_Entity[e]['obj']; if ai_starting_heath[e] == nil then ai_starting_heath[e] = g_Entity[e]['health'] end --if we can't see the player if g_Entity[e]['plrvisible'] == 0 then --try standing for better view if stood[e] == 0 then CharacterControlStand(e) if GetTimer(e) > peek_delay then peek_delay = GetTimer(e) + init_peek_delay stood[e] = 1 end --still can't see him, duck again until ready to look again elseif stood[e] == 1 then CharacterControlDucked(e) if GetTimer(e) > peek_delay then peek_delay = GetTimer(e) + init_peek_delay stood[e] = 0 end end end --always face player LookAtPlayer(e) RotateToPlayerSlowly(e,10) --fire soon as possible FireWeapon(e) end