Page 1 of 1

Oberon Boss with trigger

Posted: 08 Jul 2019, 16:47
by Templaso
Hello guys! I'm here with a special plugin for my server and make it public for all. I want oberon to appear when a Counter-Terrorist(CT) trigger a zone or something like that. And to have cvars for this.

Oberon Boss
  1. #include <amxmodx>
  2. #include <engine>
  3. #include <fakemeta>
  4. #include <hamsandwich>
  5. #include <xs>
  6.  
  7. #define OBERON_CLASSNAME "oberon"
  8. #define OBERON_HEALTH 40000.0
  9.  
  10. #define TASK_SKILL 123123123
  11. #define TASK_HOOKINGUP 123312312
  12. #define TASK_HOOKINGDOWN 123312313
  13.  
  14. new const oberon_model[] = "models/boss/zbs_bossl_big02.mdl"
  15. new const oberon_knife_effect[] = "models/boss/ef_knife.mdl"
  16. new const oberon_hole_effect[] = "models/boss/ef_hole.mdl"
  17. new const oberon_bomb_model[] = "models/boss/zbs_bossl_big02_bomb.mdl"
  18.  
  19. new const oberon_appear_sound[] = "misc/boss/appear.wav"
  20. new const oberon_death_sound[] = "misc/boss/death.wav"
  21. new const oberon_evolution_sound[] = "misc/boss/knife.wav"
  22. new const oberon_attack_sound[8][] =
  23. {
  24.     "misc/boss/attack1.wav",
  25.     "misc/boss/attack2.wav",
  26.     "misc/boss/attack3_jump.wav",
  27.     "misc/boss/attack3.wav",
  28.     "misc/boss/knife_attack1.wav",
  29.     "misc/boss/knife_attack2.wav",
  30.     "misc/boss/knife_attack3_jump.wav",
  31.     "misc/boss/knife_attack3.wav"
  32. }
  33. new const oberon_hole_sound[] = "oberon/hole.wav"
  34. new const oberon_bomb_sound[] = "oberon/attack_bomb.wav"
  35.  
  36. new oberon_model_id, g_reg, m_iBlood[2], exp_spr_id
  37. new Float:g_cur_origin[3], Float:g_cur_angles[3], Float:g_cur_v_angle[3]
  38. new g_evolution, g_evoluting, g_doing_other, g_attacking3, Float:g_attacking3_origin[3]
  39.  
  40. public plugin_init()
  41. {
  42.     register_plugin("Oberon Boss", "1.0", "Dias & ModsCs")
  43.    
  44.     register_event("HLTV", "event_newround", "a", "1=0", "2=0")
  45.     register_touch(OBERON_CLASSNAME, "*", "fw_touch")
  46.    
  47.     register_clcmd("say /zapiszmiejsce", "get_origin", ADMIN_LEVEL_H)
  48.     register_clcmd("say /stworzbossa", "create_oberon", ADMIN_LEVEL_H)
  49. }
  50.  
  51. public plugin_precache()
  52. {
  53.     oberon_model_id = precache_model(oberon_model)
  54.     precache_model(oberon_knife_effect)
  55.     precache_model(oberon_hole_effect)
  56.     precache_model(oberon_bomb_model)
  57.    
  58.     precache_sound(oberon_appear_sound)
  59.     precache_sound(oberon_death_sound)
  60.     precache_sound(oberon_evolution_sound)
  61.     for(new i = 0; i < sizeof(oberon_attack_sound); i++)
  62.     {
  63.         precache_sound(oberon_attack_sound[i])
  64.     }
  65.     precache_sound(oberon_hole_sound)
  66.     precache_sound(oberon_bomb_sound)
  67.    
  68.     m_iBlood[0] = precache_model("sprites/blood.spr")
  69.     m_iBlood[1] = precache_model("sprites/bloodspray.spr") 
  70.     exp_spr_id = precache_model("sprites/zerogxplode.spr")
  71. }
  72.  
  73. public event_newround()
  74. {
  75.     static ent
  76.     ent = find_ent_by_class(-1, OBERON_CLASSNAME)
  77.    
  78.     if(task_exists(ent+TASK_SKILL)) remove_task(ent+TASK_SKILL)
  79. }
  80.  
  81. public get_origin(id)
  82. {
  83.    
  84.     pev(id, pev_origin, g_cur_origin)
  85.     pev(id, pev_angles, g_cur_angles)
  86.     pev(id, pev_v_angle, g_cur_v_angle)
  87.    
  88.     client_print(id, print_chat, "[Oberon Boss] Zapisano miejsce stworzenia")
  89. }
  90.  
  91. public create_oberon(id)
  92. {
  93.     new ent = create_entity("info_target")
  94.    
  95.     entity_set_origin(ent, g_cur_origin)
  96.     entity_set_vector(ent, EV_VEC_angles, g_cur_angles)
  97.     //entity_set_vector(ent, EV_VEC_v_angle, g_cur_v_angle)
  98.    
  99.     entity_set_float(ent, EV_FL_takedamage, 1.0)
  100.     entity_set_float(ent, EV_FL_health, OBERON_HEALTH + 1000.0)
  101.    
  102.     entity_set_string(ent,EV_SZ_classname, OBERON_CLASSNAME)
  103.     entity_set_model(ent, oberon_model)
  104.     entity_set_int(ent, EV_INT_solid, SOLID_SLIDEBOX)
  105.     entity_set_int(ent, EV_INT_movetype, MOVETYPE_STEP)
  106.    
  107.     new Float:maxs[3] = {100.0, 100.0, 100.0}
  108.     new Float:mins[3] = {-100.0, -100.0, -30.0}
  109.     entity_set_size(ent, mins, maxs)
  110.     entity_set_int(ent, EV_INT_modelindex, oberon_model_id)
  111.    
  112.     set_entity_anim(ent, 1)
  113.    
  114.     set_pev(ent, pev_iuser4, 0)
  115.    
  116.     entity_set_float(ent, EV_FL_nextthink, halflife_time() + 6.0)
  117.     set_task(5.0, "start_oberon", ent)
  118.    
  119.     set_task(15.0, "do_random_skill", ent, _, _, "b")
  120.    
  121.     if(!g_reg)
  122.     {
  123.         RegisterHamFromEntity(Ham_TakeDamage, ent, "fw_takedmg", 1)
  124.         RegisterHamFromEntity(Ham_Think, ent, "fw_think")
  125.         g_reg = 1
  126.     }  
  127.    
  128.     g_evolution = 0
  129.     g_evoluting = 0
  130.     g_doing_other = 0
  131.    
  132.     drop_to_floor(ent)
  133.     emit_sound(ent, CHAN_BODY, oberon_appear_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  134. }
  135.  
  136. public start_oberon(ent)
  137. {
  138.     set_entity_anim(ent, 2)
  139. }
  140.  
  141. public fw_think(ent)
  142. {
  143.     if(!is_valid_ent(ent))
  144.         return HAM_IGNORED
  145.        
  146.     if(pev(ent, pev_iuser4) == 1) // Oberon nie zyje
  147.         return HAM_IGNORED
  148.        
  149.     if(g_evoluting || g_doing_other)
  150.         return HAM_IGNORED
  151.        
  152.     if(pev(ent, pev_health) - 1000.0 <= 0.0)
  153.     {
  154.         set_pev(ent, pev_iuser4, 1)
  155.         set_entity_anim(ent, 20)
  156.         set_task(15.0, "move_entity", ent)
  157.         entity_set_int(ent, EV_INT_solid, SOLID_NOT)
  158.         entity_set_float(ent, EV_FL_takedamage, 0.0)
  159.        
  160.         emit_sound(ent, CHAN_BODY, oberon_death_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  161.        
  162.         return HAM_IGNORED
  163.     }
  164.     if((pev(ent, pev_health) - 1000.0 <= OBERON_HEALTH / 2.0) && !g_evolution)
  165.     {
  166.         g_evoluting = 1
  167.         set_entity_anim(ent, 11)
  168.        
  169.         emit_sound(ent, CHAN_BODY, oberon_evolution_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  170.         set_task(8.0, "set_new_idle", ent)
  171.        
  172.         return HAM_IGNORED
  173.     }  
  174.    
  175.     static victim
  176.     static Float:Origin[3], Float:VicOrigin[3], Float:distance
  177.    
  178.     victim = FindClosesEnemy(ent)
  179.     pev(ent, pev_origin, Origin)
  180.     pev(victim, pev_origin, VicOrigin)
  181.    
  182.     distance = get_distance_f(Origin, VicOrigin)
  183.    
  184.     if(is_user_alive(victim))
  185.     {
  186.         if(distance <= 250.0)
  187.         {
  188.             if(!is_valid_ent(ent))
  189.                 return FMRES_IGNORED   
  190.        
  191.             new Float:Ent_Origin[3], Float:Vic_Origin[3]
  192.            
  193.             pev(ent, pev_origin, Ent_Origin)
  194.             pev(victim, pev_origin, Vic_Origin)        
  195.        
  196.             npc_turntotarget(ent, Ent_Origin, victim, Vic_Origin)
  197.            
  198.             static Attack_Type, attack_anim, attack_sound
  199.             Attack_Type = random_num(1, 2)
  200.            
  201.             if(Attack_Type == 1)
  202.             {
  203.                 if(g_evolution)
  204.                 {
  205.                     attack_anim = 14
  206.                     attack_sound = 4
  207.                 } else {
  208.                     attack_anim = 6
  209.                     attack_sound = 0
  210.                 }
  211.                
  212.                 set_entity_anim(ent, attack_anim)
  213.                 emit_sound(ent, CHAN_BODY, oberon_attack_sound[attack_sound], 1.0, ATTN_NORM, 0, PITCH_NORM)
  214.                
  215.                 set_task(1.0, "do_takedmg", ent)
  216.                
  217.                 entity_set_float(ent, EV_FL_nextthink, get_gametime() + 3.0)
  218.             } else {
  219.                 if(g_evolution)
  220.                 {
  221.                     attack_anim = 15
  222.                     attack_sound = 5
  223.                 } else {
  224.                     attack_anim = 7
  225.                     attack_sound = 1
  226.                 }
  227.                    
  228.                 set_entity_anim(ent, attack_anim)  
  229.                 emit_sound(ent, CHAN_BODY, oberon_attack_sound[attack_sound], 1.0, ATTN_NORM, 0, PITCH_NORM)
  230.                
  231.                 set_task(0.5, "do_takedmg", ent)           
  232.                
  233.                 entity_set_float(ent, EV_FL_nextthink, get_gametime() + 3.0)
  234.             }
  235.            
  236.         }
  237.         else
  238.         {
  239.             static moving_anim
  240.            
  241.             if(g_evolution)
  242.                 moving_anim = 13
  243.             else
  244.                 moving_anim = 3    
  245.        
  246.             if(pev(ent, pev_sequence) != moving_anim)
  247.             {
  248.                 entity_set_float(ent, EV_FL_animtime, get_gametime())
  249.                 entity_set_float(ent, EV_FL_framerate, 1.0)
  250.                 entity_set_int(ent, EV_INT_sequence, moving_anim)
  251.             }
  252.                
  253.             new Float:Ent_Origin[3], Float:Vic_Origin[3]
  254.            
  255.             pev(ent, pev_origin, Ent_Origin)
  256.             pev(victim, pev_origin, Vic_Origin)
  257.            
  258.             npc_turntotarget(ent, Ent_Origin, victim, Vic_Origin)
  259.             hook_ent(ent, victim, 100.0)
  260.            
  261.             entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.1)
  262.         }
  263.     }
  264.     else
  265.     {
  266.         static idle_anim
  267.        
  268.         if(g_evolution)
  269.             idle_anim = 12
  270.         else
  271.             idle_anim = 2
  272.            
  273.         if(pev(ent, pev_sequence) != idle_anim)
  274.         {
  275.             set_entity_anim(ent, idle_anim)
  276.         }  
  277.            
  278.         entity_set_float(ent, EV_FL_nextthink, get_gametime() + 1.0)
  279.     }  
  280.     return HAM_HANDLED
  281. }
  282.  
  283. public do_random_skill(ent)
  284. {
  285.     if(!pev_valid(ent))
  286.         return PLUGIN_HANDLED
  287.        
  288.     if(g_evoluting)
  289.         return PLUGIN_HANDLED
  290.        
  291.     if(pev(ent, pev_health) - 1000.0 <= 0.0)
  292.         return PLUGIN_HANDLED
  293.    
  294.     static random_skill
  295.     random_skill = random_num(0, 100)
  296.    
  297.     g_doing_other = 1
  298.    
  299.     switch(random_skill)
  300.     {
  301.         case 0..37:
  302.         {
  303.             do_attack3(ent)
  304.         }
  305.         case 38..72:
  306.         {
  307.             do_hole(ent)
  308.         }
  309.         case 73..100:
  310.         {
  311.             do_bomb(ent)
  312.         }      
  313.     }  
  314.     return PLUGIN_CONTINUE
  315. }
  316.  
  317. public do_bomb(oberon)
  318. {
  319.     g_doing_other = 1
  320.    
  321.     static bomb_anim
  322.     if(g_evolution)
  323.         bomb_anim = 18
  324.     else
  325.         bomb_anim = 9
  326.        
  327.     set_entity_anim(oberon, bomb_anim)
  328.    
  329.     set_task(3.0, "do_skill_bomb", oberon+2015, _, _, "b")
  330.     set_task(10.0, "stop_skill_bomb", oberon)
  331. }
  332.  
  333. public stop_skill_bomb(oberon)
  334. {
  335.     remove_task(oberon+2015)
  336.    
  337.     static idle_anim
  338.    
  339.     if(g_evolution)
  340.         idle_anim = 12
  341.     else
  342.         idle_anim = 2
  343.        
  344.     set_entity_anim(oberon, idle_anim)
  345.     set_task(2.0, "reset_think", oberon)
  346. }
  347.  
  348. public do_skill_bomb(oberon)
  349. {
  350.     oberon -= 2015
  351.     static Float:StartOrigin[3], Float:TempOrigin[6][3], Float:VicOrigin[6][3], Float:Random1
  352.    
  353.     pev(oberon, pev_origin, StartOrigin)
  354.     emit_sound(oberon, CHAN_BODY, oberon_bomb_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  355.    
  356.     // Pierwsza Bomba
  357.     Random1 = random_float(100.0, 500.0)
  358.     VicOrigin[0][0] = StartOrigin[0] + Random1
  359.     VicOrigin[0][1] = StartOrigin[1]
  360.     VicOrigin[0][2] = StartOrigin[2]
  361.    
  362.     TempOrigin[0][0] = VicOrigin[0][0] - (Random1 / 2.0)
  363.     TempOrigin[0][1] = VicOrigin[0][1]
  364.     TempOrigin[0][2] = VicOrigin[0][2] + 500.0
  365.    
  366.     // Druga Bomba
  367.     Random1 = random_float(100.0, 500.0)
  368.     VicOrigin[1][0] = StartOrigin[0]
  369.     VicOrigin[1][1] = StartOrigin[1] + Random1
  370.     VicOrigin[1][2] = StartOrigin[2]
  371.    
  372.     TempOrigin[1][0] = VicOrigin[1][0]
  373.     TempOrigin[1][1] = VicOrigin[1][1] - (Random1 / 2.0)
  374.     TempOrigin[1][2] = VicOrigin[1][2] + 500.0 
  375.    
  376.     // Trzecia Bomba
  377.     Random1 = random_float(100.0, 500.0)
  378.     VicOrigin[2][0] = StartOrigin[0] - Random1
  379.     VicOrigin[2][1] = StartOrigin[1]
  380.     VicOrigin[2][2] = StartOrigin[2]
  381.    
  382.     TempOrigin[2][0] = VicOrigin[2][0] - (Random1 / 2.0)
  383.     TempOrigin[2][1] = VicOrigin[2][1]
  384.     TempOrigin[2][2] = VicOrigin[2][2] + 500.0 
  385.    
  386.     // Czwarta Bomba
  387.     VicOrigin[3][0] = StartOrigin[0]
  388.     VicOrigin[3][1] = StartOrigin[1] - Random1
  389.     VicOrigin[3][2] = StartOrigin[2]
  390.    
  391.     TempOrigin[3][0] = VicOrigin[3][0]
  392.     TempOrigin[3][1] = VicOrigin[3][1] - (Random1 / 2.0)
  393.     TempOrigin[3][2] = VicOrigin[3][2] + 500.0
  394.    
  395.     // Piata Bomba
  396.     VicOrigin[4][0] = StartOrigin[0] + Random1
  397.     VicOrigin[4][1] = StartOrigin[1] + Random1
  398.     VicOrigin[4][2] = StartOrigin[2]
  399.    
  400.     TempOrigin[4][0] = VicOrigin[4][0] - (Random1 / 2.0)
  401.     TempOrigin[4][1] = VicOrigin[4][1] - (Random1 / 2.0)
  402.     TempOrigin[4][2] = VicOrigin[4][2] + 500.0
  403.    
  404.     // Szusta Bomba
  405.     VicOrigin[5][0] = StartOrigin[0] + Random1
  406.     VicOrigin[5][1] = StartOrigin[1] - Random1
  407.     VicOrigin[5][2] = StartOrigin[2]
  408.    
  409.     TempOrigin[5][0] = VicOrigin[5][0] + (Random1 / 2.0)
  410.     TempOrigin[5][1] = VicOrigin[5][1] - (Random1 / 2.0)
  411.     TempOrigin[5][2] = VicOrigin[5][2] + 500.0 
  412.    
  413.     for(new i = 0; i < 6; i++)
  414.     {
  415.         make_bomb(StartOrigin, TempOrigin[i], VicOrigin[i])
  416.     }  
  417. }
  418.  
  419. public make_bomb(Float:StartOrigin[3], Float:TempOrigin[3], Float:VicOrigin[3])
  420. {
  421.     new ent = create_entity("info_target")
  422.    
  423.     StartOrigin[2] += 20.0
  424.    
  425.     entity_set_origin(ent, StartOrigin)
  426.    
  427.     entity_set_string(ent,EV_SZ_classname, "oberon_bomb")
  428.     entity_set_model(ent, oberon_bomb_model)
  429.     entity_set_int(ent, EV_INT_solid, SOLID_NOT)
  430.     entity_set_int(ent, EV_INT_movetype, MOVETYPE_BOUNCE)
  431.    
  432.     new Float:maxs[3] = {10.0,10.0,10.0}
  433.     new Float:mins[3] = {-10.0,-10.0,-5.0}
  434.     entity_set_size(ent, mins, maxs)
  435.    
  436.     entity_set_float(ent, EV_FL_animtime, get_gametime())
  437.     entity_set_float(ent, EV_FL_framerate, 1.0)
  438.     entity_set_int(ent, EV_INT_sequence, 0)    
  439.    
  440.     static arg[4], arg2[4]
  441.    
  442.     arg[0] = ent
  443.     arg[1] = floatround(TempOrigin[0])
  444.     arg[2] = floatround(TempOrigin[1])
  445.     arg[3] = floatround(TempOrigin[2])
  446.  
  447.     arg2[0] = ent
  448.     arg2[1] = floatround(VicOrigin[0])
  449.     arg2[2] = floatround(VicOrigin[1])
  450.     arg2[3] = floatround(VicOrigin[2]) 
  451.    
  452.     set_task(0.01, "do_hook_bomb_up", TASK_HOOKINGUP, arg, sizeof(arg), "b")
  453.     set_task(1.0, "do_hook_bomb_down", _, arg2, sizeof(arg2))
  454.     set_task(2.0, "bomb_explode", ent)
  455. }
  456.  
  457. public bomb_explode(ent)
  458. {
  459.     remove_task(TASK_HOOKINGUP)
  460.     remove_task(TASK_HOOKINGDOWN)
  461.    
  462.     static Float:Origin[3]
  463.     pev(ent, pev_origin, Origin)
  464.    
  465.     message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
  466.     write_byte(TE_EXPLOSION)
  467.     engfunc(EngFunc_WriteCoord, Origin[0])
  468.     engfunc(EngFunc_WriteCoord, Origin[1])
  469.     engfunc(EngFunc_WriteCoord, Origin[2])
  470.     write_short(exp_spr_id) // sprite index
  471.     write_byte(20)  // scale in 0.1's
  472.     write_byte(30)  // framerate
  473.     write_byte(0)   // flags
  474.     message_end()  
  475.    
  476.     for(new i = 1; i < get_maxplayers(); i++)
  477.     {
  478.         if(is_user_alive(i) && entity_range(i, ent) <= 300.0)
  479.         {
  480.             static Float:Damage
  481.             Damage = random_float(10.0, 30.0)
  482.            
  483.             if(g_evolution)
  484.                 Damage *= 2.0
  485.                
  486.             ExecuteHam(Ham_TakeDamage, i, 0, i, Damage, DMG_BLAST)
  487.             hit_screen(i)
  488.         }
  489.     }  
  490.    
  491.     remove_entity(ent)
  492. }
  493.  
  494. public do_hook_bomb_down(arg[4])
  495. {
  496.     remove_task(TASK_HOOKINGUP)
  497.     set_task(0.01, "do_hook_bomb_down2", TASK_HOOKINGDOWN, arg, sizeof(arg), "b")
  498. }
  499.  
  500. public do_hook_bomb_down2(arg[4])
  501. {
  502.     static ent, Float:VicOrigin[3]
  503.    
  504.     ent = arg[0]
  505.     VicOrigin[0] = float(arg[1])
  506.     VicOrigin[1] = float(arg[2])
  507.     VicOrigin[2] = float(arg[3])   
  508.    
  509.     hook_ent2(ent, VicOrigin, 500.0)
  510. }
  511.  
  512. public do_hook_bomb_up(arg[4])
  513. {
  514.     static ent, Float:TempOrigin[3]
  515.    
  516.     ent = arg[0]
  517.     TempOrigin[0] = float(arg[1])
  518.     TempOrigin[1] = float(arg[2])
  519.     TempOrigin[2] = float(arg[3])
  520.    
  521.     hook_ent2(ent, TempOrigin, 500.0)
  522. }
  523.  
  524. public do_hole(oberon)
  525. {
  526.     static hole_anim
  527.    
  528.     if(g_evolution)
  529.         hole_anim = 19
  530.     else
  531.         hole_anim = 10
  532.        
  533.     set_entity_anim(oberon, hole_anim)
  534.     emit_sound(oberon, CHAN_BODY, oberon_hole_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  535.    
  536.     new ent = create_entity("info_target")
  537.    
  538.     static Float:Origin[3]
  539.     pev(oberon, pev_origin, Origin)
  540.    
  541.     Origin[2] -= 10.0
  542.    
  543.     entity_set_origin(ent, Origin)
  544.    
  545.     entity_set_string(ent,EV_SZ_classname, "hole_hook")
  546.     entity_set_model(ent, oberon_hole_effect)
  547.     entity_set_int(ent, EV_INT_solid, SOLID_NOT)
  548.     entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE)
  549.    
  550.     new Float:maxs[3] = {1.0,1.0,1.0}
  551.     new Float:mins[3] = {-1.0,-1.0,-1.0}
  552.     entity_set_size(ent, mins, maxs)
  553.    
  554.     entity_set_float(ent, EV_FL_animtime, get_gametime())
  555.     entity_set_float(ent, EV_FL_framerate, 1.0)
  556.     entity_set_int(ent, EV_INT_sequence, 0)
  557.    
  558.     set_pev(ent, pev_rendermode, kRenderTransAdd)
  559.     set_pev(ent, pev_renderamt, 255.0) 
  560.    
  561.     drop_to_floor(ent)
  562.    
  563.     for(new i = 0; i < get_maxplayers(); i++)
  564.     {
  565.         if(is_user_alive(i) && entity_range(oberon, i) <= 1000.0)
  566.         {
  567.             static arg[2]
  568.             arg[0] = oberon
  569.             arg[1] = i
  570.            
  571.             set_task(0.01, "do_hook_player", 512512, arg, sizeof(arg), "b")
  572.         }
  573.     }
  574.    
  575.     set_task(5.0, "stop_hook", oberon+2012)
  576. }
  577.  
  578. public do_hook_player(arg[2])
  579. {
  580.     static Float:Origin[3], Float:Speed
  581.     pev(arg[0], pev_origin, Origin)
  582.    
  583.     Speed = (1000.0 / entity_range(arg[0], arg[1])) * 75.0
  584.    
  585.     hook_ent2(arg[1], Origin, Speed)
  586. }
  587.  
  588. public stop_hook(oberon)
  589. {
  590.     oberon -= 2012
  591.    
  592.     static ent
  593.     ent = find_ent_by_class(-1, "hole_hook")
  594.    
  595.     remove_entity(ent)
  596.     remove_task(512512)
  597.    
  598.     do_takedmg(oberon)
  599.     set_task(1.0, "reset_think", oberon)
  600. }
  601.  
  602. public do_attack3(ent)
  603. {
  604.     static attack3_anim, attack3_sound
  605.    
  606.     if(g_evolution)
  607.     {
  608.         attack3_anim = 16
  609.         attack3_sound = 6
  610.     } else {
  611.         attack3_anim = 8
  612.         attack3_sound = 2
  613.     }  
  614.    
  615.     g_attacking3 = 1
  616.    
  617.     set_entity_anim(ent, attack3_anim)
  618.    
  619.     emit_sound(ent, CHAN_BODY, oberon_attack_sound[attack3_sound], 1.0, ATTN_NORM, 0, PITCH_NORM)
  620.     set_task(0.1, "attack3_jump", ent)
  621. }
  622.  
  623. public attack3_jump(ent)
  624. {
  625.     set_task(0.01, "hookingup", ent+TASK_HOOKINGUP, _, _, "b")
  626.     set_task(1.0, "hookingdown", ent+TASK_HOOKINGDOWN) 
  627.    
  628.     static Enemy
  629.     Enemy = FindClosesEnemy(ent)   
  630.    
  631.     pev(Enemy, pev_origin, g_attacking3_origin)
  632. }
  633.  
  634. public hookingup(ent)
  635. {
  636.     ent -= TASK_HOOKINGUP
  637.    
  638.     static Float:Origin[3]
  639.     pev(ent, pev_origin, Origin)
  640.    
  641.     Origin[2] += 1000.0
  642.    
  643.     hook_ent2(ent, Origin, 1000.0)
  644.    
  645.     static Enemy
  646.     Enemy = FindClosesEnemy(ent)   
  647.    
  648.     new Float:Ent_Origin[3], Float:Vic_Origin[3]
  649.    
  650.     pev(ent, pev_origin, Ent_Origin)
  651.     pev(Enemy, pev_origin, Vic_Origin)
  652.    
  653.     npc_turntotarget(ent, Ent_Origin, Enemy, Vic_Origin)   
  654. }
  655.  
  656. public hookingdown(ent)
  657. {
  658.     ent -= TASK_HOOKINGDOWN
  659.    
  660.     remove_task(ent+TASK_HOOKINGUP)
  661.     set_task(0.5, "set_func1", ent)
  662.    
  663.     set_task(0.01, "hookingdown2", ent+TASK_HOOKINGDOWN, _, _, "b")
  664. }
  665.  
  666. public set_func1(ent)
  667. {
  668.     set_pev(ent, pev_iuser3, 1)
  669. }
  670.  
  671. public hookingdown2(ent)
  672. {
  673.     ent -= TASK_HOOKINGDOWN
  674.    
  675.     static Enemy
  676.     Enemy = FindClosesEnemy(ent)
  677.    
  678.     hook_ent2(ent, g_attacking3_origin, 1000.0)
  679.    
  680.     new Float:Ent_Origin[3], Float:Vic_Origin[3]
  681.    
  682.     pev(ent, pev_origin, Ent_Origin)
  683.     pev(Enemy, pev_origin, Vic_Origin)
  684.    
  685.     npc_turntotarget(ent, Ent_Origin, Enemy, Vic_Origin)       
  686. }
  687.  
  688. public fw_touch(ent, touch)
  689. {
  690.     if(!pev_valid(ent))
  691.         return FMRES_IGNORED
  692.        
  693.     if(g_attacking3 && pev(ent, pev_iuser3) == 1)
  694.     {
  695.         remove_task(ent+TASK_HOOKINGDOWN)
  696.        
  697.         if(is_user_alive(touch))
  698.             user_kill(touch)
  699.            
  700.         g_attacking3 = 0
  701.         set_pev(ent, pev_iuser3, 0)
  702.        
  703.         set_task(0.75, "reset_think", ent)
  704.        
  705.         for(new i = 1; i < get_maxplayers(); i++)
  706.         {
  707.             if(is_user_alive(i) && entity_range(ent, i) <= 300.0)
  708.             {
  709.                 hit_screen(i)
  710.                
  711.                 static Float:Damage
  712.                 Damage = random_float(10.0, 25.0)
  713.                
  714.                 if(g_evolution)
  715.                     Damage *= 1.5
  716.                
  717.                 ExecuteHam(Ham_TakeDamage, i, 0, i, Damage, DMG_BLAST)
  718.             }
  719.         }  
  720.        
  721.         static attack3_sound
  722.         if(g_evolution)
  723.             attack3_sound = 7
  724.         else
  725.             attack3_sound = 3
  726.        
  727.         emit_sound(ent, CHAN_BODY, oberon_attack_sound[attack3_sound], 1.0, ATTN_NORM, 0, PITCH_NORM)      
  728.            
  729.         drop_to_floor(ent)
  730.     }
  731.        
  732.     return FMRES_HANDLED
  733. }
  734.  
  735. public do_takedmg(ent2)
  736. {
  737.     if(g_evolution)
  738.     {
  739.         new ent = create_entity("info_target")
  740.    
  741.         static Float:Origin[3], Float:Angles[3]
  742.         pev(ent2, pev_origin, Origin)
  743.         pev(ent2, pev_angles, Angles)
  744.        
  745.         entity_set_origin(ent, Origin)
  746.         entity_set_vector(ent, EV_VEC_angles, Angles)
  747.        
  748.         entity_set_string(ent,EV_SZ_classname, "knife_effect")
  749.         entity_set_model(ent, oberon_knife_effect)
  750.         entity_set_int(ent, EV_INT_solid, SOLID_NOT)
  751.         entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE)
  752.        
  753.         new Float:maxs[3] = {40.0, 40.0, 1.0}
  754.         new Float:mins[3] = {-40.0, -40.0, -1.0}
  755.         entity_set_size(ent, mins, maxs)
  756.        
  757.         drop_to_floor(ent)
  758.        
  759.         set_task(1.0, "remove_knife_effect", ent)
  760.     }
  761.    
  762.     for(new i = 1; i < get_maxplayers(); i++)
  763.     {
  764.         if(is_user_alive(i) && entity_range(ent2, i) <= 300.0)
  765.         {
  766.             hit_screen(i)
  767.            
  768.             static Float:Damage
  769.             Damage = random_float(7.5, 15.0)
  770.            
  771.             if(g_evolution)
  772.                 Damage *= 2.0
  773.            
  774.             ExecuteHam(Ham_TakeDamage, i, 0, i, Damage, DMG_BLAST)
  775.         }
  776.     }  
  777. }
  778.  
  779. public remove_knife_effect(ent)
  780. {
  781.     remove_entity(ent)
  782. }
  783.  
  784. public set_new_idle(ent)
  785. {
  786.     g_evoluting = 0
  787.     g_evolution = 1
  788.     set_entity_anim(ent, 12)
  789.    
  790.     entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.1)
  791. }
  792.  
  793. public move_entity(ent)
  794. {
  795.     static Float:Origin[3]
  796.    
  797.     Origin[0] = 4290.0
  798.     Origin[1] = 4290.0
  799.     Origin[2] = 4290.0
  800.    
  801.     set_pev(ent, pev_origin, Origin)
  802.     entity_set_float(ent, EV_FL_nextthink, halflife_time() + 99999999.0)
  803. }
  804.  
  805. public fw_takedmg(victim, inflictor, attacker, Float:damage, damagebits)
  806. {
  807.     static Float:Origin[3]
  808.     fm_get_aimorigin(attacker, Origin)
  809.    
  810.     client_print(attacker, print_center, "Zycie Oberona: %i", floatround(pev(victim, pev_health) - 1000.0))
  811.    
  812.     create_blood(Origin)   
  813. }
  814.  
  815. stock set_entity_anim(ent, anim)
  816. {
  817.     entity_set_float(ent, EV_FL_animtime, get_gametime())
  818.     entity_set_float(ent, EV_FL_framerate, 1.0)
  819.     entity_set_int(ent, EV_INT_sequence, anim) 
  820. }
  821.  
  822. stock create_blood(const Float:origin[3])
  823. {
  824.     // Show some blood :)
  825.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  826.     write_byte(TE_BLOODSPRITE)
  827.     engfunc(EngFunc_WriteCoord, origin[0])
  828.     engfunc(EngFunc_WriteCoord, origin[1])
  829.     engfunc(EngFunc_WriteCoord, origin[2])
  830.     write_short(m_iBlood[1])
  831.     write_short(m_iBlood[0])
  832.     write_byte(75)
  833.     write_byte(5)
  834.     message_end()
  835. }
  836.  
  837. stock fm_get_aimorigin(index, Float:origin[3])
  838. {
  839.     new Float:start[3], Float:view_ofs[3];
  840.     pev(index, pev_origin, start);
  841.     pev(index, pev_view_ofs, view_ofs);
  842.     xs_vec_add(start, view_ofs, start);
  843.    
  844.     new Float:dest[3];
  845.     pev(index, pev_v_angle, dest);
  846.     engfunc(EngFunc_MakeVectors, dest);
  847.     global_get(glb_v_forward, dest);
  848.     xs_vec_mul_scalar(dest, 9999.0, dest);
  849.     xs_vec_add(start, dest, dest);
  850.    
  851.     engfunc(EngFunc_TraceLine, start, dest, 0, index, 0);
  852.     get_tr2(0, TR_vecEndPos, origin);
  853.    
  854.     return 1;
  855. }  
  856.  
  857. public FindClosesEnemy(entid)
  858. {
  859.     new Float:Dist
  860.     new Float:maxdistance=4000.0
  861.     new indexid=0  
  862.     for(new i=1;i<=get_maxplayers();i++){
  863.         if(is_user_alive(i) && is_valid_ent(i) && can_see_fm(entid, i))
  864.         {
  865.             Dist = entity_range(entid, i)
  866.             if(Dist <= maxdistance)
  867.             {
  868.                 maxdistance=Dist
  869.                 indexid=i
  870.                
  871.                 return indexid
  872.             }
  873.         }  
  874.     }  
  875.     return 0
  876. }
  877.  
  878. public npc_turntotarget(ent, Float:Ent_Origin[3], target, Float:Vic_Origin[3])
  879. {
  880.     if(target)
  881.     {
  882.         new Float:newAngle[3]
  883.         entity_get_vector(ent, EV_VEC_angles, newAngle)
  884.         new Float:x = Vic_Origin[0] - Ent_Origin[0]
  885.         new Float:z = Vic_Origin[1] - Ent_Origin[1]
  886.  
  887.         new Float:radians = floatatan(z/x, radian)
  888.         newAngle[1] = radians * (180 / 3.14)
  889.         if (Vic_Origin[0] < Ent_Origin[0])
  890.             newAngle[1] -= 180.0
  891.        
  892.         entity_set_vector(ent, EV_VEC_angles, newAngle)
  893.     }
  894. }
  895.  
  896. public bool:can_see_fm(entindex1, entindex2)
  897. {
  898.     if (!entindex1 || !entindex2)
  899.         return false
  900.  
  901.     if (pev_valid(entindex1) && pev_valid(entindex1))
  902.     {
  903.         new flags = pev(entindex1, pev_flags)
  904.         if (flags & EF_NODRAW || flags & FL_NOTARGET)
  905.         {
  906.             return false
  907.         }
  908.  
  909.         new Float:lookerOrig[3]
  910.         new Float:targetBaseOrig[3]
  911.         new Float:targetOrig[3]
  912.         new Float:temp[3]
  913.  
  914.         pev(entindex1, pev_origin, lookerOrig)
  915.         pev(entindex1, pev_view_ofs, temp)
  916.         lookerOrig[0] += temp[0]
  917.         lookerOrig[1] += temp[1]
  918.         lookerOrig[2] += temp[2]
  919.  
  920.         pev(entindex2, pev_origin, targetBaseOrig)
  921.         pev(entindex2, pev_view_ofs, temp)
  922.         targetOrig[0] = targetBaseOrig [0] + temp[0]
  923.         targetOrig[1] = targetBaseOrig [1] + temp[1]
  924.         targetOrig[2] = targetBaseOrig [2] + temp[2]
  925.  
  926.         engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) //  checks the had of seen player
  927.         if (get_tr2(0, TraceResult:TR_InOpen) && get_tr2(0, TraceResult:TR_InWater))
  928.         {
  929.             return false
  930.         }
  931.         else
  932.         {
  933.             new Float:flFraction
  934.             get_tr2(0, TraceResult:TR_flFraction, flFraction)
  935.             if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
  936.             {
  937.                 return true
  938.             }
  939.             else
  940.             {
  941.                 targetOrig[0] = targetBaseOrig [0]
  942.                 targetOrig[1] = targetBaseOrig [1]
  943.                 targetOrig[2] = targetBaseOrig [2]
  944.                 engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) //  checks the body of seen player
  945.                 get_tr2(0, TraceResult:TR_flFraction, flFraction)
  946.                 if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
  947.                 {
  948.                     return true
  949.                 }
  950.                 else
  951.                 {
  952.                     targetOrig[0] = targetBaseOrig [0]
  953.                     targetOrig[1] = targetBaseOrig [1]
  954.                     targetOrig[2] = targetBaseOrig [2] - 17.0
  955.                     engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) //  checks the legs of seen player
  956.                     get_tr2(0, TraceResult:TR_flFraction, flFraction)
  957.                     if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
  958.                     {
  959.                         return true
  960.                     }
  961.                 }
  962.             }
  963.         }
  964.     }
  965.     return false
  966. }
  967.  
  968. public hook_ent(ent, victim, Float:speed)
  969. {
  970.     static Float:fl_Velocity[3]
  971.     static Float:VicOrigin[3], Float:EntOrigin[3]
  972.  
  973.     pev(ent, pev_origin, EntOrigin)
  974.     pev(victim, pev_origin, VicOrigin)
  975.    
  976.     static Float:distance_f
  977.     distance_f = get_distance_f(EntOrigin, VicOrigin)
  978.  
  979.     if (distance_f > 60.0)
  980.     {
  981.         new Float:fl_Time = distance_f / speed
  982.  
  983.         fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
  984.         fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
  985.         fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
  986.     } else
  987.     {
  988.         fl_Velocity[0] = 0.0
  989.         fl_Velocity[1] = 0.0
  990.         fl_Velocity[2] = 0.0
  991.     }
  992.  
  993.     entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
  994. }
  995.  
  996. public hook_ent2(ent, Float:VicOrigin[3], Float:speed)
  997. {
  998.     static Float:fl_Velocity[3]
  999.     static Float:EntOrigin[3]
  1000.  
  1001.     pev(ent, pev_origin, EntOrigin)
  1002.    
  1003.     static Float:distance_f
  1004.     distance_f = get_distance_f(EntOrigin, VicOrigin)
  1005.  
  1006.     if (distance_f > 60.0)
  1007.     {
  1008.         new Float:fl_Time = distance_f / speed
  1009.  
  1010.         fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
  1011.         fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
  1012.         fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
  1013.     } else
  1014.     {
  1015.         fl_Velocity[0] = 0.0
  1016.         fl_Velocity[1] = 0.0
  1017.         fl_Velocity[2] = 0.0
  1018.     }
  1019.  
  1020.     entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
  1021. }
  1022.  
  1023. public hit_screen(id)
  1024. {
  1025.     message_begin(MSG_ONE, get_user_msgid("ScreenShake"),{0,0,0}, id)
  1026.     write_short(1<<14)
  1027.     write_short(1<<13)
  1028.     write_short(1<<13)
  1029.     message_end()  
  1030. }
  1031.  
  1032. public reset_think(ent)
  1033. {
  1034.     g_doing_other = 0
  1035.     entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.1)
  1036. }

Teddy Boss
  1. /* Boss CSO By Itachi Uchiha-
  2. My Canal Youtube https://www.youtube.com/channel/UCar-rq1Dvuvha9Id2ypP7tg
  3. My Facebook Contact https://www.facebook.com/ItachiUchihapro
  4. My Pag Facebook https://www.facebook.com/TutorialesItachi/
  5. Wep Forro http://itachiuchiha-mods.esy.es/
  6. Boss All https://daniel3536.jimdo.com/news-boss-for-cs-1-6-2017/
  7. */
  8.  
  9. #include <amxmodx>
  10. #include <engine>
  11. #include <fakemeta_+>
  12. #include <hamsandwich>
  13.  
  14. #define PLUGIN "CSO Boss Teddy Bear Final"
  15. #define VERSION "4.0"
  16. #define AUTHOR "Itachi Uchiha- Mods Scripter"
  17.  
  18. //Configs Boss
  19. #define CLASS_NAME_BOSS "Boss_Teddy_CSO"
  20. #define HEALTH_BOSS 500.0
  21. #define SPEED_TEDDY 150.0
  22.  
  23. //Damage Attack
  24. #define DAMAGE_ATTACK 50.0
  25. #define DAMAGE_TENTACLE 100.0
  26. #define DAMAGE_TENTACLE_TOUCH 20.0
  27. #define DAMAGE_HOLE1 1000.0
  28. #define DAMAGE_HALLOWEEN 50.0
  29. #define DAMAGE_FINAL 1000.0 //Touch Boss
  30.  
  31. //Remove Task Anti Bug
  32. #define HP_SPRITE 1
  33. #define ATTACK_TASK 2
  34. #define CORRER_TEDDY 3
  35. #define TENTACLE_TEDDY 4
  36. #define HOLE_TEDDY 5
  37. #define HOLE1_TEDDY 6
  38. #define METEOR_TEDDY 7
  39.  
  40. //Resources..
  41. #define ice_model "models/Teddy_CSO/dd_iceblock.mdl"
  42. #define frozer "Teddy_CSO/congelacion.wav"//"Teddy_CSO/impalehit.wav"
  43.  
  44. enum
  45. {
  46.     ANIM_DUMMY = 0,
  47.     SCENE_APPEAR,
  48.     ZBS_IDLE1,
  49.     ZBS_WALK,
  50.     ZBS_RUN,
  51.     ZBS_ATTACK1,
  52.     ZBS_ATTACK2,
  53.     ZBS_ATTACK_SLIDING,
  54.     ZBS_ATTACK_CANDY,
  55.     ZBS_ATTACK_HOLE,
  56.     ZBS_ATTACK_HOLE2,
  57.     ZBS_ATTACK_METEOR,
  58.     SCENE_CHANGE,
  59.     TEDDY_DEATH
  60. }
  61. new const news[][] =
  62. {
  63.     "sprites/Teddy_CSO/shockwave.spr"  
  64. }
  65. static g_news[sizeof news]
  66.  
  67. enum {
  68.     shockwave
  69. }
  70. new const Boss_Model_CSO[] = "models/Teddy_CSO/Teddy_CSO.mdl"
  71. new const Boss_Tentacle_CSO[] = "models/Teddy_CSO/Dulce.mdl"
  72. new const Boss_Hole_Effect[] = "models/Teddy_CSO/ef_hole.mdl"
  73. new const Boss_Halloween[] = "models/Teddy_CSO/halloween.mdl"
  74. new const Boss_Halloween2[] = "sprites/Teddy_CSO/blue.spr"
  75. new const Hp_Sprite_Boss[] = "sprites/Teddy_CSO/hp.spr"
  76.  
  77. new const Sound_Boss_CSO[20][] =
  78. {
  79.     "Teddy_CSO/zbs_attack2.wav",       
  80.     "Teddy_CSO/death.wav",
  81.     "Teddy_CSO/footstep1.wav",
  82.     "Teddy_CSO/footstep2.wav",
  83.     "Teddy_CSO/zbs_fail.wav",
  84.     "Teddy_CSO/zbs_clear.wav",
  85.     "Teddy_CSO/candy_attack.wav",
  86.     "Teddy_CSO/scene_appear1.wav",
  87.     "Teddy_CSO/zbs_attack1.wav",
  88.     "Teddy_CSO/zbs_attack_sliding.wav",
  89.     "Teddy_CSO/zbs_attack_hole.wav",
  90.     "Teddy_CSO/zbs_attack_candy.wav",
  91.     "Teddy_CSO/scene_change.wav",
  92.     "Teddy_CSO/zbs_attack_hole2_1.wav",
  93.     "Teddy_CSO/zbs_attack_meteor.wav",
  94.     "Teddy_CSO/zbs_attack_meteor_exp.wav",
  95.     "Teddy_CSO/zbs_attack_hole2_2.wav",
  96.     "Teddy_CSO/footstep3.wav",
  97.     "Teddy_CSO/gift_explode.wav",
  98.     "Teddy_CSO/footstep4.wav"
  99. }
  100.  
  101. new Boss_Model_Linux, Damage_Off, Start_Boss_CSO, Damage_Touch, y_hpbar, y_think, y_bleeding[2], bool:g_bCongelado[33],
  102. iceent[33], g_msgScreenFade, g_exploSpr, g_explosfr, frostgib, y_npc_hp
  103.  
  104. new Float:VAngles[3], Float:Origin[3], Float:Attack_Time
  105.  
  106. public plugin_init()
  107. {
  108.     register_plugin(PLUGIN, VERSION, AUTHOR)
  109.    
  110.     register_event("HLTV", "event_newround", "a", "1=0", "2=0")
  111.     register_think(CLASS_NAME_BOSS, "cso_boss_think")
  112.     register_touch(CLASS_NAME_BOSS, "*", "cso_boss_touch")
  113.     register_forward(FM_PlayerPreThink, "fw_Player_Frozer")
  114.     RegisterHam(Ham_Spawn, "player", "Bug_Frozer", 1)
  115.     register_think("Halloween_Meteos", "fire_helloween_think")
  116.     register_touch("Halloween_Meteos", "*", "npc_ball_touch")
  117.     register_touch("Damage_Tentacle_Teddy", "*", "Tentacle_Touch")
  118.    
  119.     g_msgScreenFade = get_user_msgid("ScreenFade")
  120.    
  121.     register_clcmd("say /teddy", "npc_position")
  122.     register_clcmd("say /teddy2", "create_cso_boss")
  123. }
  124. public plugin_cfg()                     // Cvar's goes here
  125. {
  126.     server_cmd("mp_freezetime 0.0")
  127. }
  128. public plugin_precache()
  129. {
  130.     Boss_Model_Linux = precache_model(Boss_Model_CSO)
  131.     precache_model(Boss_Tentacle_CSO)
  132.     precache_model(Boss_Hole_Effect)
  133.     precache_sound(frozer)
  134.     precache_model(ice_model)
  135.     precache_model(Hp_Sprite_Boss)
  136.     precache_model(Boss_Halloween)
  137.     precache_model(Boss_Halloween2)
  138.    
  139.     frostgib = precache_model("sprites/Teddy_CSO/frostgib.spr")
  140.     g_exploSpr = engfunc(EngFunc_PrecacheModel, "sprites/Teddy_CSo/shockwave.spr")
  141.     g_explosfr = precache_model("sprites/Teddy_CSo/frost_exp.spr")
  142.     y_npc_hp = precache_model("sprites/Teddy_CSO/zerogxplode.spr")
  143.     y_bleeding[0] = precache_model("sprites/Teddy_CSO/blood.spr")
  144.     y_bleeding[1] = precache_model("sprites/Teddy_CSO/bloodspray.spr")
  145.    
  146.     for(new i = 0; i < sizeof(Sound_Boss_CSO); i++)
  147.         precache_sound(Sound_Boss_CSO[i])
  148.    
  149.     for(new i; i <= charsmax(news); i++)
  150.         g_news[i] = precache_model(news[i])
  151. }
  152. public event_newround()
  153. {  
  154.     if(pev_valid(y_think))
  155.     {      
  156.         remove_task(y_think+HP_SPRITE)
  157.         remove_task(y_think+ATTACK_TASK)
  158.         remove_task(y_think+CORRER_TEDDY)
  159.         remove_task(y_think+TENTACLE_TEDDY)
  160.         remove_task(y_think+HOLE_TEDDY)
  161.         remove_task(y_think+HOLE1_TEDDY)
  162.         remove_task(y_think+METEOR_TEDDY)
  163.         remove_entity_name(CLASS_NAME_BOSS)
  164.         remove_entity_name("teddy_final")
  165.         remove_entity_name("DareDevil")
  166.         remove_entity_name("Halloween_Meteos")
  167.         remove_entity_name("Damage_Tentacle_Teddy")
  168.     }
  169.     if(pev_valid(y_hpbar)) remove_entity(y_hpbar)
  170. }
  171. public npc_position(id)
  172. {
  173.     pev(id, pev_angles, VAngles)
  174.     pev(id, pev_origin, Origin)
  175.    
  176.     client_print(id, print_console, "Origin %f %f %f", Origin[0], Origin[1], Origin[2])
  177.     client_print(id, print_console, "Angles %f %f %f", VAngles[0], VAngles[1], VAngles[2])
  178. }
  179. public Bug_Frozer(id)
  180. {
  181.     if(is_user_connected(id))
  182.     {
  183.         g_bCongelado[id] = false
  184.     }
  185. }
  186. public create_cso_boss()
  187. {
  188.     event_newround()
  189.     new ent = create_entity("info_target")
  190.     y_think = ent
  191.    
  192.     Damage_Touch = 0
  193.     Start_Boss_CSO = 0
  194.    
  195.     set_pev(ent, pev_origin, Origin)
  196.     //set_pev(ent, pev_angles, VAngles)
  197.    
  198.     set_pev(ent, pev_gamestate, 1)
  199.     set_pev(ent, pev_takedamage, 1.0)
  200.     set_pev(ent, pev_health, HEALTH_BOSS + 1000.0)
  201.     set_pev(ent, pev_classname, CLASS_NAME_BOSS)
  202.     engfunc(EngFunc_SetModel, ent, Boss_Model_CSO)
  203.    
  204.     set_pev(ent, pev_solid, SOLID_BBOX)
  205.     set_pev(ent, pev_movetype, MOVETYPE_PUSHSTEP)
  206.     anim(ent, SCENE_APPEAR)
  207.    
  208.     new Float:maxs[3] = {35.0, 55.0, 200.0}
  209.     new Float:mins[3] = {-35.0, -55.0, -35.0}
  210.     engfunc(EngFunc_SetSize, ent, mins, maxs)
  211.    
  212.     set_pev(ent, pev_modelindex, Boss_Model_Linux)
  213.     set_pev(ent, pev_nextthink, get_gametime() + 5.0)
  214.    
  215.     if(!Damage_Off)
  216.     {
  217.         Damage_Off = 1
  218.         RegisterHamFromEntity(Ham_TakeDamage, ent, "cso_boss_take_damage", 1)
  219.     }
  220.     y_hpbar = create_entity("env_sprite")
  221.     set_pev(y_hpbar, pev_scale, 0.4)
  222.     set_pev(y_hpbar, pev_owner, ent)
  223.     engfunc(EngFunc_SetModel, y_hpbar, Hp_Sprite_Boss) 
  224.     set_task(0.1, "cso_boss_ready", ent+HP_SPRITE, _, _, "b")
  225. }
  226. public cso_boss_ready(ent)
  227. {
  228.     ent -= HP_SPRITE
  229.     if(!pev_valid(ent))
  230.     {
  231.         remove_task(ent+HP_SPRITE)
  232.         return
  233.     }
  234.     static Float:Origin[3], Float:cso_boss_health
  235.     pev(ent, pev_origin, Origin)
  236.     Origin[2] += 265.0 
  237.     engfunc(EngFunc_SetOrigin, y_hpbar, Origin)
  238.     pev(ent, pev_health, cso_boss_health)
  239.     if(HEALTH_BOSS < (cso_boss_health - 1000.0))
  240.     {
  241.         set_pev(y_hpbar, pev_frame, 100.0)
  242.     } else {
  243.         set_pev(y_hpbar, pev_frame, 0.0 + ((((cso_boss_health - 1000.0) - 1 ) * 100) / HEALTH_BOSS))
  244.     }      
  245. }
  246. //----------------------------Attacks Teddy----------------------------
  247. public Teddy_Attack(ent)
  248. {
  249.     if(!pev_valid(ent) || Start_Boss_CSO)
  250.         return
  251.     Start_Boss_CSO = 1
  252.     anim(ent, ZBS_ATTACK1)
  253.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  254.    
  255.     new randomx = random_num(0,1)
  256.     switch(randomx) {
  257.         case 0:
  258.         {
  259.             anim(ent, ZBS_ATTACK1)
  260.             emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[8], 1.0, ATTN_NORM, 0, PITCH_NORM)
  261.             set_task(0.3, "Damage_Teddy", ent+ATTACK_TASK)
  262.             set_task(1.0, "simple_attack_reload", ent+ATTACK_TASK)
  263.         }
  264.         case 1:
  265.         {
  266.             anim(ent, ZBS_ATTACK2)
  267.             emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
  268.             set_task(0.7, "Damage_Teddy2", ent+ATTACK_TASK)
  269.             set_task(1.3, "simple_attack_reload", ent+ATTACK_TASK)
  270.         }
  271.     }
  272. }
  273. public Damage_Teddy(ent)
  274. {
  275.     ent -= ATTACK_TASK
  276.     if(!pev_valid(ent))
  277.         return 
  278.    
  279.     static Float:Orig[3]
  280.     pev(ent, pev_origin, Orig)
  281.     ShockWave(Orig, 5, 70, 500.0, {255, 0, 0})
  282.     ShockWave(Orig, 5, 70, 400.0, {144, 238, 144})
  283.    
  284.     for(new i = 0; i < get_maxplayers(); i++)
  285.     {
  286.         if(is_user_alive(i) && entity_range(ent, i) <= 250.0)
  287.         {
  288.             shake_screen(i)
  289.             ScreenFade(i, 2, {79, 79, 79}, 120)
  290.             ExecuteHam(Ham_TakeDamage, i, 0, i, DAMAGE_ATTACK, DMG_SLASH)
  291.         }
  292.     }
  293. }
  294. public Damage_Teddy2(ent)
  295. {
  296.     ent -= ATTACK_TASK
  297.     if(!pev_valid(ent))
  298.         return 
  299.    
  300.     static Float:Orig[3]
  301.     pev(ent, pev_origin, Orig)
  302.     ShockWave(Orig, 5, 70, 500.0, {255, 0, 0})
  303.     ShockWave(Orig, 5, 70, 400.0, {144, 238, 144})
  304.    
  305.     for(new i = 0; i < get_maxplayers(); i++)
  306.     {
  307.         if(is_user_alive(i) && entity_range(ent, i) <= 250.0)
  308.         {
  309.             shake_screen(i)
  310.             ScreenFade(i, 2, {79, 79, 79}, 120)
  311.             ExecuteHam(Ham_TakeDamage, i, 0, i, DAMAGE_ATTACK, DMG_SLASH)
  312.            
  313.             static Float:Jugador[3]
  314.             Jugador[2] = 400.0
  315.             Jugador[0] = 400.0
  316.             set_pev(i, pev_velocity, Jugador)
  317.         }
  318.     }
  319. }
  320. public simple_attack_reload(ent)
  321. {
  322.     ent -= ATTACK_TASK
  323.     Start_Boss_CSO = 0
  324. }
  325.  
  326. //----------------------------Correr Teddy----------------------------
  327. public Correr_Teddy(ent)
  328. {
  329.     if(!pev_valid(ent) || Start_Boss_CSO)
  330.         return
  331.     Start_Boss_CSO = 1
  332.     Damage_Touch = 1
  333.     anim(ent, ZBS_ATTACK_SLIDING)
  334.    
  335.     emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[9], 1.0, ATTN_NORM, 0, PITCH_NORM)
  336.    
  337.     set_task(0.7, "CorrerTeddy", ent+CORRER_TEDDY)
  338.     set_task(2.5, "Correr_Teddy3", ent+CORRER_TEDDY)
  339. }
  340. public CorrerTeddy(ent)
  341. {
  342.     ent -= CORRER_TEDDY
  343.     set_task(0.2, "Correr_Teddy2", ent+CORRER_TEDDY, _, _, "b")
  344. }
  345. public Correr_Teddy2(ent)
  346. {
  347.     ent -= CORRER_TEDDY
  348.     if(!pev_valid(ent))
  349.         return
  350.     set_pev(ent, pev_movetype, MOVETYPE_PUSHSTEP)
  351.     static Float:Origin[3]
  352.     get_position(ent, 4000.0, 0.0, 0.0, Origin)
  353.     control_ai2(ent, Origin, 1000.0)
  354. }
  355. public Correr_Teddy3(ent)
  356. {
  357.     ent -= CORRER_TEDDY
  358.     if(!pev_valid(ent))
  359.         return
  360.     Damage_Touch = 0
  361.     remove_task(ent+CORRER_TEDDY)
  362.     set_task(2.0, "reload_run", ent+CORRER_TEDDY)
  363. }
  364. public reload_run(ent)
  365. {
  366.     ent -= CORRER_TEDDY
  367.     remove_task(ent+CORRER_TEDDY)
  368.     Start_Boss_CSO = 0
  369.     anim(ent, ZBS_IDLE1)
  370. }
  371.  
  372. //----------------------------Candy Teddy----------------------------
  373. public Tentacle_Hammer(ent)
  374. {
  375.     if(!pev_valid(ent) || Start_Boss_CSO)
  376.         return 
  377.        
  378.     Start_Boss_CSO = 1
  379.     anim(ent, ZBS_ATTACK_CANDY)
  380.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  381.    
  382.     set_task(10.0, "reload_run2", ent+TENTACLE_TEDDY)
  383.    
  384.     set_task(0.9, "Start_Tentacle", ent+TENTACLE_TEDDY)
  385.     set_task(4.7, "Start_Tentacle", ent+TENTACLE_TEDDY)
  386.     set_task(7.5, "Start_Tentacle", ent+TENTACLE_TEDDY)
  387.    
  388.     set_task(0.9, "Damage_Teddy3", ent+TENTACLE_TEDDY)
  389.     set_task(3.0, "Damage_Teddy3", ent+TENTACLE_TEDDY)
  390.     set_task(4.7, "Damage_Teddy3", ent+TENTACLE_TEDDY)
  391.     set_task(6.4, "Damage_Teddy3", ent+TENTACLE_TEDDY)
  392.     set_task(7.5, "Damage_Teddy3", ent+TENTACLE_TEDDY)
  393.     set_task(7.0, "Damage_Teddy3", ent+TENTACLE_TEDDY)
  394.     set_task(8.5, "Sound_Tentacle_Hammer", ent+TENTACLE_TEDDY)
  395. }
  396. public Sound_Tentacle_Hammer(ent)
  397. {
  398.     ent -= TENTACLE_TEDDY
  399.     emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[11], 1.0, ATTN_NORM, 0, PITCH_NORM)
  400. }
  401. public Damage_Teddy3(ent)
  402. {
  403.     ent -= TENTACLE_TEDDY
  404.     if(!pev_valid(ent))
  405.         return 
  406.    
  407.     static Float:Orig[3]
  408.     pev(ent, pev_origin, Orig)
  409.     ShockWave(Orig, 5, 70, 550.0, {255, 0, 0})
  410.     ShockWave(Orig, 5, 70, 450.0, {144, 238, 144})
  411.    
  412.     emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[8], 1.0, ATTN_NORM, 0, PITCH_NORM)
  413.    
  414.     for(new i = 0; i < get_maxplayers(); i++)
  415.     {
  416.         if(is_user_alive(i) && entity_range(ent, i) <= 300.0)
  417.         {
  418.             shake_screen(i)
  419.             ScreenFade(i, 2, {79, 79, 79}, 120)
  420.             ExecuteHam(Ham_TakeDamage, i, 0, i, DAMAGE_TENTACLE, DMG_SLASH)
  421.         }
  422.     }
  423. }
  424. public reload_run2(ent)
  425. {
  426.     ent -= TENTACLE_TEDDY
  427.     remove_task(ent+CORRER_TEDDY)
  428.     Start_Boss_CSO = 0
  429.     anim(ent, ZBS_IDLE1)
  430. }
  431. public Start_Tentacle(ent)
  432. {
  433.     ent -= TENTACLE_TEDDY
  434.     if(!pev_valid(ent))
  435.         return
  436.    
  437.     static Float:beam_origin[25][3]
  438.    
  439.     get_position(ent, 200.0, 00.0, 50.0, beam_origin[0])
  440.     get_position(ent, 300.0, 00.0, 50.0, beam_origin[1])
  441.     get_position(ent, 400.0, 00.0, 50.0, beam_origin[2])
  442.     get_position(ent, 500.0, 00.0, 50.0, beam_origin[3])
  443.     get_position(ent, 600.0, 00.0, 50.0, beam_origin[4])
  444.    
  445.     get_position(ent, 200.0, 150.0, 50.0, beam_origin[5])
  446.     get_position(ent, 300.0, 150.0, 50.0, beam_origin[6])
  447.     get_position(ent, 400.0, 150.0, 50.0, beam_origin[7])
  448.     get_position(ent, 500.0, 150.0, 50.0, beam_origin[8])
  449.     get_position(ent, 600.0, 150.0, 50.0, beam_origin[9])
  450.    
  451.     get_position(ent, 200.0, 250.0, 50.0, beam_origin[10])
  452.     get_position(ent, 300.0, 250.0, 50.0, beam_origin[11])
  453.     get_position(ent, 400.0, 250.0, 50.0, beam_origin[12])
  454.     get_position(ent, 500.0, 250.0, 50.0, beam_origin[13])
  455.     get_position(ent, 600.0, 250.0, 50.0, beam_origin[14])
  456.    
  457.     get_position(ent, 200.0, -150.0, 50.0, beam_origin[15])
  458.     get_position(ent, 300.0, -150.0, 50.0, beam_origin[16])
  459.     get_position(ent, 400.0, -150.0, 50.0, beam_origin[17])
  460.     get_position(ent, 500.0, -150.0, 50.0, beam_origin[18])
  461.     get_position(ent, 600.0, -150.0, 50.0, beam_origin[19])
  462.    
  463.     get_position(ent, 200.0, -250.0, 50.0, beam_origin[20])
  464.     get_position(ent, 300.0, -250.0, 50.0, beam_origin[21])
  465.     get_position(ent, 400.0, -250.0, 50.0, beam_origin[22])
  466.     get_position(ent, 500.0, -250.0, 50.0, beam_origin[23])
  467.     get_position(ent, 600.0, -250.0, 50.0, beam_origin[24])
  468.    
  469.    
  470.     for(new i = 0; i < 25; i++)
  471.     Create_Tentacle1(beam_origin[i])
  472. }
  473.  
  474. public Create_Tentacle1(Float:StartOrigin[3])
  475. {
  476.     static Ent; Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  477.     if(!pev_valid(Ent)) return
  478.    
  479.     set_pev(Ent, pev_movetype, MOVETYPE_NONE)
  480.     set_pev(Ent, pev_solid, SOLID_BBOX)
  481.    
  482.     set_pev(Ent, pev_classname, "Damage_Tentacle_Teddy")
  483.     engfunc(EngFunc_SetModel, Ent, Boss_Tentacle_CSO)
  484.     set_pev(Ent, pev_origin, StartOrigin)
  485.    
  486.     anim(Ent, 0)
  487.    
  488.     new Float:maxs[3] = {5.0, 5.0, 30.0}
  489.     new Float:mins[3] = {-5.0, -5.0, -30.0}
  490.     entity_set_size(Ent, mins, maxs)
  491.    
  492.     set_task(1.0, "Remover_Tentacle", Ent+TENTACLE_TEDDY)
  493. }
  494. public Remover_Tentacle(Ent)
  495. {
  496.     Ent -= TENTACLE_TEDDY
  497.     if(!pev_valid(Ent)) return
  498.     engfunc(EngFunc_RemoveEntity, Ent)
  499. }
  500. public Tentacle_Touch(Ent, id)
  501. {
  502.     if(!pev_valid(Ent))
  503.         return
  504.        
  505.     new Classname[32]
  506.     if(pev_valid(id)) pev(id, pev_classname, Classname, sizeof(Classname))
  507.    
  508.     if(equal(Classname, "Damage_Tentacle_Teddy"))
  509.         return
  510.        
  511.     if(is_user_alive(id))
  512.     {
  513.         ScreenFade(id, 2, {79, 79, 79}, 120)
  514.         ExecuteHam(Ham_TakeDamage, id, 0, id, DAMAGE_TENTACLE_TOUCH, DMG_SLASH)
  515.     }
  516. }
  517.  
  518. //----------------------------Hole1 Teddy----------------------------
  519. public Teddy_Hole1(ent)
  520. {
  521.     if(!pev_valid(ent) || Start_Boss_CSO)
  522.         return 
  523.        
  524.     Start_Boss_CSO = 1
  525.     anim(ent, ZBS_ATTACK_HOLE)
  526.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  527.     emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[10], 1.0, ATTN_NORM, 0, PITCH_NORM)
  528.    
  529.     set_task(8.0, "reload_run3", ent+HOLE_TEDDY)
  530.     set_task(5.0, "Damage_Teddy4", ent+HOLE_TEDDY)
  531.     set_task(0.2, "attack_hole", ent+HOLE_TEDDY)
  532. }
  533. public Damage_Teddy4(ent)
  534. {
  535.     ent -= HOLE_TEDDY
  536.     if(!pev_valid(ent))
  537.         return 
  538.    
  539.     static Float:Orig[3]
  540.     pev(ent, pev_origin, Orig)
  541.     ShockWave(Orig, 5, 70, 550.0, {255, 0, 0})
  542.     ShockWave(Orig, 5, 70, 450.0, {144, 238, 144})
  543.    
  544.     for(new i = 0; i < get_maxplayers(); i++)
  545.     {
  546.         if(is_user_alive(i) && entity_range(ent, i) <= 300.0)
  547.         {
  548.             shake_screen(i)
  549.             ScreenFade(i, 2, {79, 79, 79}, 120)
  550.             ExecuteHam(Ham_TakeDamage, i, 0, i, DAMAGE_HOLE1, DMG_SLASH)
  551.             //user_kill(i)
  552.         }
  553.     }
  554. }
  555. public attack_hole(Teddy)
  556. {
  557.     Teddy -= HOLE_TEDDY
  558.     new ent = create_entity("info_target")
  559.    
  560.     static Float:Origin[3]
  561.     pev(Teddy, pev_origin, Origin)
  562.    
  563.     Origin[2] -= 10.0
  564.    
  565.     set_pev(ent, pev_origin, Origin)
  566.     set_pev(ent, pev_classname, "teddy_final")
  567.     engfunc(EngFunc_SetModel, ent, Boss_Hole_Effect)
  568.     set_pev(ent, pev_solid, SOLID_NOT)
  569.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  570.    
  571.     new Float:maxs[3] = {1.0,1.0,1.0}
  572.     new Float:mins[3] = {-1.0,-1.0,-1.0}
  573.     engfunc(EngFunc_SetSize, ent, mins, maxs)
  574.    
  575.     set_pev(ent, pev_animtime, get_gametime())
  576.     anim(ent, 0)
  577.    
  578.     set_pev(ent, pev_rendermode, kRenderTransAdd)
  579.     set_pev(ent, pev_renderamt, 255.0) 
  580.    
  581.     for(new i = 0; i < get_maxplayers(); i++)
  582.     {
  583.         if(is_user_alive(i) && entity_range(Teddy, i) <= 1000.0)
  584.         {
  585.             static arg[2]
  586.             arg[0] = Teddy
  587.             arg[1] = i
  588.            
  589.             set_task(0.01, "Jalar_Humanos", HOLE1_TEDDY, arg, sizeof(arg), "b")
  590.         }
  591.     }
  592.    
  593.     set_task(5.8, "stop_jalamiento", Teddy+2012)   
  594. }
  595. public Jalar_Humanos(arg[2])
  596. {
  597.     static Float:Origin[3], Float:Speed
  598.     pev(arg[0], pev_origin, Origin)
  599.    
  600.     Speed = (1000.0 / entity_range(arg[0], arg[1])) * 75.0
  601.    
  602.     control_ai2(arg[1], Origin, Speed)
  603. }
  604. public stop_jalamiento(Teddy)
  605. {
  606.     Teddy -= 2012
  607.    
  608.     static ent
  609.     ent = find_ent_by_class(-1, "teddy_final")
  610.    
  611.     remove_entity(ent)
  612.     remove_task(HOLE1_TEDDY)
  613. }
  614. public reload_run3(ent)
  615. {
  616.     ent -= HOLE_TEDDY
  617.     Start_Boss_CSO = 0
  618.     anim(ent, ZBS_IDLE1)
  619. }
  620.  
  621. //----------------------------Hole2 Teddy----------------------------
  622. public Teddy_Hole2(ent)
  623. {
  624.     if(!pev_valid(ent) || Start_Boss_CSO)
  625.         return 
  626.        
  627.     Start_Boss_CSO = 1
  628.     anim(ent, ZBS_ATTACK_HOLE2)
  629.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  630.     emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[13], 1.0, ATTN_NORM, 0, PITCH_NORM)
  631.    
  632.     set_task(8.0, "reload_run3", ent+HOLE_TEDDY)
  633.     set_task(5.0, "Damage_Teddy5", ent+HOLE_TEDDY)
  634.     set_task(0.1, "attack_hole", ent+HOLE_TEDDY)
  635.    
  636.     set_task(5.0, "Hole_Teddy_Sound", ent+HOLE_TEDDY)
  637. }
  638. public Hole_Teddy_Sound(ent)
  639. {
  640.     ent -= HOLE_TEDDY
  641.     emit_sound(ent, CHAN_BODY, Sound_Boss_CSO[16], 1.0, ATTN_NORM, 0, PITCH_NORM)
  642. }
  643. public Damage_Teddy5(ent)
  644. {
  645.     ent -= HOLE_TEDDY
  646.     if(!pev_valid(ent))
  647.         return 
  648.    
  649.     static Float:Orig[3]
  650.     pev(ent, pev_origin, Orig)
  651.     ShockWave(Orig, 5, 70, 750.0, {255, 0, 0})
  652.     ShockWave(Orig, 5, 70, 650.0, {144, 238, 144})
  653.    
  654.     for(new i = 0; i < get_maxplayers(); i++)
  655.     {
  656.         if(is_user_alive(i) && entity_range(ent, i) <= 450.0)
  657.         {
  658.             shake_screen(i)
  659.             Congelar(i)
  660.         }
  661.     }
  662. }
  663. public Congelar(id)
  664. {
  665.     if (!is_user_alive(id))
  666.     return;
  667.    
  668.     ice_entity(id, 1)
  669.     frost_explode(id)
  670.    
  671.     if (pev(id, pev_flags) & FL_ONGROUND)
  672.     set_pev(id, pev_gravity, 999999.9)
  673.     else
  674.     set_pev(id, pev_gravity, 0.000001)
  675.    
  676.     g_bCongelado[id] = true
  677.    
  678.     set_task(7.0, "Descongelar", id)
  679. }
  680.  
  681. public Descongelar(id)
  682. {
  683.     //if (!is_user_alive(id))
  684.     //return;
  685.    
  686.     ice_entity(id, 0)
  687.     remove_frost(id)
  688.    
  689.     g_bCongelado[id] = false
  690.    
  691.     set_pev(id, pev_gravity, 1.0)
  692.     set_pev(id, pev_maxspeed, 250.0)
  693. }
  694.  
  695. //----------------------------Meteor Teddy----------------------------
  696. public Attack_Meteor_Halloween(ent)
  697. {
  698.     if(!pev_valid(ent) || Start_Boss_CSO)
  699.         return 
  700.        
  701.     Start_Boss_CSO = 1
  702.     anim(ent, 11)
  703.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  704.     emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[14], 1.0, ATTN_NORM, 0, PITCH_NORM)
  705.    
  706.     //set_task(8.0, "reload_run4", ent+METEOR_TEDDY)
  707.     set_task(6.0, "Damage_Teddy6", ent+METEOR_TEDDY)
  708.     set_task(6.0, "Meteor_Sound", ent+METEOR_TEDDY)
  709.     set_task(3.9, "Regalitos_Halloweeen", ent+METEOR_TEDDY)
  710. }
  711. public Meteor_Sound(ent)
  712. {
  713.     emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[15], 1.0, ATTN_NORM, 0, PITCH_NORM)
  714. }
  715. public Damage_Teddy6(ent)
  716. {
  717.     ent -= METEOR_TEDDY
  718.     if(!pev_valid(ent))
  719.         return 
  720.    
  721.     static Float:Orig[3]
  722.     pev(ent, pev_origin, Orig)
  723.     ShockWave(Orig, 5, 70, 550.0, {255, 0, 0})
  724.     ShockWave(Orig, 5, 70, 450.0, {144, 238, 144})
  725.    
  726.     for(new i = 0; i < get_maxplayers(); i++)
  727.     {
  728.         if(is_user_alive(i) && entity_range(ent, i) <= 300.0)
  729.         {
  730.             shake_screen(i)
  731.             ScreenFade(i, 2, {79, 79, 79}, 120)
  732.             user_kill(i)
  733.         }
  734.     }
  735. }
  736. public reload_run4(ent)
  737. {
  738.     ent -= METEOR_TEDDY
  739.     Start_Boss_CSO = 0
  740.     anim(ent, ZBS_IDLE1)
  741. }
  742. //Code Sacado De Dias.... Solo Esto..
  743. public Regalitos_Halloweeen(ent)
  744. {
  745.     ent -= METEOR_TEDDY
  746.     if(!pev_valid(ent))
  747.         return 
  748.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  749.     static Float:Origin[3]
  750.     get_position(ent, 150.0, 0.0, 50.0, Origin)
  751.     //emit_sound(ent, CHAN_BODY, npc_sound[3], 1.0, ATTN_NORM, 0, PITCH_NORM)
  752.     for(new i = 0; i < get_maxplayers(); i++)
  753.     {
  754.         if(is_user_alive(i) && entity_range(ent, i) <= 4000)
  755.         {
  756.             shake_screen(i)
  757.             ScreenFade(i, 10, {255, 0, 0}, 120)
  758.         }
  759.     }
  760.     set_task(0.1, "fire_attack_teddy", ent+METEOR_TEDDY)
  761.     set_task(3.8, "remove_attack_teddy", ent+METEOR_TEDDY)
  762. }
  763.  
  764. public remove_attack_teddy(ent)
  765. {
  766.     ent -= METEOR_TEDDY
  767.     if(!pev_valid(ent))
  768.         return 
  769.     remove_task(ent+METEOR_TEDDY)
  770.     set_task(2.1, "reload_run4", ent+METEOR_TEDDY)
  771. }
  772.  
  773. public npc_ball_touch(ent, id)
  774. {
  775.     if(!pev_valid(ent))
  776.         return
  777.     static Float:Origin[3]
  778.     pev(ent, pev_origin, Origin)
  779.     message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
  780.     write_byte(TE_EXPLOSION)
  781.     engfunc(EngFunc_WriteCoord, Origin[0])
  782.     engfunc(EngFunc_WriteCoord, Origin[1])
  783.     engfunc(EngFunc_WriteCoord, Origin[2])
  784.     write_short(y_npc_hp)
  785.     write_byte(10)
  786.     write_byte(30)
  787.     write_byte(4)
  788.     message_end()  
  789.     emit_sound(ent, CHAN_BODY, Sound_Boss_CSO[18], 1.0, ATTN_NORM, 0, PITCH_NORM)
  790.     for(new i = 0; i < get_maxplayers(); i++)
  791.     {
  792.         if(is_user_alive(i) && entity_range(ent, i) <= 250)
  793.         {
  794.             shake_screen(i)
  795.             ExecuteHam(Ham_TakeDamage, i, 0, i, DAMAGE_HALLOWEEN, DMG_SLASH)
  796.             ScreenFade(i, 3, {255, 0, 0}, 120)
  797.         }
  798.     }
  799.     remove_entity(ent)
  800. }
  801.  
  802. public fire_attack_teddy(ent)
  803. {
  804.     ent -= METEOR_TEDDY
  805.     if(!pev_valid(ent))
  806.         return
  807.     static Float:explosion[24][3], Float:ball_place[24][3] 
  808.     explosion[0][0] = 200.0
  809.     explosion[0][1] = 0.0
  810.     explosion[0][2] = 500.0
  811.     explosion[1][0] = 400.0
  812.     explosion[1][1] = 0.0
  813.     explosion[1][2] = 500.0
  814.     explosion[2][0] = -200.0
  815.     explosion[2][1] = 0.0
  816.     explosion[2][2] = 500.0
  817.     explosion[3][0] = -400.0
  818.     explosion[3][1] = 0.0
  819.     explosion[3][2] = 500.0
  820.     explosion[4][0] = 0.0
  821.     explosion[4][1] = 200.0
  822.     explosion[4][2] = 500.0
  823.     explosion[5][0] = 0.0
  824.     explosion[5][1] = 400.0
  825.     explosion[5][2] = 500.0
  826.     explosion[6][0] = 0.0
  827.     explosion[6][1] = -200.0
  828.     explosion[6][2] = 500.0
  829.     explosion[7][0] = 0.0
  830.     explosion[7][1] = -400.0
  831.     explosion[7][2] = 500.0
  832.     explosion[8][0] = 200.0
  833.     explosion[8][1] = 200.0
  834.     explosion[8][2] = 500.0
  835.     explosion[9][0] = 400.0
  836.     explosion[9][1] = 400.0
  837.     explosion[9][2] = 500.0
  838.     explosion[10][0] = 200.0
  839.     explosion[10][1] = 400.0
  840.     explosion[10][2] = 500.0
  841.     explosion[11][0] = 400.0
  842.     explosion[11][1] = 200.0
  843.     explosion[11][2] = 500.0
  844.     explosion[12][0] = -200.0
  845.     explosion[12][1] = 200.0
  846.     explosion[12][2] = 500.0
  847.     explosion[13][0] = -400.0
  848.     explosion[13][1] = 400.0
  849.     explosion[13][2] = 500.0
  850.     explosion[14][0] = -200.0
  851.     explosion[14][1] = 400.0
  852.     explosion[14][2] = 500.0
  853.     explosion[15][0] = -400.0
  854.     explosion[15][1] = 200.0
  855.     explosion[15][2] = 500.0
  856.     explosion[16][0] = -200.0
  857.     explosion[16][1] = -200.0
  858.     explosion[17][2] = 500.0
  859.     explosion[17][0] = -200.0
  860.     explosion[17][1] = -200.0
  861.     explosion[17][2] = 500.0
  862.     explosion[18][0] = -200.0
  863.     explosion[18][1] = -400.0
  864.     explosion[18][2] = 500.0
  865.     explosion[19][0] = -400.0
  866.     explosion[19][1] = -200.0
  867.     explosion[19][2] = 500.0
  868.     explosion[20][0] = 200.0
  869.     explosion[20][1] = -200.0
  870.     explosion[20][2] = 500.0
  871.     explosion[21][0] = 400.0
  872.     explosion[21][1] = -400.0
  873.     explosion[21][2] = 500.0
  874.     explosion[22][0] = 200.0
  875.     explosion[22][1] = -400.0
  876.     explosion[22][2] = 500.0
  877.     explosion[23][0] = 400.0
  878.     explosion[23][1] = -200.0
  879.     explosion[23][2] = 500.0
  880.     for(new i = 0; i < sizeof(explosion); i++)
  881.     {
  882.         get_position(ent, explosion[i][0], explosion[i][1], explosion[i][2], ball_place[i])
  883.         npc_fireball_big(ent, ball_place[i])
  884.     }
  885.     set_task(1.0, "fire_attack_teddy", ent+METEOR_TEDDY)
  886. }
  887.  
  888. public npc_fireball_big(fireboss, Float:Origin[3])
  889. {
  890.     new ent = create_entity("info_target")
  891.     static Float:Angles[3]
  892.     pev(fireboss, pev_angles, Angles)
  893.     entity_set_origin(ent, Origin)
  894.     Angles[0] = -100.0
  895.     entity_set_vector(ent, EV_VEC_angles, Angles)
  896.     Angles[0] = 100.0
  897.     entity_set_vector(ent, EV_VEC_v_angle, Angles)
  898.     entity_set_string(ent, EV_SZ_classname, "Halloween_Meteos")
  899.     entity_set_model(ent, Boss_Halloween)
  900.     entity_set_int(ent, EV_INT_solid, 2)
  901.     entity_set_int(ent, EV_INT_movetype, MOVETYPE_FLY)
  902.     new Float:maxs[3] = {15.0, 15.0, 15.0}
  903.     new Float:mins[3] = {-15.0, -15.0, -15.0}
  904.     entity_set_size(ent, mins, maxs)
  905.     set_pev(ent, pev_owner, fireboss)
  906.     static Float:Velocity[3]
  907.     VelocityByAim(ent, random_num(250, 1000), Velocity)
  908.     set_pev(ent, pev_light_level, 180)
  909.     set_pev(ent, pev_rendermode, kRenderTransAdd)
  910.     set_pev(ent, pev_renderamt, 255.0) 
  911.     entity_set_vector(ent, EV_VEC_velocity, Velocity)
  912.     burning(ent, 0.5)
  913. }
  914.  
  915. public burning(ball, Float:size)
  916. {
  917.     static ent
  918.     ent = create_entity("env_sprite")
  919.     set_pev(ent, pev_takedamage, 0.0)
  920.     set_pev(ent, pev_solid, SOLID_NOT)
  921.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  922.     set_pev(ent, pev_classname, "Halloween_Meteos")
  923.     engfunc(EngFunc_SetModel, ent, Boss_Halloween2)
  924.     set_pev(ent, pev_rendermode, kRenderTransAdd)
  925.     set_pev(ent, pev_renderamt, 255.0)
  926.     set_pev(ent, pev_light_level, 180)
  927.     set_pev(ent, pev_scale, size)
  928.     set_pev(ent, pev_owner, ball)
  929.     set_pev(ent, pev_animtime, get_gametime())
  930.     set_pev(ent, pev_framerate, 8.0)
  931.     set_pev(ent, pev_frame, 0.1)
  932.     set_pev(ent, pev_spawnflags, SF_SPRITE_STARTON)
  933.     dllfunc(DLLFunc_Spawn, ent)
  934.     fire_helloween_think(ent)
  935.     set_pev(ent, pev_nextthink, get_gametime() + 0.01)
  936.     return ent
  937. }
  938. public fire_helloween_think(ent)
  939. {
  940.     if(!pev_valid(ent))
  941.         return
  942.     if(!pev_valid(pev(ent, pev_owner)))
  943.     {
  944.         remove_entity(ent)
  945.         return
  946.     }
  947.     static owner
  948.     owner = pev(ent, pev_owner)
  949.     static Float:Origin[3]
  950.     pev(owner, pev_origin, Origin)
  951.     Origin[2] += 25.0
  952.     entity_set_origin(ent, Origin)
  953.     set_pev(ent, pev_nextthink, get_gametime() + 0.01)
  954. }
  955. //----------------------------Skills Full Final----------------------------
  956.  
  957.  
  958. public fw_Player_Frozer(id)
  959. {
  960.     if (!is_user_alive(id))
  961.     return;
  962.    
  963.     if (g_bCongelado[id])
  964.     {
  965.         set_pev(id, pev_velocity, Float:{0.0,0.0,0.0})
  966.         set_pev(id, pev_maxspeed, 1.0)
  967.     }
  968. }
  969. public cso_boss_touch(ent, id)
  970. {
  971.     if(!pev_valid(id))
  972.         return
  973.        
  974.     if(is_user_alive(id) && Damage_Touch)
  975.     {
  976.         ExecuteHam(Ham_TakeDamage, id, 0, id, DAMAGE_FINAL, DMG_SLASH)
  977.         shake_screen(id)
  978.         ScreenFade(id, 10, {255, 0, 0}, 120)
  979.     }
  980. }
  981. public cso_boss_think(ent)
  982. {
  983.     if(!pev_valid(ent))
  984.         return
  985.     if(pev(ent, pev_iuser3))
  986.         return
  987.     if(pev(ent, pev_health) - 1000.0 < 0.0)
  988.     {
  989.         cso_boss_death(ent)
  990.         set_pev(ent, pev_iuser3, 1)
  991.         return
  992.     }
  993.     if(!Start_Boss_CSO)
  994.     {
  995.         static victim
  996.         static Float:Origin[3], Float:ent_place[3], Float:player_place[3], Float:EnemyOrigin[3]
  997.         victim = enemy_distance(ent)
  998.         pev(victim, pev_origin, EnemyOrigin)
  999.         pev(ent, pev_origin, Origin)
  1000.        
  1001.         if(is_user_alive(victim))
  1002.         {
  1003.             if(entity_range(victim, ent) <= 170)
  1004.             {
  1005.                 Anim_Victim(ent, Origin, victim, EnemyOrigin)
  1006.                 Teddy_Attack(ent)
  1007.                 set_pev(ent, pev_nextthink, get_gametime() + 0.1)
  1008.             } else {
  1009.                 if(pev(ent, pev_sequence) != ZBS_WALK)
  1010.                     anim(ent, ZBS_WALK)
  1011.                 set_pev(ent, pev_movetype, MOVETYPE_PUSHSTEP)
  1012.                
  1013.                 if(get_gametime() - 10.0 > Attack_Time)
  1014.                 {
  1015.                     new Random_Skill_Teddy = random_num(0,4)
  1016.                     switch(Random_Skill_Teddy) {
  1017.                         case 0: Correr_Teddy(ent)
  1018.                         case 1: Tentacle_Hammer(ent)
  1019.                         case 2: Teddy_Hole1(ent)
  1020.                         case 3: Teddy_Hole2(ent)
  1021.                         case 4: Attack_Meteor_Halloween(ent)
  1022.                     }
  1023.                     Attack_Time = get_gametime()
  1024.                 }
  1025.                 for(new i = 0; i < get_maxplayers(); i++)
  1026.                 {
  1027.                     if(is_user_alive(i) && entity_range(ent, i) <= 600)
  1028.                     {
  1029.                         shake_screen(i)
  1030.                     }
  1031.                 }
  1032.                
  1033.                 emit_sound(ent, CHAN_STREAM, Sound_Boss_CSO[19], 1.0, ATTN_NORM, 0, PITCH_NORM)
  1034.                
  1035.                 pev(ent, pev_origin, ent_place)
  1036.                 pev(victim, pev_origin, player_place)
  1037.                 Anim_Victim(ent, ent_place, victim, player_place)
  1038.                
  1039.                 control_ai(ent, victim, SPEED_TEDDY)
  1040.                
  1041.                 if(pev(ent, pev_iuser4) != victim)
  1042.                     set_pev(ent, pev_iuser4, victim)
  1043.                 set_pev(ent, pev_nextthink, get_gametime() + 0.0)
  1044.             }
  1045.         } else {
  1046.             if(pev(ent, pev_sequence) != ZBS_IDLE1)
  1047.                 anim(ent, ZBS_IDLE1)
  1048.             set_pev(ent, pev_nextthink, get_gametime() + 0.0)
  1049.         }      
  1050.     } else {
  1051.         set_pev(ent, pev_nextthink, get_gametime() + 0.0)
  1052.     }
  1053.     return
  1054. }
  1055. public cso_boss_death(ent)
  1056. {  
  1057.     emit_sound(ent, CHAN_BODY, Sound_Boss_CSO[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
  1058.     anim(ent, TEDDY_DEATH)
  1059.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  1060.     set_pev(ent, pev_solid, SOLID_NOT)
  1061.     set_pev(ent, pev_velocity, {0.0, 0.0, 0.0})
  1062.     set_pev(ent, pev_deadflag, DEAD_DYING)
  1063.    
  1064.     remove_task(ent+HP_SPRITE)
  1065.     remove_task(ent+ATTACK_TASK)
  1066.     remove_task(ent+CORRER_TEDDY)
  1067.     remove_task(ent+TENTACLE_TEDDY)
  1068.     remove_task(ent+HOLE_TEDDY)
  1069.     remove_task(ent+HOLE1_TEDDY)
  1070.     remove_task(ent+METEOR_TEDDY)
  1071.     remove_entity_name("teddy_final")
  1072.     remove_entity_name("DareDevil")
  1073.     remove_entity_name("Halloween_Meteos")
  1074.     remove_entity_name("Damage_Tentacle_Teddy")
  1075.    
  1076.    
  1077.     set_task(7.0, "delete_cso_boss", ent)
  1078.     return HAM_SUPERCEDE   
  1079. }
  1080. public delete_cso_boss(ent)
  1081. {
  1082.     remove_entity(ent)
  1083.     remove_entity(y_hpbar)
  1084. }
  1085. public cso_boss_take_damage(victim, inflictor, attacker, Float:damage, damagebits)
  1086. {
  1087.     static Float:Origin[3]
  1088.     fm_get_aim_origin(attacker, Origin)
  1089.     create_blood(Origin)
  1090.     emit_sound(victim, CHAN_BODY, Sound_Boss_CSO[7], 1.0, ATTN_NORM, 0, PITCH_NORM)
  1091. }
  1092. public enemy_distance(entid)
  1093. {
  1094.     new Float:range2
  1095.     new Float:maxrange=2000.0
  1096.     new indexid=0
  1097.     for(new i=1;i<=get_maxplayers();i++)
  1098.     {
  1099.         if(is_user_alive(i) && is_valid_ent(i) && attacking1(entid, i))
  1100.         {
  1101.             range2 = entity_range(entid, i)
  1102.             if(range2 <= maxrange)
  1103.             {
  1104.                 maxrange=range2
  1105.                 indexid=i
  1106.             }
  1107.         }          
  1108.     }  
  1109.     return (indexid) ? indexid : 0
  1110. }
  1111. public Anim_Victim(ent, Float:ent_place[3], target, Float:player_place[3])
  1112. {
  1113.     if(target)
  1114.     {
  1115.         new Float:newAngle[3]
  1116.         entity_get_vector(ent, EV_VEC_angles, newAngle)
  1117.         new Float:x = player_place[0] - ent_place[0]
  1118.         new Float:z = player_place[1] - ent_place[1]
  1119.         new Float:radians = floatatan(z/x, radian)
  1120.         newAngle[1] = radians * (180 / 3.14)
  1121.         if (player_place[0] < ent_place[0])
  1122.             newAngle[1] -= 180.0
  1123.             entity_set_vector(ent, EV_VEC_v_angle, newAngle)
  1124.         entity_set_vector(ent, EV_VEC_angles, newAngle)
  1125.     }
  1126. }
  1127. public bool:attacking1(entindex1, entindex2)
  1128. {
  1129.     if (!entindex1 || !entindex2)
  1130.         return false
  1131.     if (pev_valid(entindex1) && pev_valid(entindex1))
  1132.     {
  1133.         new flags = pev(entindex1, pev_flags)
  1134.         if (flags & EF_NODRAW || flags & FL_NOTARGET)
  1135.         {
  1136.             return false
  1137.         }
  1138.         new Float:lookerOrig[3]
  1139.         new Float:targetBaseOrig[3]
  1140.         new Float:targetOrig[3]
  1141.         new Float:temp[3]
  1142.         pev(entindex1, pev_origin, lookerOrig)
  1143.         pev(entindex1, pev_view_ofs, temp)
  1144.         lookerOrig[0] += temp[0]
  1145.         lookerOrig[1] += temp[1]
  1146.         lookerOrig[2] += temp[2]
  1147.         pev(entindex2, pev_origin, targetBaseOrig)
  1148.         pev(entindex2, pev_view_ofs, temp)
  1149.         targetOrig[0] = targetBaseOrig [0] + temp[0]
  1150.         targetOrig[1] = targetBaseOrig [1] + temp[1]
  1151.         targetOrig[2] = targetBaseOrig [2] + temp[2]
  1152.         engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0)
  1153.         if (get_tr2(0, TraceResult:TR_InOpen) && get_tr2(0, TraceResult:TR_InWater))
  1154.         {
  1155.             return false
  1156.         }
  1157.         else
  1158.         {
  1159.             new Float:flFraction
  1160.             get_tr2(0, TraceResult:TR_flFraction, flFraction)
  1161.             if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
  1162.             {
  1163.                 return true
  1164.             }
  1165.             else
  1166.             {
  1167.                 targetOrig[0] = targetBaseOrig [0]
  1168.                 targetOrig[1] = targetBaseOrig [1]
  1169.                 targetOrig[2] = targetBaseOrig [2]
  1170.                 engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0)
  1171.                 get_tr2(0, TraceResult:TR_flFraction, flFraction)
  1172.                 if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
  1173.                 {
  1174.                     return true
  1175.                 }
  1176.                 else
  1177.                 {
  1178.                     targetOrig[0] = targetBaseOrig [0]
  1179.                     targetOrig[1] = targetBaseOrig [1]
  1180.                     targetOrig[2] = targetBaseOrig [2] - 17.0
  1181.                     engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0)
  1182.                     get_tr2(0, TraceResult:TR_flFraction, flFraction)
  1183.                     if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
  1184.                     {
  1185.                         return true
  1186.                     }
  1187.                 }
  1188.             }
  1189.         }
  1190.     }
  1191.     return false
  1192. }
  1193. public control_ai(ent, victim, Float:speed)
  1194. {
  1195.     static Float:fl_Velocity[3]
  1196.     static Float:VicOrigin[3], Float:EntOrigin[3]
  1197.     pev(ent, pev_origin, EntOrigin)
  1198.     pev(victim, pev_origin, VicOrigin)
  1199.     static Float:distance_f
  1200.     distance_f = get_distance_f(EntOrigin, VicOrigin)
  1201.     if (distance_f > 60.0)
  1202.     {
  1203.         new Float:fl_Time = distance_f / speed
  1204.  
  1205.         fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
  1206.         fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
  1207.         fl_Velocity[2] = 0.0
  1208.     } else
  1209.     {
  1210.         fl_Velocity[0] = 0.0
  1211.         fl_Velocity[1] = 0.0
  1212.         fl_Velocity[2] = 0.0
  1213.     }
  1214.     entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
  1215. }
  1216. stock control_ai2(ent, Float:VicOrigin[3], Float:speed)
  1217. {
  1218.     static Float:fl_Velocity[3]
  1219.     static Float:EntOrigin[3]
  1220.     pev(ent, pev_origin, EntOrigin)
  1221.     static Float:distance_f
  1222.     distance_f = get_distance_f(EntOrigin, VicOrigin)
  1223.     if (distance_f > 60.0)
  1224.     {
  1225.         new Float:fl_Time = distance_f / speed
  1226.         fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
  1227.         fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
  1228.         fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
  1229.     } else {
  1230.         fl_Velocity[0] = 0.0
  1231.         fl_Velocity[1] = 0.0
  1232.         fl_Velocity[2] = 0.0
  1233.     }
  1234.     entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
  1235. }
  1236. stock ScreenFade(id, Timer, Colors[3], Alpha) {
  1237.     message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), _, id);
  1238.     write_short((1<<12) * Timer)
  1239.     write_short(1<<12)
  1240.     write_short(0)
  1241.     write_byte(Colors[0])
  1242.     write_byte(Colors[1])
  1243.     write_byte(Colors[2])
  1244.     write_byte(Alpha)
  1245.     message_end()
  1246. }
  1247. stock shake_screen(id)
  1248. {
  1249.     message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenShake"),{0,0,0}, id)
  1250.     write_short(1<<14)
  1251.     write_short(1<<13)
  1252.     write_short(1<<13)
  1253.     message_end()
  1254. }
  1255. stock anim(ent, sequence) {
  1256.          set_pev(ent, pev_sequence, sequence)
  1257.          set_pev(ent, pev_animtime, halflife_time())
  1258.          set_pev(ent, pev_framerate, 1.0)
  1259. }
  1260. stock get_position(ent, Float:forw, Float:right, Float:up, Float:vStart[])
  1261. {
  1262.     new Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
  1263.     pev(ent, pev_origin, vOrigin)
  1264.     pev(ent, pev_view_ofs,vUp)
  1265.     xs_vec_add(vOrigin,vUp,vOrigin)
  1266.     pev(ent, pev_v_angle, vAngle)
  1267.     vAngle[0] = 0.0
  1268.     angle_vector(vAngle,ANGLEVECTOR_FORWARD,vForward)
  1269.     angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
  1270.     angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
  1271.     vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
  1272.     vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
  1273.     vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
  1274. }
  1275. stock create_blood(const Float:origin[3])
  1276. {
  1277.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  1278.     write_byte(TE_BLOODSPRITE)
  1279.     engfunc(EngFunc_WriteCoord, origin[0])
  1280.     engfunc(EngFunc_WriteCoord, origin[1])
  1281.     engfunc(EngFunc_WriteCoord, origin[2])
  1282.     write_short(y_bleeding[1])
  1283.     write_short(y_bleeding[0])
  1284.     write_byte(218)
  1285.     write_byte(7)
  1286.     message_end()
  1287. }
  1288. stock ShockWave(Float:Orig[3], Life, Width, Float:Radius, Color[3])
  1289. {
  1290.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Orig, 0)
  1291.     write_byte(TE_BEAMCYLINDER)
  1292.     engfunc(EngFunc_WriteCoord, Orig[0])
  1293.     engfunc(EngFunc_WriteCoord, Orig[1])
  1294.     engfunc(EngFunc_WriteCoord, Orig[2]-40.0)
  1295.     engfunc(EngFunc_WriteCoord, Orig[0])
  1296.     engfunc(EngFunc_WriteCoord, Orig[1])
  1297.     engfunc(EngFunc_WriteCoord, Orig[2]+Radius)
  1298.     write_short(g_news[0])
  1299.     write_byte(0)
  1300.     write_byte(0)
  1301.     write_byte(Life)
  1302.     write_byte(Width)
  1303.     write_byte(0)
  1304.     write_byte(Color[0])
  1305.     write_byte(Color[1])
  1306.     write_byte(Color[2])
  1307.     write_byte(255)
  1308.     write_byte(0)
  1309.     message_end()
  1310. }
  1311. stock ice_entity( id, status )
  1312. {
  1313.     if(status)
  1314.     {
  1315.         static ent, Float:o[3]
  1316.         if(!is_user_alive(id))
  1317.         {
  1318.             ice_entity( id, 0 )
  1319.             return
  1320.         }
  1321.        
  1322.         if( is_valid_ent(iceent[id]) )
  1323.         {
  1324.             if( pev( iceent[id], pev_iuser3 ) != id )
  1325.             {
  1326.                 if( pev(iceent[id], pev_team) == 6969 ) remove_entity(iceent[id])
  1327.             }
  1328.             else
  1329.             {
  1330.                 pev( id, pev_origin, o )
  1331.                 if( pev( id, pev_flags ) & FL_DUCKING  ) o[2] -= 15.0
  1332.                 else o[2] -= 35.0
  1333.                 entity_set_origin(iceent[id], o)
  1334.                 return
  1335.             }
  1336.         }
  1337.        
  1338.         pev( id, pev_origin, o )
  1339.         if( pev( id, pev_flags ) & FL_DUCKING  ) o[2] -= 15.0
  1340.         else o[2] -= 35.0
  1341.         ent = create_entity("info_target")
  1342.         set_pev( ent, pev_classname, "DareDevil" )
  1343.        
  1344.         entity_set_model(ent, ice_model)
  1345.         dllfunc(DLLFunc_Spawn, ent)
  1346.         set_pev(ent, pev_solid, SOLID_BBOX)
  1347.         set_pev(ent, pev_movetype, MOVETYPE_FLY)
  1348.         entity_set_origin(ent, o)
  1349.         entity_set_size(ent, Float:{ -3.0, -3.0, -3.0 }, Float:{ 3.0, 3.0, 3.0 } )
  1350.         set_pev( ent, pev_iuser3, id )
  1351.         set_pev( ent, pev_team, 6969 )
  1352.         set_rendering(ent, kRenderFxNone, 255, 255, 255, kRenderTransAdd, 255)
  1353.         iceent[id] = ent
  1354.     }
  1355.     else
  1356.     {
  1357.         if( is_valid_ent(iceent[id]) )
  1358.         {
  1359.             if( pev(iceent[id], pev_team) == 6969 ) remove_entity(iceent[id])
  1360.             iceent[id] = -1
  1361.         }
  1362.     }
  1363. }
  1364.  
  1365. frost_explode(ent)
  1366. {
  1367.     // Get origin
  1368.     static Float:originF[3]
  1369.     pev(ent, pev_origin, originF)
  1370.     // Make the explosion
  1371.     create_blast(originF)
  1372.    
  1373.     emit_sound(ent, CHAN_AUTO, frozer, 1.0, ATTN_NORM, 0, PITCH_NORM)
  1374.    
  1375.     message_begin(MSG_ONE, g_msgScreenFade, _, ent)
  1376.     write_short(0) // duration
  1377.     write_short(0) // hold time
  1378.     write_short(0x0004) // fade type
  1379.     write_byte(0) // red
  1380.     write_byte(50) // green
  1381.     write_byte(200) // blue
  1382.     write_byte(100) // alpha
  1383.     message_end()
  1384. }
  1385. public remove_frost(id)
  1386. {
  1387.     // Gradually remove screen's blue tint
  1388.     message_begin(MSG_ONE, g_msgScreenFade, _, id)
  1389.     write_short((1<<12)) // duration
  1390.     write_short(0) // hold time
  1391.     write_short(0x0000) // fade type
  1392.     write_byte(0) // red
  1393.     write_byte(50) // green
  1394.     write_byte(200) // blue
  1395.     write_byte(100) // alpha
  1396.     message_end()
  1397. }
  1398. create_blast(const Float:originF[3])
  1399. {
  1400.     // Medium ring
  1401.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  1402.     write_byte(TE_BEAMCYLINDER) // TE id
  1403.     engfunc(EngFunc_WriteCoord, originF[0]) // x
  1404.     engfunc(EngFunc_WriteCoord, originF[1]) // y
  1405.     engfunc(EngFunc_WriteCoord, originF[2]) // z
  1406.     engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  1407.     engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  1408.     engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
  1409.     write_short(g_exploSpr) // sprite
  1410.     write_byte(0) // startframe
  1411.     write_byte(0) // framerate
  1412.     write_byte(4) // life
  1413.     write_byte(60) // width
  1414.     write_byte(0) // noise
  1415.     write_byte(0) // red
  1416.     write_byte(191) // green
  1417.     write_byte(255) // blue
  1418.     write_byte(200) // brightness
  1419.     write_byte(0) // speed
  1420.     message_end()
  1421.    
  1422.     // Largest ring
  1423.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  1424.     write_byte(TE_BEAMCYLINDER) // TE id
  1425.     engfunc(EngFunc_WriteCoord, originF[0]) // x
  1426.     engfunc(EngFunc_WriteCoord, originF[1]) // y
  1427.     engfunc(EngFunc_WriteCoord, originF[2]) // z
  1428.     engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  1429.     engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  1430.     engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
  1431.     write_short(g_exploSpr) // sprite
  1432.     write_byte(0) // startframe
  1433.     write_byte(0) // framerate
  1434.     write_byte(4) // life
  1435.     write_byte(60) // width
  1436.     write_byte(0) // noise
  1437.     write_byte(0) // red
  1438.     write_byte(191) // green
  1439.     write_byte(255) // blue
  1440.     write_byte(200) // brightness
  1441.     write_byte(0) // speed
  1442.     message_end()
  1443.    
  1444.     // Luz Dinamica
  1445.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  1446.     write_byte(TE_DLIGHT) // TE id
  1447.     engfunc(EngFunc_WriteCoord, originF[0]) // x
  1448.     engfunc(EngFunc_WriteCoord, originF[1]) // y
  1449.     engfunc(EngFunc_WriteCoord, originF[2]) // z
  1450.     write_byte(50) // radio
  1451.     write_byte(0) // red
  1452.     write_byte(191) // green
  1453.     write_byte(255) // blue
  1454.     write_byte(30) // vida en 0.1, 30 = 3 segundos
  1455.     write_byte(30) // velocidad de decaimiento
  1456.     message_end()
  1457.  
  1458.     engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
  1459.     write_byte(TE_EXPLOSION)
  1460.     engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  1461.     engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  1462.     engfunc(EngFunc_WriteCoord, originF[2]+10) // z axis
  1463.     write_short(g_explosfr)
  1464.     write_byte(17)
  1465.     write_byte(15)
  1466.     write_byte(TE_EXPLFLAG_NOSOUND)
  1467.     message_end();
  1468.    
  1469.    
  1470.     engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
  1471.     write_byte(TE_SPRITETRAIL) // TE ID
  1472.     engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  1473.     engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  1474.     engfunc(EngFunc_WriteCoord, originF[2] + 40) // z axis
  1475.     engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  1476.     engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  1477.     engfunc(EngFunc_WriteCoord, originF[2]) // z axis
  1478.     write_short(frostgib) // Sprite Index
  1479.     write_byte(30) // Count
  1480.     write_byte(10) // Life
  1481.     write_byte(4) // Scale
  1482.     write_byte(50) // Velocity Along Vector
  1483.     write_byte(10) // Rendomness of Velocity
  1484.     message_end();
  1485. }

Re: Oberon Boss with trigger

Posted: 08 Jul 2019, 19:02
by Raheem
Give more information about map, will be good if you posted one map as an example.

Re: Oberon Boss with trigger

Posted: 08 Jul 2019, 19:06
by Templaso
The maps are private like ze_timesplitters_boss_v3 or ze_rooftop_runaway_v4
It's easy...when the humans reached to the escape zone they are teleported on the next part of the map and the zombies are teleported on a cage like on CS:S or CS:GO and then humans need to defeat the boss

Re: Oberon Boss with trigger

Posted: 08 Jul 2019, 19:09
by Raheem
Without sample map i can't tell you how to detect this event.

Re: Oberon Boss with trigger

Posted: 08 Jul 2019, 19:18
by Templaso
ze_rooftop_runaway_v4.bsp
(5.1 MiB) Downloaded 429 times
ze_rooftop_runaway_v4.bsp
(5.1 MiB) Downloaded 429 times

Re: Oberon Boss with trigger

Posted: 08 Jul 2019, 19:32
by Raheem
Who made the map told you when the boss will appear?

Re: Oberon Boss with trigger

Posted: 08 Jul 2019, 20:47
by czirimbolo
Raheem wrote: 4 years ago Who made the map told you when the boss will appear?


the boss will appear when human get to the end of mape (escape zone)
Mystic Viper wrote: 4 years ago The maps are private like ze_timesplitters_boss_v3 or ze_rooftop_runaway_v4
It's easy...when the humans reached to the escape zone they are teleported on the next part of the map and the zombies are teleported on a cage like on CS:S or CS:GO and then humans need to defeat the boss

Re: Oberon Boss with trigger

Posted: 10 Jul 2019, 14:32
by Raheem
More information must required.

Re: Oberon Boss with trigger

Posted: 11 Jul 2019, 02:04
by Raheem
Here when player touch trigger_muliple with targetname defined in this CVAR: oberon_boss_targetname "oberon_boss" the boss appear,
exmaple for the following map, CVAR should be: oberon_boss_targetname "oberon"
The boss will appear when a human touch this entity, it appears only one time per round:

  1. #include <zombie_escape>
  2. #include <engine>
  3. #include <xs>
  4.  
  5. #define OBERON_CLASSNAME "oberon"
  6. #define OBERON_HEALTH 40000.0
  7.  
  8. #define TASK_SKILL 123123123
  9. #define TASK_HOOKINGUP 123312312
  10. #define TASK_HOOKINGDOWN 123312313
  11.  
  12. new const oberon_model[] = "models/boss/zbs_bossl_big02.mdl"
  13. new const oberon_knife_effect[] = "models/boss/ef_knife.mdl"
  14. new const oberon_hole_effect[] = "models/boss/ef_hole.mdl"
  15. new const oberon_bomb_model[] = "models/boss/zbs_bossl_big02_bomb.mdl"
  16.  
  17. new const oberon_appear_sound[] = "misc/boss/appear.wav"
  18. new const oberon_death_sound[] = "misc/boss/death.wav"
  19. new const oberon_evolution_sound[] = "misc/boss/knife.wav"
  20. new const oberon_attack_sound[8][] =
  21. {
  22.     "misc/boss/attack1.wav",
  23.     "misc/boss/attack2.wav",
  24.     "misc/boss/attack3_jump.wav",
  25.     "misc/boss/attack3.wav",
  26.     "misc/boss/knife_attack1.wav",
  27.     "misc/boss/knife_attack2.wav",
  28.     "misc/boss/knife_attack3_jump.wav",
  29.     "misc/boss/knife_attack3.wav"
  30. }
  31. new const oberon_hole_sound[] = "oberon/hole.wav"
  32. new const oberon_bomb_sound[] = "oberon/attack_bomb.wav"
  33.  
  34. new oberon_model_id, g_reg, m_iBlood[2], exp_spr_id
  35. new Float:g_cur_origin[3], Float:g_cur_angles[3]
  36. new g_evolution, g_evoluting, g_doing_other, g_attacking3, Float:g_attacking3_origin[3]
  37.  
  38. new g_pCvarTargetName
  39. new bool:g_bBossAppeared
  40.  
  41. public plugin_init()
  42. {
  43.     register_plugin("Oberon Boss", "1.0", "Dias & ModsCs")
  44.  
  45.     register_touch(OBERON_CLASSNAME, "*", "fw_touch")
  46.    
  47.     RegisterHam(Ham_Touch, "trigger_multiple", "Fw_TouchTriggerMultiple_Pre", 0)
  48.    
  49.     g_pCvarTargetName = register_cvar("oberon_boss_targetname", "oberon_boss") /* Target name of trigger_multiple in the map */
  50. }
  51.  
  52. public plugin_precache()
  53. {
  54.     oberon_model_id = precache_model(oberon_model)
  55.     precache_model(oberon_knife_effect)
  56.     precache_model(oberon_hole_effect)
  57.     precache_model(oberon_bomb_model)
  58.    
  59.     precache_sound(oberon_appear_sound)
  60.     precache_sound(oberon_death_sound)
  61.     precache_sound(oberon_evolution_sound)
  62.     for(new i = 0; i < sizeof(oberon_attack_sound); i++)
  63.     {
  64.         precache_sound(oberon_attack_sound[i])
  65.     }
  66.     precache_sound(oberon_hole_sound)
  67.     precache_sound(oberon_bomb_sound)
  68.    
  69.     m_iBlood[0] = precache_model("sprites/blood.spr")
  70.     m_iBlood[1] = precache_model("sprites/bloodspray.spr")
  71.     exp_spr_id = precache_model("sprites/zerogxplode.spr")
  72. }
  73.  
  74. public Fw_TouchTriggerMultiple_Pre(iEnt, id)
  75. {
  76.     // Check valid entity
  77.     if (is_entity(iEnt))
  78.     {
  79.         // Get entity target name
  80.         new szTargetname[32]
  81.         get_entvar(iEnt, EntVars:var_targetname, szTargetname, charsmax(szTargetname))
  82.        
  83.         // Get cvar targetname
  84.         new szCvarTargetname[32]
  85.         get_pcvar_string(g_pCvarTargetName, szCvarTargetname, charsmax(szCvarTargetname))
  86.        
  87.         // It's our target & player is human & boss not appeard yet?
  88.         if (equal(szTargetname, szCvarTargetname) && !g_bBossAppeared && !ze_is_user_zombie(id))
  89.         {
  90.             // Create our boss
  91.             create_oberon(id)
  92.            
  93.             // Set boss as appeared so not appear again
  94.             g_bBossAppeared = true;
  95.         }
  96.     }
  97. }
  98.  
  99. public ze_game_started()
  100. {
  101.     static ent
  102.     ent = find_ent_by_class(-1, OBERON_CLASSNAME)
  103.    
  104.     if(task_exists(ent+TASK_SKILL))
  105.     {
  106.         remove_task(ent+TASK_SKILL)
  107.     }
  108.    
  109.     g_bBossAppeared = false
  110. }
  111.  
  112. public create_oberon(id)
  113. {
  114.     new ent = create_entity("info_target")
  115.    
  116.     pev(id, pev_origin, g_cur_origin)
  117.     pev(id, pev_angles, g_cur_angles)
  118.    
  119.     entity_set_origin(ent, g_cur_origin)
  120.     entity_set_vector(ent, EV_VEC_angles, g_cur_angles)
  121.    
  122.     entity_set_float(ent, EV_FL_takedamage, 1.0)
  123.     entity_set_float(ent, EV_FL_health, OBERON_HEALTH + 1000.0)
  124.    
  125.     entity_set_string(ent,EV_SZ_classname, OBERON_CLASSNAME)
  126.     entity_set_model(ent, oberon_model)
  127.     entity_set_int(ent, EV_INT_solid, SOLID_SLIDEBOX)
  128.     entity_set_int(ent, EV_INT_movetype, MOVETYPE_STEP)
  129.    
  130.     new Float:maxs[3] = {100.0, 100.0, 100.0}
  131.     new Float:mins[3] = {-100.0, -100.0, -30.0}
  132.     entity_set_size(ent, mins, maxs)
  133.     entity_set_int(ent, EV_INT_modelindex, oberon_model_id)
  134.    
  135.     set_entity_anim(ent, 1)
  136.    
  137.     set_pev(ent, pev_iuser4, 0)
  138.    
  139.     entity_set_float(ent, EV_FL_nextthink, halflife_time() + 6.0)
  140.     set_task(5.0, "start_oberon", ent)
  141.    
  142.     set_task(15.0, "do_random_skill", ent, _, _, "b")
  143.    
  144.     if(!g_reg)
  145.     {
  146.         RegisterHamFromEntity(Ham_TakeDamage, ent, "fw_takedmg", 1)
  147.         RegisterHamFromEntity(Ham_Think, ent, "fw_think")
  148.         g_reg = 1
  149.     }  
  150.    
  151.     g_evolution = 0
  152.     g_evoluting = 0
  153.     g_doing_other = 0
  154.    
  155.     drop_to_floor(ent)
  156.     emit_sound(ent, CHAN_BODY, oberon_appear_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  157. }
  158.  
  159. public start_oberon(ent)
  160. {
  161.     set_entity_anim(ent, 2)
  162. }
  163.  
  164. public fw_think(ent)
  165. {
  166.     if(!is_valid_ent(ent))
  167.         return HAM_IGNORED
  168.        
  169.     if(pev(ent, pev_iuser4) == 1) // Oberon nie zyje
  170.         return HAM_IGNORED
  171.        
  172.     if(g_evoluting || g_doing_other)
  173.         return HAM_IGNORED
  174.        
  175.     if(pev(ent, pev_health) - 1000.0 <= 0.0)
  176.     {
  177.         set_pev(ent, pev_iuser4, 1)
  178.         set_entity_anim(ent, 20)
  179.         set_task(15.0, "move_entity", ent)
  180.         entity_set_int(ent, EV_INT_solid, SOLID_NOT)
  181.         entity_set_float(ent, EV_FL_takedamage, 0.0)
  182.        
  183.         emit_sound(ent, CHAN_BODY, oberon_death_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  184.        
  185.         return HAM_IGNORED
  186.     }
  187.     if((pev(ent, pev_health) - 1000.0 <= OBERON_HEALTH / 2.0) && !g_evolution)
  188.     {
  189.         g_evoluting = 1
  190.         set_entity_anim(ent, 11)
  191.        
  192.         emit_sound(ent, CHAN_BODY, oberon_evolution_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  193.         set_task(8.0, "set_new_idle", ent)
  194.        
  195.         return HAM_IGNORED
  196.     }  
  197.    
  198.     static victim
  199.     static Float:Origin[3], Float:VicOrigin[3], Float:distance
  200.    
  201.     victim = FindClosesEnemy(ent)
  202.     pev(ent, pev_origin, Origin)
  203.     pev(victim, pev_origin, VicOrigin)
  204.    
  205.     distance = get_distance_f(Origin, VicOrigin)
  206.    
  207.     if(is_user_alive(victim))
  208.     {
  209.         if(distance <= 250.0)
  210.         {
  211.             if(!is_valid_ent(ent))
  212.                 return FMRES_IGNORED  
  213.        
  214.             new Float:Ent_Origin[3], Float:Vic_Origin[3]
  215.            
  216.             pev(ent, pev_origin, Ent_Origin)
  217.             pev(victim, pev_origin, Vic_Origin)        
  218.        
  219.             npc_turntotarget(ent, Ent_Origin, victim, Vic_Origin)
  220.            
  221.             static Attack_Type, attack_anim, attack_sound
  222.             Attack_Type = random_num(1, 2)
  223.            
  224.             if(Attack_Type == 1)
  225.             {
  226.                 if(g_evolution)
  227.                 {
  228.                     attack_anim = 14
  229.                     attack_sound = 4
  230.                 } else {
  231.                     attack_anim = 6
  232.                     attack_sound = 0
  233.                 }
  234.                
  235.                 set_entity_anim(ent, attack_anim)
  236.                 emit_sound(ent, CHAN_BODY, oberon_attack_sound[attack_sound], 1.0, ATTN_NORM, 0, PITCH_NORM)
  237.                
  238.                 set_task(1.0, "do_takedmg", ent)
  239.                
  240.                 entity_set_float(ent, EV_FL_nextthink, get_gametime() + 3.0)
  241.             } else {
  242.                 if(g_evolution)
  243.                 {
  244.                     attack_anim = 15
  245.                     attack_sound = 5
  246.                 } else {
  247.                     attack_anim = 7
  248.                     attack_sound = 1
  249.                 }
  250.                    
  251.                 set_entity_anim(ent, attack_anim)  
  252.                 emit_sound(ent, CHAN_BODY, oberon_attack_sound[attack_sound], 1.0, ATTN_NORM, 0, PITCH_NORM)
  253.                
  254.                 set_task(0.5, "do_takedmg", ent)          
  255.                
  256.                 entity_set_float(ent, EV_FL_nextthink, get_gametime() + 3.0)
  257.             }
  258.            
  259.         }
  260.         else
  261.         {
  262.             static moving_anim
  263.            
  264.             if(g_evolution)
  265.                 moving_anim = 13
  266.             else
  267.                 moving_anim = 3    
  268.        
  269.             if(pev(ent, pev_sequence) != moving_anim)
  270.             {
  271.                 entity_set_float(ent, EV_FL_animtime, get_gametime())
  272.                 entity_set_float(ent, EV_FL_framerate, 1.0)
  273.                 entity_set_int(ent, EV_INT_sequence, moving_anim)
  274.             }
  275.                
  276.             new Float:Ent_Origin[3], Float:Vic_Origin[3]
  277.            
  278.             pev(ent, pev_origin, Ent_Origin)
  279.             pev(victim, pev_origin, Vic_Origin)
  280.            
  281.             npc_turntotarget(ent, Ent_Origin, victim, Vic_Origin)
  282.             hook_ent(ent, victim, 100.0)
  283.            
  284.             entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.1)
  285.         }
  286.     }
  287.     else
  288.     {
  289.         static idle_anim
  290.        
  291.         if(g_evolution)
  292.             idle_anim = 12
  293.         else
  294.             idle_anim = 2
  295.            
  296.         if(pev(ent, pev_sequence) != idle_anim)
  297.         {
  298.             set_entity_anim(ent, idle_anim)
  299.         }  
  300.            
  301.         entity_set_float(ent, EV_FL_nextthink, get_gametime() + 1.0)
  302.     }  
  303.     return HAM_HANDLED
  304. }
  305.  
  306. public do_random_skill(ent)
  307. {
  308.     if(!pev_valid(ent))
  309.         return PLUGIN_HANDLED
  310.        
  311.     if(g_evoluting)
  312.         return PLUGIN_HANDLED
  313.        
  314.     if(pev(ent, pev_health) - 1000.0 <= 0.0)
  315.         return PLUGIN_HANDLED
  316.    
  317.     static random_skill
  318.     random_skill = random_num(0, 100)
  319.    
  320.     g_doing_other = 1
  321.    
  322.     switch(random_skill)
  323.     {
  324.         case 0..37:
  325.         {
  326.             do_attack3(ent)
  327.         }
  328.         case 38..72:
  329.         {
  330.             do_hole(ent)
  331.         }
  332.         case 73..100:
  333.         {
  334.             do_bomb(ent)
  335.         }      
  336.     }  
  337.     return PLUGIN_CONTINUE
  338. }
  339.  
  340. public do_bomb(oberon)
  341. {
  342.     g_doing_other = 1
  343.    
  344.     static bomb_anim
  345.     if(g_evolution)
  346.         bomb_anim = 18
  347.     else
  348.         bomb_anim = 9
  349.        
  350.     set_entity_anim(oberon, bomb_anim)
  351.    
  352.     set_task(3.0, "do_skill_bomb", oberon+2015, _, _, "b")
  353.     set_task(10.0, "stop_skill_bomb", oberon)
  354. }
  355.  
  356. public stop_skill_bomb(oberon)
  357. {
  358.     remove_task(oberon+2015)
  359.    
  360.     static idle_anim
  361.    
  362.     if(g_evolution)
  363.         idle_anim = 12
  364.     else
  365.         idle_anim = 2
  366.        
  367.     set_entity_anim(oberon, idle_anim)
  368.     set_task(2.0, "reset_think", oberon)
  369. }
  370.  
  371. public do_skill_bomb(oberon)
  372. {
  373.     oberon -= 2015
  374.     static Float:StartOrigin[3], Float:TempOrigin[6][3], Float:VicOrigin[6][3], Float:Random1
  375.    
  376.     pev(oberon, pev_origin, StartOrigin)
  377.     emit_sound(oberon, CHAN_BODY, oberon_bomb_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  378.    
  379.     // Pierwsza Bomba
  380.     Random1 = random_float(100.0, 500.0)
  381.     VicOrigin[0][0] = StartOrigin[0] + Random1
  382.     VicOrigin[0][1] = StartOrigin[1]
  383.     VicOrigin[0][2] = StartOrigin[2]
  384.    
  385.     TempOrigin[0][0] = VicOrigin[0][0] - (Random1 / 2.0)
  386.     TempOrigin[0][1] = VicOrigin[0][1]
  387.     TempOrigin[0][2] = VicOrigin[0][2] + 500.0
  388.    
  389.     // Druga Bomba
  390.     Random1 = random_float(100.0, 500.0)
  391.     VicOrigin[1][0] = StartOrigin[0]
  392.     VicOrigin[1][1] = StartOrigin[1] + Random1
  393.     VicOrigin[1][2] = StartOrigin[2]
  394.    
  395.     TempOrigin[1][0] = VicOrigin[1][0]
  396.     TempOrigin[1][1] = VicOrigin[1][1] - (Random1 / 2.0)
  397.     TempOrigin[1][2] = VicOrigin[1][2] + 500.0
  398.    
  399.     // Trzecia Bomba
  400.     Random1 = random_float(100.0, 500.0)
  401.     VicOrigin[2][0] = StartOrigin[0] - Random1
  402.     VicOrigin[2][1] = StartOrigin[1]
  403.     VicOrigin[2][2] = StartOrigin[2]
  404.    
  405.     TempOrigin[2][0] = VicOrigin[2][0] - (Random1 / 2.0)
  406.     TempOrigin[2][1] = VicOrigin[2][1]
  407.     TempOrigin[2][2] = VicOrigin[2][2] + 500.0
  408.    
  409.     // Czwarta Bomba
  410.     VicOrigin[3][0] = StartOrigin[0]
  411.     VicOrigin[3][1] = StartOrigin[1] - Random1
  412.     VicOrigin[3][2] = StartOrigin[2]
  413.    
  414.     TempOrigin[3][0] = VicOrigin[3][0]
  415.     TempOrigin[3][1] = VicOrigin[3][1] - (Random1 / 2.0)
  416.     TempOrigin[3][2] = VicOrigin[3][2] + 500.0
  417.    
  418.     // Piata Bomba
  419.     VicOrigin[4][0] = StartOrigin[0] + Random1
  420.     VicOrigin[4][1] = StartOrigin[1] + Random1
  421.     VicOrigin[4][2] = StartOrigin[2]
  422.    
  423.     TempOrigin[4][0] = VicOrigin[4][0] - (Random1 / 2.0)
  424.     TempOrigin[4][1] = VicOrigin[4][1] - (Random1 / 2.0)
  425.     TempOrigin[4][2] = VicOrigin[4][2] + 500.0
  426.    
  427.     // Szusta Bomba
  428.     VicOrigin[5][0] = StartOrigin[0] + Random1
  429.     VicOrigin[5][1] = StartOrigin[1] - Random1
  430.     VicOrigin[5][2] = StartOrigin[2]
  431.    
  432.     TempOrigin[5][0] = VicOrigin[5][0] + (Random1 / 2.0)
  433.     TempOrigin[5][1] = VicOrigin[5][1] - (Random1 / 2.0)
  434.     TempOrigin[5][2] = VicOrigin[5][2] + 500.0
  435.    
  436.     for(new i = 0; i < 6; i++)
  437.     {
  438.         make_bomb(StartOrigin, TempOrigin[i], VicOrigin[i])
  439.     }  
  440. }
  441.  
  442. public make_bomb(Float:StartOrigin[3], Float:TempOrigin[3], Float:VicOrigin[3])
  443. {
  444.     new ent = create_entity("info_target")
  445.    
  446.     StartOrigin[2] += 20.0
  447.    
  448.     entity_set_origin(ent, StartOrigin)
  449.    
  450.     entity_set_string(ent,EV_SZ_classname, "oberon_bomb")
  451.     entity_set_model(ent, oberon_bomb_model)
  452.     entity_set_int(ent, EV_INT_solid, SOLID_NOT)
  453.     entity_set_int(ent, EV_INT_movetype, MOVETYPE_BOUNCE)
  454.    
  455.     new Float:maxs[3] = {10.0,10.0,10.0}
  456.     new Float:mins[3] = {-10.0,-10.0,-5.0}
  457.     entity_set_size(ent, mins, maxs)
  458.    
  459.     entity_set_float(ent, EV_FL_animtime, get_gametime())
  460.     entity_set_float(ent, EV_FL_framerate, 1.0)
  461.     entity_set_int(ent, EV_INT_sequence, 0)    
  462.    
  463.     static arg[4], arg2[4]
  464.    
  465.     arg[0] = ent
  466.     arg[1] = floatround(TempOrigin[0])
  467.     arg[2] = floatround(TempOrigin[1])
  468.     arg[3] = floatround(TempOrigin[2])
  469.  
  470.     arg2[0] = ent
  471.     arg2[1] = floatround(VicOrigin[0])
  472.     arg2[2] = floatround(VicOrigin[1])
  473.     arg2[3] = floatround(VicOrigin[2])
  474.    
  475.     set_task(0.01, "do_hook_bomb_up", TASK_HOOKINGUP, arg, sizeof(arg), "b")
  476.     set_task(1.0, "do_hook_bomb_down", _, arg2, sizeof(arg2))
  477.     set_task(2.0, "bomb_explode", ent)
  478. }
  479.  
  480. public bomb_explode(ent)
  481. {
  482.     remove_task(TASK_HOOKINGUP)
  483.     remove_task(TASK_HOOKINGDOWN)
  484.    
  485.     static Float:Origin[3]
  486.     pev(ent, pev_origin, Origin)
  487.    
  488.     message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
  489.     write_byte(TE_EXPLOSION)
  490.     engfunc(EngFunc_WriteCoord, Origin[0])
  491.     engfunc(EngFunc_WriteCoord, Origin[1])
  492.     engfunc(EngFunc_WriteCoord, Origin[2])
  493.     write_short(exp_spr_id) // sprite index
  494.     write_byte(20)  // scale in 0.1's
  495.     write_byte(30)  // framerate
  496.     write_byte(0)   // flags
  497.     message_end()  
  498.    
  499.     for(new i = 1; i < get_maxplayers(); i++)
  500.     {
  501.         if(is_user_alive(i) && entity_range(i, ent) <= 300.0)
  502.         {
  503.             static Float:Damage
  504.             Damage = random_float(10.0, 30.0)
  505.            
  506.             if(g_evolution)
  507.                 Damage *= 2.0
  508.                
  509.             ExecuteHam(Ham_TakeDamage, i, 0, i, Damage, DMG_BLAST)
  510.             hit_screen(i)
  511.         }
  512.     }  
  513.    
  514.     remove_entity(ent)
  515. }
  516.  
  517. public do_hook_bomb_down(arg[4])
  518. {
  519.     remove_task(TASK_HOOKINGUP)
  520.     set_task(0.01, "do_hook_bomb_down2", TASK_HOOKINGDOWN, arg, sizeof(arg), "b")
  521. }
  522.  
  523. public do_hook_bomb_down2(arg[4])
  524. {
  525.     static ent, Float:VicOrigin[3]
  526.    
  527.     ent = arg[0]
  528.     VicOrigin[0] = float(arg[1])
  529.     VicOrigin[1] = float(arg[2])
  530.     VicOrigin[2] = float(arg[3])  
  531.    
  532.     hook_ent2(ent, VicOrigin, 500.0)
  533. }
  534.  
  535. public do_hook_bomb_up(arg[4])
  536. {
  537.     static ent, Float:TempOrigin[3]
  538.    
  539.     ent = arg[0]
  540.     TempOrigin[0] = float(arg[1])
  541.     TempOrigin[1] = float(arg[2])
  542.     TempOrigin[2] = float(arg[3])
  543.    
  544.     hook_ent2(ent, TempOrigin, 500.0)
  545. }
  546.  
  547. public do_hole(oberon)
  548. {
  549.     static hole_anim
  550.    
  551.     if(g_evolution)
  552.         hole_anim = 19
  553.     else
  554.         hole_anim = 10
  555.        
  556.     set_entity_anim(oberon, hole_anim)
  557.     emit_sound(oberon, CHAN_BODY, oberon_hole_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  558.    
  559.     new ent = create_entity("info_target")
  560.    
  561.     static Float:Origin[3]
  562.     pev(oberon, pev_origin, Origin)
  563.    
  564.     Origin[2] -= 10.0
  565.    
  566.     entity_set_origin(ent, Origin)
  567.    
  568.     entity_set_string(ent,EV_SZ_classname, "hole_hook")
  569.     entity_set_model(ent, oberon_hole_effect)
  570.     entity_set_int(ent, EV_INT_solid, SOLID_NOT)
  571.     entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE)
  572.    
  573.     new Float:maxs[3] = {1.0,1.0,1.0}
  574.     new Float:mins[3] = {-1.0,-1.0,-1.0}
  575.     entity_set_size(ent, mins, maxs)
  576.    
  577.     entity_set_float(ent, EV_FL_animtime, get_gametime())
  578.     entity_set_float(ent, EV_FL_framerate, 1.0)
  579.     entity_set_int(ent, EV_INT_sequence, 0)
  580.    
  581.     set_pev(ent, pev_rendermode, kRenderTransAdd)
  582.     set_pev(ent, pev_renderamt, 255.0)
  583.    
  584.     drop_to_floor(ent)
  585.    
  586.     for(new i = 0; i < get_maxplayers(); i++)
  587.     {
  588.         if(is_user_alive(i) && entity_range(oberon, i) <= 1000.0)
  589.         {
  590.             static arg[2]
  591.             arg[0] = oberon
  592.             arg[1] = i
  593.            
  594.             set_task(0.01, "do_hook_player", 512512, arg, sizeof(arg), "b")
  595.         }
  596.     }
  597.    
  598.     set_task(5.0, "stop_hook", oberon+2012)
  599. }
  600.  
  601. public do_hook_player(arg[2])
  602. {
  603.     static Float:Origin[3], Float:Speed
  604.     pev(arg[0], pev_origin, Origin)
  605.    
  606.     Speed = (1000.0 / entity_range(arg[0], arg[1])) * 75.0
  607.    
  608.     hook_ent2(arg[1], Origin, Speed)
  609. }
  610.  
  611. public stop_hook(oberon)
  612. {
  613.     oberon -= 2012
  614.    
  615.     static ent
  616.     ent = find_ent_by_class(-1, "hole_hook")
  617.    
  618.     remove_entity(ent)
  619.     remove_task(512512)
  620.    
  621.     do_takedmg(oberon)
  622.     set_task(1.0, "reset_think", oberon)
  623. }
  624.  
  625. public do_attack3(ent)
  626. {
  627.     static attack3_anim, attack3_sound
  628.    
  629.     if(g_evolution)
  630.     {
  631.         attack3_anim = 16
  632.         attack3_sound = 6
  633.     } else {
  634.         attack3_anim = 8
  635.         attack3_sound = 2
  636.     }  
  637.    
  638.     g_attacking3 = 1
  639.    
  640.     set_entity_anim(ent, attack3_anim)
  641.    
  642.     emit_sound(ent, CHAN_BODY, oberon_attack_sound[attack3_sound], 1.0, ATTN_NORM, 0, PITCH_NORM)
  643.     set_task(0.1, "attack3_jump", ent)
  644. }
  645.  
  646. public attack3_jump(ent)
  647. {
  648.     set_task(0.01, "hookingup", ent+TASK_HOOKINGUP, _, _, "b")
  649.     set_task(1.0, "hookingdown", ent+TASK_HOOKINGDOWN)
  650.    
  651.     static Enemy
  652.     Enemy = FindClosesEnemy(ent)  
  653.    
  654.     pev(Enemy, pev_origin, g_attacking3_origin)
  655. }
  656.  
  657. public hookingup(ent)
  658. {
  659.     ent -= TASK_HOOKINGUP
  660.    
  661.     static Float:Origin[3]
  662.     pev(ent, pev_origin, Origin)
  663.    
  664.     Origin[2] += 1000.0
  665.    
  666.     hook_ent2(ent, Origin, 1000.0)
  667.    
  668.     static Enemy
  669.     Enemy = FindClosesEnemy(ent)  
  670.    
  671.     new Float:Ent_Origin[3], Float:Vic_Origin[3]
  672.    
  673.     pev(ent, pev_origin, Ent_Origin)
  674.     pev(Enemy, pev_origin, Vic_Origin)
  675.    
  676.     npc_turntotarget(ent, Ent_Origin, Enemy, Vic_Origin)  
  677. }
  678.  
  679. public hookingdown(ent)
  680. {
  681.     ent -= TASK_HOOKINGDOWN
  682.    
  683.     remove_task(ent+TASK_HOOKINGUP)
  684.     set_task(0.5, "set_func1", ent)
  685.    
  686.     set_task(0.01, "hookingdown2", ent+TASK_HOOKINGDOWN, _, _, "b")
  687. }
  688.  
  689. public set_func1(ent)
  690. {
  691.     set_pev(ent, pev_iuser3, 1)
  692. }
  693.  
  694. public hookingdown2(ent)
  695. {
  696.     ent -= TASK_HOOKINGDOWN
  697.    
  698.     static Enemy
  699.     Enemy = FindClosesEnemy(ent)
  700.    
  701.     hook_ent2(ent, g_attacking3_origin, 1000.0)
  702.    
  703.     new Float:Ent_Origin[3], Float:Vic_Origin[3]
  704.    
  705.     pev(ent, pev_origin, Ent_Origin)
  706.     pev(Enemy, pev_origin, Vic_Origin)
  707.    
  708.     npc_turntotarget(ent, Ent_Origin, Enemy, Vic_Origin)      
  709. }
  710.  
  711. public fw_touch(ent, touch)
  712. {
  713.     if(!pev_valid(ent))
  714.         return FMRES_IGNORED
  715.        
  716.     if(g_attacking3 && pev(ent, pev_iuser3) == 1)
  717.     {
  718.         remove_task(ent+TASK_HOOKINGDOWN)
  719.        
  720.         if(is_user_alive(touch))
  721.             user_kill(touch)
  722.            
  723.         g_attacking3 = 0
  724.         set_pev(ent, pev_iuser3, 0)
  725.        
  726.         set_task(0.75, "reset_think", ent)
  727.        
  728.         for(new i = 1; i < get_maxplayers(); i++)
  729.         {
  730.             if(is_user_alive(i) && entity_range(ent, i) <= 300.0)
  731.             {
  732.                 hit_screen(i)
  733.                
  734.                 static Float:Damage
  735.                 Damage = random_float(10.0, 25.0)
  736.                
  737.                 if(g_evolution)
  738.                     Damage *= 1.5
  739.                
  740.                 ExecuteHam(Ham_TakeDamage, i, 0, i, Damage, DMG_BLAST)
  741.             }
  742.         }  
  743.        
  744.         static attack3_sound
  745.         if(g_evolution)
  746.             attack3_sound = 7
  747.         else
  748.             attack3_sound = 3
  749.        
  750.         emit_sound(ent, CHAN_BODY, oberon_attack_sound[attack3_sound], 1.0, ATTN_NORM, 0, PITCH_NORM)      
  751.            
  752.         drop_to_floor(ent)
  753.     }
  754.        
  755.     return FMRES_HANDLED
  756. }
  757.  
  758. public do_takedmg(ent2)
  759. {
  760.     if(g_evolution)
  761.     {
  762.         new ent = create_entity("info_target")
  763.    
  764.         static Float:Origin[3], Float:Angles[3]
  765.         pev(ent2, pev_origin, Origin)
  766.         pev(ent2, pev_angles, Angles)
  767.        
  768.         entity_set_origin(ent, Origin)
  769.         entity_set_vector(ent, EV_VEC_angles, Angles)
  770.        
  771.         entity_set_string(ent,EV_SZ_classname, "knife_effect")
  772.         entity_set_model(ent, oberon_knife_effect)
  773.         entity_set_int(ent, EV_INT_solid, SOLID_NOT)
  774.         entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE)
  775.        
  776.         new Float:maxs[3] = {40.0, 40.0, 1.0}
  777.         new Float:mins[3] = {-40.0, -40.0, -1.0}
  778.         entity_set_size(ent, mins, maxs)
  779.        
  780.         drop_to_floor(ent)
  781.        
  782.         set_task(1.0, "remove_knife_effect", ent)
  783.     }
  784.    
  785.     for(new i = 1; i < get_maxplayers(); i++)
  786.     {
  787.         if(is_user_alive(i) && entity_range(ent2, i) <= 300.0)
  788.         {
  789.             hit_screen(i)
  790.            
  791.             static Float:Damage
  792.             Damage = random_float(7.5, 15.0)
  793.            
  794.             if(g_evolution)
  795.                 Damage *= 2.0
  796.            
  797.             ExecuteHam(Ham_TakeDamage, i, 0, i, Damage, DMG_BLAST)
  798.         }
  799.     }  
  800. }
  801.  
  802. public remove_knife_effect(ent)
  803. {
  804.     remove_entity(ent)
  805. }
  806.  
  807. public set_new_idle(ent)
  808. {
  809.     g_evoluting = 0
  810.     g_evolution = 1
  811.     set_entity_anim(ent, 12)
  812.    
  813.     entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.1)
  814. }
  815.  
  816. public move_entity(ent)
  817. {
  818.     static Float:Origin[3]
  819.    
  820.     Origin[0] = 4290.0
  821.     Origin[1] = 4290.0
  822.     Origin[2] = 4290.0
  823.    
  824.     set_pev(ent, pev_origin, Origin)
  825.     entity_set_float(ent, EV_FL_nextthink, halflife_time() + 99999999.0)
  826. }
  827.  
  828. public fw_takedmg(victim, inflictor, attacker, Float:damage, damagebits)
  829. {
  830.     static Float:Origin[3]
  831.     fm_get_aimorigin(attacker, Origin)
  832.    
  833.     client_print(attacker, print_center, "Zycie Oberona: %i", floatround(pev(victim, pev_health) - 1000.0))
  834.    
  835.     create_blood(Origin)  
  836. }
  837.  
  838. stock set_entity_anim(ent, anim)
  839. {
  840.     entity_set_float(ent, EV_FL_animtime, get_gametime())
  841.     entity_set_float(ent, EV_FL_framerate, 1.0)
  842.     entity_set_int(ent, EV_INT_sequence, anim)
  843. }
  844.  
  845. stock create_blood(const Float:origin[3])
  846. {
  847.     // Show some blood :)
  848.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  849.     write_byte(TE_BLOODSPRITE)
  850.     engfunc(EngFunc_WriteCoord, origin[0])
  851.     engfunc(EngFunc_WriteCoord, origin[1])
  852.     engfunc(EngFunc_WriteCoord, origin[2])
  853.     write_short(m_iBlood[1])
  854.     write_short(m_iBlood[0])
  855.     write_byte(75)
  856.     write_byte(5)
  857.     message_end()
  858. }
  859.  
  860. stock fm_get_aimorigin(index, Float:origin[3])
  861. {
  862.     new Float:start[3], Float:view_ofs[3];
  863.     pev(index, pev_origin, start);
  864.     pev(index, pev_view_ofs, view_ofs);
  865.     xs_vec_add(start, view_ofs, start);
  866.    
  867.     new Float:dest[3];
  868.     pev(index, pev_v_angle, dest);
  869.     engfunc(EngFunc_MakeVectors, dest);
  870.     global_get(glb_v_forward, dest);
  871.     xs_vec_mul_scalar(dest, 9999.0, dest);
  872.     xs_vec_add(start, dest, dest);
  873.    
  874.     engfunc(EngFunc_TraceLine, start, dest, 0, index, 0);
  875.     get_tr2(0, TR_vecEndPos, origin);
  876.    
  877.     return 1;
  878. }  
  879.  
  880. public FindClosesEnemy(entid)
  881. {
  882.     new Float:Dist
  883.     new Float:maxdistance=4000.0
  884.     new indexid=0  
  885.     for(new i=1;i<=get_maxplayers();i++){
  886.         if(is_user_alive(i) && is_valid_ent(i) && can_see_fm(entid, i))
  887.         {
  888.             Dist = entity_range(entid, i)
  889.             if(Dist <= maxdistance)
  890.             {
  891.                 maxdistance=Dist
  892.                 indexid=i
  893.                
  894.                 return indexid
  895.             }
  896.         }  
  897.     }  
  898.     return 0
  899. }
  900.  
  901. public npc_turntotarget(ent, Float:Ent_Origin[3], target, Float:Vic_Origin[3])
  902. {
  903.     if(target)
  904.     {
  905.         new Float:newAngle[3]
  906.         entity_get_vector(ent, EV_VEC_angles, newAngle)
  907.         new Float:x = Vic_Origin[0] - Ent_Origin[0]
  908.         new Float:z = Vic_Origin[1] - Ent_Origin[1]
  909.  
  910.         new Float:radians = floatatan(z/x, radian)
  911.         newAngle[1] = radians * (180 / 3.14)
  912.         if (Vic_Origin[0] < Ent_Origin[0])
  913.             newAngle[1] -= 180.0
  914.        
  915.         entity_set_vector(ent, EV_VEC_angles, newAngle)
  916.     }
  917. }
  918.  
  919. public bool:can_see_fm(entindex1, entindex2)
  920. {
  921.     if (!entindex1 || !entindex2)
  922.         return false
  923.  
  924.     if (pev_valid(entindex1) && pev_valid(entindex1))
  925.     {
  926.         new flags = pev(entindex1, pev_flags)
  927.         if (flags & EF_NODRAW || flags & FL_NOTARGET)
  928.         {
  929.             return false
  930.         }
  931.  
  932.         new Float:lookerOrig[3]
  933.         new Float:targetBaseOrig[3]
  934.         new Float:targetOrig[3]
  935.         new Float:temp[3]
  936.  
  937.         pev(entindex1, pev_origin, lookerOrig)
  938.         pev(entindex1, pev_view_ofs, temp)
  939.         lookerOrig[0] += temp[0]
  940.         lookerOrig[1] += temp[1]
  941.         lookerOrig[2] += temp[2]
  942.  
  943.         pev(entindex2, pev_origin, targetBaseOrig)
  944.         pev(entindex2, pev_view_ofs, temp)
  945.         targetOrig[0] = targetBaseOrig [0] + temp[0]
  946.         targetOrig[1] = targetBaseOrig [1] + temp[1]
  947.         targetOrig[2] = targetBaseOrig [2] + temp[2]
  948.  
  949.         engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) //  checks the had of seen player
  950.         if (get_tr2(0, TraceResult:TR_InOpen) && get_tr2(0, TraceResult:TR_InWater))
  951.         {
  952.             return false
  953.         }
  954.         else
  955.         {
  956.             new Float:flFraction
  957.             get_tr2(0, TraceResult:TR_flFraction, flFraction)
  958.             if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
  959.             {
  960.                 return true
  961.             }
  962.             else
  963.             {
  964.                 targetOrig[0] = targetBaseOrig [0]
  965.                 targetOrig[1] = targetBaseOrig [1]
  966.                 targetOrig[2] = targetBaseOrig [2]
  967.                 engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) //  checks the body of seen player
  968.                 get_tr2(0, TraceResult:TR_flFraction, flFraction)
  969.                 if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
  970.                 {
  971.                     return true
  972.                 }
  973.                 else
  974.                 {
  975.                     targetOrig[0] = targetBaseOrig [0]
  976.                     targetOrig[1] = targetBaseOrig [1]
  977.                     targetOrig[2] = targetBaseOrig [2] - 17.0
  978.                     engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) //  checks the legs of seen player
  979.                     get_tr2(0, TraceResult:TR_flFraction, flFraction)
  980.                     if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
  981.                     {
  982.                         return true
  983.                     }
  984.                 }
  985.             }
  986.         }
  987.     }
  988.     return false
  989. }
  990.  
  991. public hook_ent(ent, victim, Float:speed)
  992. {
  993.     static Float:fl_Velocity[3]
  994.     static Float:VicOrigin[3], Float:EntOrigin[3]
  995.  
  996.     pev(ent, pev_origin, EntOrigin)
  997.     pev(victim, pev_origin, VicOrigin)
  998.    
  999.     static Float:distance_f
  1000.     distance_f = get_distance_f(EntOrigin, VicOrigin)
  1001.  
  1002.     if (distance_f > 60.0)
  1003.     {
  1004.         new Float:fl_Time = distance_f / speed
  1005.  
  1006.         fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
  1007.         fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
  1008.         fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
  1009.     } else
  1010.     {
  1011.         fl_Velocity[0] = 0.0
  1012.         fl_Velocity[1] = 0.0
  1013.         fl_Velocity[2] = 0.0
  1014.     }
  1015.  
  1016.     entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
  1017. }
  1018.  
  1019. public hook_ent2(ent, Float:VicOrigin[3], Float:speed)
  1020. {
  1021.     static Float:fl_Velocity[3]
  1022.     static Float:EntOrigin[3]
  1023.  
  1024.     pev(ent, pev_origin, EntOrigin)
  1025.    
  1026.     static Float:distance_f
  1027.     distance_f = get_distance_f(EntOrigin, VicOrigin)
  1028.  
  1029.     if (distance_f > 60.0)
  1030.     {
  1031.         new Float:fl_Time = distance_f / speed
  1032.  
  1033.         fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
  1034.         fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
  1035.         fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
  1036.     } else
  1037.     {
  1038.         fl_Velocity[0] = 0.0
  1039.         fl_Velocity[1] = 0.0
  1040.         fl_Velocity[2] = 0.0
  1041.     }
  1042.  
  1043.     entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
  1044. }
  1045.  
  1046. public hit_screen(id)
  1047. {
  1048.     message_begin(MSG_ONE, get_user_msgid("ScreenShake"),{0,0,0}, id)
  1049.     write_short(1<<14)
  1050.     write_short(1<<13)
  1051.     write_short(1<<13)
  1052.     message_end()  
  1053. }
  1054.  
  1055. public reset_think(ent)
  1056. {
  1057.     g_doing_other = 0
  1058.     entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.1)
  1059. }

Confirm that this working without issues, and then i can make you the other boss you need Teddy Boss.

Here is models if anyone need to test/run this on his server:

Re: Oberon Boss with trigger

Posted: 11 Jul 2019, 09:39
by Templaso
I will test with Reks when we have free time

Re: Oberon Boss with trigger

Posted: 11 Jul 2019, 18:16
by czirimbolo
I will test it too and ley you know,

EDIT

the boss does not appear and I am not teleported to battle area where I can fight with boss. I am in escape zone and nothing happens. How to turn this boss ON? or any advice how to teleport to this boss?

Re: Oberon Boss with trigger

Posted: 12 Jul 2019, 09:46
by Raheem
czirimbolo wrote: 4 years ago I will test it too and ley you know,

EDIT

the boss does not appear and I am not teleported to battle area where I can fight with boss. I am in escape zone and nothing happens. How to turn this boss ON? or any advice how to teleport to this boss?
Boss should be activated once you touched the oberon trigger_multiple, try again and let me know i updated the code viewtopic.php?p=9928#p9928

Re: Oberon Boss with trigger

Posted: 12 Jul 2019, 12:09
by Muhammet20
Mystic Viper wrote: 4 years ago Hello guys! I'm here with a special plugin for my server and make it public for all. I want oberon to appear when a Counter-Terrorist(CT) trigger a zone or something like that. And to have cvars for this.

Oberon Boss
  1. #include <amxmodx>
  2. #include <engine>
  3. #include <fakemeta>
  4. #include <hamsandwich>
  5. #include <xs>
  6.  
  7. #define OBERON_CLASSNAME "oberon"
  8. #define OBERON_HEALTH 40000.0
  9.  
  10. #define TASK_SKILL 123123123
  11. #define TASK_HOOKINGUP 123312312
  12. #define TASK_HOOKINGDOWN 123312313
  13.  
  14. new const oberon_model[] = "models/boss/zbs_bossl_big02.mdl"
  15. new const oberon_knife_effect[] = "models/boss/ef_knife.mdl"
  16. new const oberon_hole_effect[] = "models/boss/ef_hole.mdl"
  17. new const oberon_bomb_model[] = "models/boss/zbs_bossl_big02_bomb.mdl"
  18.  
  19. new const oberon_appear_sound[] = "misc/boss/appear.wav"
  20. new const oberon_death_sound[] = "misc/boss/death.wav"
  21. new const oberon_evolution_sound[] = "misc/boss/knife.wav"
  22. new const oberon_attack_sound[8][] =
  23. {
  24.     "misc/boss/attack1.wav",
  25.     "misc/boss/attack2.wav",
  26.     "misc/boss/attack3_jump.wav",
  27.     "misc/boss/attack3.wav",
  28.     "misc/boss/knife_attack1.wav",
  29.     "misc/boss/knife_attack2.wav",
  30.     "misc/boss/knife_attack3_jump.wav",
  31.     "misc/boss/knife_attack3.wav"
  32. }
  33. new const oberon_hole_sound[] = "oberon/hole.wav"
  34. new const oberon_bomb_sound[] = "oberon/attack_bomb.wav"
  35.  
  36. new oberon_model_id, g_reg, m_iBlood[2], exp_spr_id
  37. new Float:g_cur_origin[3], Float:g_cur_angles[3], Float:g_cur_v_angle[3]
  38. new g_evolution, g_evoluting, g_doing_other, g_attacking3, Float:g_attacking3_origin[3]
  39.  
  40. public plugin_init()
  41. {
  42.     register_plugin("Oberon Boss", "1.0", "Dias & ModsCs")
  43.    
  44.     register_event("HLTV", "event_newround", "a", "1=0", "2=0")
  45.     register_touch(OBERON_CLASSNAME, "*", "fw_touch")
  46.    
  47.     register_clcmd("say /zapiszmiejsce", "get_origin", ADMIN_LEVEL_H)
  48.     register_clcmd("say /stworzbossa", "create_oberon", ADMIN_LEVEL_H)
  49. }
  50.  
  51. public plugin_precache()
  52. {
  53.     oberon_model_id = precache_model(oberon_model)
  54.     precache_model(oberon_knife_effect)
  55.     precache_model(oberon_hole_effect)
  56.     precache_model(oberon_bomb_model)
  57.    
  58.     precache_sound(oberon_appear_sound)
  59.     precache_sound(oberon_death_sound)
  60.     precache_sound(oberon_evolution_sound)
  61.     for(new i = 0; i < sizeof(oberon_attack_sound); i++)
  62.     {
  63.         precache_sound(oberon_attack_sound[i])
  64.     }
  65.     precache_sound(oberon_hole_sound)
  66.     precache_sound(oberon_bomb_sound)
  67.    
  68.     m_iBlood[0] = precache_model("sprites/blood.spr")
  69.     m_iBlood[1] = precache_model("sprites/bloodspray.spr") 
  70.     exp_spr_id = precache_model("sprites/zerogxplode.spr")
  71. }
  72.  
  73. public event_newround()
  74. {
  75.     static ent
  76.     ent = find_ent_by_class(-1, OBERON_CLASSNAME)
  77.    
  78.     if(task_exists(ent+TASK_SKILL)) remove_task(ent+TASK_SKILL)
  79. }
  80.  
  81. public get_origin(id)
  82. {
  83.    
  84.     pev(id, pev_origin, g_cur_origin)
  85.     pev(id, pev_angles, g_cur_angles)
  86.     pev(id, pev_v_angle, g_cur_v_angle)
  87.    
  88.     client_print(id, print_chat, "[Oberon Boss] Zapisano miejsce stworzenia")
  89. }
  90.  
  91. public create_oberon(id)
  92. {
  93.     new ent = create_entity("info_target")
  94.    
  95.     entity_set_origin(ent, g_cur_origin)
  96.     entity_set_vector(ent, EV_VEC_angles, g_cur_angles)
  97.     //entity_set_vector(ent, EV_VEC_v_angle, g_cur_v_angle)
  98.    
  99.     entity_set_float(ent, EV_FL_takedamage, 1.0)
  100.     entity_set_float(ent, EV_FL_health, OBERON_HEALTH + 1000.0)
  101.    
  102.     entity_set_string(ent,EV_SZ_classname, OBERON_CLASSNAME)
  103.     entity_set_model(ent, oberon_model)
  104.     entity_set_int(ent, EV_INT_solid, SOLID_SLIDEBOX)
  105.     entity_set_int(ent, EV_INT_movetype, MOVETYPE_STEP)
  106.    
  107.     new Float:maxs[3] = {100.0, 100.0, 100.0}
  108.     new Float:mins[3] = {-100.0, -100.0, -30.0}
  109.     entity_set_size(ent, mins, maxs)
  110.     entity_set_int(ent, EV_INT_modelindex, oberon_model_id)
  111.    
  112.     set_entity_anim(ent, 1)
  113.    
  114.     set_pev(ent, pev_iuser4, 0)
  115.    
  116.     entity_set_float(ent, EV_FL_nextthink, halflife_time() + 6.0)
  117.     set_task(5.0, "start_oberon", ent)
  118.    
  119.     set_task(15.0, "do_random_skill", ent, _, _, "b")
  120.    
  121.     if(!g_reg)
  122.     {
  123.         RegisterHamFromEntity(Ham_TakeDamage, ent, "fw_takedmg", 1)
  124.         RegisterHamFromEntity(Ham_Think, ent, "fw_think")
  125.         g_reg = 1
  126.     }  
  127.    
  128.     g_evolution = 0
  129.     g_evoluting = 0
  130.     g_doing_other = 0
  131.    
  132.     drop_to_floor(ent)
  133.     emit_sound(ent, CHAN_BODY, oberon_appear_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  134. }
  135.  
  136. public start_oberon(ent)
  137. {
  138.     set_entity_anim(ent, 2)
  139. }
  140.  
  141. public fw_think(ent)
  142. {
  143.     if(!is_valid_ent(ent))
  144.         return HAM_IGNORED
  145.        
  146.     if(pev(ent, pev_iuser4) == 1) // Oberon nie zyje
  147.         return HAM_IGNORED
  148.        
  149.     if(g_evoluting || g_doing_other)
  150.         return HAM_IGNORED
  151.        
  152.     if(pev(ent, pev_health) - 1000.0 <= 0.0)
  153.     {
  154.         set_pev(ent, pev_iuser4, 1)
  155.         set_entity_anim(ent, 20)
  156.         set_task(15.0, "move_entity", ent)
  157.         entity_set_int(ent, EV_INT_solid, SOLID_NOT)
  158.         entity_set_float(ent, EV_FL_takedamage, 0.0)
  159.        
  160.         emit_sound(ent, CHAN_BODY, oberon_death_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  161.        
  162.         return HAM_IGNORED
  163.     }
  164.     if((pev(ent, pev_health) - 1000.0 <= OBERON_HEALTH / 2.0) && !g_evolution)
  165.     {
  166.         g_evoluting = 1
  167.         set_entity_anim(ent, 11)
  168.        
  169.         emit_sound(ent, CHAN_BODY, oberon_evolution_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  170.         set_task(8.0, "set_new_idle", ent)
  171.        
  172.         return HAM_IGNORED
  173.     }  
  174.    
  175.     static victim
  176.     static Float:Origin[3], Float:VicOrigin[3], Float:distance
  177.    
  178.     victim = FindClosesEnemy(ent)
  179.     pev(ent, pev_origin, Origin)
  180.     pev(victim, pev_origin, VicOrigin)
  181.    
  182.     distance = get_distance_f(Origin, VicOrigin)
  183.    
  184.     if(is_user_alive(victim))
  185.     {
  186.         if(distance <= 250.0)
  187.         {
  188.             if(!is_valid_ent(ent))
  189.                 return FMRES_IGNORED   
  190.        
  191.             new Float:Ent_Origin[3], Float:Vic_Origin[3]
  192.            
  193.             pev(ent, pev_origin, Ent_Origin)
  194.             pev(victim, pev_origin, Vic_Origin)        
  195.        
  196.             npc_turntotarget(ent, Ent_Origin, victim, Vic_Origin)
  197.            
  198.             static Attack_Type, attack_anim, attack_sound
  199.             Attack_Type = random_num(1, 2)
  200.            
  201.             if(Attack_Type == 1)
  202.             {
  203.                 if(g_evolution)
  204.                 {
  205.                     attack_anim = 14
  206.                     attack_sound = 4
  207.                 } else {
  208.                     attack_anim = 6
  209.                     attack_sound = 0
  210.                 }
  211.                
  212.                 set_entity_anim(ent, attack_anim)
  213.                 emit_sound(ent, CHAN_BODY, oberon_attack_sound[attack_sound], 1.0, ATTN_NORM, 0, PITCH_NORM)
  214.                
  215.                 set_task(1.0, "do_takedmg", ent)
  216.                
  217.                 entity_set_float(ent, EV_FL_nextthink, get_gametime() + 3.0)
  218.             } else {
  219.                 if(g_evolution)
  220.                 {
  221.                     attack_anim = 15
  222.                     attack_sound = 5
  223.                 } else {
  224.                     attack_anim = 7
  225.                     attack_sound = 1
  226.                 }
  227.                    
  228.                 set_entity_anim(ent, attack_anim)  
  229.                 emit_sound(ent, CHAN_BODY, oberon_attack_sound[attack_sound], 1.0, ATTN_NORM, 0, PITCH_NORM)
  230.                
  231.                 set_task(0.5, "do_takedmg", ent)           
  232.                
  233.                 entity_set_float(ent, EV_FL_nextthink, get_gametime() + 3.0)
  234.             }
  235.            
  236.         }
  237.         else
  238.         {
  239.             static moving_anim
  240.            
  241.             if(g_evolution)
  242.                 moving_anim = 13
  243.             else
  244.                 moving_anim = 3    
  245.        
  246.             if(pev(ent, pev_sequence) != moving_anim)
  247.             {
  248.                 entity_set_float(ent, EV_FL_animtime, get_gametime())
  249.                 entity_set_float(ent, EV_FL_framerate, 1.0)
  250.                 entity_set_int(ent, EV_INT_sequence, moving_anim)
  251.             }
  252.                
  253.             new Float:Ent_Origin[3], Float:Vic_Origin[3]
  254.            
  255.             pev(ent, pev_origin, Ent_Origin)
  256.             pev(victim, pev_origin, Vic_Origin)
  257.            
  258.             npc_turntotarget(ent, Ent_Origin, victim, Vic_Origin)
  259.             hook_ent(ent, victim, 100.0)
  260.            
  261.             entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.1)
  262.         }
  263.     }
  264.     else
  265.     {
  266.         static idle_anim
  267.        
  268.         if(g_evolution)
  269.             idle_anim = 12
  270.         else
  271.             idle_anim = 2
  272.            
  273.         if(pev(ent, pev_sequence) != idle_anim)
  274.         {
  275.             set_entity_anim(ent, idle_anim)
  276.         }  
  277.            
  278.         entity_set_float(ent, EV_FL_nextthink, get_gametime() + 1.0)
  279.     }  
  280.     return HAM_HANDLED
  281. }
  282.  
  283. public do_random_skill(ent)
  284. {
  285.     if(!pev_valid(ent))
  286.         return PLUGIN_HANDLED
  287.        
  288.     if(g_evoluting)
  289.         return PLUGIN_HANDLED
  290.        
  291.     if(pev(ent, pev_health) - 1000.0 <= 0.0)
  292.         return PLUGIN_HANDLED
  293.    
  294.     static random_skill
  295.     random_skill = random_num(0, 100)
  296.    
  297.     g_doing_other = 1
  298.    
  299.     switch(random_skill)
  300.     {
  301.         case 0..37:
  302.         {
  303.             do_attack3(ent)
  304.         }
  305.         case 38..72:
  306.         {
  307.             do_hole(ent)
  308.         }
  309.         case 73..100:
  310.         {
  311.             do_bomb(ent)
  312.         }      
  313.     }  
  314.     return PLUGIN_CONTINUE
  315. }
  316.  
  317. public do_bomb(oberon)
  318. {
  319.     g_doing_other = 1
  320.    
  321.     static bomb_anim
  322.     if(g_evolution)
  323.         bomb_anim = 18
  324.     else
  325.         bomb_anim = 9
  326.        
  327.     set_entity_anim(oberon, bomb_anim)
  328.    
  329.     set_task(3.0, "do_skill_bomb", oberon+2015, _, _, "b")
  330.     set_task(10.0, "stop_skill_bomb", oberon)
  331. }
  332.  
  333. public stop_skill_bomb(oberon)
  334. {
  335.     remove_task(oberon+2015)
  336.    
  337.     static idle_anim
  338.    
  339.     if(g_evolution)
  340.         idle_anim = 12
  341.     else
  342.         idle_anim = 2
  343.        
  344.     set_entity_anim(oberon, idle_anim)
  345.     set_task(2.0, "reset_think", oberon)
  346. }
  347.  
  348. public do_skill_bomb(oberon)
  349. {
  350.     oberon -= 2015
  351.     static Float:StartOrigin[3], Float:TempOrigin[6][3], Float:VicOrigin[6][3], Float:Random1
  352.    
  353.     pev(oberon, pev_origin, StartOrigin)
  354.     emit_sound(oberon, CHAN_BODY, oberon_bomb_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  355.    
  356.     // Pierwsza Bomba
  357.     Random1 = random_float(100.0, 500.0)
  358.     VicOrigin[0][0] = StartOrigin[0] + Random1
  359.     VicOrigin[0][1] = StartOrigin[1]
  360.     VicOrigin[0][2] = StartOrigin[2]
  361.    
  362.     TempOrigin[0][0] = VicOrigin[0][0] - (Random1 / 2.0)
  363.     TempOrigin[0][1] = VicOrigin[0][1]
  364.     TempOrigin[0][2] = VicOrigin[0][2] + 500.0
  365.    
  366.     // Druga Bomba
  367.     Random1 = random_float(100.0, 500.0)
  368.     VicOrigin[1][0] = StartOrigin[0]
  369.     VicOrigin[1][1] = StartOrigin[1] + Random1
  370.     VicOrigin[1][2] = StartOrigin[2]
  371.    
  372.     TempOrigin[1][0] = VicOrigin[1][0]
  373.     TempOrigin[1][1] = VicOrigin[1][1] - (Random1 / 2.0)
  374.     TempOrigin[1][2] = VicOrigin[1][2] + 500.0 
  375.    
  376.     // Trzecia Bomba
  377.     Random1 = random_float(100.0, 500.0)
  378.     VicOrigin[2][0] = StartOrigin[0] - Random1
  379.     VicOrigin[2][1] = StartOrigin[1]
  380.     VicOrigin[2][2] = StartOrigin[2]
  381.    
  382.     TempOrigin[2][0] = VicOrigin[2][0] - (Random1 / 2.0)
  383.     TempOrigin[2][1] = VicOrigin[2][1]
  384.     TempOrigin[2][2] = VicOrigin[2][2] + 500.0 
  385.    
  386.     // Czwarta Bomba
  387.     VicOrigin[3][0] = StartOrigin[0]
  388.     VicOrigin[3][1] = StartOrigin[1] - Random1
  389.     VicOrigin[3][2] = StartOrigin[2]
  390.    
  391.     TempOrigin[3][0] = VicOrigin[3][0]
  392.     TempOrigin[3][1] = VicOrigin[3][1] - (Random1 / 2.0)
  393.     TempOrigin[3][2] = VicOrigin[3][2] + 500.0
  394.    
  395.     // Piata Bomba
  396.     VicOrigin[4][0] = StartOrigin[0] + Random1
  397.     VicOrigin[4][1] = StartOrigin[1] + Random1
  398.     VicOrigin[4][2] = StartOrigin[2]
  399.    
  400.     TempOrigin[4][0] = VicOrigin[4][0] - (Random1 / 2.0)
  401.     TempOrigin[4][1] = VicOrigin[4][1] - (Random1 / 2.0)
  402.     TempOrigin[4][2] = VicOrigin[4][2] + 500.0
  403.    
  404.     // Szusta Bomba
  405.     VicOrigin[5][0] = StartOrigin[0] + Random1
  406.     VicOrigin[5][1] = StartOrigin[1] - Random1
  407.     VicOrigin[5][2] = StartOrigin[2]
  408.    
  409.     TempOrigin[5][0] = VicOrigin[5][0] + (Random1 / 2.0)
  410.     TempOrigin[5][1] = VicOrigin[5][1] - (Random1 / 2.0)
  411.     TempOrigin[5][2] = VicOrigin[5][2] + 500.0 
  412.    
  413.     for(new i = 0; i < 6; i++)
  414.     {
  415.         make_bomb(StartOrigin, TempOrigin[i], VicOrigin[i])
  416.     }  
  417. }
  418.  
  419. public make_bomb(Float:StartOrigin[3], Float:TempOrigin[3], Float:VicOrigin[3])
  420. {
  421.     new ent = create_entity("info_target")
  422.    
  423.     StartOrigin[2] += 20.0
  424.    
  425.     entity_set_origin(ent, StartOrigin)
  426.    
  427.     entity_set_string(ent,EV_SZ_classname, "oberon_bomb")
  428.     entity_set_model(ent, oberon_bomb_model)
  429.     entity_set_int(ent, EV_INT_solid, SOLID_NOT)
  430.     entity_set_int(ent, EV_INT_movetype, MOVETYPE_BOUNCE)
  431.    
  432.     new Float:maxs[3] = {10.0,10.0,10.0}
  433.     new Float:mins[3] = {-10.0,-10.0,-5.0}
  434.     entity_set_size(ent, mins, maxs)
  435.    
  436.     entity_set_float(ent, EV_FL_animtime, get_gametime())
  437.     entity_set_float(ent, EV_FL_framerate, 1.0)
  438.     entity_set_int(ent, EV_INT_sequence, 0)    
  439.    
  440.     static arg[4], arg2[4]
  441.    
  442.     arg[0] = ent
  443.     arg[1] = floatround(TempOrigin[0])
  444.     arg[2] = floatround(TempOrigin[1])
  445.     arg[3] = floatround(TempOrigin[2])
  446.  
  447.     arg2[0] = ent
  448.     arg2[1] = floatround(VicOrigin[0])
  449.     arg2[2] = floatround(VicOrigin[1])
  450.     arg2[3] = floatround(VicOrigin[2]) 
  451.    
  452.     set_task(0.01, "do_hook_bomb_up", TASK_HOOKINGUP, arg, sizeof(arg), "b")
  453.     set_task(1.0, "do_hook_bomb_down", _, arg2, sizeof(arg2))
  454.     set_task(2.0, "bomb_explode", ent)
  455. }
  456.  
  457. public bomb_explode(ent)
  458. {
  459.     remove_task(TASK_HOOKINGUP)
  460.     remove_task(TASK_HOOKINGDOWN)
  461.    
  462.     static Float:Origin[3]
  463.     pev(ent, pev_origin, Origin)
  464.    
  465.     message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
  466.     write_byte(TE_EXPLOSION)
  467.     engfunc(EngFunc_WriteCoord, Origin[0])
  468.     engfunc(EngFunc_WriteCoord, Origin[1])
  469.     engfunc(EngFunc_WriteCoord, Origin[2])
  470.     write_short(exp_spr_id) // sprite index
  471.     write_byte(20)  // scale in 0.1's
  472.     write_byte(30)  // framerate
  473.     write_byte(0)   // flags
  474.     message_end()  
  475.    
  476.     for(new i = 1; i < get_maxplayers(); i++)
  477.     {
  478.         if(is_user_alive(i) && entity_range(i, ent) <= 300.0)
  479.         {
  480.             static Float:Damage
  481.             Damage = random_float(10.0, 30.0)
  482.            
  483.             if(g_evolution)
  484.                 Damage *= 2.0
  485.                
  486.             ExecuteHam(Ham_TakeDamage, i, 0, i, Damage, DMG_BLAST)
  487.             hit_screen(i)
  488.         }
  489.     }  
  490.    
  491.     remove_entity(ent)
  492. }
  493.  
  494. public do_hook_bomb_down(arg[4])
  495. {
  496.     remove_task(TASK_HOOKINGUP)
  497.     set_task(0.01, "do_hook_bomb_down2", TASK_HOOKINGDOWN, arg, sizeof(arg), "b")
  498. }
  499.  
  500. public do_hook_bomb_down2(arg[4])
  501. {
  502.     static ent, Float:VicOrigin[3]
  503.    
  504.     ent = arg[0]
  505.     VicOrigin[0] = float(arg[1])
  506.     VicOrigin[1] = float(arg[2])
  507.     VicOrigin[2] = float(arg[3])   
  508.    
  509.     hook_ent2(ent, VicOrigin, 500.0)
  510. }
  511.  
  512. public do_hook_bomb_up(arg[4])
  513. {
  514.     static ent, Float:TempOrigin[3]
  515.    
  516.     ent = arg[0]
  517.     TempOrigin[0] = float(arg[1])
  518.     TempOrigin[1] = float(arg[2])
  519.     TempOrigin[2] = float(arg[3])
  520.    
  521.     hook_ent2(ent, TempOrigin, 500.0)
  522. }
  523.  
  524. public do_hole(oberon)
  525. {
  526.     static hole_anim
  527.    
  528.     if(g_evolution)
  529.         hole_anim = 19
  530.     else
  531.         hole_anim = 10
  532.        
  533.     set_entity_anim(oberon, hole_anim)
  534.     emit_sound(oberon, CHAN_BODY, oberon_hole_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
  535.    
  536.     new ent = create_entity("info_target")
  537.    
  538.     static Float:Origin[3]
  539.     pev(oberon, pev_origin, Origin)
  540.    
  541.     Origin[2] -= 10.0
  542.    
  543.     entity_set_origin(ent, Origin)
  544.    
  545.     entity_set_string(ent,EV_SZ_classname, "hole_hook")
  546.     entity_set_model(ent, oberon_hole_effect)
  547.     entity_set_int(ent, EV_INT_solid, SOLID_NOT)
  548.     entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE)
  549.    
  550.     new Float:maxs[3] = {1.0,1.0,1.0}
  551.     new Float:mins[3] = {-1.0,-1.0,-1.0}
  552.     entity_set_size(ent, mins, maxs)
  553.    
  554.     entity_set_float(ent, EV_FL_animtime, get_gametime())
  555.     entity_set_float(ent, EV_FL_framerate, 1.0)
  556.     entity_set_int(ent, EV_INT_sequence, 0)
  557.    
  558.     set_pev(ent, pev_rendermode, kRenderTransAdd)
  559.     set_pev(ent, pev_renderamt, 255.0) 
  560.    
  561.     drop_to_floor(ent)
  562.    
  563.     for(new i = 0; i < get_maxplayers(); i++)
  564.     {
  565.         if(is_user_alive(i) && entity_range(oberon, i) <= 1000.0)
  566.         {
  567.             static arg[2]
  568.             arg[0] = oberon
  569.             arg[1] = i
  570.            
  571.             set_task(0.01, "do_hook_player", 512512, arg, sizeof(arg), "b")
  572.         }
  573.     }
  574.    
  575.     set_task(5.0, "stop_hook", oberon+2012)
  576. }
  577.  
  578. public do_hook_player(arg[2])
  579. {
  580.     static Float:Origin[3], Float:Speed
  581.     pev(arg[0], pev_origin, Origin)
  582.    
  583.     Speed = (1000.0 / entity_range(arg[0], arg[1])) * 75.0
  584.    
  585.     hook_ent2(arg[1], Origin, Speed)
  586. }
  587.  
  588. public stop_hook(oberon)
  589. {
  590.     oberon -= 2012
  591.    
  592.     static ent
  593.     ent = find_ent_by_class(-1, "hole_hook")
  594.    
  595.     remove_entity(ent)
  596.     remove_task(512512)
  597.    
  598.     do_takedmg(oberon)
  599.     set_task(1.0, "reset_think", oberon)
  600. }
  601.  
  602. public do_attack3(ent)
  603. {
  604.     static attack3_anim, attack3_sound
  605.    
  606.     if(g_evolution)
  607.     {
  608.         attack3_anim = 16
  609.         attack3_sound = 6
  610.     } else {
  611.         attack3_anim = 8
  612.         attack3_sound = 2
  613.     }  
  614.    
  615.     g_attacking3 = 1
  616.    
  617.     set_entity_anim(ent, attack3_anim)
  618.    
  619.     emit_sound(ent, CHAN_BODY, oberon_attack_sound[attack3_sound], 1.0, ATTN_NORM, 0, PITCH_NORM)
  620.     set_task(0.1, "attack3_jump", ent)
  621. }
  622.  
  623. public attack3_jump(ent)
  624. {
  625.     set_task(0.01, "hookingup", ent+TASK_HOOKINGUP, _, _, "b")
  626.     set_task(1.0, "hookingdown", ent+TASK_HOOKINGDOWN) 
  627.    
  628.     static Enemy
  629.     Enemy = FindClosesEnemy(ent)   
  630.    
  631.     pev(Enemy, pev_origin, g_attacking3_origin)
  632. }
  633.  
  634. public hookingup(ent)
  635. {
  636.     ent -= TASK_HOOKINGUP
  637.    
  638.     static Float:Origin[3]
  639.     pev(ent, pev_origin, Origin)
  640.    
  641.     Origin[2] += 1000.0
  642.    
  643.     hook_ent2(ent, Origin, 1000.0)
  644.    
  645.     static Enemy
  646.     Enemy = FindClosesEnemy(ent)   
  647.    
  648.     new Float:Ent_Origin[3], Float:Vic_Origin[3]
  649.    
  650.     pev(ent, pev_origin, Ent_Origin)
  651.     pev(Enemy, pev_origin, Vic_Origin)
  652.    
  653.     npc_turntotarget(ent, Ent_Origin, Enemy, Vic_Origin)   
  654. }
  655.  
  656. public hookingdown(ent)
  657. {
  658.     ent -= TASK_HOOKINGDOWN
  659.    
  660.     remove_task(ent+TASK_HOOKINGUP)
  661.     set_task(0.5, "set_func1", ent)
  662.    
  663.     set_task(0.01, "hookingdown2", ent+TASK_HOOKINGDOWN, _, _, "b")
  664. }
  665.  
  666. public set_func1(ent)
  667. {
  668.     set_pev(ent, pev_iuser3, 1)
  669. }
  670.  
  671. public hookingdown2(ent)
  672. {
  673.     ent -= TASK_HOOKINGDOWN
  674.    
  675.     static Enemy
  676.     Enemy = FindClosesEnemy(ent)
  677.    
  678.     hook_ent2(ent, g_attacking3_origin, 1000.0)
  679.    
  680.     new Float:Ent_Origin[3], Float:Vic_Origin[3]
  681.    
  682.     pev(ent, pev_origin, Ent_Origin)
  683.     pev(Enemy, pev_origin, Vic_Origin)
  684.    
  685.     npc_turntotarget(ent, Ent_Origin, Enemy, Vic_Origin)       
  686. }
  687.  
  688. public fw_touch(ent, touch)
  689. {
  690.     if(!pev_valid(ent))
  691.         return FMRES_IGNORED
  692.        
  693.     if(g_attacking3 && pev(ent, pev_iuser3) == 1)
  694.     {
  695.         remove_task(ent+TASK_HOOKINGDOWN)
  696.        
  697.         if(is_user_alive(touch))
  698.             user_kill(touch)
  699.            
  700.         g_attacking3 = 0
  701.         set_pev(ent, pev_iuser3, 0)
  702.        
  703.         set_task(0.75, "reset_think", ent)
  704.        
  705.         for(new i = 1; i < get_maxplayers(); i++)
  706.         {
  707.             if(is_user_alive(i) && entity_range(ent, i) <= 300.0)
  708.             {
  709.                 hit_screen(i)
  710.                
  711.                 static Float:Damage
  712.                 Damage = random_float(10.0, 25.0)
  713.                
  714.                 if(g_evolution)
  715.                     Damage *= 1.5
  716.                
  717.                 ExecuteHam(Ham_TakeDamage, i, 0, i, Damage, DMG_BLAST)
  718.             }
  719.         }  
  720.        
  721.         static attack3_sound
  722.         if(g_evolution)
  723.             attack3_sound = 7
  724.         else
  725.             attack3_sound = 3
  726.        
  727.         emit_sound(ent, CHAN_BODY, oberon_attack_sound[attack3_sound], 1.0, ATTN_NORM, 0, PITCH_NORM)      
  728.            
  729.         drop_to_floor(ent)
  730.     }
  731.        
  732.     return FMRES_HANDLED
  733. }
  734.  
  735. public do_takedmg(ent2)
  736. {
  737.     if(g_evolution)
  738.     {
  739.         new ent = create_entity("info_target")
  740.    
  741.         static Float:Origin[3], Float:Angles[3]
  742.         pev(ent2, pev_origin, Origin)
  743.         pev(ent2, pev_angles, Angles)
  744.        
  745.         entity_set_origin(ent, Origin)
  746.         entity_set_vector(ent, EV_VEC_angles, Angles)
  747.        
  748.         entity_set_string(ent,EV_SZ_classname, "knife_effect")
  749.         entity_set_model(ent, oberon_knife_effect)
  750.         entity_set_int(ent, EV_INT_solid, SOLID_NOT)
  751.         entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE)
  752.        
  753.         new Float:maxs[3] = {40.0, 40.0, 1.0}
  754.         new Float:mins[3] = {-40.0, -40.0, -1.0}
  755.         entity_set_size(ent, mins, maxs)
  756.        
  757.         drop_to_floor(ent)
  758.        
  759.         set_task(1.0, "remove_knife_effect", ent)
  760.     }
  761.    
  762.     for(new i = 1; i < get_maxplayers(); i++)
  763.     {
  764.         if(is_user_alive(i) && entity_range(ent2, i) <= 300.0)
  765.         {
  766.             hit_screen(i)
  767.            
  768.             static Float:Damage
  769.             Damage = random_float(7.5, 15.0)
  770.            
  771.             if(g_evolution)
  772.                 Damage *= 2.0
  773.            
  774.             ExecuteHam(Ham_TakeDamage, i, 0, i, Damage, DMG_BLAST)
  775.         }
  776.     }  
  777. }
  778.  
  779. public remove_knife_effect(ent)
  780. {
  781.     remove_entity(ent)
  782. }
  783.  
  784. public set_new_idle(ent)
  785. {
  786.     g_evoluting = 0
  787.     g_evolution = 1
  788.     set_entity_anim(ent, 12)
  789.    
  790.     entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.1)
  791. }
  792.  
  793. public move_entity(ent)
  794. {
  795.     static Float:Origin[3]
  796.    
  797.     Origin[0] = 4290.0
  798.     Origin[1] = 4290.0
  799.     Origin[2] = 4290.0
  800.    
  801.     set_pev(ent, pev_origin, Origin)
  802.     entity_set_float(ent, EV_FL_nextthink, halflife_time() + 99999999.0)
  803. }
  804.  
  805. public fw_takedmg(victim, inflictor, attacker, Float:damage, damagebits)
  806. {
  807.     static Float:Origin[3]
  808.     fm_get_aimorigin(attacker, Origin)
  809.    
  810.     client_print(attacker, print_center, "Zycie Oberona: %i", floatround(pev(victim, pev_health) - 1000.0))
  811.    
  812.     create_blood(Origin)   
  813. }
  814.  
  815. stock set_entity_anim(ent, anim)
  816. {
  817.     entity_set_float(ent, EV_FL_animtime, get_gametime())
  818.     entity_set_float(ent, EV_FL_framerate, 1.0)
  819.     entity_set_int(ent, EV_INT_sequence, anim) 
  820. }
  821.  
  822. stock create_blood(const Float:origin[3])
  823. {
  824.     // Show some blood :)
  825.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  826.     write_byte(TE_BLOODSPRITE)
  827.     engfunc(EngFunc_WriteCoord, origin[0])
  828.     engfunc(EngFunc_WriteCoord, origin[1])
  829.     engfunc(EngFunc_WriteCoord, origin[2])
  830.     write_short(m_iBlood[1])
  831.     write_short(m_iBlood[0])
  832.     write_byte(75)
  833.     write_byte(5)
  834.     message_end()
  835. }
  836.  
  837. stock fm_get_aimorigin(index, Float:origin[3])
  838. {
  839.     new Float:start[3], Float:view_ofs[3];
  840.     pev(index, pev_origin, start);
  841.     pev(index, pev_view_ofs, view_ofs);
  842.     xs_vec_add(start, view_ofs, start);
  843.    
  844.     new Float:dest[3];
  845.     pev(index, pev_v_angle, dest);
  846.     engfunc(EngFunc_MakeVectors, dest);
  847.     global_get(glb_v_forward, dest);
  848.     xs_vec_mul_scalar(dest, 9999.0, dest);
  849.     xs_vec_add(start, dest, dest);
  850.    
  851.     engfunc(EngFunc_TraceLine, start, dest, 0, index, 0);
  852.     get_tr2(0, TR_vecEndPos, origin);
  853.    
  854.     return 1;
  855. }  
  856.  
  857. public FindClosesEnemy(entid)
  858. {
  859.     new Float:Dist
  860.     new Float:maxdistance=4000.0
  861.     new indexid=0  
  862.     for(new i=1;i<=get_maxplayers();i++){
  863.         if(is_user_alive(i) && is_valid_ent(i) && can_see_fm(entid, i))
  864.         {
  865.             Dist = entity_range(entid, i)
  866.             if(Dist <= maxdistance)
  867.             {
  868.                 maxdistance=Dist
  869.                 indexid=i
  870.                
  871.                 return indexid
  872.             }
  873.         }  
  874.     }  
  875.     return 0
  876. }
  877.  
  878. public npc_turntotarget(ent, Float:Ent_Origin[3], target, Float:Vic_Origin[3])
  879. {
  880.     if(target)
  881.     {
  882.         new Float:newAngle[3]
  883.         entity_get_vector(ent, EV_VEC_angles, newAngle)
  884.         new Float:x = Vic_Origin[0] - Ent_Origin[0]
  885.         new Float:z = Vic_Origin[1] - Ent_Origin[1]
  886.  
  887.         new Float:radians = floatatan(z/x, radian)
  888.         newAngle[1] = radians * (180 / 3.14)
  889.         if (Vic_Origin[0] < Ent_Origin[0])
  890.             newAngle[1] -= 180.0
  891.        
  892.         entity_set_vector(ent, EV_VEC_angles, newAngle)
  893.     }
  894. }
  895.  
  896. public bool:can_see_fm(entindex1, entindex2)
  897. {
  898.     if (!entindex1 || !entindex2)
  899.         return false
  900.  
  901.     if (pev_valid(entindex1) && pev_valid(entindex1))
  902.     {
  903.         new flags = pev(entindex1, pev_flags)
  904.         if (flags & EF_NODRAW || flags & FL_NOTARGET)
  905.         {
  906.             return false
  907.         }
  908.  
  909.         new Float:lookerOrig[3]
  910.         new Float:targetBaseOrig[3]
  911.         new Float:targetOrig[3]
  912.         new Float:temp[3]
  913.  
  914.         pev(entindex1, pev_origin, lookerOrig)
  915.         pev(entindex1, pev_view_ofs, temp)
  916.         lookerOrig[0] += temp[0]
  917.         lookerOrig[1] += temp[1]
  918.         lookerOrig[2] += temp[2]
  919.  
  920.         pev(entindex2, pev_origin, targetBaseOrig)
  921.         pev(entindex2, pev_view_ofs, temp)
  922.         targetOrig[0] = targetBaseOrig [0] + temp[0]
  923.         targetOrig[1] = targetBaseOrig [1] + temp[1]
  924.         targetOrig[2] = targetBaseOrig [2] + temp[2]
  925.  
  926.         engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) //  checks the had of seen player
  927.         if (get_tr2(0, TraceResult:TR_InOpen) && get_tr2(0, TraceResult:TR_InWater))
  928.         {
  929.             return false
  930.         }
  931.         else
  932.         {
  933.             new Float:flFraction
  934.             get_tr2(0, TraceResult:TR_flFraction, flFraction)
  935.             if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
  936.             {
  937.                 return true
  938.             }
  939.             else
  940.             {
  941.                 targetOrig[0] = targetBaseOrig [0]
  942.                 targetOrig[1] = targetBaseOrig [1]
  943.                 targetOrig[2] = targetBaseOrig [2]
  944.                 engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) //  checks the body of seen player
  945.                 get_tr2(0, TraceResult:TR_flFraction, flFraction)
  946.                 if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
  947.                 {
  948.                     return true
  949.                 }
  950.                 else
  951.                 {
  952.                     targetOrig[0] = targetBaseOrig [0]
  953.                     targetOrig[1] = targetBaseOrig [1]
  954.                     targetOrig[2] = targetBaseOrig [2] - 17.0
  955.                     engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) //  checks the legs of seen player
  956.                     get_tr2(0, TraceResult:TR_flFraction, flFraction)
  957.                     if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
  958.                     {
  959.                         return true
  960.                     }
  961.                 }
  962.             }
  963.         }
  964.     }
  965.     return false
  966. }
  967.  
  968. public hook_ent(ent, victim, Float:speed)
  969. {
  970.     static Float:fl_Velocity[3]
  971.     static Float:VicOrigin[3], Float:EntOrigin[3]
  972.  
  973.     pev(ent, pev_origin, EntOrigin)
  974.     pev(victim, pev_origin, VicOrigin)
  975.    
  976.     static Float:distance_f
  977.     distance_f = get_distance_f(EntOrigin, VicOrigin)
  978.  
  979.     if (distance_f > 60.0)
  980.     {
  981.         new Float:fl_Time = distance_f / speed
  982.  
  983.         fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
  984.         fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
  985.         fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
  986.     } else
  987.     {
  988.         fl_Velocity[0] = 0.0
  989.         fl_Velocity[1] = 0.0
  990.         fl_Velocity[2] = 0.0
  991.     }
  992.  
  993.     entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
  994. }
  995.  
  996. public hook_ent2(ent, Float:VicOrigin[3], Float:speed)
  997. {
  998.     static Float:fl_Velocity[3]
  999.     static Float:EntOrigin[3]
  1000.  
  1001.     pev(ent, pev_origin, EntOrigin)
  1002.    
  1003.     static Float:distance_f
  1004.     distance_f = get_distance_f(EntOrigin, VicOrigin)
  1005.  
  1006.     if (distance_f > 60.0)
  1007.     {
  1008.         new Float:fl_Time = distance_f / speed
  1009.  
  1010.         fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
  1011.         fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
  1012.         fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
  1013.     } else
  1014.     {
  1015.         fl_Velocity[0] = 0.0
  1016.         fl_Velocity[1] = 0.0
  1017.         fl_Velocity[2] = 0.0
  1018.     }
  1019.  
  1020.     entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
  1021. }
  1022.  
  1023. public hit_screen(id)
  1024. {
  1025.     message_begin(MSG_ONE, get_user_msgid("ScreenShake"),{0,0,0}, id)
  1026.     write_short(1<<14)
  1027.     write_short(1<<13)
  1028.     write_short(1<<13)
  1029.     message_end()  
  1030. }
  1031.  
  1032. public reset_think(ent)
  1033. {
  1034.     g_doing_other = 0
  1035.     entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.1)
  1036. }

Teddy Boss
  1. /* Boss CSO By Itachi Uchiha-
  2. My Canal Youtube https://www.youtube.com/channel/UCar-rq1Dvuvha9Id2ypP7tg
  3. My Facebook Contact https://www.facebook.com/ItachiUchihapro
  4. My Pag Facebook https://www.facebook.com/TutorialesItachi/
  5. Wep Forro http://itachiuchiha-mods.esy.es/
  6. Boss All https://daniel3536.jimdo.com/news-boss-for-cs-1-6-2017/
  7. */
  8.  
  9. #include <amxmodx>
  10. #include <engine>
  11. #include <fakemeta_+>
  12. #include <hamsandwich>
  13.  
  14. #define PLUGIN "CSO Boss Teddy Bear Final"
  15. #define VERSION "4.0"
  16. #define AUTHOR "Itachi Uchiha- Mods Scripter"
  17.  
  18. //Configs Boss
  19. #define CLASS_NAME_BOSS "Boss_Teddy_CSO"
  20. #define HEALTH_BOSS 500.0
  21. #define SPEED_TEDDY 150.0
  22.  
  23. //Damage Attack
  24. #define DAMAGE_ATTACK 50.0
  25. #define DAMAGE_TENTACLE 100.0
  26. #define DAMAGE_TENTACLE_TOUCH 20.0
  27. #define DAMAGE_HOLE1 1000.0
  28. #define DAMAGE_HALLOWEEN 50.0
  29. #define DAMAGE_FINAL 1000.0 //Touch Boss
  30.  
  31. //Remove Task Anti Bug
  32. #define HP_SPRITE 1
  33. #define ATTACK_TASK 2
  34. #define CORRER_TEDDY 3
  35. #define TENTACLE_TEDDY 4
  36. #define HOLE_TEDDY 5
  37. #define HOLE1_TEDDY 6
  38. #define METEOR_TEDDY 7
  39.  
  40. //Resources..
  41. #define ice_model "models/Teddy_CSO/dd_iceblock.mdl"
  42. #define frozer "Teddy_CSO/congelacion.wav"//"Teddy_CSO/impalehit.wav"
  43.  
  44. enum
  45. {
  46.     ANIM_DUMMY = 0,
  47.     SCENE_APPEAR,
  48.     ZBS_IDLE1,
  49.     ZBS_WALK,
  50.     ZBS_RUN,
  51.     ZBS_ATTACK1,
  52.     ZBS_ATTACK2,
  53.     ZBS_ATTACK_SLIDING,
  54.     ZBS_ATTACK_CANDY,
  55.     ZBS_ATTACK_HOLE,
  56.     ZBS_ATTACK_HOLE2,
  57.     ZBS_ATTACK_METEOR,
  58.     SCENE_CHANGE,
  59.     TEDDY_DEATH
  60. }
  61. new const news[][] =
  62. {
  63.     "sprites/Teddy_CSO/shockwave.spr"  
  64. }
  65. static g_news[sizeof news]
  66.  
  67. enum {
  68.     shockwave
  69. }
  70. new const Boss_Model_CSO[] = "models/Teddy_CSO/Teddy_CSO.mdl"
  71. new const Boss_Tentacle_CSO[] = "models/Teddy_CSO/Dulce.mdl"
  72. new const Boss_Hole_Effect[] = "models/Teddy_CSO/ef_hole.mdl"
  73. new const Boss_Halloween[] = "models/Teddy_CSO/halloween.mdl"
  74. new const Boss_Halloween2[] = "sprites/Teddy_CSO/blue.spr"
  75. new const Hp_Sprite_Boss[] = "sprites/Teddy_CSO/hp.spr"
  76.  
  77. new const Sound_Boss_CSO[20][] =
  78. {
  79.     "Teddy_CSO/zbs_attack2.wav",       
  80.     "Teddy_CSO/death.wav",
  81.     "Teddy_CSO/footstep1.wav",
  82.     "Teddy_CSO/footstep2.wav",
  83.     "Teddy_CSO/zbs_fail.wav",
  84.     "Teddy_CSO/zbs_clear.wav",
  85.     "Teddy_CSO/candy_attack.wav",
  86.     "Teddy_CSO/scene_appear1.wav",
  87.     "Teddy_CSO/zbs_attack1.wav",
  88.     "Teddy_CSO/zbs_attack_sliding.wav",
  89.     "Teddy_CSO/zbs_attack_hole.wav",
  90.     "Teddy_CSO/zbs_attack_candy.wav",
  91.     "Teddy_CSO/scene_change.wav",
  92.     "Teddy_CSO/zbs_attack_hole2_1.wav",
  93.     "Teddy_CSO/zbs_attack_meteor.wav",
  94.     "Teddy_CSO/zbs_attack_meteor_exp.wav",
  95.     "Teddy_CSO/zbs_attack_hole2_2.wav",
  96.     "Teddy_CSO/footstep3.wav",
  97.     "Teddy_CSO/gift_explode.wav",
  98.     "Teddy_CSO/footstep4.wav"
  99. }
  100.  
  101. new Boss_Model_Linux, Damage_Off, Start_Boss_CSO, Damage_Touch, y_hpbar, y_think, y_bleeding[2], bool:g_bCongelado[33],
  102. iceent[33], g_msgScreenFade, g_exploSpr, g_explosfr, frostgib, y_npc_hp
  103.  
  104. new Float:VAngles[3], Float:Origin[3], Float:Attack_Time
  105.  
  106. public plugin_init()
  107. {
  108.     register_plugin(PLUGIN, VERSION, AUTHOR)
  109.    
  110.     register_event("HLTV", "event_newround", "a", "1=0", "2=0")
  111.     register_think(CLASS_NAME_BOSS, "cso_boss_think")
  112.     register_touch(CLASS_NAME_BOSS, "*", "cso_boss_touch")
  113.     register_forward(FM_PlayerPreThink, "fw_Player_Frozer")
  114.     RegisterHam(Ham_Spawn, "player", "Bug_Frozer", 1)
  115.     register_think("Halloween_Meteos", "fire_helloween_think")
  116.     register_touch("Halloween_Meteos", "*", "npc_ball_touch")
  117.     register_touch("Damage_Tentacle_Teddy", "*", "Tentacle_Touch")
  118.    
  119.     g_msgScreenFade = get_user_msgid("ScreenFade")
  120.    
  121.     register_clcmd("say /teddy", "npc_position")
  122.     register_clcmd("say /teddy2", "create_cso_boss")
  123. }
  124. public plugin_cfg()                     // Cvar's goes here
  125. {
  126.     server_cmd("mp_freezetime 0.0")
  127. }
  128. public plugin_precache()
  129. {
  130.     Boss_Model_Linux = precache_model(Boss_Model_CSO)
  131.     precache_model(Boss_Tentacle_CSO)
  132.     precache_model(Boss_Hole_Effect)
  133.     precache_sound(frozer)
  134.     precache_model(ice_model)
  135.     precache_model(Hp_Sprite_Boss)
  136.     precache_model(Boss_Halloween)
  137.     precache_model(Boss_Halloween2)
  138.    
  139.     frostgib = precache_model("sprites/Teddy_CSO/frostgib.spr")
  140.     g_exploSpr = engfunc(EngFunc_PrecacheModel, "sprites/Teddy_CSo/shockwave.spr")
  141.     g_explosfr = precache_model("sprites/Teddy_CSo/frost_exp.spr")
  142.     y_npc_hp = precache_model("sprites/Teddy_CSO/zerogxplode.spr")
  143.     y_bleeding[0] = precache_model("sprites/Teddy_CSO/blood.spr")
  144.     y_bleeding[1] = precache_model("sprites/Teddy_CSO/bloodspray.spr")
  145.    
  146.     for(new i = 0; i < sizeof(Sound_Boss_CSO); i++)
  147.         precache_sound(Sound_Boss_CSO[i])
  148.    
  149.     for(new i; i <= charsmax(news); i++)
  150.         g_news[i] = precache_model(news[i])
  151. }
  152. public event_newround()
  153. {  
  154.     if(pev_valid(y_think))
  155.     {      
  156.         remove_task(y_think+HP_SPRITE)
  157.         remove_task(y_think+ATTACK_TASK)
  158.         remove_task(y_think+CORRER_TEDDY)
  159.         remove_task(y_think+TENTACLE_TEDDY)
  160.         remove_task(y_think+HOLE_TEDDY)
  161.         remove_task(y_think+HOLE1_TEDDY)
  162.         remove_task(y_think+METEOR_TEDDY)
  163.         remove_entity_name(CLASS_NAME_BOSS)
  164.         remove_entity_name("teddy_final")
  165.         remove_entity_name("DareDevil")
  166.         remove_entity_name("Halloween_Meteos")
  167.         remove_entity_name("Damage_Tentacle_Teddy")
  168.     }
  169.     if(pev_valid(y_hpbar)) remove_entity(y_hpbar)
  170. }
  171. public npc_position(id)
  172. {
  173.     pev(id, pev_angles, VAngles)
  174.     pev(id, pev_origin, Origin)
  175.    
  176.     client_print(id, print_console, "Origin %f %f %f", Origin[0], Origin[1], Origin[2])
  177.     client_print(id, print_console, "Angles %f %f %f", VAngles[0], VAngles[1], VAngles[2])
  178. }
  179. public Bug_Frozer(id)
  180. {
  181.     if(is_user_connected(id))
  182.     {
  183.         g_bCongelado[id] = false
  184.     }
  185. }
  186. public create_cso_boss()
  187. {
  188.     event_newround()
  189.     new ent = create_entity("info_target")
  190.     y_think = ent
  191.    
  192.     Damage_Touch = 0
  193.     Start_Boss_CSO = 0
  194.    
  195.     set_pev(ent, pev_origin, Origin)
  196.     //set_pev(ent, pev_angles, VAngles)
  197.    
  198.     set_pev(ent, pev_gamestate, 1)
  199.     set_pev(ent, pev_takedamage, 1.0)
  200.     set_pev(ent, pev_health, HEALTH_BOSS + 1000.0)
  201.     set_pev(ent, pev_classname, CLASS_NAME_BOSS)
  202.     engfunc(EngFunc_SetModel, ent, Boss_Model_CSO)
  203.    
  204.     set_pev(ent, pev_solid, SOLID_BBOX)
  205.     set_pev(ent, pev_movetype, MOVETYPE_PUSHSTEP)
  206.     anim(ent, SCENE_APPEAR)
  207.    
  208.     new Float:maxs[3] = {35.0, 55.0, 200.0}
  209.     new Float:mins[3] = {-35.0, -55.0, -35.0}
  210.     engfunc(EngFunc_SetSize, ent, mins, maxs)
  211.    
  212.     set_pev(ent, pev_modelindex, Boss_Model_Linux)
  213.     set_pev(ent, pev_nextthink, get_gametime() + 5.0)
  214.    
  215.     if(!Damage_Off)
  216.     {
  217.         Damage_Off = 1
  218.         RegisterHamFromEntity(Ham_TakeDamage, ent, "cso_boss_take_damage", 1)
  219.     }
  220.     y_hpbar = create_entity("env_sprite")
  221.     set_pev(y_hpbar, pev_scale, 0.4)
  222.     set_pev(y_hpbar, pev_owner, ent)
  223.     engfunc(EngFunc_SetModel, y_hpbar, Hp_Sprite_Boss) 
  224.     set_task(0.1, "cso_boss_ready", ent+HP_SPRITE, _, _, "b")
  225. }
  226. public cso_boss_ready(ent)
  227. {
  228.     ent -= HP_SPRITE
  229.     if(!pev_valid(ent))
  230.     {
  231.         remove_task(ent+HP_SPRITE)
  232.         return
  233.     }
  234.     static Float:Origin[3], Float:cso_boss_health
  235.     pev(ent, pev_origin, Origin)
  236.     Origin[2] += 265.0 
  237.     engfunc(EngFunc_SetOrigin, y_hpbar, Origin)
  238.     pev(ent, pev_health, cso_boss_health)
  239.     if(HEALTH_BOSS < (cso_boss_health - 1000.0))
  240.     {
  241.         set_pev(y_hpbar, pev_frame, 100.0)
  242.     } else {
  243.         set_pev(y_hpbar, pev_frame, 0.0 + ((((cso_boss_health - 1000.0) - 1 ) * 100) / HEALTH_BOSS))
  244.     }      
  245. }
  246. //----------------------------Attacks Teddy----------------------------
  247. public Teddy_Attack(ent)
  248. {
  249.     if(!pev_valid(ent) || Start_Boss_CSO)
  250.         return
  251.     Start_Boss_CSO = 1
  252.     anim(ent, ZBS_ATTACK1)
  253.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  254.    
  255.     new randomx = random_num(0,1)
  256.     switch(randomx) {
  257.         case 0:
  258.         {
  259.             anim(ent, ZBS_ATTACK1)
  260.             emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[8], 1.0, ATTN_NORM, 0, PITCH_NORM)
  261.             set_task(0.3, "Damage_Teddy", ent+ATTACK_TASK)
  262.             set_task(1.0, "simple_attack_reload", ent+ATTACK_TASK)
  263.         }
  264.         case 1:
  265.         {
  266.             anim(ent, ZBS_ATTACK2)
  267.             emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
  268.             set_task(0.7, "Damage_Teddy2", ent+ATTACK_TASK)
  269.             set_task(1.3, "simple_attack_reload", ent+ATTACK_TASK)
  270.         }
  271.     }
  272. }
  273. public Damage_Teddy(ent)
  274. {
  275.     ent -= ATTACK_TASK
  276.     if(!pev_valid(ent))
  277.         return 
  278.    
  279.     static Float:Orig[3]
  280.     pev(ent, pev_origin, Orig)
  281.     ShockWave(Orig, 5, 70, 500.0, {255, 0, 0})
  282.     ShockWave(Orig, 5, 70, 400.0, {144, 238, 144})
  283.    
  284.     for(new i = 0; i < get_maxplayers(); i++)
  285.     {
  286.         if(is_user_alive(i) && entity_range(ent, i) <= 250.0)
  287.         {
  288.             shake_screen(i)
  289.             ScreenFade(i, 2, {79, 79, 79}, 120)
  290.             ExecuteHam(Ham_TakeDamage, i, 0, i, DAMAGE_ATTACK, DMG_SLASH)
  291.         }
  292.     }
  293. }
  294. public Damage_Teddy2(ent)
  295. {
  296.     ent -= ATTACK_TASK
  297.     if(!pev_valid(ent))
  298.         return 
  299.    
  300.     static Float:Orig[3]
  301.     pev(ent, pev_origin, Orig)
  302.     ShockWave(Orig, 5, 70, 500.0, {255, 0, 0})
  303.     ShockWave(Orig, 5, 70, 400.0, {144, 238, 144})
  304.    
  305.     for(new i = 0; i < get_maxplayers(); i++)
  306.     {
  307.         if(is_user_alive(i) && entity_range(ent, i) <= 250.0)
  308.         {
  309.             shake_screen(i)
  310.             ScreenFade(i, 2, {79, 79, 79}, 120)
  311.             ExecuteHam(Ham_TakeDamage, i, 0, i, DAMAGE_ATTACK, DMG_SLASH)
  312.            
  313.             static Float:Jugador[3]
  314.             Jugador[2] = 400.0
  315.             Jugador[0] = 400.0
  316.             set_pev(i, pev_velocity, Jugador)
  317.         }
  318.     }
  319. }
  320. public simple_attack_reload(ent)
  321. {
  322.     ent -= ATTACK_TASK
  323.     Start_Boss_CSO = 0
  324. }
  325.  
  326. //----------------------------Correr Teddy----------------------------
  327. public Correr_Teddy(ent)
  328. {
  329.     if(!pev_valid(ent) || Start_Boss_CSO)
  330.         return
  331.     Start_Boss_CSO = 1
  332.     Damage_Touch = 1
  333.     anim(ent, ZBS_ATTACK_SLIDING)
  334.    
  335.     emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[9], 1.0, ATTN_NORM, 0, PITCH_NORM)
  336.    
  337.     set_task(0.7, "CorrerTeddy", ent+CORRER_TEDDY)
  338.     set_task(2.5, "Correr_Teddy3", ent+CORRER_TEDDY)
  339. }
  340. public CorrerTeddy(ent)
  341. {
  342.     ent -= CORRER_TEDDY
  343.     set_task(0.2, "Correr_Teddy2", ent+CORRER_TEDDY, _, _, "b")
  344. }
  345. public Correr_Teddy2(ent)
  346. {
  347.     ent -= CORRER_TEDDY
  348.     if(!pev_valid(ent))
  349.         return
  350.     set_pev(ent, pev_movetype, MOVETYPE_PUSHSTEP)
  351.     static Float:Origin[3]
  352.     get_position(ent, 4000.0, 0.0, 0.0, Origin)
  353.     control_ai2(ent, Origin, 1000.0)
  354. }
  355. public Correr_Teddy3(ent)
  356. {
  357.     ent -= CORRER_TEDDY
  358.     if(!pev_valid(ent))
  359.         return
  360.     Damage_Touch = 0
  361.     remove_task(ent+CORRER_TEDDY)
  362.     set_task(2.0, "reload_run", ent+CORRER_TEDDY)
  363. }
  364. public reload_run(ent)
  365. {
  366.     ent -= CORRER_TEDDY
  367.     remove_task(ent+CORRER_TEDDY)
  368.     Start_Boss_CSO = 0
  369.     anim(ent, ZBS_IDLE1)
  370. }
  371.  
  372. //----------------------------Candy Teddy----------------------------
  373. public Tentacle_Hammer(ent)
  374. {
  375.     if(!pev_valid(ent) || Start_Boss_CSO)
  376.         return 
  377.        
  378.     Start_Boss_CSO = 1
  379.     anim(ent, ZBS_ATTACK_CANDY)
  380.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  381.    
  382.     set_task(10.0, "reload_run2", ent+TENTACLE_TEDDY)
  383.    
  384.     set_task(0.9, "Start_Tentacle", ent+TENTACLE_TEDDY)
  385.     set_task(4.7, "Start_Tentacle", ent+TENTACLE_TEDDY)
  386.     set_task(7.5, "Start_Tentacle", ent+TENTACLE_TEDDY)
  387.    
  388.     set_task(0.9, "Damage_Teddy3", ent+TENTACLE_TEDDY)
  389.     set_task(3.0, "Damage_Teddy3", ent+TENTACLE_TEDDY)
  390.     set_task(4.7, "Damage_Teddy3", ent+TENTACLE_TEDDY)
  391.     set_task(6.4, "Damage_Teddy3", ent+TENTACLE_TEDDY)
  392.     set_task(7.5, "Damage_Teddy3", ent+TENTACLE_TEDDY)
  393.     set_task(7.0, "Damage_Teddy3", ent+TENTACLE_TEDDY)
  394.     set_task(8.5, "Sound_Tentacle_Hammer", ent+TENTACLE_TEDDY)
  395. }
  396. public Sound_Tentacle_Hammer(ent)
  397. {
  398.     ent -= TENTACLE_TEDDY
  399.     emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[11], 1.0, ATTN_NORM, 0, PITCH_NORM)
  400. }
  401. public Damage_Teddy3(ent)
  402. {
  403.     ent -= TENTACLE_TEDDY
  404.     if(!pev_valid(ent))
  405.         return 
  406.    
  407.     static Float:Orig[3]
  408.     pev(ent, pev_origin, Orig)
  409.     ShockWave(Orig, 5, 70, 550.0, {255, 0, 0})
  410.     ShockWave(Orig, 5, 70, 450.0, {144, 238, 144})
  411.    
  412.     emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[8], 1.0, ATTN_NORM, 0, PITCH_NORM)
  413.    
  414.     for(new i = 0; i < get_maxplayers(); i++)
  415.     {
  416.         if(is_user_alive(i) && entity_range(ent, i) <= 300.0)
  417.         {
  418.             shake_screen(i)
  419.             ScreenFade(i, 2, {79, 79, 79}, 120)
  420.             ExecuteHam(Ham_TakeDamage, i, 0, i, DAMAGE_TENTACLE, DMG_SLASH)
  421.         }
  422.     }
  423. }
  424. public reload_run2(ent)
  425. {
  426.     ent -= TENTACLE_TEDDY
  427.     remove_task(ent+CORRER_TEDDY)
  428.     Start_Boss_CSO = 0
  429.     anim(ent, ZBS_IDLE1)
  430. }
  431. public Start_Tentacle(ent)
  432. {
  433.     ent -= TENTACLE_TEDDY
  434.     if(!pev_valid(ent))
  435.         return
  436.    
  437.     static Float:beam_origin[25][3]
  438.    
  439.     get_position(ent, 200.0, 00.0, 50.0, beam_origin[0])
  440.     get_position(ent, 300.0, 00.0, 50.0, beam_origin[1])
  441.     get_position(ent, 400.0, 00.0, 50.0, beam_origin[2])
  442.     get_position(ent, 500.0, 00.0, 50.0, beam_origin[3])
  443.     get_position(ent, 600.0, 00.0, 50.0, beam_origin[4])
  444.    
  445.     get_position(ent, 200.0, 150.0, 50.0, beam_origin[5])
  446.     get_position(ent, 300.0, 150.0, 50.0, beam_origin[6])
  447.     get_position(ent, 400.0, 150.0, 50.0, beam_origin[7])
  448.     get_position(ent, 500.0, 150.0, 50.0, beam_origin[8])
  449.     get_position(ent, 600.0, 150.0, 50.0, beam_origin[9])
  450.    
  451.     get_position(ent, 200.0, 250.0, 50.0, beam_origin[10])
  452.     get_position(ent, 300.0, 250.0, 50.0, beam_origin[11])
  453.     get_position(ent, 400.0, 250.0, 50.0, beam_origin[12])
  454.     get_position(ent, 500.0, 250.0, 50.0, beam_origin[13])
  455.     get_position(ent, 600.0, 250.0, 50.0, beam_origin[14])
  456.    
  457.     get_position(ent, 200.0, -150.0, 50.0, beam_origin[15])
  458.     get_position(ent, 300.0, -150.0, 50.0, beam_origin[16])
  459.     get_position(ent, 400.0, -150.0, 50.0, beam_origin[17])
  460.     get_position(ent, 500.0, -150.0, 50.0, beam_origin[18])
  461.     get_position(ent, 600.0, -150.0, 50.0, beam_origin[19])
  462.    
  463.     get_position(ent, 200.0, -250.0, 50.0, beam_origin[20])
  464.     get_position(ent, 300.0, -250.0, 50.0, beam_origin[21])
  465.     get_position(ent, 400.0, -250.0, 50.0, beam_origin[22])
  466.     get_position(ent, 500.0, -250.0, 50.0, beam_origin[23])
  467.     get_position(ent, 600.0, -250.0, 50.0, beam_origin[24])
  468.    
  469.    
  470.     for(new i = 0; i < 25; i++)
  471.     Create_Tentacle1(beam_origin[i])
  472. }
  473.  
  474. public Create_Tentacle1(Float:StartOrigin[3])
  475. {
  476.     static Ent; Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  477.     if(!pev_valid(Ent)) return
  478.    
  479.     set_pev(Ent, pev_movetype, MOVETYPE_NONE)
  480.     set_pev(Ent, pev_solid, SOLID_BBOX)
  481.    
  482.     set_pev(Ent, pev_classname, "Damage_Tentacle_Teddy")
  483.     engfunc(EngFunc_SetModel, Ent, Boss_Tentacle_CSO)
  484.     set_pev(Ent, pev_origin, StartOrigin)
  485.    
  486.     anim(Ent, 0)
  487.    
  488.     new Float:maxs[3] = {5.0, 5.0, 30.0}
  489.     new Float:mins[3] = {-5.0, -5.0, -30.0}
  490.     entity_set_size(Ent, mins, maxs)
  491.    
  492.     set_task(1.0, "Remover_Tentacle", Ent+TENTACLE_TEDDY)
  493. }
  494. public Remover_Tentacle(Ent)
  495. {
  496.     Ent -= TENTACLE_TEDDY
  497.     if(!pev_valid(Ent)) return
  498.     engfunc(EngFunc_RemoveEntity, Ent)
  499. }
  500. public Tentacle_Touch(Ent, id)
  501. {
  502.     if(!pev_valid(Ent))
  503.         return
  504.        
  505.     new Classname[32]
  506.     if(pev_valid(id)) pev(id, pev_classname, Classname, sizeof(Classname))
  507.    
  508.     if(equal(Classname, "Damage_Tentacle_Teddy"))
  509.         return
  510.        
  511.     if(is_user_alive(id))
  512.     {
  513.         ScreenFade(id, 2, {79, 79, 79}, 120)
  514.         ExecuteHam(Ham_TakeDamage, id, 0, id, DAMAGE_TENTACLE_TOUCH, DMG_SLASH)
  515.     }
  516. }
  517.  
  518. //----------------------------Hole1 Teddy----------------------------
  519. public Teddy_Hole1(ent)
  520. {
  521.     if(!pev_valid(ent) || Start_Boss_CSO)
  522.         return 
  523.        
  524.     Start_Boss_CSO = 1
  525.     anim(ent, ZBS_ATTACK_HOLE)
  526.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  527.     emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[10], 1.0, ATTN_NORM, 0, PITCH_NORM)
  528.    
  529.     set_task(8.0, "reload_run3", ent+HOLE_TEDDY)
  530.     set_task(5.0, "Damage_Teddy4", ent+HOLE_TEDDY)
  531.     set_task(0.2, "attack_hole", ent+HOLE_TEDDY)
  532. }
  533. public Damage_Teddy4(ent)
  534. {
  535.     ent -= HOLE_TEDDY
  536.     if(!pev_valid(ent))
  537.         return 
  538.    
  539.     static Float:Orig[3]
  540.     pev(ent, pev_origin, Orig)
  541.     ShockWave(Orig, 5, 70, 550.0, {255, 0, 0})
  542.     ShockWave(Orig, 5, 70, 450.0, {144, 238, 144})
  543.    
  544.     for(new i = 0; i < get_maxplayers(); i++)
  545.     {
  546.         if(is_user_alive(i) && entity_range(ent, i) <= 300.0)
  547.         {
  548.             shake_screen(i)
  549.             ScreenFade(i, 2, {79, 79, 79}, 120)
  550.             ExecuteHam(Ham_TakeDamage, i, 0, i, DAMAGE_HOLE1, DMG_SLASH)
  551.             //user_kill(i)
  552.         }
  553.     }
  554. }
  555. public attack_hole(Teddy)
  556. {
  557.     Teddy -= HOLE_TEDDY
  558.     new ent = create_entity("info_target")
  559.    
  560.     static Float:Origin[3]
  561.     pev(Teddy, pev_origin, Origin)
  562.    
  563.     Origin[2] -= 10.0
  564.    
  565.     set_pev(ent, pev_origin, Origin)
  566.     set_pev(ent, pev_classname, "teddy_final")
  567.     engfunc(EngFunc_SetModel, ent, Boss_Hole_Effect)
  568.     set_pev(ent, pev_solid, SOLID_NOT)
  569.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  570.    
  571.     new Float:maxs[3] = {1.0,1.0,1.0}
  572.     new Float:mins[3] = {-1.0,-1.0,-1.0}
  573.     engfunc(EngFunc_SetSize, ent, mins, maxs)
  574.    
  575.     set_pev(ent, pev_animtime, get_gametime())
  576.     anim(ent, 0)
  577.    
  578.     set_pev(ent, pev_rendermode, kRenderTransAdd)
  579.     set_pev(ent, pev_renderamt, 255.0) 
  580.    
  581.     for(new i = 0; i < get_maxplayers(); i++)
  582.     {
  583.         if(is_user_alive(i) && entity_range(Teddy, i) <= 1000.0)
  584.         {
  585.             static arg[2]
  586.             arg[0] = Teddy
  587.             arg[1] = i
  588.            
  589.             set_task(0.01, "Jalar_Humanos", HOLE1_TEDDY, arg, sizeof(arg), "b")
  590.         }
  591.     }
  592.    
  593.     set_task(5.8, "stop_jalamiento", Teddy+2012)   
  594. }
  595. public Jalar_Humanos(arg[2])
  596. {
  597.     static Float:Origin[3], Float:Speed
  598.     pev(arg[0], pev_origin, Origin)
  599.    
  600.     Speed = (1000.0 / entity_range(arg[0], arg[1])) * 75.0
  601.    
  602.     control_ai2(arg[1], Origin, Speed)
  603. }
  604. public stop_jalamiento(Teddy)
  605. {
  606.     Teddy -= 2012
  607.    
  608.     static ent
  609.     ent = find_ent_by_class(-1, "teddy_final")
  610.    
  611.     remove_entity(ent)
  612.     remove_task(HOLE1_TEDDY)
  613. }
  614. public reload_run3(ent)
  615. {
  616.     ent -= HOLE_TEDDY
  617.     Start_Boss_CSO = 0
  618.     anim(ent, ZBS_IDLE1)
  619. }
  620.  
  621. //----------------------------Hole2 Teddy----------------------------
  622. public Teddy_Hole2(ent)
  623. {
  624.     if(!pev_valid(ent) || Start_Boss_CSO)
  625.         return 
  626.        
  627.     Start_Boss_CSO = 1
  628.     anim(ent, ZBS_ATTACK_HOLE2)
  629.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  630.     emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[13], 1.0, ATTN_NORM, 0, PITCH_NORM)
  631.    
  632.     set_task(8.0, "reload_run3", ent+HOLE_TEDDY)
  633.     set_task(5.0, "Damage_Teddy5", ent+HOLE_TEDDY)
  634.     set_task(0.1, "attack_hole", ent+HOLE_TEDDY)
  635.    
  636.     set_task(5.0, "Hole_Teddy_Sound", ent+HOLE_TEDDY)
  637. }
  638. public Hole_Teddy_Sound(ent)
  639. {
  640.     ent -= HOLE_TEDDY
  641.     emit_sound(ent, CHAN_BODY, Sound_Boss_CSO[16], 1.0, ATTN_NORM, 0, PITCH_NORM)
  642. }
  643. public Damage_Teddy5(ent)
  644. {
  645.     ent -= HOLE_TEDDY
  646.     if(!pev_valid(ent))
  647.         return 
  648.    
  649.     static Float:Orig[3]
  650.     pev(ent, pev_origin, Orig)
  651.     ShockWave(Orig, 5, 70, 750.0, {255, 0, 0})
  652.     ShockWave(Orig, 5, 70, 650.0, {144, 238, 144})
  653.    
  654.     for(new i = 0; i < get_maxplayers(); i++)
  655.     {
  656.         if(is_user_alive(i) && entity_range(ent, i) <= 450.0)
  657.         {
  658.             shake_screen(i)
  659.             Congelar(i)
  660.         }
  661.     }
  662. }
  663. public Congelar(id)
  664. {
  665.     if (!is_user_alive(id))
  666.     return;
  667.    
  668.     ice_entity(id, 1)
  669.     frost_explode(id)
  670.    
  671.     if (pev(id, pev_flags) & FL_ONGROUND)
  672.     set_pev(id, pev_gravity, 999999.9)
  673.     else
  674.     set_pev(id, pev_gravity, 0.000001)
  675.    
  676.     g_bCongelado[id] = true
  677.    
  678.     set_task(7.0, "Descongelar", id)
  679. }
  680.  
  681. public Descongelar(id)
  682. {
  683.     //if (!is_user_alive(id))
  684.     //return;
  685.    
  686.     ice_entity(id, 0)
  687.     remove_frost(id)
  688.    
  689.     g_bCongelado[id] = false
  690.    
  691.     set_pev(id, pev_gravity, 1.0)
  692.     set_pev(id, pev_maxspeed, 250.0)
  693. }
  694.  
  695. //----------------------------Meteor Teddy----------------------------
  696. public Attack_Meteor_Halloween(ent)
  697. {
  698.     if(!pev_valid(ent) || Start_Boss_CSO)
  699.         return 
  700.        
  701.     Start_Boss_CSO = 1
  702.     anim(ent, 11)
  703.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  704.     emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[14], 1.0, ATTN_NORM, 0, PITCH_NORM)
  705.    
  706.     //set_task(8.0, "reload_run4", ent+METEOR_TEDDY)
  707.     set_task(6.0, "Damage_Teddy6", ent+METEOR_TEDDY)
  708.     set_task(6.0, "Meteor_Sound", ent+METEOR_TEDDY)
  709.     set_task(3.9, "Regalitos_Halloweeen", ent+METEOR_TEDDY)
  710. }
  711. public Meteor_Sound(ent)
  712. {
  713.     emit_sound(ent, CHAN_AUTO, Sound_Boss_CSO[15], 1.0, ATTN_NORM, 0, PITCH_NORM)
  714. }
  715. public Damage_Teddy6(ent)
  716. {
  717.     ent -= METEOR_TEDDY
  718.     if(!pev_valid(ent))
  719.         return 
  720.    
  721.     static Float:Orig[3]
  722.     pev(ent, pev_origin, Orig)
  723.     ShockWave(Orig, 5, 70, 550.0, {255, 0, 0})
  724.     ShockWave(Orig, 5, 70, 450.0, {144, 238, 144})
  725.    
  726.     for(new i = 0; i < get_maxplayers(); i++)
  727.     {
  728.         if(is_user_alive(i) && entity_range(ent, i) <= 300.0)
  729.         {
  730.             shake_screen(i)
  731.             ScreenFade(i, 2, {79, 79, 79}, 120)
  732.             user_kill(i)
  733.         }
  734.     }
  735. }
  736. public reload_run4(ent)
  737. {
  738.     ent -= METEOR_TEDDY
  739.     Start_Boss_CSO = 0
  740.     anim(ent, ZBS_IDLE1)
  741. }
  742. //Code Sacado De Dias.... Solo Esto..
  743. public Regalitos_Halloweeen(ent)
  744. {
  745.     ent -= METEOR_TEDDY
  746.     if(!pev_valid(ent))
  747.         return 
  748.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  749.     static Float:Origin[3]
  750.     get_position(ent, 150.0, 0.0, 50.0, Origin)
  751.     //emit_sound(ent, CHAN_BODY, npc_sound[3], 1.0, ATTN_NORM, 0, PITCH_NORM)
  752.     for(new i = 0; i < get_maxplayers(); i++)
  753.     {
  754.         if(is_user_alive(i) && entity_range(ent, i) <= 4000)
  755.         {
  756.             shake_screen(i)
  757.             ScreenFade(i, 10, {255, 0, 0}, 120)
  758.         }
  759.     }
  760.     set_task(0.1, "fire_attack_teddy", ent+METEOR_TEDDY)
  761.     set_task(3.8, "remove_attack_teddy", ent+METEOR_TEDDY)
  762. }
  763.  
  764. public remove_attack_teddy(ent)
  765. {
  766.     ent -= METEOR_TEDDY
  767.     if(!pev_valid(ent))
  768.         return 
  769.     remove_task(ent+METEOR_TEDDY)
  770.     set_task(2.1, "reload_run4", ent+METEOR_TEDDY)
  771. }
  772.  
  773. public npc_ball_touch(ent, id)
  774. {
  775.     if(!pev_valid(ent))
  776.         return
  777.     static Float:Origin[3]
  778.     pev(ent, pev_origin, Origin)
  779.     message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
  780.     write_byte(TE_EXPLOSION)
  781.     engfunc(EngFunc_WriteCoord, Origin[0])
  782.     engfunc(EngFunc_WriteCoord, Origin[1])
  783.     engfunc(EngFunc_WriteCoord, Origin[2])
  784.     write_short(y_npc_hp)
  785.     write_byte(10)
  786.     write_byte(30)
  787.     write_byte(4)
  788.     message_end()  
  789.     emit_sound(ent, CHAN_BODY, Sound_Boss_CSO[18], 1.0, ATTN_NORM, 0, PITCH_NORM)
  790.     for(new i = 0; i < get_maxplayers(); i++)
  791.     {
  792.         if(is_user_alive(i) && entity_range(ent, i) <= 250)
  793.         {
  794.             shake_screen(i)
  795.             ExecuteHam(Ham_TakeDamage, i, 0, i, DAMAGE_HALLOWEEN, DMG_SLASH)
  796.             ScreenFade(i, 3, {255, 0, 0}, 120)
  797.         }
  798.     }
  799.     remove_entity(ent)
  800. }
  801.  
  802. public fire_attack_teddy(ent)
  803. {
  804.     ent -= METEOR_TEDDY
  805.     if(!pev_valid(ent))
  806.         return
  807.     static Float:explosion[24][3], Float:ball_place[24][3] 
  808.     explosion[0][0] = 200.0
  809.     explosion[0][1] = 0.0
  810.     explosion[0][2] = 500.0
  811.     explosion[1][0] = 400.0
  812.     explosion[1][1] = 0.0
  813.     explosion[1][2] = 500.0
  814.     explosion[2][0] = -200.0
  815.     explosion[2][1] = 0.0
  816.     explosion[2][2] = 500.0
  817.     explosion[3][0] = -400.0
  818.     explosion[3][1] = 0.0
  819.     explosion[3][2] = 500.0
  820.     explosion[4][0] = 0.0
  821.     explosion[4][1] = 200.0
  822.     explosion[4][2] = 500.0
  823.     explosion[5][0] = 0.0
  824.     explosion[5][1] = 400.0
  825.     explosion[5][2] = 500.0
  826.     explosion[6][0] = 0.0
  827.     explosion[6][1] = -200.0
  828.     explosion[6][2] = 500.0
  829.     explosion[7][0] = 0.0
  830.     explosion[7][1] = -400.0
  831.     explosion[7][2] = 500.0
  832.     explosion[8][0] = 200.0
  833.     explosion[8][1] = 200.0
  834.     explosion[8][2] = 500.0
  835.     explosion[9][0] = 400.0
  836.     explosion[9][1] = 400.0
  837.     explosion[9][2] = 500.0
  838.     explosion[10][0] = 200.0
  839.     explosion[10][1] = 400.0
  840.     explosion[10][2] = 500.0
  841.     explosion[11][0] = 400.0
  842.     explosion[11][1] = 200.0
  843.     explosion[11][2] = 500.0
  844.     explosion[12][0] = -200.0
  845.     explosion[12][1] = 200.0
  846.     explosion[12][2] = 500.0
  847.     explosion[13][0] = -400.0
  848.     explosion[13][1] = 400.0
  849.     explosion[13][2] = 500.0
  850.     explosion[14][0] = -200.0
  851.     explosion[14][1] = 400.0
  852.     explosion[14][2] = 500.0
  853.     explosion[15][0] = -400.0
  854.     explosion[15][1] = 200.0
  855.     explosion[15][2] = 500.0
  856.     explosion[16][0] = -200.0
  857.     explosion[16][1] = -200.0
  858.     explosion[17][2] = 500.0
  859.     explosion[17][0] = -200.0
  860.     explosion[17][1] = -200.0
  861.     explosion[17][2] = 500.0
  862.     explosion[18][0] = -200.0
  863.     explosion[18][1] = -400.0
  864.     explosion[18][2] = 500.0
  865.     explosion[19][0] = -400.0
  866.     explosion[19][1] = -200.0
  867.     explosion[19][2] = 500.0
  868.     explosion[20][0] = 200.0
  869.     explosion[20][1] = -200.0
  870.     explosion[20][2] = 500.0
  871.     explosion[21][0] = 400.0
  872.     explosion[21][1] = -400.0
  873.     explosion[21][2] = 500.0
  874.     explosion[22][0] = 200.0
  875.     explosion[22][1] = -400.0
  876.     explosion[22][2] = 500.0
  877.     explosion[23][0] = 400.0
  878.     explosion[23][1] = -200.0
  879.     explosion[23][2] = 500.0
  880.     for(new i = 0; i < sizeof(explosion); i++)
  881.     {
  882.         get_position(ent, explosion[i][0], explosion[i][1], explosion[i][2], ball_place[i])
  883.         npc_fireball_big(ent, ball_place[i])
  884.     }
  885.     set_task(1.0, "fire_attack_teddy", ent+METEOR_TEDDY)
  886. }
  887.  
  888. public npc_fireball_big(fireboss, Float:Origin[3])
  889. {
  890.     new ent = create_entity("info_target")
  891.     static Float:Angles[3]
  892.     pev(fireboss, pev_angles, Angles)
  893.     entity_set_origin(ent, Origin)
  894.     Angles[0] = -100.0
  895.     entity_set_vector(ent, EV_VEC_angles, Angles)
  896.     Angles[0] = 100.0
  897.     entity_set_vector(ent, EV_VEC_v_angle, Angles)
  898.     entity_set_string(ent, EV_SZ_classname, "Halloween_Meteos")
  899.     entity_set_model(ent, Boss_Halloween)
  900.     entity_set_int(ent, EV_INT_solid, 2)
  901.     entity_set_int(ent, EV_INT_movetype, MOVETYPE_FLY)
  902.     new Float:maxs[3] = {15.0, 15.0, 15.0}
  903.     new Float:mins[3] = {-15.0, -15.0, -15.0}
  904.     entity_set_size(ent, mins, maxs)
  905.     set_pev(ent, pev_owner, fireboss)
  906.     static Float:Velocity[3]
  907.     VelocityByAim(ent, random_num(250, 1000), Velocity)
  908.     set_pev(ent, pev_light_level, 180)
  909.     set_pev(ent, pev_rendermode, kRenderTransAdd)
  910.     set_pev(ent, pev_renderamt, 255.0) 
  911.     entity_set_vector(ent, EV_VEC_velocity, Velocity)
  912.     burning(ent, 0.5)
  913. }
  914.  
  915. public burning(ball, Float:size)
  916. {
  917.     static ent
  918.     ent = create_entity("env_sprite")
  919.     set_pev(ent, pev_takedamage, 0.0)
  920.     set_pev(ent, pev_solid, SOLID_NOT)
  921.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  922.     set_pev(ent, pev_classname, "Halloween_Meteos")
  923.     engfunc(EngFunc_SetModel, ent, Boss_Halloween2)
  924.     set_pev(ent, pev_rendermode, kRenderTransAdd)
  925.     set_pev(ent, pev_renderamt, 255.0)
  926.     set_pev(ent, pev_light_level, 180)
  927.     set_pev(ent, pev_scale, size)
  928.     set_pev(ent, pev_owner, ball)
  929.     set_pev(ent, pev_animtime, get_gametime())
  930.     set_pev(ent, pev_framerate, 8.0)
  931.     set_pev(ent, pev_frame, 0.1)
  932.     set_pev(ent, pev_spawnflags, SF_SPRITE_STARTON)
  933.     dllfunc(DLLFunc_Spawn, ent)
  934.     fire_helloween_think(ent)
  935.     set_pev(ent, pev_nextthink, get_gametime() + 0.01)
  936.     return ent
  937. }
  938. public fire_helloween_think(ent)
  939. {
  940.     if(!pev_valid(ent))
  941.         return
  942.     if(!pev_valid(pev(ent, pev_owner)))
  943.     {
  944.         remove_entity(ent)
  945.         return
  946.     }
  947.     static owner
  948.     owner = pev(ent, pev_owner)
  949.     static Float:Origin[3]
  950.     pev(owner, pev_origin, Origin)
  951.     Origin[2] += 25.0
  952.     entity_set_origin(ent, Origin)
  953.     set_pev(ent, pev_nextthink, get_gametime() + 0.01)
  954. }
  955. //----------------------------Skills Full Final----------------------------
  956.  
  957.  
  958. public fw_Player_Frozer(id)
  959. {
  960.     if (!is_user_alive(id))
  961.     return;
  962.    
  963.     if (g_bCongelado[id])
  964.     {
  965.         set_pev(id, pev_velocity, Float:{0.0,0.0,0.0})
  966.         set_pev(id, pev_maxspeed, 1.0)
  967.     }
  968. }
  969. public cso_boss_touch(ent, id)
  970. {
  971.     if(!pev_valid(id))
  972.         return
  973.        
  974.     if(is_user_alive(id) && Damage_Touch)
  975.     {
  976.         ExecuteHam(Ham_TakeDamage, id, 0, id, DAMAGE_FINAL, DMG_SLASH)
  977.         shake_screen(id)
  978.         ScreenFade(id, 10, {255, 0, 0}, 120)
  979.     }
  980. }
  981. public cso_boss_think(ent)
  982. {
  983.     if(!pev_valid(ent))
  984.         return
  985.     if(pev(ent, pev_iuser3))
  986.         return
  987.     if(pev(ent, pev_health) - 1000.0 < 0.0)
  988.     {
  989.         cso_boss_death(ent)
  990.         set_pev(ent, pev_iuser3, 1)
  991.         return
  992.     }
  993.     if(!Start_Boss_CSO)
  994.     {
  995.         static victim
  996.         static Float:Origin[3], Float:ent_place[3], Float:player_place[3], Float:EnemyOrigin[3]
  997.         victim = enemy_distance(ent)
  998.         pev(victim, pev_origin, EnemyOrigin)
  999.         pev(ent, pev_origin, Origin)
  1000.        
  1001.         if(is_user_alive(victim))
  1002.         {
  1003.             if(entity_range(victim, ent) <= 170)
  1004.             {
  1005.                 Anim_Victim(ent, Origin, victim, EnemyOrigin)
  1006.                 Teddy_Attack(ent)
  1007.                 set_pev(ent, pev_nextthink, get_gametime() + 0.1)
  1008.             } else {
  1009.                 if(pev(ent, pev_sequence) != ZBS_WALK)
  1010.                     anim(ent, ZBS_WALK)
  1011.                 set_pev(ent, pev_movetype, MOVETYPE_PUSHSTEP)
  1012.                
  1013.                 if(get_gametime() - 10.0 > Attack_Time)
  1014.                 {
  1015.                     new Random_Skill_Teddy = random_num(0,4)
  1016.                     switch(Random_Skill_Teddy) {
  1017.                         case 0: Correr_Teddy(ent)
  1018.                         case 1: Tentacle_Hammer(ent)
  1019.                         case 2: Teddy_Hole1(ent)
  1020.                         case 3: Teddy_Hole2(ent)
  1021.                         case 4: Attack_Meteor_Halloween(ent)
  1022.                     }
  1023.                     Attack_Time = get_gametime()
  1024.                 }
  1025.                 for(new i = 0; i < get_maxplayers(); i++)
  1026.                 {
  1027.                     if(is_user_alive(i) && entity_range(ent, i) <= 600)
  1028.                     {
  1029.                         shake_screen(i)
  1030.                     }
  1031.                 }
  1032.                
  1033.                 emit_sound(ent, CHAN_STREAM, Sound_Boss_CSO[19], 1.0, ATTN_NORM, 0, PITCH_NORM)
  1034.                
  1035.                 pev(ent, pev_origin, ent_place)
  1036.                 pev(victim, pev_origin, player_place)
  1037.                 Anim_Victim(ent, ent_place, victim, player_place)
  1038.                
  1039.                 control_ai(ent, victim, SPEED_TEDDY)
  1040.                
  1041.                 if(pev(ent, pev_iuser4) != victim)
  1042.                     set_pev(ent, pev_iuser4, victim)
  1043.                 set_pev(ent, pev_nextthink, get_gametime() + 0.0)
  1044.             }
  1045.         } else {
  1046.             if(pev(ent, pev_sequence) != ZBS_IDLE1)
  1047.                 anim(ent, ZBS_IDLE1)
  1048.             set_pev(ent, pev_nextthink, get_gametime() + 0.0)
  1049.         }      
  1050.     } else {
  1051.         set_pev(ent, pev_nextthink, get_gametime() + 0.0)
  1052.     }
  1053.     return
  1054. }
  1055. public cso_boss_death(ent)
  1056. {  
  1057.     emit_sound(ent, CHAN_BODY, Sound_Boss_CSO[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
  1058.     anim(ent, TEDDY_DEATH)
  1059.     set_pev(ent, pev_movetype, MOVETYPE_NONE)
  1060.     set_pev(ent, pev_solid, SOLID_NOT)
  1061.     set_pev(ent, pev_velocity, {0.0, 0.0, 0.0})
  1062.     set_pev(ent, pev_deadflag, DEAD_DYING)
  1063.    
  1064.     remove_task(ent+HP_SPRITE)
  1065.     remove_task(ent+ATTACK_TASK)
  1066.     remove_task(ent+CORRER_TEDDY)
  1067.     remove_task(ent+TENTACLE_TEDDY)
  1068.     remove_task(ent+HOLE_TEDDY)
  1069.     remove_task(ent+HOLE1_TEDDY)
  1070.     remove_task(ent+METEOR_TEDDY)
  1071.     remove_entity_name("teddy_final")
  1072.     remove_entity_name("DareDevil")
  1073.     remove_entity_name("Halloween_Meteos")
  1074.     remove_entity_name("Damage_Tentacle_Teddy")
  1075.    
  1076.    
  1077.     set_task(7.0, "delete_cso_boss", ent)
  1078.     return HAM_SUPERCEDE   
  1079. }
  1080. public delete_cso_boss(ent)
  1081. {
  1082.     remove_entity(ent)
  1083.     remove_entity(y_hpbar)
  1084. }
  1085. public cso_boss_take_damage(victim, inflictor, attacker, Float:damage, damagebits)
  1086. {
  1087.     static Float:Origin[3]
  1088.     fm_get_aim_origin(attacker, Origin)
  1089.     create_blood(Origin)
  1090.     emit_sound(victim, CHAN_BODY, Sound_Boss_CSO[7], 1.0, ATTN_NORM, 0, PITCH_NORM)
  1091. }
  1092. public enemy_distance(entid)
  1093. {
  1094.     new Float:range2
  1095.     new Float:maxrange=2000.0
  1096.     new indexid=0
  1097.     for(new i=1;i<=get_maxplayers();i++)
  1098.     {
  1099.         if(is_user_alive(i) && is_valid_ent(i) && attacking1(entid, i))
  1100.         {
  1101.             range2 = entity_range(entid, i)
  1102.             if(range2 <= maxrange)
  1103.             {
  1104.                 maxrange=range2
  1105.                 indexid=i
  1106.             }
  1107.         }          
  1108.     }  
  1109.     return (indexid) ? indexid : 0
  1110. }
  1111. public Anim_Victim(ent, Float:ent_place[3], target, Float:player_place[3])
  1112. {
  1113.     if(target)
  1114.     {
  1115.         new Float:newAngle[3]
  1116.         entity_get_vector(ent, EV_VEC_angles, newAngle)
  1117.         new Float:x = player_place[0] - ent_place[0]
  1118.         new Float:z = player_place[1] - ent_place[1]
  1119.         new Float:radians = floatatan(z/x, radian)
  1120.         newAngle[1] = radians * (180 / 3.14)
  1121.         if (player_place[0] < ent_place[0])
  1122.             newAngle[1] -= 180.0
  1123.             entity_set_vector(ent, EV_VEC_v_angle, newAngle)
  1124.         entity_set_vector(ent, EV_VEC_angles, newAngle)
  1125.     }
  1126. }
  1127. public bool:attacking1(entindex1, entindex2)
  1128. {
  1129.     if (!entindex1 || !entindex2)
  1130.         return false
  1131.     if (pev_valid(entindex1) && pev_valid(entindex1))
  1132.     {
  1133.         new flags = pev(entindex1, pev_flags)
  1134.         if (flags & EF_NODRAW || flags & FL_NOTARGET)
  1135.         {
  1136.             return false
  1137.         }
  1138.         new Float:lookerOrig[3]
  1139.         new Float:targetBaseOrig[3]
  1140.         new Float:targetOrig[3]
  1141.         new Float:temp[3]
  1142.         pev(entindex1, pev_origin, lookerOrig)
  1143.         pev(entindex1, pev_view_ofs, temp)
  1144.         lookerOrig[0] += temp[0]
  1145.         lookerOrig[1] += temp[1]
  1146.         lookerOrig[2] += temp[2]
  1147.         pev(entindex2, pev_origin, targetBaseOrig)
  1148.         pev(entindex2, pev_view_ofs, temp)
  1149.         targetOrig[0] = targetBaseOrig [0] + temp[0]
  1150.         targetOrig[1] = targetBaseOrig [1] + temp[1]
  1151.         targetOrig[2] = targetBaseOrig [2] + temp[2]
  1152.         engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0)
  1153.         if (get_tr2(0, TraceResult:TR_InOpen) && get_tr2(0, TraceResult:TR_InWater))
  1154.         {
  1155.             return false
  1156.         }
  1157.         else
  1158.         {
  1159.             new Float:flFraction
  1160.             get_tr2(0, TraceResult:TR_flFraction, flFraction)
  1161.             if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
  1162.             {
  1163.                 return true
  1164.             }
  1165.             else
  1166.             {
  1167.                 targetOrig[0] = targetBaseOrig [0]
  1168.                 targetOrig[1] = targetBaseOrig [1]
  1169.                 targetOrig[2] = targetBaseOrig [2]
  1170.                 engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0)
  1171.                 get_tr2(0, TraceResult:TR_flFraction, flFraction)
  1172.                 if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
  1173.                 {
  1174.                     return true
  1175.                 }
  1176.                 else
  1177.                 {
  1178.                     targetOrig[0] = targetBaseOrig [0]
  1179.                     targetOrig[1] = targetBaseOrig [1]
  1180.                     targetOrig[2] = targetBaseOrig [2] - 17.0
  1181.                     engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0)
  1182.                     get_tr2(0, TraceResult:TR_flFraction, flFraction)
  1183.                     if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
  1184.                     {
  1185.                         return true
  1186.                     }
  1187.                 }
  1188.             }
  1189.         }
  1190.     }
  1191.     return false
  1192. }
  1193. public control_ai(ent, victim, Float:speed)
  1194. {
  1195.     static Float:fl_Velocity[3]
  1196.     static Float:VicOrigin[3], Float:EntOrigin[3]
  1197.     pev(ent, pev_origin, EntOrigin)
  1198.     pev(victim, pev_origin, VicOrigin)
  1199.     static Float:distance_f
  1200.     distance_f = get_distance_f(EntOrigin, VicOrigin)
  1201.     if (distance_f > 60.0)
  1202.     {
  1203.         new Float:fl_Time = distance_f / speed
  1204.  
  1205.         fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
  1206.         fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
  1207.         fl_Velocity[2] = 0.0
  1208.     } else
  1209.     {
  1210.         fl_Velocity[0] = 0.0
  1211.         fl_Velocity[1] = 0.0
  1212.         fl_Velocity[2] = 0.0
  1213.     }
  1214.     entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
  1215. }
  1216. stock control_ai2(ent, Float:VicOrigin[3], Float:speed)
  1217. {
  1218.     static Float:fl_Velocity[3]
  1219.     static Float:EntOrigin[3]
  1220.     pev(ent, pev_origin, EntOrigin)
  1221.     static Float:distance_f
  1222.     distance_f = get_distance_f(EntOrigin, VicOrigin)
  1223.     if (distance_f > 60.0)
  1224.     {
  1225.         new Float:fl_Time = distance_f / speed
  1226.         fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
  1227.         fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
  1228.         fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
  1229.     } else {
  1230.         fl_Velocity[0] = 0.0
  1231.         fl_Velocity[1] = 0.0
  1232.         fl_Velocity[2] = 0.0
  1233.     }
  1234.     entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
  1235. }
  1236. stock ScreenFade(id, Timer, Colors[3], Alpha) {
  1237.     message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), _, id);
  1238.     write_short((1<<12) * Timer)
  1239.     write_short(1<<12)
  1240.     write_short(0)
  1241.     write_byte(Colors[0])
  1242.     write_byte(Colors[1])
  1243.     write_byte(Colors[2])
  1244.     write_byte(Alpha)
  1245.     message_end()
  1246. }
  1247. stock shake_screen(id)
  1248. {
  1249.     message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenShake"),{0,0,0}, id)
  1250.     write_short(1<<14)
  1251.     write_short(1<<13)
  1252.     write_short(1<<13)
  1253.     message_end()
  1254. }
  1255. stock anim(ent, sequence) {
  1256.          set_pev(ent, pev_sequence, sequence)
  1257.          set_pev(ent, pev_animtime, halflife_time())
  1258.          set_pev(ent, pev_framerate, 1.0)
  1259. }
  1260. stock get_position(ent, Float:forw, Float:right, Float:up, Float:vStart[])
  1261. {
  1262.     new Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
  1263.     pev(ent, pev_origin, vOrigin)
  1264.     pev(ent, pev_view_ofs,vUp)
  1265.     xs_vec_add(vOrigin,vUp,vOrigin)
  1266.     pev(ent, pev_v_angle, vAngle)
  1267.     vAngle[0] = 0.0
  1268.     angle_vector(vAngle,ANGLEVECTOR_FORWARD,vForward)
  1269.     angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
  1270.     angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
  1271.     vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
  1272.     vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
  1273.     vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
  1274. }
  1275. stock create_blood(const Float:origin[3])
  1276. {
  1277.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  1278.     write_byte(TE_BLOODSPRITE)
  1279.     engfunc(EngFunc_WriteCoord, origin[0])
  1280.     engfunc(EngFunc_WriteCoord, origin[1])
  1281.     engfunc(EngFunc_WriteCoord, origin[2])
  1282.     write_short(y_bleeding[1])
  1283.     write_short(y_bleeding[0])
  1284.     write_byte(218)
  1285.     write_byte(7)
  1286.     message_end()
  1287. }
  1288. stock ShockWave(Float:Orig[3], Life, Width, Float:Radius, Color[3])
  1289. {
  1290.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Orig, 0)
  1291.     write_byte(TE_BEAMCYLINDER)
  1292.     engfunc(EngFunc_WriteCoord, Orig[0])
  1293.     engfunc(EngFunc_WriteCoord, Orig[1])
  1294.     engfunc(EngFunc_WriteCoord, Orig[2]-40.0)
  1295.     engfunc(EngFunc_WriteCoord, Orig[0])
  1296.     engfunc(EngFunc_WriteCoord, Orig[1])
  1297.     engfunc(EngFunc_WriteCoord, Orig[2]+Radius)
  1298.     write_short(g_news[0])
  1299.     write_byte(0)
  1300.     write_byte(0)
  1301.     write_byte(Life)
  1302.     write_byte(Width)
  1303.     write_byte(0)
  1304.     write_byte(Color[0])
  1305.     write_byte(Color[1])
  1306.     write_byte(Color[2])
  1307.     write_byte(255)
  1308.     write_byte(0)
  1309.     message_end()
  1310. }
  1311. stock ice_entity( id, status )
  1312. {
  1313.     if(status)
  1314.     {
  1315.         static ent, Float:o[3]
  1316.         if(!is_user_alive(id))
  1317.         {
  1318.             ice_entity( id, 0 )
  1319.             return
  1320.         }
  1321.        
  1322.         if( is_valid_ent(iceent[id]) )
  1323.         {
  1324.             if( pev( iceent[id], pev_iuser3 ) != id )
  1325.             {
  1326.                 if( pev(iceent[id], pev_team) == 6969 ) remove_entity(iceent[id])
  1327.             }
  1328.             else
  1329.             {
  1330.                 pev( id, pev_origin, o )
  1331.                 if( pev( id, pev_flags ) & FL_DUCKING  ) o[2] -= 15.0
  1332.                 else o[2] -= 35.0
  1333.                 entity_set_origin(iceent[id], o)
  1334.                 return
  1335.             }
  1336.         }
  1337.        
  1338.         pev( id, pev_origin, o )
  1339.         if( pev( id, pev_flags ) & FL_DUCKING  ) o[2] -= 15.0
  1340.         else o[2] -= 35.0
  1341.         ent = create_entity("info_target")
  1342.         set_pev( ent, pev_classname, "DareDevil" )
  1343.        
  1344.         entity_set_model(ent, ice_model)
  1345.         dllfunc(DLLFunc_Spawn, ent)
  1346.         set_pev(ent, pev_solid, SOLID_BBOX)
  1347.         set_pev(ent, pev_movetype, MOVETYPE_FLY)
  1348.         entity_set_origin(ent, o)
  1349.         entity_set_size(ent, Float:{ -3.0, -3.0, -3.0 }, Float:{ 3.0, 3.0, 3.0 } )
  1350.         set_pev( ent, pev_iuser3, id )
  1351.         set_pev( ent, pev_team, 6969 )
  1352.         set_rendering(ent, kRenderFxNone, 255, 255, 255, kRenderTransAdd, 255)
  1353.         iceent[id] = ent
  1354.     }
  1355.     else
  1356.     {
  1357.         if( is_valid_ent(iceent[id]) )
  1358.         {
  1359.             if( pev(iceent[id], pev_team) == 6969 ) remove_entity(iceent[id])
  1360.             iceent[id] = -1
  1361.         }
  1362.     }
  1363. }
  1364.  
  1365. frost_explode(ent)
  1366. {
  1367.     // Get origin
  1368.     static Float:originF[3]
  1369.     pev(ent, pev_origin, originF)
  1370.     // Make the explosion
  1371.     create_blast(originF)
  1372.    
  1373.     emit_sound(ent, CHAN_AUTO, frozer, 1.0, ATTN_NORM, 0, PITCH_NORM)
  1374.    
  1375.     message_begin(MSG_ONE, g_msgScreenFade, _, ent)
  1376.     write_short(0) // duration
  1377.     write_short(0) // hold time
  1378.     write_short(0x0004) // fade type
  1379.     write_byte(0) // red
  1380.     write_byte(50) // green
  1381.     write_byte(200) // blue
  1382.     write_byte(100) // alpha
  1383.     message_end()
  1384. }
  1385. public remove_frost(id)
  1386. {
  1387.     // Gradually remove screen's blue tint
  1388.     message_begin(MSG_ONE, g_msgScreenFade, _, id)
  1389.     write_short((1<<12)) // duration
  1390.     write_short(0) // hold time
  1391.     write_short(0x0000) // fade type
  1392.     write_byte(0) // red
  1393.     write_byte(50) // green
  1394.     write_byte(200) // blue
  1395.     write_byte(100) // alpha
  1396.     message_end()
  1397. }
  1398. create_blast(const Float:originF[3])
  1399. {
  1400.     // Medium ring
  1401.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  1402.     write_byte(TE_BEAMCYLINDER) // TE id
  1403.     engfunc(EngFunc_WriteCoord, originF[0]) // x
  1404.     engfunc(EngFunc_WriteCoord, originF[1]) // y
  1405.     engfunc(EngFunc_WriteCoord, originF[2]) // z
  1406.     engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  1407.     engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  1408.     engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
  1409.     write_short(g_exploSpr) // sprite
  1410.     write_byte(0) // startframe
  1411.     write_byte(0) // framerate
  1412.     write_byte(4) // life
  1413.     write_byte(60) // width
  1414.     write_byte(0) // noise
  1415.     write_byte(0) // red
  1416.     write_byte(191) // green
  1417.     write_byte(255) // blue
  1418.     write_byte(200) // brightness
  1419.     write_byte(0) // speed
  1420.     message_end()
  1421.    
  1422.     // Largest ring
  1423.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  1424.     write_byte(TE_BEAMCYLINDER) // TE id
  1425.     engfunc(EngFunc_WriteCoord, originF[0]) // x
  1426.     engfunc(EngFunc_WriteCoord, originF[1]) // y
  1427.     engfunc(EngFunc_WriteCoord, originF[2]) // z
  1428.     engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  1429.     engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  1430.     engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
  1431.     write_short(g_exploSpr) // sprite
  1432.     write_byte(0) // startframe
  1433.     write_byte(0) // framerate
  1434.     write_byte(4) // life
  1435.     write_byte(60) // width
  1436.     write_byte(0) // noise
  1437.     write_byte(0) // red
  1438.     write_byte(191) // green
  1439.     write_byte(255) // blue
  1440.     write_byte(200) // brightness
  1441.     write_byte(0) // speed
  1442.     message_end()
  1443.    
  1444.     // Luz Dinamica
  1445.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
  1446.     write_byte(TE_DLIGHT) // TE id
  1447.     engfunc(EngFunc_WriteCoord, originF[0]) // x
  1448.     engfunc(EngFunc_WriteCoord, originF[1]) // y
  1449.     engfunc(EngFunc_WriteCoord, originF[2]) // z
  1450.     write_byte(50) // radio
  1451.     write_byte(0) // red
  1452.     write_byte(191) // green
  1453.     write_byte(255) // blue
  1454.     write_byte(30) // vida en 0.1, 30 = 3 segundos
  1455.     write_byte(30) // velocidad de decaimiento
  1456.     message_end()
  1457.  
  1458.     engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
  1459.     write_byte(TE_EXPLOSION)
  1460.     engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  1461.     engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  1462.     engfunc(EngFunc_WriteCoord, originF[2]+10) // z axis
  1463.     write_short(g_explosfr)
  1464.     write_byte(17)
  1465.     write_byte(15)
  1466.     write_byte(TE_EXPLFLAG_NOSOUND)
  1467.     message_end();
  1468.    
  1469.    
  1470.     engfunc(EngFunc_MessageBegin, MSG_BROADCAST,SVC_TEMPENTITY, originF, 0)
  1471.     write_byte(TE_SPRITETRAIL) // TE ID
  1472.     engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  1473.     engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  1474.     engfunc(EngFunc_WriteCoord, originF[2] + 40) // z axis
  1475.     engfunc(EngFunc_WriteCoord, originF[0]) // x axis
  1476.     engfunc(EngFunc_WriteCoord, originF[1]) // y axis
  1477.     engfunc(EngFunc_WriteCoord, originF[2]) // z axis
  1478.     write_short(frostgib) // Sprite Index
  1479.     write_byte(30) // Count
  1480.     write_byte(10) // Life
  1481.     write_byte(4) // Scale
  1482.     write_byte(50) // Velocity Along Vector
  1483.     write_byte(10) // Rendomness of Velocity
  1484.     message_end();
  1485. }
bro what i do when i come to Hold E place ?
idk where i should go

Re: Oberon Boss with trigger

Posted: 12 Jul 2019, 12:17
by Mark
No maps are private lol I could get it from your server you know?

Re: Oberon Boss with trigger

Posted: 12 Jul 2019, 13:12
by Muhammet20
Mark wrote: 4 years ago No maps are private lol I could get it from your server you know?
you are right bro if anyone join can get any private map
and as you said:
Mark wrote: 4 years ago No maps are private

Re: Oberon Boss with trigger

Posted: 12 Jul 2019, 14:24
by Raheem
After testing this, it's proved that the mapper who made it don't tell me the right information and no at all trigger_multiple with name orbeon than can be activated when a player touch it so boss appears, for this the topic will be trashed. At least i show the way how to hook trigger_multiple.

Next time provide right information or don't post your request at all, if your map is private this is a public requests section so don't post it.