Veteran Member
Join Date: Oct 2007
Location: Sweden
|
03-03-2010
, 17:26
Help with the sound
|
#1
|
Okey im getting tierd of this ripp now....
The only thing i wanted to do was;
1. Change the name. (DONE)
2. Change the effects. (DONE)
3. Change the sound. (..)
I've tried awhile adding the freekin sound but it just wont.
I've tried to replace "my" sound with other custom sounds, but no.
The default (Electro) sound, wich is hl1, does works fine.
so its basically just a problem with the custom sound...
It precaches the sound, but i hear nothing when i use the power.
(I did just edit the sound location.. i also tried to precache the sound other ways. But no)
Here's the... "Electro" but.. with, my name and settings.
(i think this is the proper one)
PHP Code:
// Chidori! - From naruto animé
/* CVARS - copy and paste to shconfig.cfg
//Chidori
chidori_level 0
chidori_cooldown 45 //# of seconds for cooldown between use (Default 45)
chidori_searchtime 45 //# of seconds to search for a victim when key is pressed (Default 45)
chidori_maxdamage 50 //Damage on first victim, amount is decreased each jump by decay rate (Default 50)
chidori_jumpdecay 0.66 //Decay rate for damage and sprite line width each lightning jump (Default 0.66)
chidori_jumpradius 500 //Radius to search for a lightning jump (Default 500)
*/
/*
*
* Ripp by Viktor B.N.
*
* Used: Electro(AssKicR).
*
* 2010
*/
#include <superheromod>
#define LINE_WIDTH 80
// GLOBAL VARIABLES
new gHeroID
new bool:gHasChidori[SH_MAXSLOTS+1]
new bool:gLightningHit[SH_MAXSLOTS+1]
new bool:gIsSearching[SH_MAXSLOTS+1]
new const gSoundSearch[] = "turret/tu_ping.wav"
new const gSoundLightning[] = "shmod/chidori.wav"
new gSpriteLightning
new gPcvarCooldown, gPcvarSearchTime, gPcvarMaxDamage, gPcvarJumpDecay, gPcvarJumpRadius
//----------------------------------------------------------------------------------------------
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO Sasuke's Chidori", "1.0", "AssKicR/Viktor B.N.")
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
new pcvarLevel = register_cvar("chidori_level", "1")
gPcvarCooldown = register_cvar("chidori_cooldown", "30")
gPcvarSearchTime = register_cvar("chidori_searchtime", "60")
gPcvarMaxDamage = register_cvar("chidori_maxdamage", "50")
gPcvarJumpDecay = register_cvar("chidori_jumpdecay", "0.88")
gPcvarJumpRadius = register_cvar("chidori_jumpradius", "1500")
// FIRE THE EVENTS TO CREATE THIS SUPERHERO!
gHeroID = sh_create_hero("Sasuke's Chidori", pcvarLevel)
sh_set_hero_info(gHeroID, "Chidori Jutsu", "This jutsu channels a large amount of lightning chakra to the user's hand.")
sh_set_hero_bind(gHeroID)
register_forward(FM_TraceLine, "fm_TraceLine")
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
precache_sound(gSoundSearch)
precache_sound(gSoundLightning)
gSpriteLightning = precache_model("sprites/lgtning.spr")
}
//----------------------------------------------------------------------------------------------
public sh_hero_init(id, heroID, mode)
{
if ( gHeroID != heroID ) return
gHasChidori[id] = mode ? true : false
}
//----------------------------------------------------------------------------------------------
public sh_client_spawn(id)
{
gPlayerInCooldown[id] = false
gIsSearching[id] = false
gLightningHit[id] = false
remove_task(id)
}
//----------------------------------------------------------------------------------------------
public sh_hero_key(id, heroID, key)
{
if ( gHeroID != heroID || sh_is_freezetime() ) return
if ( !is_user_alive(id) || !gHasChidori[id] ) return
if ( gIsSearching[id] ) return
if ( key == SH_KEYDOWN )
{
// Let them know they already used their ultimate if they have
if ( gPlayerInCooldown[id] )
{
sh_sound_deny(id)
return
}
gIsSearching[id] = true
new parm[2]
parm[0] = id
parm[1] = get_pcvar_num(gPcvarSearchTime)
chidori_search(parm)
}
}
//----------------------------------------------------------------------------------------------
public chidori_search(parm[2])
{
new id = parm[0]
new timeLeft = parm[1]
// Decrement our timer
parm[1]--
// User died or diconnected
if ( !is_user_alive(id) || !gHasChidori[id] )
{
gIsSearching[id] = false
}
// This is the last "playing" of the sound, no target was found :/
if ( timeLeft == 0 )
{
gIsSearching[id] = false
}
// Then we need to play the sound + flash their icon!
if ( gIsSearching[id] )
{
// Play the ping sound
emit_sound(id, CHAN_STATIC, gSoundSearch, 1.0, ATTN_NORM, 0, PITCH_NORM)
set_task(1.0, "chidori_search", id, parm, 2)
}
}
//----------------------------------------------------------------------------------------------
public fm_TraceLine(Float:v1[3], Float:v2[3], const noMonsters, const pentToSkip)
{
if ( !sh_is_active() ) return FMRES_IGNORED
new victim = get_tr(TR_pHit)
if ( !is_user_alive(victim) ) return FMRES_IGNORED
//new attacker = pentToSkip
if ( !is_user_alive(pentToSkip) || !gHasChidori[pentToSkip] || !gIsSearching[pentToSkip] ) return FMRES_IGNORED
if ( cs_get_user_team(pentToSkip) == cs_get_user_team(victim) ) return FMRES_IGNORED
new damage = get_pcvar_num(gPcvarMaxDamage)
chidori_attack(victim, pentToSkip, damage, LINE_WIDTH, pentToSkip)
new Float:seconds = get_pcvar_float(gPcvarCooldown)
if ( seconds > 0.0 ) sh_set_cooldown(pentToSkip, seconds)
gIsSearching[pentToSkip] = false
// Now we need to search for the next "jump"
new parm[4]
parm[0] = victim
parm[1] = damage
parm[2] = LINE_WIDTH
parm[3] = pentToSkip
set_task(0.2, "chidori_jump_check", pentToSkip, parm, 4)
return FMRES_IGNORED
}
//----------------------------------------------------------------------------------------------
public chidori_jump_check(parm[4])
{
// parm[0] = victim
// parm[1] = damage
// parm[2] = linewidth
// parm[3] = attacker
new lastVictim = parm[0]
new players[32], numberofplayers, i
get_players(players, numberofplayers, "a")
new Float:decay = get_pcvar_float(gPcvarJumpDecay)
// Damage should be decreased on each jump
new damage = floatround(parm[1] * decay)
if ( is_user_connected(lastVictim) && damage > 0 )
{
new lvOrigin[3]
get_user_origin(lastVictim, lvOrigin)
new attacker = parm[3]
new CsTeams:attackerTeam = cs_get_user_team(attacker)
new target, closestTarget, closestDistance
new distance, targetOrigin[3]
new radius = get_pcvar_num(gPcvarJumpRadius)
// Loop through every alive player
for ( i = 0; i < numberofplayers; i++ )
{
target = players[i]
if ( target == attacker || target == lastVictim ) continue
if ( gLightningHit[target] ) continue
// Make sure our target player isn't on the same team!
if ( cs_get_user_team(target) != attackerTeam )
{
get_user_origin(target, targetOrigin)
distance = get_distance(lvOrigin, targetOrigin)
// Verify the user is within range
if ( distance <= radius )
{
// This user is closest!! Lets make a note of this...
if ( distance < closestDistance || !closestTarget )
{
closestDistance = distance
closestTarget = target
}
}
}
}
if ( closestTarget )
{
// Then we have a valid target!!!
// Decrease line width as well
new lineWidth = floatround(parm[2] * decay)
// Display the actual lightning
chidori_attack(closestTarget, attacker, damage, lineWidth, lastVictim)
// Lets call this again on our next target!
parm[0] = closestTarget
parm[1] = damage
parm[2] = lineWidth
set_task(0.2, "chidori_jump_check", attacker, parm, 4)
return
}
}
// No valid target found - reset all lightning hit variables
for ( i = 0; i < numberofplayers; i++ )
{
gLightningHit[players[i]] = false
}
}
//----------------------------------------------------------------------------------------------
chidori_attack(const victim, const attacker, const damage, const linewidth, const beamStartID)
{
// Make sure we set this user as hit, otherwise we'll hit him again
gLightningHit[victim] = true
// Get the target's origin
new Float:beamOrigin[3]
pev(beamStartID, pev_origin, beamOrigin)
// Damage the user
sh_extra_damage(victim, attacker, damage, "chain lightning", 0, SH_DMG_NORM, true, false, beamOrigin)
// Create the lightning
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMENTS)
write_short(beamStartID)// start entity
write_short(victim) // entity
write_short(gSpriteLightning) // model
write_byte(0) // starting frame
write_byte(15) // frame rate
write_byte(50) // life
write_byte(150) // linewidth
write_byte(10) // noise amplitude
write_byte(105) // r, g, b
write_byte(105) // r, g, b
write_byte(255) // r, g, b 125
write_byte(60) // brightness 175
write_byte(0) // scroll speed
message_end()
// Get the victim's origin
new vicOrigin[3]
get_user_origin(victim, vicOrigin)
// Create an elight on the target
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_ELIGHT)
write_short(victim) // entity
write_coord(vicOrigin[0]) // initial position
write_coord(vicOrigin[1]) // initial position
write_coord(vicOrigin[2]) // initial position
write_coord(10) // radius
write_byte(0) // r, g, b
write_byte(0) // r, g, b
write_byte(255) // r, g, b
write_byte(10) // life
write_coord(0) // decay rate
message_end()
// Play the lightning sound
emit_sound(beamStartID, CHAN_STATIC, gSoundLightning, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
//----------------------------------------------------------------------------------------------
Note that i also tried
PHP Code:
precache_sound("shmod/chidori.wav")
Thanks.
__________________
Quote:
Originally Posted by wrecked_
Stop saying words before I sodomize you with a cucumber.
|
|
|