Combat System for UPBGE

I’m trying to make a combat system for an RPG game I’m working on. I’m aiming for some simple mechanics for AI (targeting when close to the player, following the player after targeting), but I also wanted a mechanic where you can select an enemy if they have not spotted you. I have no idea with a start, and I’m just looking for a nudge in the right direction. Any tips?

I can upload .blend file if needed.

ok, have the vision system, when it is activated (monster sees player) -have it set a bool or a timer

have a mouse over sensor in your ‘click on not active monster’ look for this property to see if it should work.
[properties in enemy ‘Chase_Timer’ ]

sensors in ‘enemy select logic’

logic in monster
property Chase_Timer> 0 ---------------and----------add -1 to Chase_Timer

Radar------------------and-------------------set Chase_Timer to 120

Python for select in-active monster logic

import bge

cont = bge.logic.getCurrentController()
TriggerKey = cont.sensors['TriggerKey']
MouseOver = cont.sensors['MouseOver']

if MouseOver.positive and TriggerKey.positive:
    if MouseOver.hitObject['Timer']==0:
        Monster = MouseOver.hitObject
        #do click on monster stuff
1 Like