Raised This Month: $ Target: $400
 0% 

Problem with Dias's NPC Revenant


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Apokalipsisa
Member
Join Date: May 2012
Old 05-07-2013 , 14:05   Problem with Dias's NPC Revenant
Reply With Quote #1

I have edit the plugin a little,but it gives me a Don't Send Error after 2-3 rounds when the boss die.I've place a debug after the plugin,but it gives me no error when it crash.I remember it was giving me error in line 1907 when it crash,but now no error in debug.Please help me.Here is the code:
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <xs>
#include <cstrike>

#define PLUGIN "[Dias's NPC] Revenant"
#define VERSION "1.0"
#define AUTHOR "Dias"

#define REVENANT_HEALTH 100.0

#define TASK_STARTING 3000
#define TASK_REMOVE_REVENANT 3003
#define TASK_BURNING 3016
#define TASK_EVOLUTION 3017
#define TASK_RECHECK 3018
#define TASK_CREATE 3019
#define TASK_MUSIC 3020
#define TASK_SKILL 3021
#define TASK_CHECKPLAYER 3022

// Skill: FireStorm
#define TASK_MAKE_AURA 3010
#define TASK_MAKE_STORM 3011
#define TASK_STOP_STORM 3012
#define TASK_RESET_STORM 3013
#define TASK_SET_MINI_FIREBALL 3014
#define TASK_REMOVE_MINI_FIREBALL 3015
// End of Skill: FireStorm

// Skill:Circle Fire
#define TASK_DOING_CIRCLE_FIRE 3008
#define TASK_RESET_CIRCLE_FIRE 3009
new g_time_doing
#define EXPLOSION_RADIUS 250.0
#define EXPLOSION_DAMAGE 50.0

// Skill: Mahadash
#define TASK_DOING_MAHADASH 3006
#define TASK_STOP_MAHADASH 3007
#define MAHADASH_DAMAGE 200.0
new g_mahadashing
// End Of Skill: Mahadash

// Skill: Attack1 
#define TASK_REVENANT_ATTACK 3004
#define TASK_REVENANT_ATTACK_RELOAD 3005
#define ATTACK1_DAMAGE 70.0
// End of Skill: Attack1

// Skill: Fireball
#define TASK_FIREBALL1 3001
#define TASK_FIREBALL2 3002
#define FIREBALL_DAMAGE 50.0
#define FIREBALL_RADIUS 150.0

new g_fireball1_countg_fireball2_countg_fireball12_countg_fireball22_count
new Float:fireball_origin1[3], Float:fireball_origin2[3], Float:fireball_origin12[3], Float:fireball_origin22[3]
new const 
fireball_flame[] = "sprites/npc_revenant/flame2.spr"
// End of Skill: Fireball

new const revenant_model[] = "models/npc_revelant/zbs_bossl_big05.mdl"
new const fireball_model[] = "models/npc_revelant/ef_fireball.mdl"
new const revenant_sound[10][] = {
    
"npc_revenant/revenant_zbs_death.wav",
    
"npc_revenant/revenant_fireball_explode.wav",
    
"npc_revenant/revenant_zbs_attack1.wav",
    
"npc_revenant/revenant_zbs_attack4.wav",
    
"npc_revenant/revenant_zbs_attack5.wav",
    
"npc_revenant/revenant_zbs_fireball1.wav",
    
"npc_revenant/revenant_zbs_fireball2.wav",
    
"npc_revenant/revenant_scene_appear.wav",
    
"npc_revenant/roundclear.wav",
    
"npc_revenant/roundfail.wav"
}

new 
g_entrevenant_model_idg_fire_ent[5], g_reg
new g_spr_idg_doing_skillg_evolution
new m_iBlood[2]
new 
healthbarFloat:g_official_origin[3]
new const 
healthbar_spr[] = "sprites/zs_healthbar.spr"

// Map Sound
new const map_sound[2][] = {
    
"sound/npc_revenant/Scenario_Ready.mp3",
    
"sound/npc_revenant/Scenario_Rush.mp3"
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Spawn"player""fw_spawn"1)
    
    
register_event("HLTV""event_newround""a""1=0""2=0")
    
register_logevent("event_roundstart"2"1=Round_Start")
    
register_logevent("event_roundend"2"1=Round_End")
    
    
register_think("npc_revenant""fw_revenant_think")
    
register_touch("npc_revenant""*""fw_revenant_touch")
    
    
// Fireball Skill
    
register_think("revenant_fireball""fw_fireball_think")
    
register_touch("revenant_fireball""*""fw_fireball_touch")
    
register_think("fireball_flame""fw_flame_think")
    
    
register_clcmd("say /make""create_revenant")
    
    
register_clcmd("do_firestorm""do_firestorm3")
    
register_clcmd("do_circle_fire""do_circle_fire3")
    
register_clcmd("do_mahadash""do_mahadash3")
    
register_clcmd("do_fireball""do_fireball3")
}

public 
plugin_precache()
{
    
g_spr_id precache_model("sprites/zerogxplode.spr")
    
    
revenant_model_id precache_model(revenant_model)
    
precache_model(fireball_model)
    
precache_model(fireball_flame)
    
precache_model(healthbar_spr)
    
    for(new 
0sizeof(revenant_sound); i++)
        
precache_sound(revenant_sound[i])
    for(new 
0sizeof(map_sound); i++)
        
precache_generic(map_sound[i])        
        
    
m_iBlood[0] = precache_model("sprites/blood.spr")
    
m_iBlood[1] = precache_model("sprites/bloodspray.spr")    
    
    static 
mapname[64]
    
get_mapname(mapnamesizeof(mapname))
    
    if(
equal(mapname"zs_boss_construction"))
    {
        
g_official_origin[0] = -48.8
        g_official_origin
[1] = 26.8
        g_official_origin
[2] = 2000.0
    
}
}

/*
public client_PostThink(id)
{
    static Float:Origin[3]
    pev(id, pev_origin, Origin)
    
    client_print(id, print_center, "%f %f %f", Origin[0], Origin[1], Origin[2])
}*/

public plugin_cfg()
{
    
server_cmd("mp_buytime 999999.0")
    
server_cmd("mp_freezetime 20.0")
}

public 
do_firestorm3() do_firestorm(g_ent)
public 
do_circle_fire3() do_circle_fire(g_ent)
public 
do_mahadash3() do_mahadash(g_ent)
public 
do_fireball3() do_fireball(g_ent)

public 
fw_spawn(id)
{
    if(
is_user_connected(id))
    {
        
cs_set_user_money(id16000)
    }
}

public 
event_newround()
{    
    if(
pev_valid(g_ent))
    {
        
g_time_doing 0
        g_mahadashing 
0
        
        remove_task
(g_ent+TASK_BURNING)
        
remove_task(g_ent+TASK_EVOLUTION)
        
        
remove_task(g_ent+TASK_MAKE_AURA)
        
remove_task(g_ent+TASK_MAKE_STORM)
        
remove_task(g_ent+TASK_RESET_STORM)        
        
        
remove_task(g_ent+TASK_DOING_CIRCLE_FIRE)
        
remove_task(g_ent+TASK_RESET_CIRCLE_FIRE)    
        
        
remove_task(g_ent+TASK_DOING_MAHADASH)
        
remove_task(g_ent+TASK_STOP_MAHADASH)
        
        
remove_task(g_ent+TASK_STARTING)
        
remove_task(g_ent+TASK_REMOVE_REVENANT)
    
        
remove_task(g_ent+TASK_REVENANT_ATTACK)
        
remove_task(g_ent+TASK_REVENANT_ATTACK_RELOAD)    
        
        
remove_task(g_ent+TASK_RECHECK)
    
        
stop_fireball(g_ent)
        
remove_entity_name("npc_revenant")    
    }
    
    
remove_task(TASK_CREATE)
    
remove_task(TASK_MUSIC)
    
remove_task(TASK_CHECKPLAYER)
    
    if(
pev_valid(healthbar)) remove_entity(healthbar)
    for(new 
0sizeof(g_fire_ent); i++)
    {
        if(
pev_valid(g_fire_ent[i]))
            
remove_entity(g_fire_ent[i])
    }    

    
// Play ready sound
    
client_cmd(0"mp3 play %s"map_sound[0])
}

public 
event_roundstart()
{
    
// Play ready sound
    
client_cmd(0"mp3 play %s"map_sound[1])    
    
    
set_hudmessage(02550, -1.00.3015.05.0)
    
show_hudmessage(0"Revenant will appear after 5 second(s)")

    
set_task(180.0"replay_music"TASK_MUSIC)
    
    
set_task(1.0"recheck_player"TASK_CHECKPLAYER__"b")
}

public 
recheck_player()
{
    static 
player[32], player_num
    get_players
(playerplayer_num"a")
    
    if(
player_num <= 0)
    {
        
set_hudmessage(02550, -1.00.3015.05.0)
        
show_hudmessage(0"Round Fail !!!")
        
        
client_cmd(0"stopsound")    
        
client_cmd(0"spk %s"revenant_sound[9])
        
        
set_task(3.0"do_restart")
        
        
remove_task(TASK_CHECKPLAYER)
    } else {
        if(
pev_valid(g_ent) && pev(g_entpev_iuser3) == 1)
        {
            
set_hudmessage(02550, -1.00.3015.05.0)
            
show_hudmessage(0"Round Clear !!!")    
        
            
client_cmd(0"stopsound")    
            
client_cmd(0"spk %s"revenant_sound[8])
            
set_task(3.0"do_restart")
            
            
remove_task(TASK_CHECKPLAYER)
        }
    }
}

public 
do_restart()
{
    
server_cmd("sv_restartround 1")
}

public 
event_roundend()
{
    
client_cmd(0"stopsound")    
    
remove_task(TASK_MUSIC)
}

public 
replay_music()
{
    
// Play ready sound
    
client_cmd(0"mp3 play %s"map_sound[1])    
    
set_task(180.0"replay_music"TASK_MUSIC)
}

// ================== FireStorm =======================
public do_firestorm(ent)
{
    if(!
pev_valid(ent) || g_doing_skill)
        return    
    
    
g_doing_skill 1
    set_entity_anim
(ent12)
    
    static 
Float:Origin[3]
    
get_position(ent150.00.050.0Origin)
    
    
emit_sound(entCHAN_BODYrevenant_sound[4], 1.0ATTN_NORM0PITCH_NORM)
    
    
make_mini_fireball(entOrigin)
    
    
set_task(0.1"make_aura"ent+TASK_MAKE_AURA__"b")
    
set_task(4.0"do_storm"ent+TASK_MAKE_STORM)
    
set_task(10.0"stop_storm"ent+TASK_STOP_STORM)
}

public 
make_mini_fireball(bossFloat:Origin[3])
{
    new 
ent create_entity("info_target")

    static 
Float:Angles[3]
    
pev(bosspev_anglesAngles)
    
    
entity_set_origin(entOrigin)
    
    
Angles[0] = 100.0
    entity_set_vector
(entEV_VEC_anglesAngles)
    
    
Angles[0] = -100.0
    entity_set_vector
(entEV_VEC_v_angleAngles)
    
    
entity_set_string(entEV_SZ_classname"revenant_fireball")
    
entity_set_model(entfireball_model)
    
entity_set_int(entEV_INT_solid2)
    
entity_set_int(entEV_INT_movetypeMOVETYPE_FLY)
    
    new 
Float:maxs[3] = {15.015.015.0}
    new 
Float:mins[3] = {-15.0, -15.0, -15.0}
    
entity_set_size(entminsmaxs)
    
set_pev(entpev_ownerboss)
    
    
set_task(0.01"set_mini_fireball"ent+TASK_SET_MINI_FIREBALL)
    
set_task(3.0"remove_mini_fireball"ent+TASK_REMOVE_MINI_FIREBALL)
    
    
make_fire(ent0.5)
}

public 
set_mini_fireball(ent)
{
    
ent -= TASK_SET_MINI_FIREBALL
    
    
if(!pev_valid(ent))
        return
    
    static 
Float:Origin[3]
    
get_position(ent2.00.02.0Origin)
    
    
set_pev(entpev_originOrigin)
    
    
set_task(0.01"set_mini_fireball"ent+TASK_SET_MINI_FIREBALL)
}

public 
remove_mini_fireball(ent)
{
    
ent -= TASK_REMOVE_MINI_FIREBALL
    
    
if(!pev_valid(ent))
        return
        
    
remove_entity(ent)
}

public 
do_storm(ent)
{
    
ent -= TASK_MAKE_STORM
    
    
if(!pev_valid(ent))
        return
        
    static 
Float:Explosion_Origin[24][3], Float:Real_Origin[24][3]    
    
    
// Plus
    
Explosion_Origin[0][0] = 200.0
    Explosion_Origin
[0][1] = 0.0
    Explosion_Origin
[0][2] = 500.0
    
    Explosion_Origin
[1][0] = 400.0
    Explosion_Origin
[1][1] = 0.0
    Explosion_Origin
[1][2] = 500.0
    
    Explosion_Origin
[2][0] = -200.0
    Explosion_Origin
[2][1] = 0.0
    Explosion_Origin
[2][2] = 500.0
    
    Explosion_Origin
[3][0] = -400.0
    Explosion_Origin
[3][1] = 0.0
    Explosion_Origin
[3][2] = 500.0
    
    Explosion_Origin
[4][0] = 0.0
    Explosion_Origin
[4][1] = 200.0
    Explosion_Origin
[4][2] = 500.0
    
    Explosion_Origin
[5][0] = 0.0
    Explosion_Origin
[5][1] = 400.0
    Explosion_Origin
[5][2] = 500.0
    
    Explosion_Origin
[6][0] = 0.0
    Explosion_Origin
[6][1] = -200.0
    Explosion_Origin
[6][2] = 500.0
    
    Explosion_Origin
[7][0] = 0.0
    Explosion_Origin
[7][1] = -400.0
    Explosion_Origin
[7][2] = 500.0
    
    
// Other 1
    
Explosion_Origin[8][0] = 200.0
    Explosion_Origin
[8][1] = 200.0
    Explosion_Origin
[8][2] = 500.0
    
    Explosion_Origin
[9][0] = 400.0
    Explosion_Origin
[9][1] = 400.0
    Explosion_Origin
[9][2] = 500.0
    
    Explosion_Origin
[10][0] = 200.0
    Explosion_Origin
[10][1] = 400.0
    Explosion_Origin
[10][2] = 500.0
    
    Explosion_Origin
[11][0] = 400.0
    Explosion_Origin
[11][1] = 200.0
    Explosion_Origin
[11][2] = 500.0
    
    
// Other 2    
    
Explosion_Origin[12][0] = -200.0
    Explosion_Origin
[12][1] = 200.0
    Explosion_Origin
[12][2] = 500.0
    
    Explosion_Origin
[13][0] = -400.0
    Explosion_Origin
[13][1] = 400.0
    Explosion_Origin
[13][2] = 500.0
    
    Explosion_Origin
[14][0] = -200.0
    Explosion_Origin
[14][1] = 400.0
    Explosion_Origin
[14][2] = 500.0
    
    Explosion_Origin
[15][0] = -400.0
    Explosion_Origin
[15][1] = 200.0
    Explosion_Origin
[15][2] = 500.0
    
    
// Other 3
    
Explosion_Origin[16][0] = -200.0
    Explosion_Origin
[16][1] = -200.0
    Explosion_Origin
[17][2] = 500.0
    
    Explosion_Origin
[17][0] = -200.0
    Explosion_Origin
[17][1] = -200.0
    Explosion_Origin
[17][2] = 500.0
    
    Explosion_Origin
[18][0] = -200.0
    Explosion_Origin
[18][1] = -400.0
    Explosion_Origin
[18][2] = 500.0
    
    Explosion_Origin
[19][0] = -400.0
    Explosion_Origin
[19][1] = -200.0
    Explosion_Origin
[19][2] = 500.0
    
    
// Other 4
    
Explosion_Origin[20][0] = 200.0
    Explosion_Origin
[20][1] = -200.0
    Explosion_Origin
[20][2] = 500.0
    
    Explosion_Origin
[21][0] = 400.0
    Explosion_Origin
[21][1] = -400.0
    Explosion_Origin
[21][2] = 500.0
    
    Explosion_Origin
[22][0] = 200.0
    Explosion_Origin
[22][1] = -400.0
    Explosion_Origin
[22][2] = 500.0
    
    Explosion_Origin
[23][0] = 400.0
    Explosion_Origin
[23][1] = -200.0
    Explosion_Origin
[23][2] = 500.0
    
    
for(new 0sizeof(Explosion_Origin); i++)
    {
        
get_position(entExplosion_Origin[i][0], Explosion_Origin[i][1], Explosion_Origin[i][2], Real_Origin[i])
        
make_fireball2(entReal_Origin[i])
    }

    
remove_task(ent+TASK_MAKE_AURA)
    
set_task(1.0"do_storm"ent+TASK_MAKE_STORM)
}

public 
make_fireball2(bossFloat:Origin[3])
{
    new 
ent create_entity("info_target")

    static 
Float:Angles[3]
    
pev(bosspev_anglesAngles)
    
    
entity_set_origin(entOrigin)
    
    
Angles[0] = -100.0
    entity_set_vector
(entEV_VEC_anglesAngles)
    
    
Angles[0] = 100.0
    entity_set_vector
(entEV_VEC_v_angleAngles)
    
    
entity_set_string(entEV_SZ_classname"revenant_fireball")
    
entity_set_model(entfireball_model)
    
entity_set_int(entEV_INT_solid2)
    
entity_set_int(entEV_INT_movetypeMOVETYPE_FLY)
    
    new 
Float:maxs[3] = {15.015.015.0}
    new 
Float:mins[3] = {-15.0, -15.0, -15.0}
    
entity_set_size(entminsmaxs)
    
set_pev(entpev_ownerboss)
    
    static 
Float:Velocity[3]
    
VelocityByAim(entrandom_num(2501000), Velocity)
    
    
set_pev(entpev_light_level180)
    
set_pev(entpev_rendermodekRenderTransAdd)
    
set_pev(entpev_renderamt255.0)    
    
    
entity_set_vector(entEV_VEC_velocityVelocity)

    
make_fire(ent0.5)
}

public 
fw_fireball2_touch(entid)
{
    if(!
pev_valid(ent))
        return
    
    static 
Float:Origin[3]
    
pev(entpev_originOrigin)
    
    
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
    
write_byte(TE_EXPLOSION)
    
engfunc(EngFunc_WriteCoordOrigin[0])
    
engfunc(EngFunc_WriteCoordOrigin[1])
    
engfunc(EngFunc_WriteCoordOrigin[2])
    
write_short(g_spr_id)    // sprite index
    
write_byte(10)    // scale in 0.1's
    
write_byte(30)    // framerate
    
write_byte(4)    // flags
    
message_end()    
    
    
emit_sound(entCHAN_BODYrevenant_sound[1], 1.0ATTN_NORM0PITCH_NORM)
    
    for(new 
0get_maxplayers(); i++)
    {
        if(
is_user_alive(i) && entity_range(enti) <= FIREBALL_RADIUS)
        {
            
shake_screen(i)
            
ExecuteHam(Ham_TakeDamagei0iFIREBALL_DAMAGEDMG_BURN)
        }
    }
    
    
remove_entity(ent)
}

public 
stop_storm(ent)
{
    
ent -= TASK_STOP_STORM
    
    
if(!pev_valid(ent))
        return    
    
    
remove_task(ent+TASK_MAKE_AURA)
    
remove_task(ent+TASK_MAKE_STORM)
    
    
set_task(2.0"reset_storm"ent+TASK_RESET_STORM)
}

public 
reset_storm(ent)
{
    
ent -= TASK_RESET_STORM
    
    set_entity_anim
(ent2)
    
    
g_doing_skill 0
    entity_set_float
(entEV_FL_nextthinkget_gametime() + 2.0)
}

public 
make_aura(ent)
{
    
ent -= TASK_MAKE_AURA
    
    
if(!pev_valid(ent))
    {
        
remove_task(ent+TASK_MAKE_AURA)
        return
    }
    
    static 
Float:Origin[3]
    
pev(entpev_originOrigin)
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(27)
    
engfunc(EngFunc_WriteCoordOrigin[0])
    
engfunc(EngFunc_WriteCoordOrigin[1])
    
engfunc(EngFunc_WriteCoordOrigin[2])
    
write_byte(500)
    
write_byte(255)
    
write_byte(0)
    
write_byte(0)
    
write_byte(10)
    
write_byte(60)
    
message_end()    
}
// ================== End Of FireStorm =======================

// ================== Circle Fire =======================
public do_circle_fire(ent)
{
    if(!
pev_valid(ent) || g_doing_skill)
        return    
    
    
g_doing_skill 1
    g_time_doing 
3
    set_entity_anim
(ent11)
    
    
emit_sound(entCHAN_BODYrevenant_sound[3], 1.0ATTN_NORM0PITCH_NORM)
    
    
set_task(0.25"do_explosion"ent+TASK_DOING_CIRCLE_FIRE)
    
set_task(0.5"do_explosion"ent+TASK_DOING_CIRCLE_FIRE)
    
set_task(0.75"do_explosion"ent+TASK_DOING_CIRCLE_FIRE)
    
    
set_task(2.0"reset_circle_explosion"ent+TASK_RESET_CIRCLE_FIRE)
}

public 
reset_circle_explosion(ent)
{
    
ent -= TASK_RESET_CIRCLE_FIRE
    
    g_doing_skill 
0
    g_time_doing 
0    
    
    set_entity_anim
(ent2)
    
entity_set_float(entEV_FL_nextthinkget_gametime() + 1.0)
}

public 
do_explosion(ent)
{
    
ent -= TASK_DOING_CIRCLE_FIRE
    
    
static Float:Explosion_Origin[8][3], Float:Real_Origin[8][3]
    
    if(
g_time_doing == 3)
    {
        
Explosion_Origin[0][0] = 100.0
        Explosion_Origin
[0][1] = 0.0
        Explosion_Origin
[0][2] = 0.0
        
        Explosion_Origin
[1][0] = 50.0
        Explosion_Origin
[1][1] = 50.0
        Explosion_Origin
[1][2] = 0.0
        
        Explosion_Origin
[2][0] = 0.0
        Explosion_Origin
[2][1] = 100.0
        Explosion_Origin
[2][2] = 0.0
        
        Explosion_Origin
[3][0] = -50.0
        Explosion_Origin
[3][1] = -100.0
        Explosion_Origin
[3][2] = 0.0
        
        Explosion_Origin
[4][0] = -100.0
        Explosion_Origin
[4][1] = 0.0
        Explosion_Origin
[4][2] = 0.0
        
        Explosion_Origin
[5][0] = -50.0
        Explosion_Origin
[5][1] = -50.0
        Explosion_Origin
[5][2] = 0.0
        
        Explosion_Origin
[6][0] = 0.0
        Explosion_Origin
[6][1] = -50.0
        Explosion_Origin
[6][2] = 0.0
        
        Explosion_Origin
[7][0] = 50.0
        Explosion_Origin
[7][1] = -50.0
        Explosion_Origin
[7][2] = 0.0
    
} else if(g_time_doing == 2) {
        
Explosion_Origin[0][0] = 200.0
        Explosion_Origin
[0][1] = 0.0
        Explosion_Origin
[0][2] = 0.0
        
        Explosion_Origin
[1][0] = 100.0
        Explosion_Origin
[1][1] = 100.0
        Explosion_Origin
[1][2] = 0.0
        
        Explosion_Origin
[2][0] = 0.0
        Explosion_Origin
[2][1] = 200.0
        Explosion_Origin
[2][2] = 0.0
        
        Explosion_Origin
[3][0] = -100.0
        Explosion_Origin
[3][1] = -200.0
        Explosion_Origin
[3][2] = 0.0
        
        Explosion_Origin
[4][0] = -200.0
        Explosion_Origin
[4][1] = 0.0
        Explosion_Origin
[4][2] = 0.0
        
        Explosion_Origin
[5][0] = -100.0
        Explosion_Origin
[5][1] = -100.0
        Explosion_Origin
[5][2] = 0.0
        
        Explosion_Origin
[6][0] = 0.0
        Explosion_Origin
[6][1] = -100.0
        Explosion_Origin
[6][2] = 0.0
        
        Explosion_Origin
[7][0] = 100.0
        Explosion_Origin
[7][1] = -100.0
        Explosion_Origin
[7][2] = 0.0            
    
} else if(g_time_doing == 1) {
        
Explosion_Origin[0][0] = 300.0
        Explosion_Origin
[0][1] = 0.0
        Explosion_Origin
[0][2] = 0.0
        
        Explosion_Origin
[1][0] = 150.0
        Explosion_Origin
[1][1] = 150.0
        Explosion_Origin
[1][2] = 0.0
        
        Explosion_Origin
[2][0] = 0.0
        Explosion_Origin
[2][1] = 300.0
        Explosion_Origin
[2][2] = 0.0
        
        Explosion_Origin
[3][0] = -150.0
        Explosion_Origin
[3][1] = -300.0
        Explosion_Origin
[3][2] = 0.0
        
        Explosion_Origin
[4][0] = -300.0
        Explosion_Origin
[4][1] = 0.0
        Explosion_Origin
[4][2] = 0.0
        
        Explosion_Origin
[5][0] = -150.0
        Explosion_Origin
[5][1] = -150.0
        Explosion_Origin
[5][2] = 0.0
        
        Explosion_Origin
[6][0] = 0.0
        Explosion_Origin
[6][1] = -150.0
        Explosion_Origin
[6][2] = 0.0
        
        Explosion_Origin
[7][0] = 150.0
        Explosion_Origin
[7][1] = -150.0
        Explosion_Origin
[7][2] = 0.0        
    
}
    
    for(new 
0sizeof(Explosion_Origin); i++)
    {
        
get_position(entExplosion_Origin[i][0], Explosion_Origin[i][1], Explosion_Origin[i][2], Real_Origin[i])
        
make_explosion(entReal_Origin[i])
    }    

    
g_time_doing--
}

public 
make_explosion(entFloat:Origin[3])
{
    
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
    
write_byte(TE_EXPLOSION)
    
engfunc(EngFunc_WriteCoordOrigin[0])
    
engfunc(EngFunc_WriteCoordOrigin[1])
    
engfunc(EngFunc_WriteCoordOrigin[2])
    
write_short(g_spr_id)    // sprite index
    
write_byte(10)    // scale in 0.1's
    
write_byte(30)    // framerate
    
write_byte(4)    // flags
    
message_end()    
    
    
emit_sound(entCHAN_BODYrevenant_sound[1], 1.0ATTN_NORM0PITCH_NORM)
    
    for(new 
0get_maxplayers(); i++)
    {
        if(
is_user_alive(i))
        {
            static 
Float:Origin2[3], Float:distance
            pev
(ipev_originOrigin2)
            
            
distance get_distance_f(OriginOrigin2)
            
            if(
distance <= EXPLOSION_RADIUS)
            {
                
shake_screen(i)
                
ExecuteHam(Ham_TakeDamagei0iEXPLOSION_DAMAGEDMG_BURN)
                
                static 
Float:Velocity[3]
                
Velocity[0] = random_float(250.0750.0)
                
Velocity[1] = random_float(250.0750.0)
                
Velocity[2] = random_float(250.0750.0)
                
                
set_pev(ipev_velocityVelocity)
            }
        }
    }
}
// ================== End of Circle Fire =======================

// ================== Madadash =======================
public do_mahadash(ent)
{
    if(!
pev_valid(ent) || g_doing_skill)
        return    
    
    
g_doing_skill 1
    g_mahadashing 
0
    
    set_entity_anim
(ent5)
    
set_task(1.5"mahadash_now"ent+TASK_DOING_MAHADASH)
    
set_task(2.0"stop_mahadash"ent+TASK_STOP_MAHADASH)
}

public 
mahadash_now(ent)
{
    
ent -= TASK_DOING_MAHADASH
    
    
if(!pev_valid(ent))
        return
        
    
g_mahadashing 1
    set_entity_anim
(ent6)
    
    static 
Float:Origin[3]
    
get_position(ent1000.00.00.0Origin)
    
    
hook_ent2(entOrigin2000.0)
}

public 
fw_revenant_touch(entid)
{
    if(!
pev_valid(id))
        return
    if(!
g_mahadashing)
        return

    
g_mahadashing 0
    
    remove_task
(ent+TASK_STOP_MAHADASH)
    
set_task(0.1"stop_mahadash"ent+TASK_STOP_MAHADASH)
    
    if(
is_user_alive(id))
    {
        
ExecuteHam(Ham_TakeDamageid0idMAHADASH_DAMAGEDMG_SLASH)
        
shake_screen(id)
        
        static 
Float:Velocity[3]
        
Velocity[0] = random_float(1000.02000.0)
        
Velocity[1] = random_float(1000.02000.0)
        
Velocity[2] = random_float(1000.02000.0)
        
        
set_pev(idpev_velocityVelocity)
    }
}

public 
stop_mahadash(ent)
{
    
ent -= TASK_STOP_MAHADASH
    
    g_mahadashing 
0
    g_doing_skill 
1
    set_entity_anim
(ent7)
    
    
set_task(0.5"reset_mahadash"ent)
}

public 
reset_mahadash(ent)
{
    
g_doing_skill 0
    set_entity_anim
(ent2)
    
entity_set_float(entEV_FL_nextthinkget_gametime() + 1.0)
}

// ================== Make FireBall ===================
public do_fireball(ent)
{
    if(!
pev_valid(ent) || g_doing_skill)
        return
    
    
stop_fireball(ent)
    
g_doing_skill 1
    
    
static random_mode
    random_mode 
random_num(01)
    
    switch(
random_mode)
    {
        case 
0: {
            
set_entity_anim(ent9)
            
set_task(1.0"throw_fireball"g_ent+TASK_FIREBALL1)    
            
emit_sound(entCHAN_BODYrevenant_sound[5], 1.0ATTN_NORM0PITCH_NORM)
        }
        case 
1: {
            
set_entity_anim(ent10)
            
set_task(1.0"throw_fireball2"g_ent+TASK_FIREBALL1)        
            
emit_sound(entCHAN_BODYrevenant_sound[6], 1.0ATTN_NORM0PITCH_NORM)
        }
    }
}

public 
stop_fireball(ent)
{
    
g_doing_skill 0
    
    remove_task
(ent+TASK_FIREBALL1)
    
remove_task(ent+TASK_FIREBALL2)
    
remove_entity_name("revenant_fireball")
}

public 
throw_fireball(ent)
{
    
ent -= TASK_FIREBALL1
    
static Float:Origin[3], fireball_leftfireball_right
    
    
// Fireball Left
    
fireball_origin2[0] = 0.0
    fireball_origin2
[1] = 0.0
    fireball_origin2
[2] = 0.0        
    
    get_position
(ent50.0, -25.0100.0Origin)
    
fireball_left make_fireball(entOrigin)    
    
g_fireball2_count 50
    set_pev
(fireball_leftpev_iuser42)
    
set_pev(fireball_leftpev_nextthinkget_gametime() + 0.3)    
    
    
// Fireball Right
    
fireball_origin1[0] = 0.0
    fireball_origin1
[1] = 0.0
    fireball_origin1
[2] = 0.0    
    
    get_position
(ent50.050.0100.0Origin)    
    
fireball_right make_fireball(entOrigin)
    
g_fireball1_count 50
    set_pev
(fireball_rightpev_iuser41)
    
set_pev(fireball_rightpev_nextthinkget_gametime() + 0.4)
    
    
set_task(1.5"restart_skill"ent+TASK_FIREBALL2)
}

public 
throw_fireball2(ent)
{
    
ent -= TASK_FIREBALL1
    
static Float:Origin[3], fireball_leftfireball_right
    
    
// Fireball Left
    
fireball_origin2[0] = 0.0
    fireball_origin2
[1] = 0.0
    fireball_origin2
[2] = 0.0        
    
    get_position
(ent50.0, -25.0100.0Origin)
    
fireball_left make_fireball(entOrigin)    
    
g_fireball2_count 50
    set_pev
(fireball_leftpev_iuser42)
    
set_pev(fireball_leftpev_nextthinkget_gametime() + 0.1)    
    
    
// Fireball Right
    
fireball_origin1[0] = 0.0
    fireball_origin1
[1] = 0.0
    fireball_origin1
[2] = 0.0    
    
    get_position
(ent50.050.0100.0Origin)    
    
fireball_right make_fireball(entOrigin)
    
g_fireball1_count 50
    set_pev
(fireball_rightpev_iuser41)
    
set_pev(fireball_rightpev_nextthinkget_gametime() + 0.2)
    
    
set_task(0.5"throw_fireball2_2"ent)
    
set_task(2.0"restart_skill"ent+TASK_FIREBALL2)
}

public 
throw_fireball2_2(ent)
{
    static 
Float:Origin[3], fireball_leftfireball_right
    
    
// Fireball Left
    
fireball_origin22[0] = 0.0
    fireball_origin22
[1] = 0.0
    fireball_origin22
[2] = 0.0        
    
    get_position
(ent50.0, -25.0100.0Origin)
    
fireball_left make_fireball(entOrigin)    
    
g_fireball22_count 50
    set_pev
(fireball_leftpev_iuser44)
    
set_pev(fireball_leftpev_nextthinkget_gametime() + 0.1)    
    
    
// Fireball Right
    
fireball_origin12[0] = 0.0
    fireball_origin12
[1] = 0.0
    fireball_origin12
[2] = 0.0    
    
    get_position
(ent50.050.0100.0Origin)    
    
fireball_right make_fireball(entOrigin)
    
g_fireball12_count 50
    set_pev
(fireball_rightpev_iuser43)
    
set_pev(fireball_rightpev_nextthinkget_gametime() + 0.2)    
}

public 
restart_skill(ent)
{
    
ent -= TASK_FIREBALL2
    
    g_doing_skill 
0
    set_pev
(entpev_nextthinkget_gametime() + 1.0)
}

public 
make_fireball(bossFloat:Origin[3])
{
    new 
ent create_entity("info_target")

    
entity_set_origin(entOrigin)
    
    
entity_set_string(entEV_SZ_classname"revenant_fireball")
    
entity_set_model(entfireball_model)
    
entity_set_int(entEV_INT_solid0)
    
entity_set_int(entEV_INT_movetype0)
    
    new 
Float:maxs[3] = {15.015.015.0}
    new 
Float:mins[3] = {-15.0, -15.0, -15.0}
    
entity_set_size(entminsmaxs)
    
set_pev(entpev_ownerboss)

    
set_pev(entpev_light_level180)
    
set_pev(entpev_rendermodekRenderTransAdd)
    
set_pev(entpev_renderamt255.0)
    
    
make_fire(ent0.5)
    
    return 
ent
}

public 
make_fire(fireballFloat:size)
{
    static 
ent
    ent 
create_entity("env_sprite")
    
    
set_pev(entpev_takedamage0.0)
    
set_pev(entpev_solidSOLID_NOT)
    
set_pev(entpev_movetypeMOVETYPE_NONE)
    
set_pev(entpev_classname"fireball_flame")
    
    
engfunc(EngFunc_SetModelentfireball_flame)
    
    
set_pev(entpev_rendermodekRenderTransAdd)
    
set_pev(entpev_renderamt255.0)
    
set_pev(entpev_light_level180)
    
    
set_pev(entpev_scalesize)
    
set_pev(entpev_ownerfireball)
    
    
set_pev(entpev_animtimeget_gametime())
    
set_pev(entpev_framerate8.0)
    
set_pev(entpev_frame0.1)
    
set_pev(entpev_spawnflagsSF_SPRITE_STARTON)

    
dllfunc(DLLFunc_Spawnent)

    
fw_flame_think(ent)
    
entity_set_float(entEV_FL_nextthinkget_gametime() + 0.01)
    
    return 
ent
}

public 
fw_flame_think(ent)
{
    if(!
pev_valid(ent))
        return
        
    if(!
pev_valid(pev(entpev_owner)))
    {
        
remove_entity(ent)
        return
    }
    
    static 
owner
    owner 
pev(entpev_owner)
    
    static 
Float:Origin[3]
    
pev(ownerpev_originOrigin)
    
    
Origin[2] += 25.0
    entity_set_origin
(entOrigin)

    
entity_set_float(entEV_FL_nextthinkget_gametime() + 0.01)
}

public 
fw_fireball_think(ent// Fireball Right
{
    if(!
pev_valid(ent))
        return
    
    
// 1st Time
    
if(g_fireball1_count && pev(entpev_iuser4) == 1)
    {    
        static 
Float:Origin[3]
            
        switch(
g_fireball1_count)
        {
            case 
35..40: {
                
fireball_origin1[2] += 0.5
                get_position
(entfireball_origin1[0], fireball_origin1[1], fireball_origin1[2], Origin)
                
set_pev(entpev_originOrigin)
                
                static 
owner
                owner 
pev(entpev_owner)
                
                if(
pev_valid(owner))
                    
turn_to_victim(owner)    
            }    
            case 
20..34: {
                
fireball_origin1[0] += 0.1
                fireball_origin1
[1] += 0.25                
                get_position
(entfireball_origin1[0], fireball_origin1[1], fireball_origin1[2], Origin)
                
set_pev(entpev_originOrigin)
                
                static 
owner
                owner 
pev(entpev_owner)
                
                if(
pev_valid(owner))
                    
turn_to_victim(owner)    
            }    
            case 
5..19: {
                
fireball_origin1[2] -= 0.5
                fireball_origin1
[1] -= 0.5
                fireball_origin1
[0] -= 0.1
                get_position
(entfireball_origin1[0], fireball_origin1[1], fireball_origin1[2], Origin)
                
set_pev(entpev_originOrigin)
                
                static 
owner
                owner 
pev(entpev_owner)
                
                if(
pev_valid(owner))
                    
turn_to_victim(owner)    
            }
            case 
4: {
                static 
ownerFloat:Velocity[3]
                
owner pev(entpev_owner)
    
                
get_position(owner1000.00.0, -100.0Velocity)
                
fm_get_aim_origin(ownerVelocity)
                
//Velocity[2] -= 20.0
                
                
entity_set_int(entEV_INT_solid2)
                
set_pev(entpev_movetypeMOVETYPE_FLY)
                
hook_ent2(entVelocityrandom_float(2000.04000.0))
                    
                
g_fireball1_count 0
            
}
        }
        
        if(
g_fireball1_count 0)
        
g_fireball1_count--
    }
    
    if(
g_fireball2_count && pev(entpev_iuser4) == 2)
    {    
        static 
Float:Origin[3]
            
        switch(
g_fireball2_count)
        {
            case 
35..40: {
                
fireball_origin2[2] += 0.5
                get_position
(entfireball_origin2[0], fireball_origin2[1], fireball_origin2[2], Origin)
                
set_pev(entpev_originOrigin)
                
                static 
owner
                owner 
pev(entpev_owner)
                
                if(
pev_valid(owner))
                    
turn_to_victim(owner)    
            }    
            case 
20..34: {
                
fireball_origin2[0] -= 0.1
                fireball_origin2
[1] += 0.25    
                get_position
(entfireball_origin2[0], fireball_origin2[1], fireball_origin2[2], Origin)
                
set_pev(entpev_originOrigin)
                
                static 
owner
                owner 
pev(entpev_owner)
                
                if(
pev_valid(owner))
                    
turn_to_victim(owner)    
            }    
            case 
5..19: {
                
fireball_origin2[2] -= 0.5
                fireball_origin2
[1] -= 0.5
                fireball_origin2
[0] += 0.1
                get_position
(entfireball_origin2[0], fireball_origin2[1], fireball_origin2[2], Origin)
                
set_pev(entpev_originOrigin)
                
                static 
owner
                owner 
pev(entpev_owner)
                
                if(
pev_valid(owner))
                    
turn_to_victim(owner)    
            }
            case 
4: {
                static 
ownerFloat:Velocity[3]
                
owner pev(entpev_owner)
    
                
get_position(owner1000.00.0, -100.0Velocity)
                
fm_get_aim_origin(ownerVelocity)
                
//Velocity[2] -= 20.0
                
                
entity_set_int(entEV_INT_solid2)
                
set_pev(entpev_movetypeMOVETYPE_FLY)
                
hook_ent2(entVelocityrandom_float(2000.04000.0))
                    
                
g_fireball2_count 0
            
}
        }
        
        if(
g_fireball2_count 0)
        
g_fireball2_count--
    }    
    
    
// 2nd Time
    
if(g_fireball12_count && pev(entpev_iuser4) == 3)
    {    
        static 
Float:Origin[3]
            
        switch(
g_fireball12_count)
        {
            case 
35..40: {
                
fireball_origin12[2] += 0.5
                get_position
(entfireball_origin12[0], fireball_origin12[1], fireball_origin12[2], Origin)
                
set_pev(entpev_originOrigin)
                
                static 
owner
                owner 
pev(entpev_owner)
                
                if(
pev_valid(owner))
                    
turn_to_victim(owner)    
            }    
            case 
20..34: {
                
fireball_origin12[0] += 0.1
                fireball_origin12
[1] += 0.25                
                get_position
(entfireball_origin12[0], fireball_origin12[1], fireball_origin12[2], Origin)
                
set_pev(entpev_originOrigin)
                
                static 
owner
                owner 
pev(entpev_owner)
                
                if(
pev_valid(owner))
                    
turn_to_victim(owner)    
            }    
            case 
5..19: {
                
fireball_origin12[2] -= 0.5
                fireball_origin12
[1] -= 0.5
                fireball_origin12
[0] -= 0.1
                get_position
(entfireball_origin12[0], fireball_origin12[1], fireball_origin12[2], Origin)
                
set_pev(entpev_originOrigin)
                
                static 
owner
                owner 
pev(entpev_owner)
                
                if(
pev_valid(owner))
                    
turn_to_victim(owner)    
            }
            case 
4: {
                static 
ownerFloat:Velocity[3]
                
owner pev(entpev_owner)
    
                
get_position(owner1000.00.0, -100.0Velocity)
                
fm_get_aim_origin(ownerVelocity)
                
//Velocity[2] -= 20.0
                
                
entity_set_int(entEV_INT_solid2)
                
set_pev(entpev_movetypeMOVETYPE_FLY)
                
hook_ent2(entVelocity2000.0)
                    
                
g_fireball1_count 0
            
}
        }
        
        if(
g_fireball12_count 0)
        
g_fireball12_count--
    }
    
    if(
g_fireball22_count && pev(entpev_iuser4) == 4)
    {    
        static 
Float:Origin[3]
            
        switch(
g_fireball22_count)
        {
            case 
35..40: {
                
fireball_origin22[2] += 0.5
                get_position
(entfireball_origin22[0], fireball_origin22[1], fireball_origin22[2], Origin)
                
set_pev(entpev_originOrigin)
                
                static 
owner
                owner 
pev(entpev_owner)
                
                if(
pev_valid(owner))
                    
turn_to_victim(owner)    
            }    
            case 
20..34: {
                
fireball_origin2[0] -= 0.1
                fireball_origin2
[1] += 0.25    
                get_position
(entfireball_origin22[0], fireball_origin22[1], fireball_origin22[2], Origin)
                
set_pev(entpev_originOrigin)
                
                static 
owner
                owner 
pev(entpev_owner)
                
                if(
pev_valid(owner))
                    
turn_to_victim(owner)    
            }    
            case 
5..19: {
                
fireball_origin22[2] -= 0.5
                fireball_origin22
[1] -= 0.5
                fireball_origin22
[0] += 0.1
                get_position
(entfireball_origin22[0], fireball_origin22[1], fireball_origin22[2], Origin)
                
set_pev(entpev_originOrigin)
                
                static 
owner
                owner 
pev(entpev_owner)
                
                if(
pev_valid(owner))
                    
turn_to_victim(owner)                    
            }
            case 
4: {
                static 
ownerFloat:Velocity[3]
                
owner pev(entpev_owner)
    
                
get_position(owner1000.00.0, -100.0Velocity)
                
fm_get_aim_origin(ownerVelocity)
                
//Velocity[2] -= 20.0
                
                
entity_set_int(entEV_INT_solid2)
                
set_pev(entpev_movetypeMOVETYPE_FLY)
                
hook_ent2(entVelocity2000.0)
                    
                
g_fireball22_count 0
            
}
        }
        
        if(
g_fireball22_count 0)
        
g_fireball22_count--
    }        
    
    
set_pev(entpev_nextthinkget_gametime() + 0.01)
}

public 
turn_to_victim(ent)
{
    static 
victim
    victim 
pev(entpev_iuser4)
    
    if(!
is_user_alive(victim))
        return
    
    new 
Float:Ent_Origin[3], Float:Vic_Origin[3]
    
pev(entpev_originEnt_Origin)
    
pev(victimpev_originVic_Origin)
    
    
npc_turntotarget(entEnt_OriginvictimVic_Origin)        
}

public 
fw_fireball_touch(entid)
{
    if(!
pev_valid(ent))
        return
    
    static 
Float:Origin[3]
    
pev(entpev_originOrigin)
    
    
message_begin(MSG_BROADCAST ,SVC_TEMPENTITY)
    
write_byte(TE_EXPLOSION)
    
engfunc(EngFunc_WriteCoordOrigin[0])
    
engfunc(EngFunc_WriteCoordOrigin[1])
    
engfunc(EngFunc_WriteCoordOrigin[2])
    
write_short(g_spr_id)    // sprite index
    
write_byte(10)    // scale in 0.1's
    
write_byte(30)    // framerate
    
write_byte(4)    // flags
    
message_end()    
    
    
emit_sound(entCHAN_BODYrevenant_sound[1], 1.0ATTN_NORM0PITCH_NORM)
    
    for(new 
0get_maxplayers(); i++)
    {
        if(
is_user_alive(i) && entity_range(enti) <= FIREBALL_RADIUS)
        {
            
shake_screen(i)
            
ExecuteHam(Ham_TakeDamagei0iFIREBALL_DAMAGEDMG_BURN)
        }
    }
    
    
remove_entity(ent)
}
// ================== End of Make FireBall ===================

public create_revenant()
{
    new 
ent create_entity("info_target")
    
g_ent ent
    
    
static Float:Origin[3]
    
Origin[0] = g_official_origin[0]
    
Origin[1] = g_official_origin[1]
    
Origin[2] = g_official_origin[2]
    
    
entity_set_origin(entOrigin)
    
    
//entity_set_vector(ent, EV_VEC_angles, MyAngles)
    
    //MyAngles[0] -= MyAngles[0] * 2
    
    //entity_set_vector(ent, EV_VEC_v_angle, MyAngles)
    
    
entity_set_float(entEV_FL_takedamage1.0)
    
entity_set_float(entEV_FL_healthREVENANT_HEALTH 1000.0)
    
    
entity_set_string(entEV_SZ_classname"npc_revenant")
    
entity_set_model(entrevenant_model)
    
entity_set_int(entEV_INT_solidSOLID_BBOX)
    
entity_set_int(entEV_INT_movetypeMOVETYPE_PUSHSTEP)
    
    new 
Float:maxs[3] = {25.050.0200.0}
    new 
Float:mins[3] = {-25.0, -50.0, -35.0}
    
entity_set_size(entminsmaxs)
    
entity_set_int(entEV_INT_modelindexrevenant_model_id)
    
    
set_entity_anim(ent1)
    
set_task(14.0"set_start_revenant"ent+TASK_STARTING)
    
    if(!
g_reg)
    {
        
g_reg 1
        RegisterHamFromEntity
(Ham_TakeDamageent"fw_revenant_takedamage"1)
    }
    
    
g_mahadashing 0
    g_time_doing 
0
    
    emit_sound
(entCHAN_BODYrevenant_sound[7], 1.0ATTN_NORM0PITCH_NORM)
    
    
// Make Healthbar
    
healthbar create_entity("env_sprite")
    
    
set_pev(healthbarpev_scale1.0)
    
set_pev(healthbarpev_ownerent)
    
engfunc(EngFunc_SetModelhealthbarhealthbar_spr)    
    
    
set_task(0.1"recheck_boss"ent+TASK_RECHECK__"b")
    
set_task(random_float(7.015.0), "do_skill_now"TASK_SKILL)
    
    
drop_to_floor(ent)
}

public 
do_skill_now()
{
    static 
ent
    ent 
g_ent
    
    
if(!pev_valid(ent))
        return
    static 
victim
    victim 
pev(entpev_iuser4)
    
    
set_task(random_float(5.015.0), "do_skill_now"TASK_SKILL)
    
    if(!
is_user_alive(victim))
        return
        
    static 
random_skill

    
if(g_evolution)
    {
        
random_skill random_num(03)        
        
        switch(
random_skill)
        {
            case 
0do_fireball(ent)
            case 
1do_circle_fire(ent)
            case 
2do_mahadash(ent)
            case 
3do_firestorm(ent)
        }
    } else {
        
random_skill random_num(03)    
        
        switch(
random_skill)
        {
            case 
0do_fireball(ent)
            case 
1do_circle_fire(ent)
            case 
2do_mahadash(ent)
        }    
    }
}

public 
recheck_boss(ent)
{
    
ent -= TASK_RECHECK
    
    
if(!pev_valid(ent))
    {
        
remove_task(ent+TASK_RECHECK)
        return
    }
    
    static 
Float:Origin[3], Float:revenant_health
    pev
(entpev_originOrigin)
                            
    
Origin[2] += 250.0    
    engfunc
(EngFunc_SetOriginhealthbarOrigin)
    
    
pev(entpev_healthrevenant_health)
    
    if(
REVENANT_HEALTH < (revenant_health 1000.0))
    {
        
set_pev(healthbarpev_frame99.0)
    }
    else
    {
        
set_pev(healthbarpev_frame0.0 + ((((revenant_health 1000.0) - ) * 100) / REVENANT_HEALTH))
    }        
}

public 
set_start_revenant(ent)
{
    
ent -= TASK_STARTING
    
    set_entity_anim
(ent2)
    
entity_set_float(entEV_FL_nextthinkget_gametime() + 0.1)
}

public 
fw_revenant_think(ent)
{
    if(!
pev_valid(ent))
        return
    if(
pev(entpev_iuser3))
        return
    if(
pev(entpev_health) - 1000.0 0.0)
    {
        
revenant_death(ent)
        
set_pev(entpev_iuser31)
        
        return
    }
    
    if(!
g_evolution && (pev(entpev_health) - 1000.0) <= (REVENANT_HEALTH 2) && !g_doing_skill)
    {
        
g_evolution 1
        g_doing_skill 
1
        
        do_evolution
(ent)
        
        return
    }
    
    if(!
g_doing_skill)
    {
        static 
victim
        
static Float:Origin[3], Float:VicOrigin[3], Float:distance
        
        victim 
FindClosesEnemy(ent)
        
pev(entpev_originOrigin)
        
pev(victimpev_originVicOrigin)
        
        
distance get_distance_f(OriginVicOrigin)
        
        if(
is_user_alive(victim))
        {
            if(
distance <= 250.0)
            {
                
do_attack1(ent)
                
entity_set_float(entEV_FL_nextthinkget_gametime() + 2.5)
            } else {
                if(
pev(entpev_sequence) != 4)
                    
set_entity_anim(ent4)
                    
                new 
Float:Ent_Origin[3], Float:Vic_Origin[3]
                
                
pev(entpev_originEnt_Origin)
                
pev(victimpev_originVic_Origin)
                
                
npc_turntotarget(entEnt_OriginvictimVic_Origin)
                
hook_ent(entvictim200.0)

                if(
pev(entpev_iuser4) != victim)
                    
set_pev(entpev_iuser4victim)
                
                
entity_set_float(entEV_FL_nextthinkget_gametime() + 0.1)
            }
        } else {
            if(
pev(entpev_sequence) != 2)
                
set_entity_anim(ent2)
                
            
entity_set_float(entEV_FL_nextthinkget_gametime() + 1.0)
        }        
    } else {
        
entity_set_float(entEV_FL_nextthinkget_gametime() + 2.0)
    }
    
    return
}

public 
do_attack1(ent)
{
    
g_doing_skill 1
                
    set_entity_anim
(ent8)    
    
    
set_task(1.0"revenant_attack1"ent+TASK_REVENANT_ATTACK)
    
set_task(2.0"reload_attack1"ent+TASK_REVENANT_ATTACK_RELOAD)    
}

public 
do_evolution(ent)
{
    
set_entity_anim(entrandom_num(1314))

    
set_task(2.9"create_fire"ent+TASK_BURNING+1)
    
set_task(3.0"do_burning"ent+TASK_BURNING)
    
set_task(10.0"reset_evolution"ent+TASK_EVOLUTION)
}

public 
create_fire(ent)
{
    
ent -= TASK_BURNING+1
    
    
for(new 0sizeof(g_fire_ent); i++)
    {
        if(!
pev_valid(g_fire_ent[i]))
        {
            
g_fire_ent[i] = create_entity("info_target")
            
make_fire(g_fire_ent[i], 0.75)
        }
    }
}

public 
do_burning(ent)
{
    
ent -= TASK_BURNING
    
    
static Float:TempOrigin[5][3], Float:RealOrigin[5][3]
    
    
TempOrigin[0][0] = 0.0
    TempOrigin
[0][1] = 0.0
    TempOrigin
[0][2] = 50.0
    
    TempOrigin
[1][0] = 0.0
    TempOrigin
[1][1] = 25.0
    TempOrigin
[1][2] = 50.0
    
    TempOrigin
[2][0] = 0.0
    TempOrigin
[2][1] = -25.0
    TempOrigin
[2][2] = 50.0
    
    TempOrigin
[3][0] = 0.0
    TempOrigin
[3][1] = 25.0
    TempOrigin
[3][2] = 0.0
    
    TempOrigin
[4][0] = 0.0
    TempOrigin
[4][1] = -25.0
    TempOrigin
[4][2] = 0.0    
    
    
for(new 0sizeof(g_fire_ent); i++)
    {
        
get_position(entTempOrigin[i][0], TempOrigin[i][1], TempOrigin[i][2], RealOrigin[i])
        
set_pev(g_fire_ent[i], pev_originRealOrigin[i])
    }
    
    
set_task(0.1"do_burning"ent+TASK_BURNING)
}

public 
reset_evolution(ent)
{
    
ent -= TASK_EVOLUTION
    
    set_entity_anim
(ent2)
    
g_doing_skill 0
    entity_set_float
(entEV_FL_nextthinkget_gametime() + 1.0)
}

public 
reload_attack1(ent)
{
    
ent -= TASK_REVENANT_ATTACK_RELOAD
    
    g_doing_skill 
0
}

public 
revenant_attack1(ent)
{
    
ent -= TASK_REVENANT_ATTACK
    
    emit_sound
(entCHAN_BODYrevenant_sound[2], 1.0ATTN_NORM0PITCH_NORM)
    
    for(new 
0get_maxplayers(); i++)
    {
        if(
is_user_alive(i) && entity_range(enti) <= 300.0)
        {
            
shake_screen(i)
            
ExecuteHam(Ham_TakeDamagei0iATTACK1_DAMAGEDMG_SLASH)
        }
    }
}

public 
revenant_death(ent)
{
    
remove_task(ent+TASK_BURNING)
    
    
set_entity_anim(ent16)
    
emit_sound(entCHAN_BODYrevenant_sound[0], 1.0ATTN_NORM0PITCH_NORM)
    
    for(new 
0sizeof(g_fire_ent); i++)
    {
        if(
pev_valid(g_fire_ent[i]))
            
remove_entity(g_fire_ent[i])
    }    
    
    
remove_task(g_ent+TASK_RECHECK)
    if(
pev_valid(healthbar)) remove_entity(healthbar)    
    
    
set_task(10.0"set_remove_revenant"ent+TASK_REMOVE_REVENANT)    
}

public 
set_remove_revenant(ent)
{
    
ent -= TASK_REMOVE_REVENANT
    
if(pev_valid(ent))
        
remove_entity(ent)
}

public 
fw_revenant_takedamage(victiminflictorattackerFloat:damagedamagebits)
{
    static 
Float:Origin[3]
    
fm_get_aim_origin(attackerOrigin)
    
    
create_blood(Origin)    
}

// ============ DEFAULT NPC FORWARD + PUBLIC ===============
public FindClosesEnemy(entid)
{
    new 
Float:Dist
    
new Float:maxdistance=4000.0
    
new indexid=0    
    
for(new i=1;i<=get_maxplayers();i++){
        if(
is_user_alive(i) && is_valid_ent(i) && can_see_fm(entidi))
        {
            
Dist entity_range(entidi)
            if(
Dist <= maxdistance)
            {
                
maxdistance=Dist
                indexid
=i
                
                
return indexid
            
}
        }    
    }    
    return 
0
}

public 
npc_turntotarget(entFloat:Ent_Origin[3], targetFloat:Vic_Origin[3]) 
{
    if(
target
    {
        new 
Float:newAngle[3]
        
entity_get_vector(entEV_VEC_anglesnewAngle)
        new 
Float:Vic_Origin[0] - Ent_Origin[0]
        new 
Float:Vic_Origin[1] - Ent_Origin[1]

        new 
Float:radians floatatan(z/xradian)
        
newAngle[1] = radians * (180 3.14)
        if (
Vic_Origin[0] < Ent_Origin[0])
            
newAngle[1] -= 180.0
        
        entity_set_vector
(entEV_VEC_v_anglenewAngle)
        
entity_set_vector(entEV_VEC_anglesnewAngle)
    }
}

public 
bool:can_see_fm(entindex1entindex2)
{
    if (!
entindex1 || !entindex2)
        return 
false

    
if (pev_valid(entindex1) && pev_valid(entindex1))
    {
        new 
flags pev(entindex1pev_flags)
        if (
flags EF_NODRAW || flags FL_NOTARGET)
        {
            return 
false
        
}

        new 
Float:lookerOrig[3]
        new 
Float:targetBaseOrig[3]
        new 
Float:targetOrig[3]
        new 
Float:temp[3]

        
pev(entindex1pev_originlookerOrig)
        
pev(entindex1pev_view_ofstemp)
        
lookerOrig[0] += temp[0]
        
lookerOrig[1] += temp[1]
        
lookerOrig[2] += temp[2]

        
pev(entindex2pev_origintargetBaseOrig)
        
pev(entindex2pev_view_ofstemp)
        
targetOrig[0] = targetBaseOrig [0] + temp[0]
        
targetOrig[1] = targetBaseOrig [1] + temp[1]
        
targetOrig[2] = targetBaseOrig [2] + temp[2]

        
engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the had of seen player
        
if (get_tr2(0TraceResult:TR_InOpen) && get_tr2(0TraceResult:TR_InWater))
        {
            return 
false
        

        else 
        {
            new 
Float:flFraction
            get_tr2
(0TraceResult:TR_flFractionflFraction)
            if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2))
            {
                return 
true
            
}
            else
            {
                
targetOrig[0] = targetBaseOrig [0]
                
targetOrig[1] = targetBaseOrig [1]
                
targetOrig[2] = targetBaseOrig [2]
                
engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the body of seen player
                
get_tr2(0TraceResult:TR_flFractionflFraction)
                if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2))
                {
                    return 
true
                
}
                else
                {
                    
targetOrig[0] = targetBaseOrig [0]
                    
targetOrig[1] = targetBaseOrig [1]
                    
targetOrig[2] = targetBaseOrig [2] - 17.0
                    engfunc
(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the legs of seen player
                    
get_tr2(0TraceResult:TR_flFractionflFraction)
                    if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2))
                    {
                        return 
true
                    
}
                }
            }
        }
    }
    return 
false
}

public 
hook_ent(entvictimFloat:speed)
{
    static 
Float:fl_Velocity[3]
    static 
Float:VicOrigin[3], Float:EntOrigin[3]

    
pev(entpev_originEntOrigin)
    
pev(victimpev_originVicOrigin)
    
    static 
Float:distance_f
    distance_f 
get_distance_f(EntOriginVicOrigin)

    if (
distance_f 60.0)
    {
        new 
Float:fl_Time distance_f speed

        fl_Velocity
[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
        fl_Velocity
[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
        fl_Velocity
[2] = 0.0 //(VicOrigin[2] - EntOrigin[2]) / fl_Time
    
} else
    {
        
fl_Velocity[0] = 0.0
        fl_Velocity
[1] = 0.0
        fl_Velocity
[2] = 0.0
    
}

    
entity_set_vector(entEV_VEC_velocityfl_Velocity)
}

// ======================== NPC STOCK ======================
stock shake_screen(id)
{
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("ScreenShake"),{0,0,0}, id)
    
write_short(1<<14)
    
write_short(1<<13)
    
write_short(1<<13)
    
message_end()
}

stock hook_ent2(entFloat:VicOrigin[3], Float:speed)
{
    static 
Float:fl_Velocity[3]
    static 
Float:EntOrigin[3]
    
    
pev(entpev_originEntOrigin)
    
    static 
Float:distance_f
    distance_f 
get_distance_f(EntOriginVicOrigin)
    
    if (
distance_f 60.0)
    {
        new 
Float:fl_Time distance_f speed
        
        fl_Velocity
[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
        fl_Velocity
[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
        fl_Velocity
[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
    
} else {
        
fl_Velocity[0] = 0.0
        fl_Velocity
[1] = 0.0
        fl_Velocity
[2] = 0.0
    
}

    
entity_set_vector(entEV_VEC_velocityfl_Velocity)
}

stock set_entity_anim(entanim)
{
    
entity_set_float(entEV_FL_animtimeget_gametime())
    
entity_set_float(entEV_FL_framerate1.0)
    
entity_set_float(entEV_FL_frame0.0)
    
entity_set_int(entEV_INT_sequenceanim)    
}

stock get_position(entFloat:forwFloat:rightFloat:upFloat:vStart[])
{
    new 
Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
    
    
pev(entpev_originvOrigin)
    
pev(entpev_view_ofs,vUp//for player
    
xs_vec_add(vOrigin,vUp,vOrigin)
    
pev(entpev_v_anglevAngle// if normal entity ,use pev_angles
    
    
vAngle[0] = 0.0
    
    angle_vector
(vAngle,ANGLEVECTOR_FORWARD,vForward//or use EngFunc_AngleVectors
    
angle_vector(vAngle,ANGLEVECTOR_RIGHT,vRight)
    
angle_vector(vAngle,ANGLEVECTOR_UP,vUp)
    
    
vStart[0] = vOrigin[0] + vForward[0] * forw vRight[0] * right vUp[0] * up
    vStart
[1] = vOrigin[1] + vForward[1] * forw vRight[1] * right vUp[1] * up
    vStart
[2] = vOrigin[2] + vForward[2] * forw vRight[2] * right vUp[2] * up
}

stock create_blood(const Float:origin[3])
{
    
// Show some blood :)
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY
    
write_byte(TE_BLOODSPRITE)
    
engfunc(EngFunc_WriteCoordorigin[0])
    
engfunc(EngFunc_WriteCoordorigin[1])
    
engfunc(EngFunc_WriteCoordorigin[2])
    
write_short(m_iBlood[1])
    
write_short(m_iBlood[0])
    
write_byte(75)
    
write_byte(5)
    
message_end()

The main problem is,when the boss die it give's me don't send error.If some one could tell me were is the error in the code it would be great.

Last edited by Apokalipsisa; 05-08-2013 at 05:14.
Apokalipsisa is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode