Senior Member
|
09-03-2006
, 04:43
Hero: Sephiroth 2006
|
#1
|
http://i110.photobucket.com/albums/n.../sephiroth.jpg
This is merely a rip of Goku. I cut out about 1/3 of the script, all of the sounds, a lot of the precaching, most importantly the check that deducts AP for using a shot, and the check that stops you from casting more than one shot at a time.
I plan on commenting the code and cleaning it up for submission to new heroes - where it's at right now it causes crashes. Props to those who put Goku together, I learned more from this one script than any other...
-edit- Okay so here is the code!!! I finally got it to run without crashing. Your server can only take so much stress, so watch what you set the maxshots cvar to. I plan on cleaning this up, and commenting. This is my first upload and I didn't have time to really make it pretty yet but - here is the sma, please compile yourself.
-note- you must have Goku installed and working, as this hero was ripped from Goku and still uses the Goku models and sprites.
Code:
// Sephiroth! - from FFvii series.
/* CVARS - copy and paste to shconfig.cfg
//Sephiroth
sephiroth_level 60
sephiroth_aps 60 //The amount of AP gained per second (Default 5)
sephiroth_apl 800 //AP amount multiplied by sSephLevel = AP required for each sSephLevel and cost of sSephLevel power use (Default 250)
sephiroth_hpl 300 //HP amount multiplied by sSephLevel, ex. 30*ssj2 = +60HP (Default 30)
sephiroth_hpmax 2400 //Max HP that can be gained (Default 500)
sephiroth_speedbase 969 //Initial Speed boost for sSephLevel 1, only sets if you are slower (Default 300)
sephiroth_speedadd 10 //Speed added to sephiroth_speedbase every next sSephLevel (Default 25)
sephiroth_damage1 100 //Max Damage for sSephLevel 1 power (Default 70)
sephiroth_damage2 150 //Max Damage for sSephLevel 2 power (Default 100)
sephiroth_damage3 250 //Max Damage for sSephLevel 3 power (Default 175)
sephiroth_radius1 100 //Max Radius of Damage for sSephLevel 1 power (Default 100)
sephiroth_radius2 300 //Max Radius of Damage for sSephLevel 2 power (Default 300)
sephiroth_radius3 700 //Max Radius of Damage for sSephLevel 3 power (Default 700)
sephiroth_maxshots 7
sephiroth_blast_decals 1 //Show the burn decals on the walls (0-no 1-yes)
*/
/*
* v1.5 - vittu - 11/24/05
* - Fixed crash to AMX since it can't register a MSG_ONE_UNRELIABLE message.
*
* v1.4 - vittu - 10/24/05
* - Cleaned/Changed up code and formatted sounds to smaller file size for release.
* - Consolodated cvars and global variables so less are declared. Instead
* of individual settings, multipliers of one cvar are now used. Left
* damage and radius cvars of powers for more customization.
*
* v1.3 - vittu - 9/10/05
* - Added guided kamehameha.
*
* v1.2 - vittu - 5/29/05
* - Added Health and Speed boost to Saiyan level.
* - Increased time of powerup effect.
*
* v1.1 - vittu - 5/26/05
* - Recoded from scratch but kept basic premise.
* - Created entities for power instead of beams.
*
* Hero concept and originally by |RIC|_ALBANIAN.
* Entity creation partially based on Bazooka, which is based on Missiles Launcher 3.8.2 by Eric Lidman & jtp10181.
*
* ***Warning: This hero contains many extra files and may cause problems if you are precaching too much.***
*
* Extra sprites and sounds used from Earth's Special Forces a HL mod - http://www.esforces.com/
* and some sounds from http://www.esf-world.com/
*/
#include <amxmod>
#include <Vexd_Utilities>
#include <superheromod>
// GLOBAL VARIBLES
new g_heroName[]="Sephiroth"
new bool:g_hassephiroth[SH_MAXSLOTS+1]
new bool:g_weaponSwitched[SH_MAXSLOTS+1]
//new bool:g_inStun[SH_MAXSLOTS+1]
new bool:g_betweenRounds
new g_isSaiyanLevel[SH_MAXSLOTS+1]
new g_powerNum[SH_MAXSLOTS+1]
new g_powerID[SH_MAXSLOTS+1]
new g_maxRadius[SH_MAXSLOTS+1]
new g_maxDamage[SH_MAXSLOTS+1]
new g_lastWeapon[SH_MAXSLOTS+1]
new g_prevWeapon[SH_MAXSLOTS+1]
new g_sSephLevel[3]
new Float:g_ssjSpeed[3]
new g_armorPts, g_spriteSmoke, g_spriteTrailY, g_spriteTrailB, g_spriteTrailR
new g_spriteExplosionY, g_spriteExplosionB, g_spriteExplosionR, g_maxShots
static const g_burnDecal[3] = {28, 29, 30}
static const g_burnDecalBig[3] = {46, 47, 48}
//----------------------------------------------------------------------------------------------
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO sephiroth", "1.5", "|RIC|_ALBANIAN / 0 / vittu")
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
register_cvar("sephiroth_level", "60")
register_cvar("sephiroth_aps", "60")
register_cvar("sephiroth_apl", "800")
register_cvar("sephiroth_hpl", "300")
register_cvar("sephiroth_hpmax", "2400")
register_cvar("sephiroth_speedbase", "969")
register_cvar("sephiroth_speedadd", "10")
register_cvar("sephiroth_damage1", "50")
register_cvar("sephiroth_damage2", "80")
register_cvar("sephiroth_damage3", "150")
register_cvar("sephiroth_radius1", "100")
register_cvar("sephiroth_radius2", "300")
register_cvar("sephiroth_radius3", "700")
register_cvar("sephiroth_maxshots", "7")
register_cvar("sephiroth_blast_decals", "1")
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
shCreateHero(g_heroName, "Sephiroth", "Generate Chi/Armor for mega attack.", true, "sephiroth_level")
// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
// INIT
register_srvcmd("sephiroth_init", "sephiroth_init")
shRegHeroInit(g_heroName, "sephiroth_init")
// KEY DOWN
register_srvcmd("sephiroth_kd", "sephiroth_kd")
shRegKeyDown(g_heroName, "sephiroth_kd")
// KEY UP
register_srvcmd("sephiroth_ku", "sephiroth_ku")
shRegKeyUp(g_heroName, "sephiroth_ku")
// EVENTS
register_event("ResetHUD", "newSpawn", "b")
register_event("CurWeapon", "curweapon", "be", "1=1")
// LOG EVENTS
register_logevent("round_start", 2, "1=Round_Start")
register_logevent("round_end", 2, "1=Round_End")
register_logevent("round_end", 2, "1&Restart_Round_")
// LOOP
set_task(1.0, "sephiroth_loop", 0, "", 0, "b")
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
//precache_sound("shmod/goku_ki_blast.wav")
//precache_sound("shmod/goku_kamehameha.wav")
//precache_sound("shmod/goku_10x_kamehameha.wav")
//precache_sound("shmod/goku_spirit_bomb.wav")
//precache_sound("shmod/goku_powerup1.wav")
//precache_sound("shmod/goku_powerup2.wav")
//precache_sound("shmod/goku_powerup3.wav")
//precache_sound("shmod/goku_powerup4.wav")
//precache_sound("player/pl_pain2.wav")
precache_model("sprites/shmod/esf_ki_blast.spr")
precache_model("sprites/shmod/esf_kamehameha_blue.spr")
precache_model("sprites/shmod/esf_kamehameha_red.spr")
//precache_model("sprites/shmod/esf_spirit_bomb.spr")
g_spriteTrailY = precache_model("sprites/shmod/esf_trail_yellow.spr")
g_spriteTrailB = precache_model("sprites/shmod/esf_trail_blue.spr")
g_spriteTrailR = precache_model("sprites/shmod/esf_trail_red.spr")
g_spriteExplosionY = precache_model("sprites/shmod/esf_exp_yellow.spr")
g_spriteExplosionB = precache_model("sprites/shmod/esf_exp_blue.spr")
g_spriteExplosionR = precache_model("sprites/shmod/esf_exp_red.spr")
//g_spritePowerUp = precache_model("sprites/shmod/esf_powerup.spr")
g_spriteSmoke = precache_model("sprites/wall_puff4.spr")
}
//----------------------------------------------------------------------------------------------
public sephiroth_init()
{
// First Argument is an id
new temp[6]
read_argv(1,temp,5)
new id = str_to_num(temp)
// 2nd Argument is 0 or 1 depending on whether the id has the hero
read_argv(2,temp,5)
new hasPowers = str_to_num(temp)
if ( hasPowers ) {
sephiroth_setarmor(id)
}
//This gets run if they had the power but don't anymore
else if ( !hasPowers && g_hassephiroth[id] ) {
shRemArmorPower(id)
shRemSpeedPower(id)
// remove the power if it was used and user dropped hero
if ( g_powerID[id] > 0 ) {
remove_power(id, g_powerID[id])
}
}
// Sets this variable to the current status
g_hassephiroth[id] = (hasPowers != 0)
}
//----------------------------------------------------------------------------------------------
public plugin_cfg()
{
loadCVARS()
}
//----------------------------------------------------------------------------------------------
public loadCVARS()
{
// These cvars are checked very often
g_armorPts = get_cvar_num("sephiroth_aps")
g_maxShots = get_cvar_num("sephiroth_maxshots")
g_sSephLevel[0] = get_cvar_num("sephiroth_apl")
g_sSephLevel[1] = g_sSephLevel[0] * 2
g_sSephLevel[2] = g_sSephLevel[0] * 3
g_ssjSpeed[0] = get_cvar_float("sephiroth_speedbase")
g_ssjSpeed[1] = g_ssjSpeed[0] + get_cvar_float("sephiroth_speedadd")
g_ssjSpeed[2] = g_ssjSpeed[1] + get_cvar_float("sephiroth_speedadd")
}
//----------------------------------------------------------------------------------------------
public newSpawn(id)
{
//g_inStun[id] = false
if ( shModActive() && g_hassephiroth[id] && is_user_alive(id) ) {
// Set armor in x seconds to avoid breaking max ap settings in other heroes
//set_task(0.5, "sephiroth_setarmor", id)
g_isSaiyanLevel[id] = 0
}
}
//----------------------------------------------------------------------------------------------
public sephiroth_setarmor(id)
{
if ( is_user_alive(id) ) {
// Start a sephiroth off with 100 AP, even if user has more from other heroes
//give_item(id, "item_assaultsuit")
//set_user_armor(id, 100)
}
}
//----------------------------------------------------------------------------------------------
// RESPOND TO KEYDOWN
public sephiroth_kd()
{
if ( g_betweenRounds ) return
// First Argument is an id
new temp[6]
read_argv(1,temp,5)
new id = str_to_num(temp)
if ( !is_user_alive(id) || !g_hassephiroth[id] ) return
// Reload CVARS to make sure the variables are current
loadCVARS()
new userArmor = get_user_armor(id)
//if ( userArmor < g_sSephLevel[0] ) {
// playSoundDenySelect(id)
// client_print(id, print_chat, "[SH](Sephiroth) Not enough Chi/Armor")
// return
//}
// Prevent too many entities, which would cause server problems
//if( g_powerID[id] ){
// playSoundDenySelect(id)
// client_print(id,print_chat,"[SH](Sephiroth) You cannot use more than one power at a time.")
// return
//}
// Remember this weapon...
new clip, ammo, weaponID = get_user_weapon(id, clip, ammo)
g_lastWeapon[id] = weaponID
g_weaponSwitched[id] = true
// Switch to knife
engclient_cmd(id, "weapon_knife")
if ( userArmor <= g_sSephLevel[0]) {
client_print(id,print_chat,"[SH](Sephiroth) Minor Energy Attack!")
//emit_sound(id, CHAN_STATIC, "shmod/goku_ki_blast.wav", 0.8, ATTN_NORM, 0, PITCH_NORM)
set_user_armor(id, userArmor-(g_sSephLevel[0]/4))
g_maxDamage[id] = get_cvar_num("sephiroth_damage1")
g_maxRadius[id] = get_cvar_num("sephiroth_radius1")
g_powerNum[id] = 1
}
else if ( userArmor >= g_sSephLevel[0] && userArmor < g_sSephLevel[1] ) {
client_print(id,print_chat,"[SH](Sephiroth) Energy Attack!!")
// Wish this sound was shorter
//emit_sound(id, CHAN_STATIC, "shmod/goku_kamehameha.wav", 0.8, ATTN_NORM, 0, PITCH_NORM)
set_user_armor(id, userArmor-(g_sSephLevel[1]/4))
g_maxDamage[id] = get_cvar_num("sephiroth_damage2")
g_maxRadius[id] = get_cvar_num("sephiroth_radius2")
g_powerNum[id] = 2
}
else if ( userArmor >= g_sSephLevel[1]) {
client_print(id,print_chat,"[SH](Sephiroth) Uber l33t Energy Attack!!!")
// Wish this sound was shorter
//emit_sound(id, CHAN_STATIC, "shmod/goku_10x_kamehameha.wav", 0.8, ATTN_NORM, 0, PITCH_NORM)
set_user_armor(id, userArmor-(g_sSephLevel[2]/g_maxShots))
g_maxDamage[id] = get_cvar_num("sephiroth_damage3")
g_maxRadius[id] = get_cvar_num("sephiroth_radius3")
g_powerNum[id] = 3
}
create_power(id)
}
//----------------------------------------------------------------------------------------------
public sephiroth_ku()
{
if ( g_betweenRounds ) return
// First Argument is an id
new temp[6]
read_argv(1,temp,5)
new id = str_to_num(temp)
if ( !is_user_alive(id) || !g_hassephiroth[id] || !g_weaponSwitched[id] ) return
// Switch back to previous weapon... Only if power was used...
if (g_lastWeapon[id] != CSW_KNIFE) shSwitchWeaponID(id, g_lastWeapon[id])
g_weaponSwitched[id] = false
}
//----------------------------------------------------------------------------------------------
public create_power(id)
{
new Float:vOrigin[3], Float:vAngles[3], Float:vAngle[3], entModel[40]
new Float:entScale, Float:entSpeed, trailModel, trailLength, trailWidth
new Float:VecMins[3] = {-1.0,-1.0,-1.0}
new Float:VecMaxs[3] = {1.0,1.0,1.0}
// Seting entSpeed higher then 2000.0 will not go where you aim
// Vec Mins/Maxes must be below +-5.0 to make a burndecal
switch(g_powerNum[id]){
case 1:{
entModel = "sprites/shmod/esf_ki_blast.spr"
entScale = 0.20
entSpeed = 2000.0
trailModel = g_spriteTrailY
trailLength = 1
trailWidth = 2
}
case 2:{
entModel = "sprites/shmod/esf_kamehameha_blue.spr"
entScale = 1.20
entSpeed = 1500.0
trailModel = g_spriteTrailB
trailLength = 100
trailWidth = 8
VecMins[0] = -2.0
VecMins[1] = -2.0
VecMins[2] = -2.0
VecMaxs[0] = 2.0
VecMaxs[1] = 2.0
VecMaxs[2] = 2.0
}
case 3:{
entModel = "sprites/shmod/esf_kamehameha_red.spr"
entScale = 2.00
entSpeed = 1000.0
trailModel = g_spriteTrailR
trailLength = 100
trailWidth = 16
VecMins[0] = -3.0
VecMins[1] = -3.0
VecMins[2] = -3.0
VecMaxs[0] = 3.0
VecMaxs[1] = 3.0
VecMaxs[2] = 3.0
}
}
// Get users postion and angles
Entvars_Get_Vector(id, EV_VEC_origin, vOrigin)
Entvars_Get_Vector(id, EV_VEC_angles, vAngles)
Entvars_Get_Vector(id, EV_VEC_v_angle, vAngle)
// Change height for entity origin
if (g_powerNum[id] == 4) vOrigin[2] += 110
else vOrigin[2] += 6
new newEnt = CreateEntity("info_target")
if( newEnt == 0 ) {
client_print(id, print_chat, "[SH](Sephiroth) Power Creation Failure")
return
}
g_powerID[id] = newEnt
Entvars_Set_String(newEnt, EV_SZ_classname, "vexd_sephiroth_power")
ENT_SetModel(newEnt, entModel)
Entvars_Set_Vector(newEnt, EV_VEC_mins, VecMins)
Entvars_Set_Vector(newEnt, EV_VEC_maxs, VecMaxs)
ENT_SetOrigin(newEnt, vOrigin)
Entvars_Set_Vector(newEnt, EV_VEC_angles, vAngles)
Entvars_Set_Vector(newEnt, EV_VEC_v_angle, vAngle)
Entvars_Set_Int(newEnt, EV_INT_solid, 2)
Entvars_Set_Int(newEnt, EV_INT_movetype, 5)
Entvars_Set_Int(newEnt, EV_INT_rendermode, 5)
Entvars_Set_Float(newEnt, EV_FL_renderamt, 255.0)
Entvars_Set_Float(newEnt, EV_FL_scale, entScale)
Entvars_Set_Edict(newEnt, EV_ENT_owner, id)
// Create a VelocityByAim() function, but instead of users
// eyesight make it start from the entity's origin - vittu
new Float:fl_Velocity[3], AimVec[3], velOrigin[3]
velOrigin[0] = floatround(vOrigin[0])
velOrigin[1] = floatround(vOrigin[1])
velOrigin[2] = floatround(vOrigin[2])
get_user_origin(id, AimVec, 3)
new distance = get_distance(velOrigin, AimVec)
// Stupid Check but lets make sure you don't devide by 0
if (!distance) distance = 1
new Float:invTime = entSpeed / distance
fl_Velocity[0] = (AimVec[0] - vOrigin[0]) * invTime
fl_Velocity[1] = (AimVec[1] - vOrigin[1]) * invTime
fl_Velocity[2] = (AimVec[2] - vOrigin[2]) * invTime
Entvars_Set_Vector(newEnt, EV_VEC_velocity, fl_Velocity)
// Set Trail on entity
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(22) // TE_BEAMFOLLOW
write_short(newEnt) // entity:attachment to follow
write_short(trailModel) // sprite index
write_byte(trailLength) // life in 0.1's
write_byte(trailWidth) // line width in 0.1's
write_byte(255) //colour
write_byte(255)
write_byte(255)
write_byte(255) // brightness
message_end()
if ( g_powerNum[id] == 2 || g_powerNum[id] == 3 ) {
new iNewVelocity[3], args[6]
iNewVelocity[0] = floatround(fl_Velocity[0])
iNewVelocity[1] = floatround(fl_Velocity[1])
iNewVelocity[2] = floatround(fl_Velocity[2])
// Pass varibles used to guide entity with
args[0] = id
args[1] = newEnt
args[2] = floatround(entSpeed)
args[3] = iNewVelocity[0]
args[4] = iNewVelocity[1]
args[5] = iNewVelocity[2]
set_task(0.1, "guide_kamehameha", newEnt, args, 6)
}
}
//----------------------------------------------------------------------------------------------
public guide_kamehameha(args[])
{
new AimVec[3], avgFactor
new Float:fl_origin[3]
new id = args[0]
new ent = args[1]
new speed = args[2]
if ( !is_valid_ent(ent) ) return
if ( !is_user_connected(id) ) {
vexd_pfntouch(ent, 0)
return
}
get_user_origin(id, AimVec, 3)
Entvars_Get_Vector(ent, EV_VEC_origin, fl_origin)
new iNewVelocity[3]
new origin[3]
origin[0] = floatround(fl_origin[0])
origin[1] = floatround(fl_origin[1])
origin[2] = floatround(fl_origin[2])
if ( g_powerNum[id] == 2 )
avgFactor = 3
else if ( g_powerNum[id] == 3 )
avgFactor = 6
// stupid check but why not
else
avgFactor = 8
new velocityVec[3], length
velocityVec[0] = AimVec[0]-origin[0]
velocityVec[1] = AimVec[1]-origin[1]
velocityVec[2] = AimVec[2]-origin[2]
length = sqroot(velocityVec[0]*velocityVec[0] + velocityVec[1]*velocityVec[1] + velocityVec[2]*velocityVec[2])
// Stupid Check but lets make sure you don't devide by 0
if ( !length ) length = 1
velocityVec[0] = velocityVec[0]*speed/length
velocityVec[1] = velocityVec[1]*speed/length
velocityVec[2] = velocityVec[2]*speed/length
iNewVelocity[0] = (velocityVec[0] + (args[3] * (avgFactor-1))) / avgFactor
iNewVelocity[1] = (velocityVec[1] + (args[4] * (avgFactor-1))) / avgFactor
iNewVelocity[2] = (velocityVec[2] + (args[5] * (avgFactor-1))) / avgFactor
new Float:fl_iNewVelocity[3]
fl_iNewVelocity[0] = float(iNewVelocity[0])
fl_iNewVelocity[1] = float(iNewVelocity[1])
fl_iNewVelocity[2] = float(iNewVelocity[2])
Entvars_Set_Vector(ent, EV_VEC_velocity, fl_iNewVelocity)
args[3] = iNewVelocity[0]
args[4] = iNewVelocity[1]
args[5] = iNewVelocity[2]
set_task(0.1, "guide_kamehameha", ent, args, 6)
}
//----------------------------------------------------------------------------------------------
#if defined AMX_NEW
public vexd_pfntouch(pToucher, pTouched) {
entity_touch(pToucher, pTouched)
}
public entity_touch(entity1, entity2) {
new pToucher = entity1
#else
public vexd_pfntouch(pToucher, pTouched) {
#endif
if (pToucher <= 0) return
if (!is_valid_ent(pToucher)) return
new szClassName[32]
Entvars_Get_String(pToucher, EV_SZ_classname, szClassName, 31)
if(equal(szClassName, "vexd_sephiroth_power")) {
new id = Entvars_Get_Edict(pToucher, EV_ENT_owner)
new dmgRadius = g_maxRadius[id]
new maxDamage = g_maxDamage[id]
new Float:fl_vExplodeAt[3], damageName[16]
new spriteExp = g_spriteExplosionY
switch(g_powerNum[id]){
case 1:{
damageName = "Chi Blast"
}
case 2:{
damageName = "Kamehameha"
spriteExp = g_spriteExplosionB
}
case 3:{
damageName = "10x Kamehameha"
spriteExp = g_spriteExplosionR
}
}
Entvars_Get_Vector(pToucher, EV_VEC_origin, fl_vExplodeAt)
new vExplodeAt[3]
vExplodeAt[0] = floatround(fl_vExplodeAt[0])
vExplodeAt[1] = floatround(fl_vExplodeAt[1])
vExplodeAt[2] = floatround(fl_vExplodeAt[2])
// Cause the Damage
new vicOrigin[3], Float:dRatio, distance, damage
new players[SH_MAXSLOTS], pnum, vic
get_players(players, pnum, "a")
for (new i = 0; i < pnum; i++) {
vic = players[i]
if( !is_user_alive(vic) ) continue
if ( get_user_team(id) == get_user_team(vic) && !get_cvar_num("mp_friendlyfire") && id != vic ) continue
get_user_origin(vic, vicOrigin)
distance = get_distance(vExplodeAt, vicOrigin)
if ( distance < dmgRadius ) {
dRatio = floatdiv(float(distance), float(dmgRadius))
damage = maxDamage - floatround(maxDamage * dRatio)
// Lessen damage taken by self by half
if ( vic == id ) damage = floatround(damage / 2.0)
shExtraDamage(vic, id, damage, damageName)
// Make them feel it
sh_screenShake(vic, 10, 10, 10)
//emit_sound(vic, CHAN_BODY, "player/pl_pain2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
new Float:fl_Time = distance / 125.0
new Float:fl_vicVelocity[3]
fl_vicVelocity[0] = (vicOrigin[0] - vExplodeAt[0]) / fl_Time
fl_vicVelocity[1] = (vicOrigin[1] - vExplodeAt[1]) / fl_Time
fl_vicVelocity[2] = (vicOrigin[2] - vExplodeAt[2]) / fl_Time
Entvars_Set_Vector(vic, EV_VEC_velocity, fl_vicVelocity)
}
}
// Make some Effects
new blastSize = floatround(dmgRadius / 12.0)
// Explosion Sprite
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(23) //TE_GLOWSPRITE
write_coord(vExplodeAt[0])
write_coord(vExplodeAt[1])
write_coord(vExplodeAt[2])
write_short(spriteExp) // model
write_byte(01) // life 0.x sec
write_byte(blastSize) // size
write_byte(255) // brightness
message_end()
// Explosion (smoke, sound/effects)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(3) //TE_EXPLOSION
write_coord(vExplodeAt[0])
write_coord(vExplodeAt[1])
write_coord(vExplodeAt[2])
write_short(g_spriteSmoke) // model
write_byte(blastSize+5) // scale in 0.1's
write_byte(20) // framerate
write_byte(10) // flags
message_end()
// Create Burn Decals, if they are used
if ( get_cvar_num("sephiroth_blast_decals") == 1 ) {
// Change burn decal according to blast size
new decal_id
if ( blastSize <= 18 ) {
//radius ~< 216
decal_id = g_burnDecal[random_num(0,2)]
}
else {
decal_id = g_burnDecalBig[random_num(0,2)]
}
// Create the burn decal
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(109) //TE_GUNSHOTDECAL
write_coord(vExplodeAt[0])
write_coord(vExplodeAt[1])
write_coord(vExplodeAt[2])
write_short(0) //?
write_byte(decal_id) //decal
message_end()
}
RemoveEntity(pToucher)
// Reset the Varibles
g_powerNum[id] = 0
g_powerID[id] = 0
}
}
//----------------------------------------------------------------------------------------------
public remove_power(id, powerID)
{
new Float:fl_vOrigin[3]
Entvars_Get_Vector(powerID, EV_VEC_origin, fl_vOrigin)
// Create an effect of kamehameha being removed
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(14) //TE_IMPLOSION
write_coord(floatround(fl_vOrigin[0]))
write_coord(floatround(fl_vOrigin[1]))
write_coord(floatround(fl_vOrigin[2]))
write_byte(200) // radius
write_byte(40) // count
write_byte(45) // life in 0.1's
message_end()
g_powerNum[id] = 0
g_powerID[id] = 0
RemoveEntity(powerID)
}
//----------------------------------------------------------------------------------------------
public sephiroth_loop()
{
if ( !shModActive() || g_betweenRounds ) return
new players[SH_MAXSLOTS], pnum, id
get_players(players, pnum, "a")
for (new i = 0; i < pnum; i++) {
id = players[i]
if ( g_hassephiroth[id] && is_user_alive(id) ) {
new userArmor = get_user_armor(id)
// Give him armor
if ( userArmor < g_sSephLevel[2] ) {
if ( userArmor + g_armorPts > g_sSephLevel[2] ) {
set_user_armor(id, g_sSephLevel[2])
}
else {
// Give the armor item if armor is 0 so CS knows the player has armor
if ( userArmor <= 0 ) give_item(id, "item_assaultsuit")
set_user_armor(id, userArmor + g_armorPts)
}
}
// Check armor again after it's been set
userArmor = get_user_armor(id)
if ( userArmor < g_sSephLevel[0] ) {
// run it this way so it doesn't check all the elses
if ( g_isSaiyanLevel[id] > 0 ) {
shResetSpeed(id)
g_isSaiyanLevel[id] = 0
}
}
else if ( userArmor >= g_sSephLevel[0] && userArmor < g_sSephLevel[1] ) {
// Set these items only once when armor is sSephLevel 1
if ( g_isSaiyanLevel[id] < 1 ) {
set_hudmessage(255, 255, 100, -1.0, 0.25, 0, 0.25, 3.0, 0.0, 0.0, 84)
show_hudmessage(id, "Sephiroth - You've turned into Sephiroth")
//emit_sound(id, CHAN_STATIC, "shmod/goku_powerup1.wav", 0.8, ATTN_NORM, 0, PITCH_NORM)
g_isSaiyanLevel[id] = 1
ssj_boost(id)
}
}
else if ( userArmor >= g_sSephLevel[1] && userArmor < g_sSephLevel[2] ) {
// Set these items only once when armor is sSephLevel 2
if ( g_isSaiyanLevel[id] < 2 ) {
set_hudmessage(222, 226, 0, -1.0, 0.25, 0, 0.25, 3.0, 0.0, 0.0, 84)
show_hudmessage(id, "Sephiroth - You've turned Superhuman")
//emit_sound(id, CHAN_STATIC, "shmod/goku_powerup2.wav", 0.8, ATTN_NORM, 0, PITCH_NORM)
g_isSaiyanLevel[id] = 2
ssj_boost(id)
}
}
else if ( userArmor >= g_sSephLevel[2]) {
// Set these items only once when armor is sSephLevel 3
if ( g_isSaiyanLevel[id] < 3 ) {
set_hudmessage(248, 220, 117, -1.0, 0.25, 0, 0.25, 3.0, 0.0, 0.0, 84)
show_hudmessage(id, "Sephiroth - You've turned into a Demi-God")
//emit_sound(id, CHAN_STATIC, "shmod/goku_powerup3.wav", 0.8, ATTN_NORM, 0, PITCH_NORM)
new sephirothName[32]
get_user_name(id, sephirothName, 31)
set_hudmessage(196, 0, 0, -1.0, 0.20, 0, 0.25, 3.0, 0.0, 0.0, 84)
show_hudmessage(id, "Sephiroth - %s has turned into a Demi-God", sephirothName)
g_isSaiyanLevel[id] = 3
ssj_boost(id)
}
}
}
}
}
//----------------------------------------------------------------------------------------------
public ssj_boost(id)
{
if ( !shModActive() || !g_hassephiroth[id] || !is_user_alive(id) || g_betweenRounds ) return
if ( !g_isSaiyanLevel[id] ) return
// Speed Boost
new speedNum = g_isSaiyanLevel[id] - 1
if ( get_user_maxspeed(id) < g_ssjSpeed[speedNum]) {
set_user_maxspeed(id, g_ssjSpeed[speedNum])
}
// HP boost
new userHealth = get_user_health(id)
if ( userHealth < get_cvar_num("sephiroth_hpmax") ) {
new addHP = get_cvar_num("sephiroth_hpl") * g_isSaiyanLevel[id]
if ( userHealth + addHP > get_cvar_num("sephiroth_hpmax") ) {
set_user_health(id, get_cvar_num("sephiroth_hpmax") )
}
else {
set_user_health(id, userHealth) //+ addHP
}
}
}
//----------------------------------------------------------------------------------------------
public curweapon(id)
{
if ( !shModActive() || !g_hassephiroth[id] || !is_user_alive(id) || g_betweenRounds ) return
new wpnid = read_data(2)
if ( g_prevWeapon[id] != wpnid ) {
switch(g_isSaiyanLevel[id]) {
case 1: if ( get_user_maxspeed(id) < g_ssjSpeed[0] ) set_user_maxspeed(id, g_ssjSpeed[0])
case 2: if ( get_user_maxspeed(id) < g_ssjSpeed[1] ) set_user_maxspeed(id, g_ssjSpeed[1])
case 3: if ( get_user_maxspeed(id) < g_ssjSpeed[2] ) set_user_maxspeed(id, g_ssjSpeed[2])
}
}
g_prevWeapon[id] = wpnid
}
//----------------------------------------------------------------------------------------------
public round_end()
{
g_betweenRounds = true
for (new id=1; id <= SH_MAXSLOTS; id++) {
if ( g_hassephiroth[id] ) {
g_isSaiyanLevel[id] = 0
shResetSpeed(id)
if ( g_powerID[id] > 0 ) {
remove_power(id, g_powerID[id])
}
}
}
}
//----------------------------------------------------------------------------------------------
public round_start()
{
g_betweenRounds = false
}
//----------------------------------------------------------------------------------------------
public client_disconnect(id)
{
if( g_hassephiroth[id] && g_powerID[id] > 0 ) {
remove_power(id, g_powerID[id])
}
}
//----------------------------------------------------------------------------------------------
Please help me test and report any errors. Scripting pros out there please take a look and see if there is any room for improvement.
Last edited by heliumdream; 09-04-2006 at 12:48.
|
|