This is a first attempt to try to make them aim at the head instead of the body. It improves them a little bit, but there's still quite a bit more work to do.
I'm not a python coder, and I know very little about source engine - so apologies if this is rubbish!
I'd like to improve bots a lot more, so if anyone has any knowledge of bots I'd love to hear about it. I've been sat looking at IDA for days without getting very far.
Code: Select all
import memory
from memory import find_binary, DataType, Convention
from memory.hooks import PostHook
from players.entity import Player
from entities.helpers import pointer_from_index
server = memory.find_binary('server', False)
PICK_AIM_SPOT = server['_ZN6CCSBot14PickNewAimSpotEv'].make_function(
Convention.THISCALL,
(DataType.POINTER,),
DataType.INT
)
@PostHook(PICK_AIM_SPOT)
def post_pick_aim_spot(args, return_value):
playerPointer = args[0]
index = playerPointer.get_ushort(20944)
if (index != -1 and index < 32):
entPointer = pointer_from_index(index)
enemy = memory.make_object(Player, entPointer)
eyeLocation = enemy.eye_location
botProfile = playerPointer.get_pointer(12108)
skillLevel = botProfile.get_float(8)
playerPointer.set_float(eyeLocation[0], 20852)
playerPointer.set_float(eyeLocation[1] - (1 - skillLevel), 20856)
playerPointer.set_float(eyeLocation[2], 20860)