|
Member
|

05-07-2013
, 14:05
Problem with Dias's NPC Revenant
|
#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_count, g_fireball2_count, g_fireball12_count, g_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_ent, revenant_model_id, g_fire_ent[5], g_reg new g_spr_id, g_doing_skill, g_evolution new m_iBlood[2] new healthbar, Float: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(PLUGIN, VERSION, AUTHOR) 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 i = 0; i < sizeof(revenant_sound); i++) precache_sound(revenant_sound[i]) for(new i = 0; i < sizeof(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(mapname, sizeof(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(id, 16000) } }
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 i = 0; i < sizeof(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(0, 255, 0, -1.0, 0.30, 1, 5.0, 5.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(player, player_num, "a") if(player_num <= 0) { set_hudmessage(0, 255, 0, -1.0, 0.30, 1, 5.0, 5.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_ent, pev_iuser3) == 1) { set_hudmessage(0, 255, 0, -1.0, 0.30, 1, 5.0, 5.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(ent, 12) static Float:Origin[3] get_position(ent, 150.0, 0.0, 50.0, Origin) emit_sound(ent, CHAN_BODY, revenant_sound[4], 1.0, ATTN_NORM, 0, PITCH_NORM) make_mini_fireball(ent, Origin) 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(boss, Float:Origin[3]) { new ent = create_entity("info_target")
static Float:Angles[3] pev(boss, pev_angles, Angles) entity_set_origin(ent, Origin) Angles[0] = 100.0 entity_set_vector(ent, EV_VEC_angles, Angles) Angles[0] = -100.0 entity_set_vector(ent, EV_VEC_v_angle, Angles) entity_set_string(ent, EV_SZ_classname, "revenant_fireball") entity_set_model(ent, fireball_model) entity_set_int(ent, EV_INT_solid, 2) entity_set_int(ent, EV_INT_movetype, MOVETYPE_FLY) new Float:maxs[3] = {15.0, 15.0, 15.0} new Float:mins[3] = {-15.0, -15.0, -15.0} entity_set_size(ent, mins, maxs) set_pev(ent, pev_owner, boss) 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(ent, 0.5) }
public set_mini_fireball(ent) { ent -= TASK_SET_MINI_FIREBALL if(!pev_valid(ent)) return static Float:Origin[3] get_position(ent, 2.0, 0.0, 2.0, Origin) set_pev(ent, pev_origin, Origin) 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 i = 0; i < sizeof(Explosion_Origin); i++) { get_position(ent, Explosion_Origin[i][0], Explosion_Origin[i][1], Explosion_Origin[i][2], Real_Origin[i]) make_fireball2(ent, Real_Origin[i]) }
remove_task(ent+TASK_MAKE_AURA) set_task(1.0, "do_storm", ent+TASK_MAKE_STORM) }
public make_fireball2(boss, Float:Origin[3]) { new ent = create_entity("info_target")
static Float:Angles[3] pev(boss, pev_angles, Angles) entity_set_origin(ent, Origin) Angles[0] = -100.0 entity_set_vector(ent, EV_VEC_angles, Angles) Angles[0] = 100.0 entity_set_vector(ent, EV_VEC_v_angle, Angles) entity_set_string(ent, EV_SZ_classname, "revenant_fireball") entity_set_model(ent, fireball_model) entity_set_int(ent, EV_INT_solid, 2) entity_set_int(ent, EV_INT_movetype, MOVETYPE_FLY) new Float:maxs[3] = {15.0, 15.0, 15.0} new Float:mins[3] = {-15.0, -15.0, -15.0} entity_set_size(ent, mins, maxs) set_pev(ent, pev_owner, boss) static Float:Velocity[3] VelocityByAim(ent, random_num(250, 1000), Velocity) set_pev(ent, pev_light_level, 180) set_pev(ent, pev_rendermode, kRenderTransAdd) set_pev(ent, pev_renderamt, 255.0) entity_set_vector(ent, EV_VEC_velocity, Velocity)
make_fire(ent, 0.5) }
public fw_fireball2_touch(ent, id) { if(!pev_valid(ent)) return static Float:Origin[3] pev(ent, pev_origin, Origin) message_begin(MSG_BROADCAST ,SVC_TEMPENTITY) write_byte(TE_EXPLOSION) engfunc(EngFunc_WriteCoord, Origin[0]) engfunc(EngFunc_WriteCoord, Origin[1]) engfunc(EngFunc_WriteCoord, Origin[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(ent, CHAN_BODY, revenant_sound[1], 1.0, ATTN_NORM, 0, PITCH_NORM) for(new i = 0; i < get_maxplayers(); i++) { if(is_user_alive(i) && entity_range(ent, i) <= FIREBALL_RADIUS) { shake_screen(i) ExecuteHam(Ham_TakeDamage, i, 0, i, FIREBALL_DAMAGE, DMG_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(ent, 2) g_doing_skill = 0 entity_set_float(ent, EV_FL_nextthink, get_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(ent, pev_origin, Origin) message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(27) engfunc(EngFunc_WriteCoord, Origin[0]) engfunc(EngFunc_WriteCoord, Origin[1]) engfunc(EngFunc_WriteCoord, Origin[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(ent, 11) emit_sound(ent, CHAN_BODY, revenant_sound[3], 1.0, ATTN_NORM, 0, PITCH_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(ent, 2) entity_set_float(ent, EV_FL_nextthink, get_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 i = 0; i < sizeof(Explosion_Origin); i++) { get_position(ent, Explosion_Origin[i][0], Explosion_Origin[i][1], Explosion_Origin[i][2], Real_Origin[i]) make_explosion(ent, Real_Origin[i]) }
g_time_doing-- }
public make_explosion(ent, Float:Origin[3]) { message_begin(MSG_BROADCAST ,SVC_TEMPENTITY) write_byte(TE_EXPLOSION) engfunc(EngFunc_WriteCoord, Origin[0]) engfunc(EngFunc_WriteCoord, Origin[1]) engfunc(EngFunc_WriteCoord, Origin[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(ent, CHAN_BODY, revenant_sound[1], 1.0, ATTN_NORM, 0, PITCH_NORM) for(new i = 0; i < get_maxplayers(); i++) { if(is_user_alive(i)) { static Float:Origin2[3], Float:distance pev(i, pev_origin, Origin2) distance = get_distance_f(Origin, Origin2) if(distance <= EXPLOSION_RADIUS) { shake_screen(i) ExecuteHam(Ham_TakeDamage, i, 0, i, EXPLOSION_DAMAGE, DMG_BURN) static Float:Velocity[3] Velocity[0] = random_float(250.0, 750.0) Velocity[1] = random_float(250.0, 750.0) Velocity[2] = random_float(250.0, 750.0) set_pev(i, pev_velocity, Velocity) } } } } // ================== 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(ent, 5) 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(ent, 6) static Float:Origin[3] get_position(ent, 1000.0, 0.0, 0.0, Origin) hook_ent2(ent, Origin, 2000.0) }
public fw_revenant_touch(ent, id) { 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_TakeDamage, id, 0, id, MAHADASH_DAMAGE, DMG_SLASH) shake_screen(id) static Float:Velocity[3] Velocity[0] = random_float(1000.0, 2000.0) Velocity[1] = random_float(1000.0, 2000.0) Velocity[2] = random_float(1000.0, 2000.0) set_pev(id, pev_velocity, Velocity) } }
public stop_mahadash(ent) { ent -= TASK_STOP_MAHADASH g_mahadashing = 0 g_doing_skill = 1 set_entity_anim(ent, 7) set_task(0.5, "reset_mahadash", ent) }
public reset_mahadash(ent) { g_doing_skill = 0 set_entity_anim(ent, 2) entity_set_float(ent, EV_FL_nextthink, get_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(0, 1) switch(random_mode) { case 0: { set_entity_anim(ent, 9) set_task(1.0, "throw_fireball", g_ent+TASK_FIREBALL1) emit_sound(ent, CHAN_BODY, revenant_sound[5], 1.0, ATTN_NORM, 0, PITCH_NORM) } case 1: { set_entity_anim(ent, 10) set_task(1.0, "throw_fireball2", g_ent+TASK_FIREBALL1) emit_sound(ent, CHAN_BODY, revenant_sound[6], 1.0, ATTN_NORM, 0, PITCH_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_left, fireball_right // Fireball Left fireball_origin2[0] = 0.0 fireball_origin2[1] = 0.0 fireball_origin2[2] = 0.0 get_position(ent, 50.0, -25.0, 100.0, Origin) fireball_left = make_fireball(ent, Origin) g_fireball2_count = 50 set_pev(fireball_left, pev_iuser4, 2) set_pev(fireball_left, pev_nextthink, get_gametime() + 0.3) // Fireball Right fireball_origin1[0] = 0.0 fireball_origin1[1] = 0.0 fireball_origin1[2] = 0.0 get_position(ent, 50.0, 50.0, 100.0, Origin) fireball_right = make_fireball(ent, Origin) g_fireball1_count = 50 set_pev(fireball_right, pev_iuser4, 1) set_pev(fireball_right, pev_nextthink, get_gametime() + 0.4) set_task(1.5, "restart_skill", ent+TASK_FIREBALL2) }
public throw_fireball2(ent) { ent -= TASK_FIREBALL1 static Float:Origin[3], fireball_left, fireball_right // Fireball Left fireball_origin2[0] = 0.0 fireball_origin2[1] = 0.0 fireball_origin2[2] = 0.0 get_position(ent, 50.0, -25.0, 100.0, Origin) fireball_left = make_fireball(ent, Origin) g_fireball2_count = 50 set_pev(fireball_left, pev_iuser4, 2) set_pev(fireball_left, pev_nextthink, get_gametime() + 0.1) // Fireball Right fireball_origin1[0] = 0.0 fireball_origin1[1] = 0.0 fireball_origin1[2] = 0.0 get_position(ent, 50.0, 50.0, 100.0, Origin) fireball_right = make_fireball(ent, Origin) g_fireball1_count = 50 set_pev(fireball_right, pev_iuser4, 1) set_pev(fireball_right, pev_nextthink, get_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_left, fireball_right // Fireball Left fireball_origin22[0] = 0.0 fireball_origin22[1] = 0.0 fireball_origin22[2] = 0.0 get_position(ent, 50.0, -25.0, 100.0, Origin) fireball_left = make_fireball(ent, Origin) g_fireball22_count = 50 set_pev(fireball_left, pev_iuser4, 4) set_pev(fireball_left, pev_nextthink, get_gametime() + 0.1) // Fireball Right fireball_origin12[0] = 0.0 fireball_origin12[1] = 0.0 fireball_origin12[2] = 0.0 get_position(ent, 50.0, 50.0, 100.0, Origin) fireball_right = make_fireball(ent, Origin) g_fireball12_count = 50 set_pev(fireball_right, pev_iuser4, 3) set_pev(fireball_right, pev_nextthink, get_gametime() + 0.2) }
public restart_skill(ent) { ent -= TASK_FIREBALL2 g_doing_skill = 0 set_pev(ent, pev_nextthink, get_gametime() + 1.0) }
public make_fireball(boss, Float:Origin[3]) { new ent = create_entity("info_target")
entity_set_origin(ent, Origin) entity_set_string(ent, EV_SZ_classname, "revenant_fireball") entity_set_model(ent, fireball_model) entity_set_int(ent, EV_INT_solid, 0) entity_set_int(ent, EV_INT_movetype, 0) new Float:maxs[3] = {15.0, 15.0, 15.0} new Float:mins[3] = {-15.0, -15.0, -15.0} entity_set_size(ent, mins, maxs) set_pev(ent, pev_owner, boss)
set_pev(ent, pev_light_level, 180) set_pev(ent, pev_rendermode, kRenderTransAdd) set_pev(ent, pev_renderamt, 255.0) make_fire(ent, 0.5) return ent }
public make_fire(fireball, Float:size) { static ent ent = create_entity("env_sprite") set_pev(ent, pev_takedamage, 0.0) set_pev(ent, pev_solid, SOLID_NOT) set_pev(ent, pev_movetype, MOVETYPE_NONE) set_pev(ent, pev_classname, "fireball_flame") engfunc(EngFunc_SetModel, ent, fireball_flame) set_pev(ent, pev_rendermode, kRenderTransAdd) set_pev(ent, pev_renderamt, 255.0) set_pev(ent, pev_light_level, 180) set_pev(ent, pev_scale, size) set_pev(ent, pev_owner, fireball) set_pev(ent, pev_animtime, get_gametime()) set_pev(ent, pev_framerate, 8.0) set_pev(ent, pev_frame, 0.1) set_pev(ent, pev_spawnflags, SF_SPRITE_STARTON)
dllfunc(DLLFunc_Spawn, ent)
fw_flame_think(ent) entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.01) return ent }
public fw_flame_think(ent) { if(!pev_valid(ent)) return if(!pev_valid(pev(ent, pev_owner))) { remove_entity(ent) return } static owner owner = pev(ent, pev_owner) static Float:Origin[3] pev(owner, pev_origin, Origin) Origin[2] += 25.0 entity_set_origin(ent, Origin)
entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.01) }
public fw_fireball_think(ent) // Fireball Right { if(!pev_valid(ent)) return // 1st Time if(g_fireball1_count > 0 && pev(ent, pev_iuser4) == 1) { static Float:Origin[3] switch(g_fireball1_count) { case 35..40: { fireball_origin1[2] += 0.5 get_position(ent, fireball_origin1[0], fireball_origin1[1], fireball_origin1[2], Origin) set_pev(ent, pev_origin, Origin) static owner owner = pev(ent, pev_owner) if(pev_valid(owner)) turn_to_victim(owner) } case 20..34: { fireball_origin1[0] += 0.1 fireball_origin1[1] += 0.25 get_position(ent, fireball_origin1[0], fireball_origin1[1], fireball_origin1[2], Origin) set_pev(ent, pev_origin, Origin) static owner owner = pev(ent, pev_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(ent, fireball_origin1[0], fireball_origin1[1], fireball_origin1[2], Origin) set_pev(ent, pev_origin, Origin) static owner owner = pev(ent, pev_owner) if(pev_valid(owner)) turn_to_victim(owner) } case 4: { static owner, Float:Velocity[3] owner = pev(ent, pev_owner) get_position(owner, 1000.0, 0.0, -100.0, Velocity) fm_get_aim_origin(owner, Velocity) //Velocity[2] -= 20.0 entity_set_int(ent, EV_INT_solid, 2) set_pev(ent, pev_movetype, MOVETYPE_FLY) hook_ent2(ent, Velocity, random_float(2000.0, 4000.0)) g_fireball1_count = 0 } } if(g_fireball1_count > 0) g_fireball1_count-- } if(g_fireball2_count > 0 && pev(ent, pev_iuser4) == 2) { static Float:Origin[3] switch(g_fireball2_count) { case 35..40: { fireball_origin2[2] += 0.5 get_position(ent, fireball_origin2[0], fireball_origin2[1], fireball_origin2[2], Origin) set_pev(ent, pev_origin, Origin) static owner owner = pev(ent, pev_owner) if(pev_valid(owner)) turn_to_victim(owner) } case 20..34: { fireball_origin2[0] -= 0.1 fireball_origin2[1] += 0.25 get_position(ent, fireball_origin2[0], fireball_origin2[1], fireball_origin2[2], Origin) set_pev(ent, pev_origin, Origin) static owner owner = pev(ent, pev_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(ent, fireball_origin2[0], fireball_origin2[1], fireball_origin2[2], Origin) set_pev(ent, pev_origin, Origin) static owner owner = pev(ent, pev_owner) if(pev_valid(owner)) turn_to_victim(owner) } case 4: { static owner, Float:Velocity[3] owner = pev(ent, pev_owner) get_position(owner, 1000.0, 0.0, -100.0, Velocity) fm_get_aim_origin(owner, Velocity) //Velocity[2] -= 20.0 entity_set_int(ent, EV_INT_solid, 2) set_pev(ent, pev_movetype, MOVETYPE_FLY) hook_ent2(ent, Velocity, random_float(2000.0, 4000.0)) g_fireball2_count = 0 } } if(g_fireball2_count > 0) g_fireball2_count-- } // 2nd Time if(g_fireball12_count > 0 && pev(ent, pev_iuser4) == 3) { static Float:Origin[3] switch(g_fireball12_count) { case 35..40: { fireball_origin12[2] += 0.5 get_position(ent, fireball_origin12[0], fireball_origin12[1], fireball_origin12[2], Origin) set_pev(ent, pev_origin, Origin) static owner owner = pev(ent, pev_owner) if(pev_valid(owner)) turn_to_victim(owner) } case 20..34: { fireball_origin12[0] += 0.1 fireball_origin12[1] += 0.25 get_position(ent, fireball_origin12[0], fireball_origin12[1], fireball_origin12[2], Origin) set_pev(ent, pev_origin, Origin) static owner owner = pev(ent, pev_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(ent, fireball_origin12[0], fireball_origin12[1], fireball_origin12[2], Origin) set_pev(ent, pev_origin, Origin) static owner owner = pev(ent, pev_owner) if(pev_valid(owner)) turn_to_victim(owner) } case 4: { static owner, Float:Velocity[3] owner = pev(ent, pev_owner) get_position(owner, 1000.0, 0.0, -100.0, Velocity) fm_get_aim_origin(owner, Velocity) //Velocity[2] -= 20.0 entity_set_int(ent, EV_INT_solid, 2) set_pev(ent, pev_movetype, MOVETYPE_FLY) hook_ent2(ent, Velocity, 2000.0) g_fireball1_count = 0 } } if(g_fireball12_count > 0) g_fireball12_count-- } if(g_fireball22_count > 0 && pev(ent, pev_iuser4) == 4) { static Float:Origin[3] switch(g_fireball22_count) { case 35..40: { fireball_origin22[2] += 0.5 get_position(ent, fireball_origin22[0], fireball_origin22[1], fireball_origin22[2], Origin) set_pev(ent, pev_origin, Origin) static owner owner = pev(ent, pev_owner) if(pev_valid(owner)) turn_to_victim(owner) } case 20..34: { fireball_origin2[0] -= 0.1 fireball_origin2[1] += 0.25 get_position(ent, fireball_origin22[0], fireball_origin22[1], fireball_origin22[2], Origin) set_pev(ent, pev_origin, Origin) static owner owner = pev(ent, pev_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(ent, fireball_origin22[0], fireball_origin22[1], fireball_origin22[2], Origin) set_pev(ent, pev_origin, Origin) static owner owner = pev(ent, pev_owner) if(pev_valid(owner)) turn_to_victim(owner) } case 4: { static owner, Float:Velocity[3] owner = pev(ent, pev_owner) get_position(owner, 1000.0, 0.0, -100.0, Velocity) fm_get_aim_origin(owner, Velocity) //Velocity[2] -= 20.0 entity_set_int(ent, EV_INT_solid, 2) set_pev(ent, pev_movetype, MOVETYPE_FLY) hook_ent2(ent, Velocity, 2000.0) g_fireball22_count = 0 } } if(g_fireball22_count > 0) g_fireball22_count-- } set_pev(ent, pev_nextthink, get_gametime() + 0.01) }
public turn_to_victim(ent) { static victim victim = pev(ent, pev_iuser4) if(!is_user_alive(victim)) return new Float:Ent_Origin[3], Float:Vic_Origin[3] pev(ent, pev_origin, Ent_Origin) pev(victim, pev_origin, Vic_Origin) npc_turntotarget(ent, Ent_Origin, victim, Vic_Origin) }
public fw_fireball_touch(ent, id) { if(!pev_valid(ent)) return static Float:Origin[3] pev(ent, pev_origin, Origin) message_begin(MSG_BROADCAST ,SVC_TEMPENTITY) write_byte(TE_EXPLOSION) engfunc(EngFunc_WriteCoord, Origin[0]) engfunc(EngFunc_WriteCoord, Origin[1]) engfunc(EngFunc_WriteCoord, Origin[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(ent, CHAN_BODY, revenant_sound[1], 1.0, ATTN_NORM, 0, PITCH_NORM) for(new i = 0; i < get_maxplayers(); i++) { if(is_user_alive(i) && entity_range(ent, i) <= FIREBALL_RADIUS) { shake_screen(i) ExecuteHam(Ham_TakeDamage, i, 0, i, FIREBALL_DAMAGE, DMG_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(ent, Origin) //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(ent, EV_FL_takedamage, 1.0) entity_set_float(ent, EV_FL_health, REVENANT_HEALTH + 1000.0) entity_set_string(ent, EV_SZ_classname, "npc_revenant") entity_set_model(ent, revenant_model) entity_set_int(ent, EV_INT_solid, SOLID_BBOX) entity_set_int(ent, EV_INT_movetype, MOVETYPE_PUSHSTEP) new Float:maxs[3] = {25.0, 50.0, 200.0} new Float:mins[3] = {-25.0, -50.0, -35.0} entity_set_size(ent, mins, maxs) entity_set_int(ent, EV_INT_modelindex, revenant_model_id) set_entity_anim(ent, 1) set_task(14.0, "set_start_revenant", ent+TASK_STARTING) if(!g_reg) { g_reg = 1 RegisterHamFromEntity(Ham_TakeDamage, ent, "fw_revenant_takedamage", 1) } g_mahadashing = 0 g_time_doing = 0 emit_sound(ent, CHAN_BODY, revenant_sound[7], 1.0, ATTN_NORM, 0, PITCH_NORM) // Make Healthbar healthbar = create_entity("env_sprite") set_pev(healthbar, pev_scale, 1.0) set_pev(healthbar, pev_owner, ent) engfunc(EngFunc_SetModel, healthbar, healthbar_spr) set_task(0.1, "recheck_boss", ent+TASK_RECHECK, _, _, "b") set_task(random_float(7.0, 15.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(ent, pev_iuser4) set_task(random_float(5.0, 15.0), "do_skill_now", TASK_SKILL) if(!is_user_alive(victim)) return static random_skill
if(g_evolution) { random_skill = random_num(0, 3) switch(random_skill) { case 0: do_fireball(ent) case 1: do_circle_fire(ent) case 2: do_mahadash(ent) case 3: do_firestorm(ent) } } else { random_skill = random_num(0, 3) switch(random_skill) { case 0: do_fireball(ent) case 1: do_circle_fire(ent) case 2: do_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(ent, pev_origin, Origin) Origin[2] += 250.0 engfunc(EngFunc_SetOrigin, healthbar, Origin) pev(ent, pev_health, revenant_health) if(REVENANT_HEALTH < (revenant_health - 1000.0)) { set_pev(healthbar, pev_frame, 99.0) } else { set_pev(healthbar, pev_frame, 0.0 + ((((revenant_health - 1000.0) - 1 ) * 100) / REVENANT_HEALTH)) } }
public set_start_revenant(ent) { ent -= TASK_STARTING set_entity_anim(ent, 2) entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.1) }
public fw_revenant_think(ent) { if(!pev_valid(ent)) return if(pev(ent, pev_iuser3)) return if(pev(ent, pev_health) - 1000.0 < 0.0) { revenant_death(ent) set_pev(ent, pev_iuser3, 1) return } if(!g_evolution && (pev(ent, pev_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(ent, pev_origin, Origin) pev(victim, pev_origin, VicOrigin) distance = get_distance_f(Origin, VicOrigin) if(is_user_alive(victim)) { if(distance <= 250.0) { do_attack1(ent) entity_set_float(ent, EV_FL_nextthink, get_gametime() + 2.5) } else { if(pev(ent, pev_sequence) != 4) set_entity_anim(ent, 4) new Float:Ent_Origin[3], Float:Vic_Origin[3] pev(ent, pev_origin, Ent_Origin) pev(victim, pev_origin, Vic_Origin) npc_turntotarget(ent, Ent_Origin, victim, Vic_Origin) hook_ent(ent, victim, 200.0)
if(pev(ent, pev_iuser4) != victim) set_pev(ent, pev_iuser4, victim) entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.1) } } else { if(pev(ent, pev_sequence) != 2) set_entity_anim(ent, 2) entity_set_float(ent, EV_FL_nextthink, get_gametime() + 1.0) } } else { entity_set_float(ent, EV_FL_nextthink, get_gametime() + 2.0) } return }
public do_attack1(ent) { g_doing_skill = 1 set_entity_anim(ent, 8) 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(ent, random_num(13, 14))
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 i = 0; i < sizeof(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 i = 0; i < sizeof(g_fire_ent); i++) { get_position(ent, TempOrigin[i][0], TempOrigin[i][1], TempOrigin[i][2], RealOrigin[i]) set_pev(g_fire_ent[i], pev_origin, RealOrigin[i]) } set_task(0.1, "do_burning", ent+TASK_BURNING) }
public reset_evolution(ent) { ent -= TASK_EVOLUTION set_entity_anim(ent, 2) g_doing_skill = 0 entity_set_float(ent, EV_FL_nextthink, get_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(ent, CHAN_BODY, revenant_sound[2], 1.0, ATTN_NORM, 0, PITCH_NORM) for(new i = 0; i < get_maxplayers(); i++) { if(is_user_alive(i) && entity_range(ent, i) <= 300.0) { shake_screen(i) ExecuteHam(Ham_TakeDamage, i, 0, i, ATTACK1_DAMAGE, DMG_SLASH) } } }
public revenant_death(ent) { remove_task(ent+TASK_BURNING) set_entity_anim(ent, 16) emit_sound(ent, CHAN_BODY, revenant_sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM) for(new i = 0; i < sizeof(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(victim, inflictor, attacker, Float:damage, damagebits) { static Float:Origin[3] fm_get_aim_origin(attacker, Origin) 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(entid, i)) { Dist = entity_range(entid, i) if(Dist <= maxdistance) { maxdistance=Dist indexid=i return indexid } } } return 0 }
public npc_turntotarget(ent, Float:Ent_Origin[3], target, Float:Vic_Origin[3]) { if(target) { new Float:newAngle[3] entity_get_vector(ent, EV_VEC_angles, newAngle) new Float:x = Vic_Origin[0] - Ent_Origin[0] new Float:z = Vic_Origin[1] - Ent_Origin[1]
new Float:radians = floatatan(z/x, radian) newAngle[1] = radians * (180 / 3.14) if (Vic_Origin[0] < Ent_Origin[0]) newAngle[1] -= 180.0 entity_set_vector(ent, EV_VEC_v_angle, newAngle) entity_set_vector(ent, EV_VEC_angles, newAngle) } }
public bool:can_see_fm(entindex1, entindex2) { if (!entindex1 || !entindex2) return false
if (pev_valid(entindex1) && pev_valid(entindex1)) { new flags = pev(entindex1, pev_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(entindex1, pev_origin, lookerOrig) pev(entindex1, pev_view_ofs, temp) lookerOrig[0] += temp[0] lookerOrig[1] += temp[1] lookerOrig[2] += temp[2]
pev(entindex2, pev_origin, targetBaseOrig) pev(entindex2, pev_view_ofs, temp) targetOrig[0] = targetBaseOrig [0] + temp[0] targetOrig[1] = targetBaseOrig [1] + temp[1] targetOrig[2] = targetBaseOrig [2] + temp[2]
engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) // checks the had of seen player if (get_tr2(0, TraceResult:TR_InOpen) && get_tr2(0, TraceResult:TR_InWater)) { return false } else { new Float:flFraction get_tr2(0, TraceResult:TR_flFraction, flFraction) if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2)) { return true } else { targetOrig[0] = targetBaseOrig [0] targetOrig[1] = targetBaseOrig [1] targetOrig[2] = targetBaseOrig [2] engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) // checks the body of seen player get_tr2(0, TraceResult:TR_flFraction, flFraction) if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2)) { return true } else { targetOrig[0] = targetBaseOrig [0] targetOrig[1] = targetBaseOrig [1] targetOrig[2] = targetBaseOrig [2] - 17.0 engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) // checks the legs of seen player get_tr2(0, TraceResult:TR_flFraction, flFraction) if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2)) { return true } } } } } return false }
public hook_ent(ent, victim, Float:speed) { static Float:fl_Velocity[3] static Float:VicOrigin[3], Float:EntOrigin[3]
pev(ent, pev_origin, EntOrigin) pev(victim, pev_origin, VicOrigin) static Float:distance_f distance_f = get_distance_f(EntOrigin, VicOrigin)
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(ent, EV_VEC_velocity, fl_Velocity) }
// ======================== NPC STOCK ====================== stock shake_screen(id) { message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenShake"),{0,0,0}, id) write_short(1<<14) write_short(1<<13) write_short(1<<13) message_end() }
stock hook_ent2(ent, Float:VicOrigin[3], Float:speed) { static Float:fl_Velocity[3] static Float:EntOrigin[3] pev(ent, pev_origin, EntOrigin) static Float:distance_f distance_f = get_distance_f(EntOrigin, VicOrigin) 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(ent, EV_VEC_velocity, fl_Velocity) }
stock set_entity_anim(ent, anim) { entity_set_float(ent, EV_FL_animtime, get_gametime()) entity_set_float(ent, EV_FL_framerate, 1.0) entity_set_float(ent, EV_FL_frame, 0.0) entity_set_int(ent, EV_INT_sequence, anim) }
stock get_position(ent, Float:forw, Float:right, Float:up, Float:vStart[]) { new Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3] pev(ent, pev_origin, vOrigin) pev(ent, pev_view_ofs,vUp) //for player xs_vec_add(vOrigin,vUp,vOrigin) pev(ent, pev_v_angle, vAngle) // 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_BROADCAST, SVC_TEMPENTITY) write_byte(TE_BLOODSPRITE) engfunc(EngFunc_WriteCoord, origin[0]) engfunc(EngFunc_WriteCoord, origin[1]) engfunc(EngFunc_WriteCoord, origin[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.
|
|