求助: 玩家死后自爆 + 范围性伤害插件
本插件(death_explode.amxx)由超级英雄插件 -- 自杀炸弹人(sh_explosion.amxx)修改而成. 插件的功能如下:玩家死后身体会爆炸,并能在一定范围内对敌人造成伤害.呵呵,大家可能都看出来了,其实这个插件的功能和魔兽插件中的不死族的终极技能是一样的.(插件运行环境为AMXMODX1.76d)插件的配置参数如下:
// 插件的开关
death_explode 1
// 爆炸的伤害范围
explosion_radius 250
// 爆炸的最大伤害值
explosion_damage 200
这个插件可以看作是以前的玩家死亡自爆效果插件的增强版(jetpack_explode.amxx).但二者的区别也是显而易见的:首先,二者产生的火焰效果是不一样的;其次,后者能造成范围性伤害,因此功能更加完善.
插件在服务器运行良好,编译时也没有出错提示,但还是有个BUG:
*** 就是玩家爆炸时只会产生火焰和光环,但却不会对敌人造成范围性伤害,即"explosion_damage 200"命令无效.
因此,希望高手能帮忙修复一下这个BUG,不胜感激!
回复: 求助: 玩家死后自爆 + 范围性伤害插件
不知道有没用,试下...........回复: 求助: 玩家死后自爆 + 范围性伤害插件
测试失败!其实在超级英雄的源代码里,关于爆炸造成的伤害值定义得非常简单,下面的两段代码都可以实现,但把它们添加到修改后的death_explode插件里就不行了,什么原因呢?if( distanceBetween < get_cvar_num("bomberman_radius") ) {
dRatio = float(distanceBetween) / float(damradius)
damage = maxdamage - floatround( maxdamage * dRatio)
shExtraDamage(a, id, damage, "Bomberman Bomb")
} // distance
} // alive target...
} // loop
}
或者
distanceBetween = get_distance(origin, origin1 )
if( distanceBetween < blast_cir )
{
damage=get_cvar_num("explosion_damage")
shExtraDamage(a, id, damage, "Explosion")
} // distance
} // alive
} // loop
}
回复: 求助: 玩家死后自爆 + 范围性伤害插件
有人解决这个问题了吗?:em10:回复: 求助: 玩家死后自爆 + 范围性伤害插件
其实用RadiusDamage这个函数就可以了,不过听说这个函数有BUG,到0HP了,也不会死,不知道是真的,自己试下.RadiusDamageEngine (engine.inc)
DescriptionRadiusDamage - Hurts/Kills players in a sphere, like an explosion, Multiplier determines damage.
SyntaxRadiusDamage ( Float:ExplodeAt, DamageMultiplier, RadiusMultiplier )
TypeNative
回复: 求助: 玩家死后自爆 + 范围性伤害插件
我还看了一下魔兽插件里不死族的终极技能 -- 自杀炸弹的这部分代码,发现race_undead.inl文件里面是这样定义爆炸的范围和伤害值的:new players, numberofplayers;
get_players( players, numberofplayers, "a" );
new i, iTargetID, vTargetOrigin, iDamage, iDistance;
new iMultiplier = ( EXPLOSION_MAX_DAMAGE * EXPLOSION_MAX_DAMAGE ) / EXPLOSION_RANGE;
new iTeam = get_user_team( id );
还有这些:
// The user isn't immune!
else
{
// Calculate the damage to be done
iDamage = ( EXPLOSION_RANGE - iDistance) * iMultiplier;
iDamage = sqroot( iDamage );
// Damage them!!!!
WC3_Damage( iTargetID, id, iDamage, CSW_SUICIDE, -1 );
// Lets shake up their screen a bit
Create_ScreenShake( iTargetID, (1<<14), (1<<13), (1<<14) );
}
}
希望有人能从里面提取一下相关的代码。
回复: 求助: 玩家死后自爆 + 范围性伤害插件
你可以看下这贴中的导弹插件教程,里面有你需要的东西http://www.dt-club.net/forum/thread/72/22085/4.htm
回复: 求助: 玩家死后自爆 + 范围性伤害插件
很好的教程,先研究研究。:)回复: 求助: 玩家死后自爆 + 范围性伤害插件
#include <amxmodx>#include <engine>
#define TE_EXPLOSION 3
#define TE_SMOKE 5
#define TE_IMPLOSION 14
#define TE_BEAMCYLINDER 21
#define TE_EXPLFLAG_NONE 0
new g_cvar_death_explode
new g_cvar_radius
new g_cvar_damage
new g_sModelIndexFireball
new g_sModelIndexSmoke
new m_iSpriteTexture
new g_maxplayers
public plugin_init()
{
register_plugin("Death Explode","1.0","LiToViEtBoI & X-man")
register_cvar("death_explode", "1")
register_event("DeathMsg","death","a")
register_cvar("explosion_radius", "250")
register_cvar("explosion_damage", "200")
g_maxplayers = get_maxplayers()
}
public plugin_precache()
{
m_iSpriteTexture = precache_model( "sprites/shockwave.spr")
g_sModelIndexFireball = precache_model("sprites/zerogxplode.spr")
g_sModelIndexSmoke = precache_model("sprites/steam1.spr")
precache_sound("ambience/particle_suck1.wav")
}
public death()
{
if(!get_pcvar_num(g_cvar_death_explode))
return PLUGIN_CONTINUE
new id = read_data(2)
new origin
get_user_origin(id, origin)
explode(origin)
emit_sound(id,CHAN_STATIC, "ambience/particle_suck1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
set_task(0.5, "blastcircles", id)
return PLUGIN_CONTINUE
}
public explode(const origin)
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_IMPLOSION)
write_coord(origin)
write_coord(origin)
write_coord(origin)
write_byte(100)
write_byte(20)
write_byte(5)
message_end()
}
public blastcircles(id)
{
new origin
get_user_origin(id, origin)
new blast_cir = get_pcvar_num(g_cvar_radius)
// blast circles
message_begin(MSG_PAS, SVC_TEMPENTITY, origin)
write_byte(TE_BEAMCYLINDER)
write_coord(origin)
write_coord(origin)
write_coord(origin - 16)
write_coord(origin)
write_coord(origin)
write_coord(origin - 16 + blast_cir)
write_short(m_iSpriteTexture)
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(6) // life
write_byte(16) // width
write_byte(0) // noise
write_byte(188)
write_byte(220)
write_byte(255)
write_byte(255) //brightness
write_byte(0) // speed
message_end()
message_begin(MSG_PAS, SVC_TEMPENTITY, origin)
write_byte(TE_BEAMCYLINDER)
write_coord(origin)
write_coord(origin)
write_coord(origin - 16)
write_coord(origin)
write_coord(origin)
write_coord(origin - 16 + blast_cir / 2)
write_short(m_iSpriteTexture)
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(6) // life
write_byte(16) // width
write_byte(0) // noise
write_byte(188)
write_byte(220)
write_byte(255)
write_byte(255) //brightness
write_byte(0) // speed
message_end()
// random explosions
message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
write_byte(TE_EXPLOSION) // This just makes a dynamic light now
write_coord(origin + random_num(-100, 100))
write_coord(origin + random_num(-100, 100))
write_coord(origin + random_num(-50, 50))
write_short(g_sModelIndexFireball)
write_byte(random_num(20, 40)) // scale * 10
write_byte(12) // framerate
write_byte(TE_EXPLFLAG_NONE)
message_end()
// lots of smoke
message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
write_byte(TE_SMOKE)
write_coord(origin + random_num(-100, 100))
write_coord(origin + random_num(-100, 100))
write_coord(origin + random_num(-50, 50))
write_short(g_sModelIndexSmoke)
write_byte(60) // scale * 10
write_byte(10) // framerate
message_end()
set_task(0.5, "bum", id)
}
public bum(id)
{
new team = get_user_team(id)
new radius = get_pcvar_num(g_cvar_radius)
new damage = get_pcvar_num(g_cvar_damage)
new dist
new origin, origin1
get_user_origin(id,origin)
for(new i = 1; i <= g_maxplayers; i++)
{
if(is_user_alive(i) && get_user_team(i) != team)
{
get_user_origin(i, origin1)
dist = get_distance(origin, origin1)
if(dist < radius)
{
fakedamage(i, "Explosion", float(damage - damage * dist / radius), 0)
}
}
}
}
试试这个
回复: 求助: 玩家死后自爆 + 范围性伤害插件
HOOO~~~ CESHI
页:
[1]
2