PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#define DIONE_CLASSNAME "dione"
new dione_model_id
new const dione_model[] = "models/dione/dione.mdl"
new const skill_posion[2][] = {
"models/dione/ef_poison01.mdl", // Start
"models/dione/ef_poison02.mdl" // End
}
new const skill_swing[] = "models/dione/ef_swing.mdl"
new const skill_tentacle[][] = {
"models/dione/ef_tentacle_sign.mdl",
"models/dione/tentacle.mdl",
"models/dione/ef_tentacle.mdl"
}
new const skill_bite_sound[] = "dione/zbs_attack_bite.wav"
new const skill_posion_sound[] = "dione/zbs_attack_poison1.wav"
new const skill_swing_sound[] = "dione/boss_swing.wav"
new const skill_rolling_sound[] = "dione/zbs_rolling2.wav"
new const escape_sound[] = "dione/exit1.wav"
new Float:g_origin[3], ent_id, Float:g_angles[3], Float:g_v_angles[3]
new Float:g_poison_touch[33], g_rolling, g_can_do_skill, g_doing_skill
new g_reg, m_iBlood[2], g_can_bite
public plugin_init()
{
register_plugin("[Dias's NPC] Dione", "1.0", "Dias")
register_touch("poison", "*", "fw_poison_touch")
register_touch("poison2", "*", "fw_poison2_touch")
register_touch("tentacle2", "*", "fw_tentacle_touch")
register_touch(DIONE_CLASSNAME, "*", "fw_dione_touch")
register_think(DIONE_CLASSNAME, "fw_dione_think")
register_clcmd("say /get_origin", "get_origin_first")
register_clcmd("say /make", "dione_appear")
register_clcmd("say /skill_swing", "dione_do_skill")
register_clcmd("say /skill_poison", "dione_do_skill2")
register_clcmd("say /skill_rolling", "dione_do_skill3")
register_clcmd("say /skill_bite", "dione_do_skill4")
register_clcmd("say /skill_tentacle", "dione_do_skill5")
}
public plugin_precache()
{
dione_model_id = engfunc(EngFunc_PrecacheModel, dione_model)
engfunc(EngFunc_PrecacheModel, skill_swing)
for(new i = 0; i < sizeof(skill_posion); i++)
{
engfunc(EngFunc_PrecacheModel, skill_posion[i])
}
for(new i = 0; i < sizeof(skill_tentacle); i++)
{
engfunc(EngFunc_PrecacheModel, skill_tentacle[i])
}
engfunc(EngFunc_PrecacheSound, skill_bite_sound)
engfunc(EngFunc_PrecacheSound, skill_posion_sound)
engfunc(EngFunc_PrecacheSound, skill_swing_sound)
engfunc(EngFunc_PrecacheSound, skill_rolling_sound)
engfunc(EngFunc_PrecacheSound, escape_sound)
m_iBlood[0] = precache_model("sprites/blood.spr")
m_iBlood[1] = precache_model("sprites/bloodspray.spr")
}
public get_origin_first(id)
{
pev(id, pev_origin, g_origin)
pev(id, pev_angles, g_angles)
pev(id, pev_v_angle, g_v_angles)
}
public dione_appear(id)
{
new ent = create_entity("info_target")
ent_id = ent
entity_set_origin(ent, g_origin)
entity_set_vector(ent, EV_VEC_angles, g_angles)
entity_set_vector(ent, EV_VEC_v_angle, g_v_angles)
entity_set_float(ent, EV_FL_takedamage, 1.0)
entity_set_float(ent, EV_FL_health, 500.0)
entity_set_string(ent,EV_SZ_classname, DIONE_CLASSNAME)
entity_set_model(ent, dione_model)
entity_set_int(ent, EV_INT_solid, SOLID_SLIDEBOX)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_STEP)
new Float:maxs[3] = {50.0,50.0, 50.0}
new Float:mins[3] = {-50.0, -50.0,-30.0}
entity_set_size(ent, mins, maxs)
entity_set_int(ent, EV_INT_modelindex, dione_model_id)
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 4)
entity_set_float(ent, EV_FL_nextthink, halflife_time() + 0.01)
if(!g_reg)
{
RegisterHamFromEntity(Ham_TakeDamage, ent, "fw_takedmg")
RegisterHamFromEntity(Ham_Killed, ent, "fw_killed")
g_reg = 1
}
g_can_bite = 0
g_rolling = 0
g_can_do_skill = 1
drop_to_floor(ent)
}
public dione_do_skill()
{
g_doing_skill = 1
dione_swing()
}
public dione_do_skill2()
{
g_doing_skill = 1
dione_poison()
}
public dione_do_skill3()
{
g_doing_skill = 1
dione_rolling()
}
public dione_do_skill4()
{
g_can_bite = 1
}
public dione_do_skill5()
{
g_doing_skill = 1
dione_tentacle()
}
public fw_dione_think(ent)
{
if(!is_valid_ent(ent))
return FMRES_IGNORED
if(!g_doing_skill && g_can_bite)
{
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 <= 300.0)
{
if(!is_valid_ent(ent))
return FMRES_IGNORED
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)
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 8)
emit_sound(victim, CHAN_BODY, skill_bite_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
static arg[2]
arg[0] = ent
arg[1] = victim
set_task(0.5, "dione_attack", _, arg, sizeof(arg))
set_task(1.0, "dione_attack2", victim)
entity_set_float(ent, EV_FL_nextthink, get_gametime() + 3.0)
} else {
if(pev(ent, pev_sequence) != 5)
{
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 5)
}
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)
entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.5)
}
} else {
if(pev(ent, pev_sequence) != 4)
{
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 4)
}
entity_set_float(ent, EV_FL_nextthink, get_gametime() + 1.0)
}
} else {
entity_set_float(ent, EV_FL_nextthink, get_gametime() + 2.0)
}
return FMRES_HANDLED
}
public dione_attack(arg[])
{
static ent, victim
ent = arg[0]
victim = arg[1]
ExecuteHam(Ham_TakeDamage, victim, 0, victim, random_float(15.0, 30.0), DMG_BLAST)
set_task(1.5, "stop_attack", ent)
}
public dione_attack2(victim)
{
ExecuteHam(Ham_TakeDamage, victim, 0, victim, random_float(15.0, 30.0), DMG_BLAST)
}
public stop_attack(ent)
{
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 4)
}
public fw_takedmg(victim, inflictor, attacker, Float:damage, damagebits)
{
static Float:Origin[3]
pev(victim, pev_origin, Origin)
create_blood(Origin)
}
public fw_killed(ent2, attacker)
{
static ent
ent = create_entity("info_target")
static Float:Origin[3], Float:Angles[3]
pev(ent2, pev_origin, Origin)
pev(ent2, pev_angles, Angles)
entity_set_origin(ent, Origin)
entity_set_vector(ent, EV_VEC_angles, Angles)
entity_set_string(ent, EV_SZ_classname, "temp_zb")
entity_set_model(ent, dione_model)
new Float:maxs[3] = {50.0,50.0, 50.0}
new Float:mins[3] = {-50.0, -50.0,-30.0}
entity_set_size(ent, mins, maxs)
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 16)
set_task(5.0, "set_dione_run", ent)
set_task(10.0, "remove_temp_zb", ent)
emit_sound(ent, CHAN_BODY, escape_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
drop_to_floor(ent)
}
public set_dione_run(ent)
{
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 17)
}
public remove_temp_zb(ent)
{
remove_entity(ent)
}
// ====================== TENTACLE SKILL ==============================
public dione_tentacle()
{
if(!g_can_do_skill)
return PLUGIN_HANDLED
static ent
ent = ent_id
g_doing_skill = 1
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 9)
set_task(2.5, "make_hole_tentacle", ent)
return PLUGIN_CONTINUE
}
public make_hole_tentacle(ent)
{
static Float:Origin[3], Float:beam_origin[30][3], Float:Angles[3]
entity_get_vector(ent, EV_VEC_origin, Origin)
entity_get_vector(ent, EV_VEC_v_angle, Angles)
// 1st
beam_origin[0][0] = Origin[0]
beam_origin[0][1] = Origin[1] + 100.0
beam_origin[0][2] = Origin[2]
// 2nd
beam_origin[1][0] = Origin[0]
beam_origin[1][1] = Origin[1] + 200.0
beam_origin[1][2] = Origin[2]
// 3rd
beam_origin[2][0] = Origin[0]
beam_origin[2][1] = Origin[1] + 300.0
beam_origin[2][2] = Origin[2]
// 4th
beam_origin[3][0] = Origin[0]
beam_origin[3][1] = Origin[1] + 400.0
beam_origin[3][2] = Origin[2]
// 5th
beam_origin[4][0] = Origin[0]
beam_origin[4][1] = Origin[1] + 500.0
beam_origin[4][2] = Origin[2]
// 6th
beam_origin[5][0] = Origin[0] + 100.0
beam_origin[5][1] = Origin[1] + 100.0
beam_origin[5][2] = Origin[2]
// 7th
beam_origin[6][0] = Origin[0] + 200.0
beam_origin[6][1] = Origin[1] + 200.0
beam_origin[6][2] = Origin[2]
// 8th
beam_origin[7][0] = Origin[0] + 300.0
beam_origin[7][1] = Origin[1] + 300.0
beam_origin[7][2] = Origin[2]
// 9th
beam_origin[8][0] = Origin[0] + 400.0
beam_origin[8][1] = Origin[1] + 400.0
beam_origin[8][2] = Origin[2]
// 10th
beam_origin[9][0] = Origin[0] + 500.0
beam_origin[9][1] = Origin[1] + 500.0
beam_origin[9][2] = Origin[2]
// 11th
beam_origin[10][0] = Origin[0] - 100.0
beam_origin[10][1] = Origin[1] + 100.0
beam_origin[10][2] = Origin[2]
// 12th
beam_origin[11][0] = Origin[0] - 200.0
beam_origin[11][1] = Origin[1] + 200.0
beam_origin[11][2] = Origin[2]
// 13th
beam_origin[12][0] = Origin[0] - 300.0
beam_origin[12][1] = Origin[1] + 300.0
beam_origin[12][2] = Origin[2]
// 14th
beam_origin[13][0] = Origin[0] - 400.0
beam_origin[13][1] = Origin[1] + 400.0
beam_origin[13][2] = Origin[2]
// 15th
beam_origin[14][0] = Origin[0] - 500.0
beam_origin[14][1] = Origin[1] + 500.0
beam_origin[14][2] = Origin[2]
// II
// 1st
beam_origin[15][0] = Origin[0]
beam_origin[15][1] = Origin[1] - 100.0
beam_origin[15][2] = Origin[2]
// 2nd
beam_origin[16][0] = Origin[0]
beam_origin[16][1] = Origin[1] - 200.0
beam_origin[16][2] = Origin[2]
// 3rd
beam_origin[17][0] = Origin[0]
beam_origin[17][1] = Origin[1] - 300.0
beam_origin[17][2] = Origin[2]
// 4th
beam_origin[18][0] = Origin[0]
beam_origin[18][1] = Origin[1] - 400.0
beam_origin[18][2] = Origin[2]
// 5th
beam_origin[19][0] = Origin[0]
beam_origin[19][1] = Origin[1] - 500.0
beam_origin[19][2] = Origin[2]
// 6th
beam_origin[20][0] = Origin[0] - 100.0
beam_origin[20][1] = Origin[1] - 100.0
beam_origin[20][2] = Origin[2]
// 7th
beam_origin[21][0] = Origin[0] - 200.0
beam_origin[21][1] = Origin[1] - 200.0
beam_origin[21][2] = Origin[2]
// 8th
beam_origin[22][0] = Origin[0] - 300.0
beam_origin[22][1] = Origin[1] - 300.0
beam_origin[22][2] = Origin[2]
// 9th
beam_origin[23][0] = Origin[0] - 400.0
beam_origin[23][1] = Origin[1] - 400.0
beam_origin[23][2] = Origin[2]
// 10th
beam_origin[24][0] = Origin[0] - 500.0
beam_origin[24][1] = Origin[1] - 500.0
beam_origin[24][2] = Origin[2]
// 11th
beam_origin[25][0] = Origin[0] + 100.0
beam_origin[25][1] = Origin[1] - 100.0
beam_origin[25][2] = Origin[2]
// 12th
beam_origin[26][0] = Origin[0] + 200.0
beam_origin[26][1] = Origin[1] - 200.0
beam_origin[26][2] = Origin[2]
// 13th
beam_origin[27][0] = Origin[0] + 300.0
beam_origin[27][1] = Origin[1] - 300.0
beam_origin[27][2] = Origin[2]
// 14th
beam_origin[28][0] = Origin[0] + 400.0
beam_origin[28][1] = Origin[1] - 400.0
beam_origin[28][2] = Origin[2]
// 15th
beam_origin[29][0] = Origin[0] + 500.0
beam_origin[29][1] = Origin[1] - 500.0
beam_origin[29][2] = Origin[2]
for(new i; i < 30; i++)
{
make_tentacle(beam_origin[i], Angles)
}
set_task(8.0, "set_default_anim", ent)
}
public make_tentacle(Float:Origin[3], Float:Angles[3])
{
new ent = create_entity("info_target")
Origin[2] += 5.0
entity_set_origin(ent, Origin)
entity_set_vector(ent, EV_VEC_v_angle, Angles)
entity_set_string(ent,EV_SZ_classname, "tentacle")
entity_set_model(ent, skill_tentacle[0])
entity_set_int(ent, EV_INT_solid, SOLID_SLIDEBOX)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE)
new Float:maxs[3] = {1.0,1.0,1.0}
new Float:mins[3] = {-1.0,-1.0,-1.0}
entity_set_size(ent, mins, maxs)
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 0)
set_pev(ent, pev_rendermode, kRenderTransAdd)
set_pev(ent, pev_renderamt, 255.0)
set_task(4.0, "tentacle_change", ent)
//drop_to_floor(ent)
}
public tentacle_change(ent)
{
entity_set_model(ent, skill_tentacle[1])
entity_set_string(ent,EV_SZ_classname, "tentacle2")
new Float:maxs[3] = {26.0,26.0,36.0}
new Float:mins[3] = {-26.0,-26.0,-36.0}
entity_set_size(ent, mins, maxs)
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 0)
set_pev(ent, pev_rendermode, kRenderNormal)
set_pev(ent, pev_renderamt, 255.0)
set_task(1.0, "tentacle_change2", ent)
}
public tentacle_change2(ent)
{
entity_set_model(ent, skill_tentacle[2])
entity_set_string(ent,EV_SZ_classname, "tentacle")
new Float:maxs[3] = {1.0,1.0,1.0}
new Float:mins[3] = {-1.0,-1.0,-1.0}
entity_set_size(ent, mins, maxs)
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 0)
set_pev(ent, pev_rendermode, kRenderTransAdd)
set_pev(ent, pev_renderamt, 255.0)
set_task(3.0, "remove_tentacle", ent)
}
public remove_tentacle(ent)
{
remove_entity(ent)
g_doing_skill = 0
}
public set_default_anim(ent)
{
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 4)
}
public fw_tentacle_touch(tentacle, touch)
{
if(is_user_alive(touch))
{
static Float:CurTime
CurTime = get_gametime()
if(CurTime - 0.1 > g_poison_touch[touch])
{
static ent
ent = find_ent_by_owner(-1, "weapon_knife", touch)
ExecuteHamB(Ham_TakeDamage, touch, ent, touch, 5.0, DMG_BLAST)
g_poison_touch[touch] = CurTime
}
}
}
// ====================== ROLLING SKILL ==============================
public dione_rolling()
{
if(!g_can_do_skill)
return PLUGIN_HANDLED
static ent
ent = ent_id
g_doing_skill = 1
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 13)
set_task(0.75, "do_rolling", ent)
set_task(2.0, "stop_rolling", ent)
return PLUGIN_CONTINUE
}
public do_rolling(ent)
{
g_rolling = 1
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 14)
emit_sound(ent, CHAN_BODY, skill_rolling_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
static Float:Velocity[3]
velocity_by_aim(ent, 1250, Velocity)
entity_set_vector(ent, EV_VEC_velocity, Velocity)
for(new i = 1; i < get_maxplayers(); i++)
{
if(is_user_alive(i) && entity_range(i, ent) <= 500.0)
{
message_begin(MSG_ONE, get_user_msgid("ScreenShake"),{0,0,0}, i)
write_short(1<<14)
write_short(1<<13)
write_short(1<<13)
message_end()
}
}
drop_to_floor(ent)
}
public stop_rolling(ent)
{
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 15)
static Float:Velocity[3]
velocity_by_aim(ent, 0, Velocity)
entity_set_vector(ent, EV_VEC_velocity, Velocity)
drop_to_floor(ent)
g_rolling = 0
set_task(1.0, "restart_rolling", ent)
}
public restart_rolling(ent)
{
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 4)
g_doing_skill = 0
drop_to_floor(ent)
}
public fw_dione_touch(dione, touch)
{
if(!g_rolling)
return FMRES_IGNORED
if(is_user_alive(touch))
{
user_kill(touch)
}
return FMRES_HANDLED
}
// ====================== SWING SKILL ==============================
public dione_swing()
{
if(!g_can_do_skill)
return PLUGIN_HANDLED
static ent
ent = ent_id
g_doing_skill = 1
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 7)
emit_sound(ent, CHAN_BODY, skill_swing_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
set_task(1.0, "attack_swing", ent)
set_task(1.5, "remove_swing_model", ent)
set_task(2.0, "stop_swing", ent)
return PLUGIN_CONTINUE
}
public attack_swing(dione)
{
new ent = create_entity("info_target")
static Float:Origin[3]
entity_get_vector(dione, EV_VEC_origin, Origin)
Origin[2] -= 30.0
entity_set_origin(ent, Origin)
entity_set_string(ent,EV_SZ_classname, "swing")
entity_set_model(ent, skill_swing)
entity_set_int(ent, EV_INT_solid, SOLID_SLIDEBOX)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE)
new Float:maxs[3] = {16.0,16.0,36.0}
new Float:mins[3] = {-16.0,-16.0,-36.0}
entity_set_size(ent, mins, maxs)
set_pev(ent, pev_rendermode, kRenderTransAdd)
set_pev(ent, pev_renderamt, 255.0)
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 0)
for(new i = 1; i < get_maxplayers(); i++)
{
if(is_user_alive(i) && entity_range(i, dione) <= 300.0)
{
message_begin(MSG_ONE, get_user_msgid("ScreenShake"),{0,0,0}, i)
write_short(1<<14)
write_short(1<<13)
write_short(1<<13)
message_end()
ExecuteHamB(Ham_TakeDamage, i, 0, i, 15.0, DMG_BLAST)
new wpn, wpnname[32]
wpn = get_user_weapon(i)
if(get_weaponname(wpn, wpnname, charsmax(wpnname)))
{
engclient_cmd(i, "drop", wpnname)
}
}
}
drop_to_floor(ent)
}
public remove_swing_model(ent)
{
static ent2
ent2 = find_ent_by_class(-1, "swing")
remove_entity(ent2)
}
public stop_swing(ent)
{
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, 4)
g_doing_skill = 0
}
// ====================== POISON SKILL ==============================
public dione_poison()
{
if(!g_can_do_skill)
return PLUGIN_HANDLED
static ent
ent = ent_id
g_doing_skill = 1
emit_sound(ent, CHAN_BODY, skill_posion_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
entity_set_float(ent, EV_FL_animtime, get_gametime())
entity_set_float(ent, EV_FL_framerate, 1.0)
entity_set_int(ent, EV_INT_sequence, random_num(11, 12))
set_task(3.5, "attack_poison", ent)
return PLUGIN_CONTINUE
}
public attack_poison(dione)
{
static Float:Velocity[3], Float:Origin[3], Float:Angles[3], Float:V_Angles[3]
engfunc(EngFunc_GetAttachment, dione, 0, Origin, Angles)
//entity_get_vector(dione, EV_VEC_origin, Origin)
entity_get_vector(dione, EV_VEC_angles, Angles)
entity_get_vector(dione, EV_VEC_v_angle, V_Angles)
new ent = create_entity("info_target")
entity_set_origin(ent, Origin)
entity_set_vector(ent, EV_VEC_angles, Angles)
entity_set_vector(ent, EV_VEC_v_angle, V_Angles)
entity_set_string(ent,EV_SZ_classname, "poison")
entity_set_model(ent, skill_posion[0])
entity_set_int(ent, EV_INT_solid, SOLID_SLIDEBOX)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_FLY)
new Float:maxs[3] = {16.0,16.0,36.0}
new Float:mins[3] = {-16.0,-16.0,-36.0}
entity_set_size(ent, mins, maxs)
velocity_by_aim(dione, 1500, Velocity)
entity_set_vector(ent, EV_VEC_velocity, Velocity)
entity_set_float(dione, EV_FL_animtime, get_gametime())
entity_set_float(dione, EV_FL_framerate, 1.0)
entity_set_int(dione, EV_INT_sequence, 4)
}
public fw_poison_touch(poison, touch)
{
entity_set_int(poison, EV_INT_movetype, MOVETYPE_NONE)
static Float:Origin[3], Float:beam_origin[8][3]
entity_get_vector(poison, EV_VEC_origin, Origin)
// 1st
beam_origin[0][0] = Origin[0] + 100.0
beam_origin[0][1] = Origin[1] + 50.0
beam_origin[0][2] = Origin[2]
// 2nd
beam_origin[1][0] = Origin[0] + 100.0
beam_origin[1][1] = Origin[1] - 50.0
beam_origin[1][2] = Origin[2]
// 3rd
beam_origin[2][0] = Origin[0] - 100.0
beam_origin[2][1] = Origin[1] - 50.0
beam_origin[2][2] = Origin[2]
// 4th
beam_origin[3][0] = Origin[0] - 100.0
beam_origin[3][1] = Origin[1] + 50.0
beam_origin[3][2] = Origin[2]
// 5th
beam_origin[4][0] = Origin[0] + 50.0
beam_origin[4][1] = Origin[1] + 100.0
beam_origin[4][2] = Origin[2]
// 6th
beam_origin[5][0] = Origin[0] + 50.0
beam_origin[5][1] = Origin[1] - 100.0
beam_origin[5][2] = Origin[2]
// 7th
beam_origin[6][0] = Origin[0] - 50.0
beam_origin[6][1] = Origin[1] - 100.0
beam_origin[6][2] = Origin[2]
// 8th
beam_origin[7][0] = Origin[0] - 50.0
beam_origin[7][1] = Origin[1] + 100.0
beam_origin[7][2] = Origin[2]
Origin[2] -= 35.0
make_acid(Origin)
for(new i; i < 8; i++)
{
make_acid(beam_origin[i])
}
new Float:remove_origin[3] = {999999.9,999999.9,999999.0}
entity_set_origin(poison, remove_origin)
}
public fw_poison2_touch(poison, touch)
{
if(is_user_alive(touch))
{
static Float:CurTime
CurTime = get_gametime()
if(CurTime - 1.0 > g_poison_touch[touch])
{
static ent
ent = find_ent_by_owner(-1, "weapon_knife", touch)
ExecuteHamB(Ham_TakeDamage, touch, ent, touch, 10.0, DMG_BLAST)
g_poison_touch[touch] = CurTime
}
}
}
public remove_poison(ent)
{
remove_entity(ent)
g_doing_skill = 0
}
public make_acid(Float:Origin[3])
{
new ent = create_entity("info_target")
entity_set_origin(ent, Origin)
set_pev(ent, pev_rendermode, kRenderTransAdd)
set_pev(ent, pev_renderamt, 150.0)
entity_set_string(ent,EV_SZ_classname, "poison2")
entity_set_model(ent, skill_posion[1])
entity_set_int(ent, EV_INT_solid, SOLID_BBOX)
entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE)
new Float:maxs[3] = {40.0, 40.0, 1.0}
new Float:mins[3] = {-40.0, -40.0, -1.0}
entity_set_size(ent, mins, maxs)
drop_to_floor(ent)
set_task(5.0, "remove_poison", ent)
}
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_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)
{
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 / 250.0
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)
}
public 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()
}
1- When kill boss come to exp.
3- Born within the period determined in any part of the map boss(cvar) -> Sample: "amx_boss_time <30.0>"