-- global variables mid_x = -3437 mid_y = -25207 mid_z = 2000 recharge_x = -3413 recharge_z = 3334 -- radius_inner -- radius_mid -- radius_outer -- Time variabler that determines the length of actions recharge_time = 5 punch_time = 2 lookaround_time = 2.5 lookaround_blind = 0.8 walk_time = 3 handmine_time = 1 turn_time = 0.5 shouldermine_time = 1 rush_time = 6 laserbot_time = 1 stumble_time_back = 0.5 stumble_time_front = 1 recover_time = 0.8 dmg_time = 2 pi = 3.1415 elec = 0 visibility = 0 -- Bool that keeps track if player been ld by chris electricity recetly last_dmg = 0 -- Bool to keep track of current direction clockwise = 1 -- angle difference in circle between chris and jack angle_diff = 0 player_angle = 0 chris_angle = 0 -- ANIMATIONS SPEEDS lookaround_speed = 1 walk_speed = 1.6 handmine_speed = 1 turn_speed = 1 shoulder_speed = 1 rush_speed = 1 laserbot_speed = 1 stumble_speed = 1 recover_speed = 1 die_speed = 1 punch_speed = 1.2 rush_punch_speed = 1.0 stumble_until = 0 biomechs_active = 0 mines_fired = 0 mines_to_fire = 3 time_between_mines = 0.3 last_laser_bot = 0 recharge_shot = 0 -- PROBS shoulder_prob = 15 walk_prob = 60 -- temporary as we dont have any other anims look_prob = 90 -- Target points for walk/rush target_x = 0 target_z = 1 last_stumble_rush = 800 punch_damage_delay = 1 -- general initializers sleep_until = 0 shield_on = 0 chris_start_health = 800 last_health = 800 recover_at = 300 last_shield_health = 10 max_recover_health = chris_start_health shield_decrease = 0 chris_rot_speed = 100 chris_hit_rad = 60 chris_dmg_range = 150 chris_punch_range = 290 time_between_bots = 35 recharge_health_per_frame = 0.25 total_recharge = 0 test_time = 2 last_test = 0 number_looks = 0 last_look = 0 blind_until = 0 player_spotted = 0 fire_aim_at_x = 0 fire_aim_at_z = 0 hit = 0 last_daddy = 0 stumble_back = 0 aim_until = 0 next_laser_bot_time = 0 PlayAnimNow(0, ANM_CHRIS_IO_IDLE, APT_PLAY_ONCE) function do_wait() PlayAnimNow(0, ANM_CHRIS_IO_IDLE, APT_PLAY_ONCE) think_state = think_wait think0 = state_wait mx, my, mz = Position() SetEnemyPosition(mx,my,mz) end function callback0() AssignDynamicAnimations() Suspend(0) mx, my, mz = Position() SetEnemyPosition(mx,my,mz) activate_shield() think0 = state_init think_state = think_idle end -- This callback is called when the recharge-generator is shot function callback1() recharge_shot = 1 end function callback2() biomechs_active = 0 end function callback3() Print('Callback3\n') end function callback4() if(think0 == state_dead) then Suspend(1) end end function callback5() PlayAnimNow(0,ANM_CHRIS_IO_LOOKRIGHT, APT_PLAY_ONCE,lookaround_speed) end function callback6() PlayAnimNow(0,ANM_CHRIS_IO_LOOKLEFT, APT_PLAY_ONCE,lookaround_speed) end ---------------------------------------------------------------------------- -- HELPER FUNCTIONS ---------------------------------------------------------------------------- function get_room_angle(x,z) local angle = atan2(x,z) return angle end function play_daddy_sound(delay) if(GetTime() > last_daddy + 1) then local s = mod(rand(),3) PlayLoadedSound(4+s,delay) last_daddy = GetTime() end end function sees_hero() if( abs(angle_diff) > 2.0) then player_spotted = 0 end if(player_distance < 300) then if(player_spotted == 0) then play_daddy_sound(0) end player_spotted = 1 return 1 end if( (abs(angle_diff) < 1.7) and ((angle_diff > 0 and clockwise == 0) or (angle_diff < 0 and clockwise == 1)) ) then player_spotted = 1 return 1 end return 0 end function check_angle() player_angle = get_room_angle(px-mid_x,pz-mid_z) chris_angle = get_room_angle(mx-mid_x,mz-mid_z) angle_diff = player_angle - chris_angle if(angle_diff > pi) then angle_diff= angle_diff - 2 * pi end if(angle_diff < -pi) then angle_diff = angle_diff + 2 * pi end -- Print('chris angle: ' .. chris_angle .. '\n') if(clockwise == 1) then set_target_cw() else set_target_ccw() end end function check_shield() if(GetHealth(1) <= 0 and shield_on == 1) then deactivate_shield() activate_stumble_front() elseif(GetHealth(1) < last_shield_health and think_state ~= think_shield_recover and think_state ~= think_stunned) then activate_shield_recover() end shield_decrease = GetHealth(1) - last_shield_health last_shield_health = GetHealth(1) end function check_splash() if(GetAggro() < 50 and think_state ~= think_rush and think_state ~= think_rush_punch and think_state ~= think_goto_recover and think_state ~= think_circulate_to_recover and think_state ~= think_in_recharge) then Print('Stunned\n') activate_stunned() end end function check_health() local health = GetHealth() if(health < last_health) then Print('Hit\n') if(think_state ~= think_stumble and think_state ~= think_pre_rush and think_state ~= think_rush and think_state ~= think_rush_punch and think_state ~= think_goto_recover and think_state ~= think_circulate_to_recover and think_state ~= think_aim_pre_shoot and think_state ~= think_handmine and think_state ~= think_stunned) then activate_stumble_back() end end last_health = health end function set_target_cw() local rad_vector_x = mx-mid_x local rad_vector_z = mz-mid_z target_x = mx-rad_vector_z target_z = mz+rad_vector_x mid_distance = (rad_vector_x * rad_vector_x) + (rad_vector_z*rad_vector_z) if(mid_distance > 810000) then target_x = target_x - rad_vector_x target_z = target_z - rad_vector_z -- Print('Correct for tangent\n') end local player_mid = (px-mid_x)*(px-mid_x)+(pz-mid_z)*(pz-mid_z) --Print('Mid_dist: ' .. player_mid .. '\n') if((player_mid > 450000) and (player_spotted == 1) and (OpenPathTo(123,px,py,pz) == 1) and (think_state ~= think_circulate_to_recover)) then target_x = px target_z = pz end -- Print('Target x: ' .. target_x .. ' Target z: ' .. target_z ..'\n'); end function set_target_ccw() local rad_vector_x = mx-mid_x local rad_vector_z = mz-mid_z target_x = mx+rad_vector_z target_z = mz-rad_vector_x mid_distance = (rad_vector_x * rad_vector_x) + (rad_vector_z*rad_vector_z) if(mid_distance > 810000) then target_x = target_x - rad_vector_x target_z = target_z - rad_vector_z -- Print('Correct for tangent\n') end local player_mid = (px-mid_x)*(px-mid_x)+(pz-mid_z)*(pz-mid_z) --Print('MID DISTANCE' .. player_mid .. '\n') if((player_mid > 450000) and (player_spotted == 1) and (OpenPathTo(123,px,py,pz) == 1) and (think_state ~= think_circulate_to_recover)) then target_x = px target_z = pz end -- Print('Target x: ' .. target_x .. ' Target z: ' .. target_z ..'\n'); end function fire_aim_at() for i = 1, 5 do local xrand = mod(rand(),200)-100 local zrand = mod(rand(),200)-100 fire_aim_at_x = px + xrand fire_aim_at_z = pz + zrand if(OpenPathTo(100,fire_aim_at_x,py,fire_aim_at_z) == 1) then Print('Aim OK!\n') return end Print('Aim NOT OK!\n') end fire_aim_at_x = px fire_aim_at_z = pz end function can_shoot_hero() -- return 0 if(OpenPathTo(100,px,py,pz) == 1) then -- Print('Can shoot hero!\n') return 1 end -- Print('Can NOT shoot hero!\n') return 0 end function call_on_biomechs() if(biomechs_active == 0) then SendMsg('TR:Team72_Enable:TEAM') biomechs_active = 1 end end function activate_shield() if(shield_on == 0) then shield_on = 1 --SetInvulnerable(1) AttachParticleSystem(3, 123, 0 ,-35, 0, 0, 0, 90, 1, 0) Print('Shield turned ON\n') end end function deactivate_shield() if(shield_on == 1) then shield_on = 0 --SetInvulnerable(0) DetatchParticleSystem(3) current_mode = wave1_mode Print('Shield turned OFF\n') end end ---------------------------------------------------------------------- -- STATE FUNCTIONS ---------------------------------------------------------------------- function state_init() px, py, pz = PlayerPos() mx, my, mz = Position() x = mx - px z = mz - pz player_distance = sqrt(x*x + z*z) Print('State INIT\n') PlayAnimNow(0, ANM_CHRIS_IO_IDLE, APT_PLAY_ONCE) SetRotationSpeed(chris_rot_speed) SetHealth(chris_start_health) SetHitRadius(chris_hit_rad) SetCollRadius(100) EnableBossHealth() think0 = state_main activate_walk() end function state_idle() px, py, pz = PlayerPos() mx, my, mz = Position() x = mx - px z = mz - pz player_distance = sqrt(x*x + z*z) if (GetTime() > sleep_until) then DisableBossHealth() Print('Sending death message, goto dead\n') SendMsg(script_argument2) think0 = state_dead end Pause() end function state_dead() Pause() end function state_main() px, py, pz = PlayerPos() mx, my, mz = Position() x = mx - px z = mz - pz player_distance = sqrt(x*x + z*z) ----- react to damage ----- local damage = GetDamage() check_health() ----- react to death ----- if (GetHealth() <= 0) then PlayAnimNow(0, ANM_CHRIS_IO_DIE, APT_PLAY_ONCE, die_speed) PlayLoadedSound(1,0.5) sleep_until = GetTime() + 3 Print('health <= 0, goto idle\n') think0 = state_idle return end check_angle() current_mode() think_state() check_shield() check_splash() update_visibility() end function state_in_event() px, py, pz = PlayerPos() mx, my, mz = Position() x = mx - px z = mz - pz player_distance = sqrt(x*x + z*z) ----- react to damage ----- local damage = GetDamage() --if (damage > 0) then check_health() --end ----- react to death ----- if (GetHealth() <= 0) then PlayAnimNow(0, ANM_CHRIS_IO_DIE, APT_PLAY_ONCE, die_speed) PlayLoadedSound(1,0.5) sleep_until = GetTime() + 3 Print('health <= 0, goto idle\n') think0 = state_idle return end check_shield() check_angle() think_state() check_splash() update_visibility() end function state_wait() think_state() end function update_visibility() if(player_spotted == 1) then visibility = visibility + 1 else visibility = visibility - 2 end if(visibility > 150) then visibility = 150 end if(visibility < 0) then visibility = 0 end --Print('VISIBILITY : ' .. visibility .. '\n') end ---------------------------------------------------------------------- -- ACTIVATE FUNCTIONS ---------------------------------------------------------------------- function activate_punch() SetRotationSpeed(150) PlayAnimNow(0, ANM_CHRIS_IO_RUSH, APT_BLEND_THEN_PLAY,rush_speed) Print('ACTIVATE_PUNCH\n') think0 = state_in_event think_state = think_punch_aim sleep_until = GetTime() + 0.6 end function activate_protect(wait_for) SetInvulnerable(1) PlayAnimNow(0,ANM_CHRIS_IO_PUNCH_STATIC, APT_BLEND_THEN_PLAY_ONCE,walk_speed/100) Print('ACTIVATE PROTECT\n') think0 = state_in_event think_state = think_protect sleep_until = GetTime() + wait_for end function activate_pre_rush() Print('ACTIVATE_PRE_RUSH\n') PlayAnimNow(0,ANM_CHRIS_IO_IDLE,APT_BLEND_THEN_PLAY,lookaround_speed) think_state = think_pre_rush SetRotationSpeed(300) think0 = state_in_event sleep_until = GetTime() + 1 end function activate_rush_punch() Print('ACTIVATE_RUSH_PUNCH\n') think0 = state_in_event think_state = think_rush_punch PlayAnimNow(0, ANM_CHRIS_IO_PUNCH, APT_PLAY_ONCE,rush_punch_speed) sleep_until = GetTime() + punch_time aim_until = GetTime() + punch_time/3 end function activate_lookright() if(clockwise == 0) then clockwise = 1 else clockwise = 0 end last_look = 0 number_looks = number_looks + 1 Print('ACTIVATE_LOOKRIGHT\n') PlayAnimNow(0,ANM_CHRIS_IO_LOOKLEFT, APT_PLAY_ONCE,lookaround_speed) think_state = think_look think0 = state_in_event sleep_until = GetTime() + lookaround_time blind_until = GetTime() + lookaround_blind end function activate_lookaround() Print('ACTIVATE_LOOKAROUND\n') PlayAnimNow(0,ANM_CHRIS_IO_IDLE,APT_BLEND_THEN_PLAY,recover_speed) think_state = think_pre_lookaround think0 = state_in_event number_looks = 0 sleep_until = GetTime() + 1.6 end function activate_lookleft() if(clockwise == 0) then clockwise = 1 else clockwise = 0 end last_look = 1 number_looks = number_looks + 1 Print('ACTIVATE_LOOKLEFT\n') PlayAnimNow(0,ANM_CHRIS_IO_LOOKRIGHT, APT_PLAY_ONCE,lookaround_speed) think_state = think_look think0 = state_in_event sleep_until = GetTime() + lookaround_time blind_until = GetTime() + lookaround_blind end function activate_aim() Print('ACTIVATE_AIM\n') PlayAnimNow(0,ANM_CHRIS_IO_IDLE,APT_BLEND_THEN_PLAY,lookaround_speed) SetRotationSpeed(300) think_state = think_aim_pre_walk think0 = state_in_event end function activate_aim_shoot() Print('ACTIVATE_AIM\n') PlayAnimNow(0,ANM_CHRIS_IO_SHOOT,APT_BLEND_THEN_PLAY_ONCE,lookaround_speed) SetRotationSpeed(300) think_state = think_aim_pre_shoot think0 = state_in_event end function activate_walk() Print('ACTIVATE_WALK\n') PlayAnimNow(0,ANM_CHRIS_IO_WALK, APT_BLEND_THEN_PLAY,walk_speed) think_state= think_circulate think0 = state_in_event sleep_until = GetTime() + walk_time end function activate_handmine() AimAt(px,pz) Print('ACTIVATE_HANDMINE\n') PlayAnimNow(0, ANM_CHRIS_IO_SHOOT, APT_PLAY_ONCE, handmine_speed) think_state= think_handmine think0 = state_in_event sleep_until = GetTime() + handmine_time end function activate_rush() --activate_recover() Print('ACTIVATE_RUSH\n') PlayAnimNow(0,ANM_CHRIS_IO_RUSH,APT_BLEND_THEN_PLAY,rush_speed) think_state= think_rush think0 = state_in_event sleep_until = GetTime() + rush_time end function activate_stumble_front() Print('ACTIVATE_STUMBLE_FRONT\n') PlayAnimNow(0,ANM_CHRIS_IO_STUMBLE_FRONT,APT_BLEND_THEN_PLAY_ONCE,stumble_speed) SetRotationSpeed(chris_rot_speed) think_state= think_stumble think0 = state_in_event sleep_until = GetTime() + stumble_time_front stumble_back = 0 end function activate_stumble_back() Print('ACTIVATE_STUMBLE_BACK\n') PlayAnimNow(0,ANM_CHRIS_IO_STUMBLE_BACK,APT_PLAY_ONCE,stumble_speed) SetRotationSpeed(chris_rot_speed) think_state= think_stumble think0 = state_in_event sleep_until = GetTime() + stumble_time_back stumble_back = 1 end function activate_recover() SetInvulnerable(0) Print('ACTIVATE_RECOVER\n') PlayAnimNow(0,ANM_CHRIS_IO_IDLE,APT_BLEND_THEN_PLAY,recover_speed) think_state = think_recover think0 = state_in_event sleep_until = GetTime() + recover_time end function activate_shield_recover() Print('ACTIVATE SHIELD RECOVER\n') PlayAnimNow(0,ANM_CHRIS_IO_PUNCH_STATIC,APT_BLEND_THEN_PLAY,recover_speed) SetRotationSpeed(chris_rot_speed*2) think_state = think_shield_recover think0 = state_in_event player_spotted = 1 sleep_until = GetTime() + 1.5 end function activate_go_to_recover() walk_speed = 2.0 PlayAnimNow(0,ANM_CHRIS_IO_PUNCH_STATIC, APT_BLEND_THEN_PLAY,walk_speed) Print('GOTO_RECOVER\n') if(chris_angle < 0) then clockwise = 0 else clockwise = 1 end --call_on_biomechs() think_state = think_circulate_to_recover think0 = state_in_event end function activate_stunned() PlayAnimNow(0,ANM_CHRIS_IO_STUMBLE_FRONT,APT_BLEND_THEN_PLAY_ONCE,stumble_speed) think_state = think_stunned think0 = state_in_event elec = 0 stumble_until = GetTime() + 1 sleep_until = GetTime() + 10 end ---------------------------------------------------------------------- -- THINK FUNCTIONS ---------------------------------------------------------------------- function think_wait() --Print('Think wait\n') --if(GetTime() > (test_time + last_test)) then -- AttachParticleSystem(0, 100, 75, 8, 8, 0, 0, 277) -- last_test = GetTime() --end Pause() end function think_idle() AimAt(px, pz) think0 = state_main Pause() end function think_punch() if( GetTime() < aim_until) then AimAt(px, pz) end if (GetTime() > sleep_until) then -- think0 = state_main -- think_state = think_idle SetRotationSpeed(chris_rot_speed) visibility = 0 activate_recover() end Pause() end function think_stunned() if(GetTime() > stumble_until and elec == 0) then PlayAnimNow(0,ANM_COMBAT_ELECTRIFIED,APT_BLEND_THEN_PLAY,1.0) elec = 1 end if(GetTime() > sleep_until) then play_daddy_sound(0.8) activate_pre_rush() end Pause() end function think_protect() AimAt(px,pz) Print('IN PROTECT\n') if(GetTime() > sleep_until) then Print('DEACTIVATE PROTECT\n') SetInvulnerable(0) play_daddy_sound(0.8) activate_aim_shoot() SetRotationSpeed(chris_rot_speed) end Pause() end function think_punch_aim() if((abs(AimAt(px,pz)) < 0.01) or (GetTime() > sleep_until)) then SetRotationSpeed(chris_rot_speed) PlayAnimNow(0, ANM_CHRIS_IO_PUNCH, APT_PLAY_ONCE,punch_speed) think_state = think_punch sleep_until = GetTime() + punch_time aim_until = GetTime() + punch_time/2 end end function think_rush_punch() if( GetTime() < aim_until) then AimAt(px, pz) end if (GetTime() > sleep_until) then -- think0 = state_main -- think_state = think_idle activate_recover() visibility = 0 --activate_walk() end Pause() end function think_circulate() AimAt(target_x,target_z) if(sees_hero() == 1 or player_spotted == 1) then if(angle_diff > 0) then clockwise = 0 else clockwise = 1 end end if(sees_hero() == 1 and visibility == 150) then play_daddy_sound(0) activate_pre_rush() visibility = 0 elseif(GetTime() > sleep_until) then think0 = state_main think_state = think_idle end isclose() Pause() end function think_handmine() if(GetTime() > sleep_until) then think_state = think_handmine_fire fire_aim_at() end Pause() end function think_handmine_fire() AimAt(fire_aim_at_x,fire_aim_at_z) if(GetTime() > sleep_until and can_shoot_hero() == 1) then if(mines_fired == mines_to_fire) then mines_fired = 0 activate_walk() else FireUtilWeapon(UTILSLOT1,UTILITYFIRE_CHRISMINE) PlayLoadedSound(3) AttachParticleSystem(mines_fired, 100, 75, 8, 8, 0, 0, 277) sleep_until = GetTime() + time_between_mines mines_fired = mines_fired + 1 fire_aim_at() end elseif(GetTime() > sleep_until + time_between_mines) then activate_pre_rush() end Pause() end function think_look() AimAt(mid_x,mid_z) if(isclose() == 0) then if(GetTime() > sleep_until) then if(sees_hero() == 1 and can_shoot_hero() == 1) then play_daddy_sound(0) activate_walk() else if(number_looks < 2) then if(last_look == 0) then activate_lookleft() else activate_lookright() end else clockwise = mod(rand(),2) think0 = state_main think_state = think_idle end end elseif(GetTime() > blind_until) then if(sees_hero() == 1 and can_shoot_hero() == 1) then --play_daddy_sound(0) activate_walk() end end end Pause() end function think_pre_lookaround() if(GetTime() > sleep_until) then Print('ACTIVATE_LOOKAROUND\n') think_state = think_lookaround end end function think_aim_pre_walk() Print('AIM PRE WALK\n') if(abs(AimAt(px,pz)) < 0.01) then activate_walk() SetRotationSpeed(chris_rot_speed) end end function think_aim_pre_shoot() Print('AIM PRE WALK\n') if(abs(AimAt(px,pz)) < 0.01) then activate_handmine() SetRotationSpeed(chris_rot_speed) end end function think_lookaround() AimAt(mid_x,mid_z) if(clockwise == 0) then activate_lookright() else activate_lookleft() end Pause() end function think_rush() -- if close to player aim at him if(sees_hero() == 1 or player_spotted == 1) then if(angle_diff > 0) then clockwise = 0 else clockwise = 1 end end --if(((player_distance < 500) and ((angle_diff > 0 and clockwise == 0) or (angle_diff < 0 and clockwise == 1)))) then if(((OpenPathTo(123,px,py,pz) == 1) and ((angle_diff > 0 and clockwise == 0) or (angle_diff < 0 and clockwise == 1)))) then AimAt(px,pz) player_spotted = 1 if(player_distance < 310) then visibility = 0 activate_rush_punch() end else AimAt(target_x,target_z) end if(GetTime() > sleep_until or player_distance < chris_dmg_range) then activate_recover() end Pause() end function think_recover() if(GetTime() > sleep_until) then think0 = state_main think_state = think_idle end Pause() end function think_pre_rush() AimAt(px,pz) if(GetTime() > sleep_until) then activate_rush() SetRotationSpeed(chris_rot_speed) end Pause() end function think_shield_recover() if(think_state ~= think_stunned) then AimAt(px,pz) end if(GetTime() > sleep_until) then Print('Shield recover END ---------------\n') player_spotted = 1 play_daddy_sound(0.8) activate_aim_shoot() SetRotationSpeed(chris_rot_speed) end Pause() end function think_stumble() if(GetTime() > sleep_until) then --SetInvulnerable(0) Print('STUMBLE max recover: ' .. max_recover_health .. '\n') Print('STUMBLE recover_at: ' .. recover_at .. '\n') Print('STUMBLE health: ' .. GetHealth() .. '\n') if(GetHealth() < max_recover_health-recover_at) then SetInvulnerable(1) activate_go_to_recover() else Print('Last sumble: ' .. last_stumble_rush .. '\n') Print('Health: ' .. GetHealth() .. '\n') if(stumble_back == 1) then activate_protect(1.0) else SetRotationSpeed(chris_rot_speed*2) activate_protect(1.2) end end end Pause() end function think_circulate_to_recover() AimAt(target_x,target_z) if(abs(chris_angle) < 0.1) then think_state = think_goto_recover end Pause() end function think_goto_recover() AimAt(recharge_x,recharge_z) local dist_x = recharge_x - mx local dist_z = recharge_z - mz local dist = sqrt(dist_x*dist_x + dist_z*dist_z) if(dist < 100) then PlayAnimNow(0, ANM_CHRIS_IO_IDLE, APT_PLAY_ONCE) total_recharge = 0 think_state = think_in_recharge FireLaserBot(0) SetTargetable(0) Print('In cradle, sends CHRIS_IO:Activate:GEN01') recharge_shot = 0 SendMsg('CHRIS_IO:Activate:GEN01') end Pause() end function think_in_recharge() if(total_recharge > recover_at*0.75 ) then walk_speed = 1.6 activate_shield() activate_recover() SetCurrentHealth(10,1) max_recover_health = GetHealth() SendMsg('CHRIS_IO:Deactivate:GEN01') SetTargetable(1) visibility = 0 FireLaserBot(1) end if(recharge_shot == 1) then walk_speed = 1.6 activate_shield() activate_recover() SetCurrentHealth(10,1) max_recover_health = GetHealth() SetTargetable(1) visibility = 0 FireLaserBot(1) end SetCurrentHealth(GetHealth() + recharge_health_per_frame,0) total_recharge = total_recharge + recharge_health_per_frame Pause() end ---------------------------------------------------------------------- -- CHECK FUNCTIONS ---------------------------------------------------------------------- function isclose() ----- react to being near the player ----- if (player_distance < chris_punch_range and think_state ~= think_punch and think_state ~= think_rush_punch and think_state ~= think_rush) then player_spotted = 1 activate_punch() Print('Punch!!!\n') return 1 end return 0 end ---------------------------------------------------------------------- -- MODES ---------------------------------------------------------------------- function wave1_mode() -- activate_weapon = activate_handmine Print('Player spotted: ' .. player_spotted .. '\n') if(isclose() == 0) then if(sees_hero() == 1 and can_shoot_hero() == 1) then activate_walk() else local event = mod(rand(),100) if(event < 20 and player_spotted == 0) then activate_lookaround() else activate_walk() end end end end CreateUtilWeapon(UTILSLOT1,UTILITYWEAPON_CHRIS) LoadParticleSystem(0, 'Particles/Chris_Muzzle01.pcf') LoadParticleSystem(1, 'Particles/Chris_Muzzle01.pcf') LoadParticleSystem(2, 'Particles/Chris_Muzzle01.pcf') LoadParticleSystem(3, 'Particles/Wade_power.pcf') LoadSound(1, 'BIOCHRIS_DIE') LoadSound(3, 'ROCKETLAUNCHER_SHOT') LoadSound(4, 'BIOCHRIS_DADDY1') LoadSound(5, 'BIOCHRIS_DADDY2') LoadSound(6, 'BIOCHRIS_DADDY3') activate_weapon = activate_handmine think0 = state_init current_mode = wave1_mode think_state = think_idle do_wait()