-- DESCRIPTION: This is a custom behavior, and can be configured with [customvalue1=0(0,100)], [customvalue2=0(0,100)] and [customvalue3=0(0,100)]. master_interpreter_core = require "scriptbank\\masterinterpreter" -- Define the constants local talkdists = 150 local engageds = 0 ---------- patrol or what ever default activity ------ allowheadshot = 1 range = 150 g_patrol = {} g_patrol_behavior = {} g_patrol_behavior_count = 0 g_stand_idle = {} g_stand_idle_behavior = {} g_stand_idle_behavior_count = 0 ------------------- end ---------------- -------------------------------------------------- function split_properties_init(e) ------------ patrol or default activity --------------------- g_patrol[e] = {} g_patrol[e]["bycfilename"] = "scriptbank\\people\\patrol.byc" g_patrol_behavior_count = master_interpreter_core.masterinterpreter_load (g_patrol[e], g_patrol_behavior ) patrol_properties(e,1) g_stand_idle[e] = {} g_stand_idle[e]["bycfilename"] = "scriptbank\\people\\stand_idle.byc" g_stand_idle_behavior_count = master_interpreter_core.masterinterpreter_load (g_stand_idle[e], g_stand_idle_behavior ) master_interpreter_core.masterinterpreter_restart (g_stand_idle[e], g_Entity[e]) end ---------------------- patrol or default function patrol_properties(e,allowheadshot) g_patrol[e]['allowheadshot'] = allowheadshot master_interpreter_core.masterinterpreter_restart (g_patrol[e], g_Entity[e]) end -------------------------------------------- function split_properties_main(e) PlayerDist = GetPlayerDistance(e) if PlayerDist < talkdists and engageds == 0 then RotateToPlayer(e) engageds = 1 ---------------------- stand there --------- if g_stand_idle[e] ~= nil and g_stand_idle_behavior_count > 0 then g_stand_idle_behavior_count = master_interpreter_core.masterinterpreter (g_stand_idle_behavior, g_stand_idle_behavior_count, e, g_stand_idle[e], g_Entity[e]) end -- debug - report default action takeing place action PromptDuration(" talk to me ",2000) -- debug line above only for testing else -- When player moves away, reset the conversation if PlayerDist > talkdists then --------- process non talking default -------- if g_patrol[e] ~= nil and g_patrol_behavior_count > 0 then g_patrol_behavior_count = master_interpreter_core.masterinterpreter (g_patrol_behavior, g_patrol_behavior_count, e, g_patrol[e], g_Entity[e]) -- debug - report default action takeing place action --PromptDuration(" come on Im walking here ",2000) -- debug line above only for testing -- talktome = 0 end if engageds == 1 then engageds = 0 -------------- reset patrol or other action ---------------- split_properties_init(e) -- debug - report default action takeing place action PromptDuration(" reset ",2000) -- debug line above only for testing ------------------------------------------------------------ end end end end