-- DESCRIPTION: This will control a character to engage their enemy within view, can also [!FollowAPath=1] at the start,and is capable of attacking their target and [!CanRetreat=1] to the [RetreatRange=500(200,1000)] when hurt. Sound effects are alerted in , seen target in , lost target in and killed target in . Have this character [!StandGround=0] to defend their position, and when not using a [!RandomFlankMode=1], can optionally [@FlankTarget=1(1=Stay Back, 2=Get Close, 3=Wide Flank)], start [!Alerted=0], [AllowHeadshot!=1], [*CombatTime=15000] and [!CanHearSound=1] within [HearingRange=1250]. master_interpreter_core = require "scriptbank\\masterinterpreter" g_character_attack = {} g_character_attack_behavior = {} g_character_attack_behavior_count = 0 function character_attack_init(e) g_character_attack[e] = {} g_character_attack[e]["bycfilename"] = "scriptbank\\people\\character_attack.byc" g_character_attack_behavior_count = master_interpreter_core.masterinterpreter_load (g_character_attack[e], g_character_attack_behavior ) character_attack_properties(e,1,1,500,0,1,1,0,1,15000,1,1250) end function character_attack_properties(e, followapath, canretreat, retreatrange, standground, randomflankmode, flanktarget, alerted, allowheadshot, combattime, canhearsound, hearingrange) g_character_attack[e]['followapath'] = followapath g_character_attack[e]['canretreat'] = canretreat g_character_attack[e]['retreatrange'] = retreatrange g_character_attack[e]['standground'] = standground g_character_attack[e]['randomflankmode'] = randomflankmode g_character_attack[e]['flanktarget'] = flanktarget g_character_attack[e]['alerted'] = alerted g_character_attack[e]['allowheadshot'] = allowheadshot g_character_attack[e]['combattime'] = combattime g_character_attack[e]['canhearsound'] = canhearsound g_character_attack[e]['hearingrange'] = hearingrange master_interpreter_core.masterinterpreter_restart (g_character_attack[e], g_Entity[e]) end function character_attack_main(e) if g_Entity[e]['health'] < 20 then local obj = g_Entity[3].obj -- my entity ID is 3 - replace by yours to fit your needs. local oX = g_Entity[e]['x'] local oY = g_Entity[3]['y'] local oZ = g_Entity[e]['z'] PositionObject(obj,oX+20,oY,oZ+10) Spawn(3) end if g_character_attack[e] ~= nil and g_character_attack_behavior_count > 0 then g_character_attack_behavior_count = master_interpreter_core.masterinterpreter (g_character_attack_behavior, g_character_attack_behavior_count, e, g_character_attack[e], g_Entity[e]) end --PromptLocal(e,"health="..g_Entity[e]['health']) end