BANGTANTV @BTS ‧ 7750萬位訂閱者 ‧ 2448 部影片 This is the official YouTube channel of BTS. 방탄소년단 공식 유튜브 채널 입니다.
廣告
  加入我的最愛 設為首頁 風格修改
首頁 首尾
 手機版   訂閱   地圖  簡體 
您是第 5656 個閱讀者
 
發表文章 發表投票 回覆文章
  可列印版   加為IE收藏   收藏主題   上一主題 | 下一主題   
xuqiang52133
個人文章 個人相簿 個人日記 個人地圖
初露鋒芒
級別: 初露鋒芒 該用戶目前不上站
推文 x1 鮮花 x32
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片
推文 x0
[CS1.6] NPC卡在一起问题,求各位高手解决。谢谢了,我自己改了,没成功  (NPC卡在一起问题,求各位高手解决。谢谢了,我自己改了,没成功)
new const npc_mdl[] = "models/ganymede/ganymede.mdl"
new const hp_spr[] = "sprites/ganymede/ganymedehp.spr"
new const npc_sound[11][] = 
{
"ganymede/dash.wav",
"ganymede/death.wav",
"ganymede/boss_footstep_1.wav",
"ganymede/boss_footstep_2.wav",
"ganymede/zbs_fail.wav",
"ganymede/zbs_clear.wav",
"ganymede/attack.wav",
"ganymede/hurt2.wav",
"ganymede/attack2.wav",
"ganymede/thunder.wav",
"ganymede/prepare.wav"
}
#define npc_healthpoints 30000.0      // Ganymede health
#define npc_mh_damage 1000.0       // Ganymede dash damage in percentage (1000.0 instant kill)
#define npc_simple_attack_damage 50.0      // Ganymede simple attack damage in percentage
#define npc_start_think 1
#define npc_clear 2
#define npc_restart 3
#define npc_create 4
#define npc_ability 5
#define npc_think_player 6
#define npc_set_attack3 7
#define npc_idle 8
#define npc_reload_skill 9
#define npc_skill3 10
#define npc_run 11
#define npc_stop 12
#define npc_simple_attack 13
#define npc_simple_attack2 14
#define map_music 15
#define FALL_VELOCITY 350.0
#define RefreshPlayersList()    get_players(g_iPlayers, g_iNum, g_szAliveFlags)
static y_ids
new bool:g_bRestoreVel
new Float:g_vecVel[3]
new g_cvarPainShockFree
new g_fmPlayerPreThink
new g_fmPlayerPreThink_Post
new hologramas
new semiclip
const MAX_PLAYERS = 32
new g_iPlayers[MAX_PLAYERS], g_iNum, g_iPlayer, i
new const g_szAliveFlags[] = "a"
new y_think, y_bleeding[2], y_run, y_hpbar
new y_npc_mdl, y_start_npc, y_start_thinking
new Float:HAngles[3], Float:VAngles[3], Float:y_spawn_points[3]
new const map_sound[2][] = {
"sound/ganymede/scenario_ready.mp3",
"sound/ganymede/scenario_start.mp3"
}
#define PLUGIN "NPC Ganymede"       // Ganymede/Siege Type Deimos
#define VERSION "Public"
#define AUTHOR "Glamurnaya Kisa"
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_+>       // Fakemeta_Util + Sql
#include <hamsandwich>
#include <xs>
#include <cstrike>
#include <fun>
public plugin_init()
{
register_clcmd("get_position", "npc_position")
register_clcmd("make_ganymede", "create_ganymede")
register_clcmd("npc_attack_mh", "npc_attack_mh_ent")
register_think("npc_ganymede", "npc_ganymede_think")
register_touch("npc_ganymede", "*", "npc_ganymede_touch")
register_logevent("event_roundstart", 2, "1=Round_Start")
register_logevent("event_roundend", 2, "1=Round_End")
RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
g_cvarPainShockFree = register_cvar("amx_painshockfree", "1", FCVAR_SERVER)
g_fmPlayerPreThink = register_forward(FM_PlayerPreThink, "onPlayerPreThink")
g_fmPlayerPreThink_Post = register_forward(FM_PlayerPreThink, "onPlayerPreThink_Post", 1)
    register_forward(FM_AddToFullPack, "FM_client_AddToFullPack_Post", 1)
    RegisterHam(Ham_Player_PreThink, "player", "Ham_CBasePlayer_PreThink_Post", 1)
hologramas = register_cvar("hologram","0")
    semiclip = register_cvar("semiclip","1") 
register_plugin(PLUGIN, VERSION, AUTHOR)
if(!cvar_exists("mp_falldamage")) 
{
    register_cvar("mp_falldamage", "0");
  }
}
public FM_client_AddToFullPack_Post(es, e, iEnt, id, hostflags, player, pSet)
{
    if( player && id != iEnt && get_orig_retval() && is_user_alive(id) )
    {
        if( get_pcvar_num(semiclip) == 1)
        {
            set_es(es, ES_Solid, SOLID_NOT)
}
if( get_pcvar_num(hologramas) == 1 )
        {
            set_es(es, ES_RenderMode, kRenderTransAdd)
            set_es(es, ES_RenderAmt, 80)
            set_es(es, ES_RenderColor, 0, 0, 0)
            set_es(es, ES_RenderFx, kRenderFxDistort)
        } 
        if(is_user_alive(id) && get_pcvar_num(semiclip) == 0 )
        {
            set_pev(id, pev_solid, SOLID_SLIDEBOX)
        }     
    }   
}
public Ham_CBasePlayer_PreThink_Post(id)
{
    if( !is_user_alive(id)  )
    {
        return
    }
    if(get_pcvar_num(semiclip) == 1)
    {    
    RefreshPlayersList()


    for(i = 0; i<g_iNum; i++)
    {
        g_iPlayer = g_iPlayers
        if( id != g_iPlayer )
        {
            set_pev(g_iPlayer, pev_solid, SOLID_NOT)
        }
    }
    }
}
public plugin_end()
{
if(g_fmPlayerPreThink)
unregister_forward(FM_PlayerPreThink, g_fmPlayerPreThink)
if(g_fmPlayerPreThink_Post)
unregister_forward(FM_PlayerPreThink, g_fmPlayerPreThink_Post, 1)
}
public onPlayerPreThink(id)
{
if(get_pcvar_num(g_cvarPainShockFree))
{
if(pev_valid(id) && is_user_alive(id) 
&& (FL_ONGROUND & pev(id, pev_flags)))
{
pev(id, pev_velocity, g_vecVel)
g_bRestoreVel = true
}
return FMRES_HANDLED
}
return FMRES_IGNORED
}
public onPlayerPreThink_Post(id)
{
if(g_bRestoreVel)
{
g_bRestoreVel = false
if(!(FL_ONTRAIN & pev(id, pev_flags)))
{
static iGEnt
iGEnt = pev(id, pev_groundentity)
if(pev_valid(iGEnt) && (FL_CONVEYOR & pev(iGEnt, pev_flags)))
{
static Float:vecTemp[3]
pev(id, pev_basevelocity, vecTemp)
g_vecVel[0] += vecTemp[0]
g_vecVel[1] += vecTemp[1]
g_vecVel[2] += vecTemp[2]
}
set_pev(id, pev_velocity, g_vecVel)
return FMRES_HANDLED
}
}
return FMRES_IGNORED
}
new bool:falling[33]
public client_PreThink(id) 
{
  if(get_cvar_num("mp_falldamage") == 0 
  && is_user_alive(id) 
  && is_user_connected(id)) {
    if(entity_get_float(id, EV_FL_flFallVelocity) >= FALL_VELOCITY) 
{
      falling[id] = true
    } else {
      falling[id] = false
    }
  }
}
public client_PostThink(id) 
{
  if(get_cvar_num("mp_falldamage") == 0 
  && is_user_alive(id) 
  && is_user_connected(id)) 
{
    if(falling[id]) {
      entity_set_int(id, EV_INT_watertype, -3)
    }
    if(get_pcvar_num(semiclip) == 1)
    { 
    RefreshPlayersList()


    for(i = 0; i<g_iNum; i++)
    {
        g_iPlayer = g_iPlayers
        if( g_iPlayer != id )
        {
            set_pev(g_iPlayer, pev_solid, SOLID_SLIDEBOX)
        }
    }
    }
  }
}
public player_spawn(id)
{
if(is_user_connected(id))
{
cs_set_user_money(id, 16000)
}
}
public enemy_distance(entid)
{
new Float:range2
new Float:maxrange=2000.0
new indexid=0
for(new i=1;i<=get_maxplayers();i++)
{
if(is_user_alive(i) && is_valid_ent(i) && attacking1(entid, i))
{
range2 = entity_range(entid, i)
if(range2 <= maxrange)
{
maxrange=range2
indexid=i
}
}
}
return (indexid) ? indexid : 0
}
public follow_player(ent, Float:ent_place[3], target, Float:player_place[3]) 
{
if(target) 
{
new Float:newAngle[3]
entity_get_vector(ent, EV_VEC_angles, newAngle)
new Float:x = player_place[0] - ent_place[0]
new Float:z = player_place[1] - ent_place[1]
new Float:radians = floatatan(z/x, radian)
newAngle[1] = radians * (180 / 3.14)
if (player_place[0] < ent_place[0])
newAngle[1] -= 180.0
              entity_set_vector(ent, EV_VEC_v_angle, newAngle)
entity_set_vector(ent, EV_VEC_angles, newAngle)
}
}
public bool:attacking1(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)
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)
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)
get_tr2(0, TraceResult:TR_flFraction, flFraction)
if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
{
return true
}
}
}
}
}
return false
}
public control_ai(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
} 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 event_roundstart()
{
client_cmd(0, "mp3 play %s", map_sound[1])
set_task(0.0, "create_ganymede", npc_create)
set_task(180.0, "replay_music", map_music)
set_task(1.0, "player1", npc_think_player, _, _, "b")
}
public player1()
{
static player[32], player_num
get_players(player, player_num, "a")
if(player_num <= 0)
{
client_cmd(0, "stopsound")
client_cmd(0, "spk %s", npc_sound[5])
set_task(3.0, "replay_game")
remove_task(npc_think_player)
} else {
if(pev_valid(y_think) && pev(y_think, pev_iuser3) == 1)
{
client_cmd(0, "stopsound")
client_cmd(0, "spk %s", npc_sound[4])
set_task(3.0, "replay_game")
remove_task(npc_think_player)
}
}
}
public replay_game()
{
server_cmd("sv_restartround 10")
}
public event_roundend()
{
client_cmd(0, "stopsound")
remove_task(map_music)
}
public replay_music()
{
client_cmd(0, "mp3 play %s", map_sound[1])
set_task(180.0, "replay_music", map_music)
}
public event_newround()
{
if(pev_valid(y_think))
{
remove_task(y_think+npc_run)
remove_task(y_think+npc_stop)
remove_task(y_think+npc_set_attack3)
remove_task(y_think+npc_reload_skill)
remove_task(y_think+npc_start_think)
remove_task(y_think+npc_clear)
remove_task(y_think+npc_restart)
remove_entity_name("npc_ganymede")
}
remove_task(npc_create)
remove_task(map_music)
remove_task(npc_think_player)
if(pev_valid(y_hpbar)) remove_entity(y_hpbar)
client_cmd(0, "mp3 play %s", map_sound[0])
}
public npc_position(id)
{
pev(id, pev_origin, HAngles)
pev(id, pev_angles, VAngles)
VAngles[0] = 0.0
}
public plugin_cfg()       // Cvar's goes here
{
server_cmd("mp_buytime 9999.0")
server_cmd("mp_freezetime 20.0")
server_cmd("sv_restartround 5")
server_cmd("mp_timelimit 9999.0")
}
public plugin_precache()
{
y_npc_mdl = precache_model(npc_mdl)
precache_model(hp_spr)
for(new i = 0; i < sizeof(npc_sound); i++)
precache_sound(npc_sound)
for(new i = 0; i < sizeof(map_sound); i++)
precache_generic(map_sound)
y_bleeding[0] = precache_model("sprites/blood.spr")
y_bleeding[1] = precache_model("sprites/bloodspray.spr")
static mapname[64]
get_mapname(mapname, sizeof(mapname))       // Ganymede spawn points 
if(equal(mapname, "zs_dangerous"))       // Can be added manually with waypoint util
{
y_spawn_points[0] = 243.0
y_spawn_points[1] = 109.0 
y_spawn_points[2] = -412.0
}
if(equal(mapname, "zs_egypt"))
{
y_spawn_points[0] = 138.0
y_spawn_points[1] = -263.0 
y_spawn_points[2] = 36.0 
}
if(equal(mapname, "zs_construction"))
{
y_spawn_points[0] = -308.0
y_spawn_points[1] = -168.0 
y_spawn_points[2] = 612.0 
}
if(equal(mapname, "zs_behind"))
{
y_spawn_points[0] = 706.0
y_spawn_points[1] = 1192.0 
y_spawn_points[2] = 120.0 
}
}
public npc_attack_mh_ent() npc_attack_mh(y_think)
public npc_attack_simple(ent)
{
if(!pev_valid(ent) || y_start_thinking)
return
y_start_thinking = 1
anim(ent, 1)
set_rendering(ent,kRenderFxGlowShell,171,130,255,kRenderNormal,1)
set_pev(ent, pev_movetype, MOVETYPE_NONE)
emit_sound(ent, CHAN_BODY, npc_sound[8], 1.0, ATTN_NORM, 0, PITCH_NORM)
for(new i = 0; i < get_maxplayers(); i++)
{
if(is_user_alive(i) && entity_range(ent, i) <= 250.0)
{
shake_screen(i)
ScreenFade(i, 2, {79, 79, 79}, 120)
ExecuteHam(Ham_TakeDamage, i, 0, i, npc_simple_attack_damage, DMG_POISON)
}
}
set_task(1.0, "ganymede_simple", ent)
set_task(1.1, "simple_attack_reload", ent+npc_simple_attack2)
}
public simple_attack_reload(ent)
{
ent -= npc_simple_attack2
y_start_thinking = 0
}
public ganymede_simple(ent)
{
static Float:OriginA[3], Float:OriginA2[3], Float:xls, Float:Vector[3], Float:Velocity[3]
pev(ent, pev_origin, OriginA)
pev(y_ids, pev_origin, OriginA2)
xs_vec_sub(OriginA2, OriginA, Velocity)
xs_vec_sub(OriginA, OriginA2, Vector)
xls = xs_vec_len(Vector)
if (xls <= 200) {
xs_vec_normalize(Velocity, Velocity)
Velocity[2] = 0.5
xs_vec_mul_scalar(Velocity, 1000.0, Velocity)
set_pev(y_ids, pev_velocity, Velocity)
}
}
public npc_attack_mh(ent)
{
if(!pev_valid(ent) || y_start_thinking)
return
y_start_thinking = 1
y_run = 0
anim(ent, 5)
emit_sound(ent, CHAN_BODY, npc_sound[10], 1.0, ATTN_NORM, 0, PITCH_NORM)
set_rendering(ent,kRenderFxNone,255,255,255,kRenderTransAdd,200)
for(new i = 0; i < get_maxplayers(); i++)
{
if(is_user_alive(i) && entity_range(ent, i) <= 1000)
{
shake_screen(i)
ScreenFade(i, 2, {255, 0, 0}, 120)
}
}
set_pev(ent, pev_movetype, MOVETYPE_NONE)
set_task(1.5, "run_now", ent+npc_run)
set_task(2.0, "stop_run", ent+npc_stop)
}
public run_now(ent)
{
ent -= npc_run
if(!pev_valid(ent))
return
y_run = 1
anim(ent, 5)
emit_sound(ent, CHAN_BODY, npc_sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
set_rendering(ent,kRenderFxGlowShell,151,255,255,kRenderNormal,1)
set_pev(ent, pev_movetype, MOVETYPE_PUSHSTEP)
static Float:Origin[3]
get_position(ent, 1000.0, 0.0, 0.0, Origin)
control_ai2(ent, Origin, 2000.0)
for(new i = 0; i < get_maxplayers(); i++)
{
if(is_user_alive(i) && entity_range(ent, i) <= 1000)
{
shake_screen(i)
}
}
}
public npc_ganymede_touch(ent, id)
{
if(!pev_valid(id))
return
if(!y_run)
return
y_run = 0
remove_task(ent+npc_stop)
set_task(0.1, "stop_run", ent+npc_stop)
if(is_user_alive(id))
{
ExecuteHam(Ham_TakeDamage, id, 0, id, npc_mh_damage, DMG_SLASH)
shake_screen(id)
ScreenFade(id, 10, {255, 0, 0}, 120)
}
}
public stop_run(ent)
{
ent -= npc_stop
y_run = 0
y_start_thinking = 1
anim(ent, 3)
for(new i = 0; i < get_maxplayers(); i++)
{
if(is_user_alive(i) && entity_range(ent, i) <= 1000)
{
shake_screen(i)
}
}
set_pev(ent, pev_movetype, MOVETYPE_NONE)
set_task(0.1, "reload_run", ent)
}
public reload_run(ent)
{
y_start_thinking = 0
anim(ent, 3)
}
public create_ganymede()
{
new ent = create_entity("info_target")
y_think = ent
static Float:Origin[3]
Origin[0] = y_spawn_points[0]
Origin[1] = y_spawn_points[1]
Origin[2] = y_spawn_points[2]
entity_set_origin(ent, Origin)
entity_set_float(ent, EV_FL_takedamage, 1.0)
entity_set_float(ent, EV_FL_health, npc_healthpoints + 1000.0)
entity_set_string(ent, EV_SZ_classname, "npc_ganymede")
entity_set_model(ent, npc_mdl)
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, y_npc_mdl)
anim(ent, 3)
set_task(5.0, "ganymede_done", ent+npc_start_think)       // Ganymede prepare time
set_rendering(ent,kRenderFxNone,255,255,255,kRenderTransAdd,200)
emit_sound(ent, CHAN_BODY, npc_sound[9], 1.0, ATTN_NORM, 0, PITCH_NORM)
if(!y_start_npc)
{
y_start_npc = 1
RegisterHamFromEntity(Ham_TakeDamage, ent, "ganymede_take_damage", 1)
}
y_hpbar = create_entity("env_sprite")
set_pev(y_hpbar, pev_scale, 0.2)
set_pev(y_hpbar, pev_owner, ent)
engfunc(EngFunc_SetModel, y_hpbar, hp_spr)
set_task(0.1, "ganymede_ready", ent+npc_restart, _, _, "b")
set_task(random_float(7.0, 15.0), "punish", npc_ability)
}
public punish()
{
static ent
ent = y_think
if(!pev_valid(ent))
return
static victim
victim = pev(ent, pev_iuser4)
set_task(random_float(5.0, 15.0), "punish", npc_ability)
if(!is_user_alive(victim))
return
static random_skill
random_skill = random_num(0, 1)
switch(random_skill)
{
case 0: npc_attack_mh(ent)



}
public ganymede_ready(ent)
{
ent -= npc_restart
if(!pev_valid(ent))
{
remove_task(ent+npc_restart)
return
}
static Float:Origin[3], Float:ganymede_health
pev(ent, pev_origin, Origin)
Origin[2] += 100.0
engfunc(EngFunc_SetOrigin, y_hpbar, Origin)
pev(ent, pev_health, ganymede_health)
if(npc_healthpoints < (ganymede_health - 1000.0))
{
set_pev(y_hpbar, pev_frame, 100.0)
}
else
{
set_pev(y_hpbar, pev_frame, 0.0 + ((((ganymede_health - 1000.0) - 1 ) * 100) / npc_healthpoints))
}
}
public ganymede_done(ent)
{
ent -= npc_start_think
anim(ent, 3)
set_pev(ent, pev_movetype, MOVETYPE_NONE)
set_pev(ent, pev_nextthink, get_gametime() + 0.1)
}
public npc_ganymede_think(ent)
{
if(!pev_valid(ent))
return
if(pev(ent, pev_iuser3))
return
if(pev(ent, pev_health) - 1000.0 < 0.0)
{
ganymede_death(ent)
set_pev(ent, pev_iuser3, 1)
return
}
if(!y_start_thinking)
{
static victim
static Float:Origin[3], Float:VicOrigin[3], Float:distance
victim = enemy_distance(ent)
pev(ent, pev_origin, Origin)
pev(victim, pev_origin, VicOrigin)
distance = get_distance_f(Origin, VicOrigin)
if(is_user_alive(victim))
{
if(distance <= 100.0)
{
npc_attack_simple(ent)
set_pev(ent, pev_nextthink, get_gametime() + 0.1)
} else {
if(pev(ent, pev_sequence) != 4)
anim(ent, 4)
set_pev(ent, pev_movetype, MOVETYPE_PUSHSTEP)
set_rendering (ent,kRenderFxNone,255,255,255,kRenderNormal,16)
new Float:ent_place[3], Float:player_place[3]
pev(ent, pev_origin, ent_place)
pev(victim, pev_origin, player_place)
follow_player(ent, ent_place, victim, player_place)
control_ai(ent, victim, 200.0)
if(pev(ent, pev_iuser4) != victim)
set_pev(ent, pev_iuser4, victim)
set_pev(ent, pev_nextthink, get_gametime() + 0.0)
}
} else {
if(pev(ent, pev_sequence) != 3)
anim(ent, 3)
set_pev(ent, pev_nextthink, get_gametime() + 0.0)
}
} else {
set_pev(ent, pev_nextthink, get_gametime() + 0.0)
}
return
}
public ganymede_death(ent)
{
anim(ent, 2)
set_rendering(ent,kRenderFxNone,255,255,255,kRenderTransAdd,200)
        set_pev(ent, pev_movetype, MOVETYPE_FLY)
        set_pev(ent, pev_solid, SOLID_NOT)
        set_pev(ent, pev_velocity, {0.0, 0.0, 0.0})
        set_pev(ent, pev_deadflag, DEAD_DYING)
        remove_task(npc_ability)
remove_task(npc_simple_attack)
set_task(6.0, "delete_ganymede", ent)
        return HAM_SUPERCEDE
}
public delete_ganymede(ent)
{
remove_entity(ent)
remove_entity(y_hpbar)
}
public ganymede_take_damage(victim, inflictor, attacker, Float:damage, damagebits)
{
static Float:Origin[3]
fm_get_aim_origin(attacker, Origin)
create_blood(Origin)
emit_sound(victim, CHAN_BODY, npc_sound[7], 1.0, ATTN_NORM, 0, PITCH_NORM)
}
stock ScreenFade(id, Timer, Colors[3], Alpha) {
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), _, id);
write_short((1<<12) * Timer)
write_short(1<<12)
write_short(0)
write_byte(Colors[0])
write_byte(Colors[1])
write_byte(Colors[2])
write_byte(Alpha)
message_end()
}
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 anim(ent, sequence) {
         set_pev(ent, pev_sequence, sequence)
         set_pev(ent, pev_animtime, halflife_time())
         set_pev(ent, pev_framerate, 1.0)
}
stock control_ai2(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 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)
xs_vec_add(vOrigin,vUp,vOrigin)
pev(ent, pev_v_angle, vAngle)
vAngle[0] = 0.0
angle_vector(vAngle,ANGLEVECTOR_FORWARD,vForward)
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])
{
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(y_bleeding[1])
write_short(y_bleeding[0])
write_byte(218)
write_byte(7)
message_end()
}



我要暴你头。。。。。
獻花 x0 回到頂端 [樓 主] From:未知地址 | Posted:2015-11-09 22:21 |
a7811311622 手機
個人頭像
個人文章 個人相簿 個人日記 個人地圖
特殊貢獻獎 優秀管理員勳章 社區建設獎
頭銜:我…在工作了…我…在工作了…
版主
級別: 版主 該用戶目前不上站
版區: CS提問區
推文 x771 鮮花 x2152
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

懶的看程式碼…
卡在一起不就同時在接近的座標上生出兩個以上有 size 又重疊的物件當然卡住…玩家這樣設都會卡了何況 NPC…
不然就是座標位置不理想導致 size 大的卡進牆壁、天花板、地板內…
又或者 velocity 設定根本不對,別以為 NPC 有走路動作就以為 NPC 能動了…


尚無簽名,歡迎 [新增個性化簽名]
獻花 x0 回到頂端 [1 樓] From:臺灣中華電信股份有限公司 | Posted:2015-12-01 18:01 |
QW542121 手機
個人頭像
個人文章 個人相簿 個人日記 個人地圖
小人物
級別: 小人物 該用戶目前不上站
推文 x0 鮮花 x1
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

坐标 表情 表情


恐惧并不代表害怕死亡
獻花 x0 回到頂端 [2 樓] From:未知地址 | Posted:2015-12-02 02:28 |

首頁  發表文章 發表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.036087 second(s),query:17 Gzip disabled
本站由 瀛睿律師事務所 擔任常年法律顧問 | 免責聲明 | 本網站已依台灣網站內容分級規定處理 | 連絡我們 | 訪客留言