Script Request
14 replies



24.06.12 09:07:57 pm
hi all!
well im working on another map and i need simple script (i hope its simple)... well im not scripter and i dont like scripting
so...
Script:
When player dies - Random Custom Death Sound will run (of 3)...
and also specific sound file will run.
Thx and sry for bad english
well im working on another map and i need simple script (i hope its simple)... well im not scripter and i dont like scripting

Script:
When player dies - Random Custom Death Sound will run (of 3)...
and also specific sound file will run.
Thx and sry for bad english
thx
and is it possible to disable any other sounds when player dies? there are some sound loops in map...
and is it possible to disable any other sounds when player dies? there are some sound loops in map...
@
Jarago: I do not think so that is possible to disable the default sounds of the game. But if it's annoying to hear lots of sounds at same time (when playing with much users) you can use this script that just allows to sound to the players that are in a specific range.

Code:
You can change the distance (in pixels) if you want. 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
sounds={
"player/die1.wav",
"player/die2.wav",
"player/die3.wav"
}
distance = 300
addhook("die","_die")
function _die(id)
for _,pl in ipairs(player(0,"table")) do
local x = (player(pl,"x") - player(id,"x"))^2
local y = (player(pl,"y") - player(id,"y"))^2
local dist = math.sqrt(x + y)
if dist < distance then
parse("sv_sound2 "..pl.." "..sounds[math.random(#sounds)])
parse("sv_sound2 "..pl.." anothersound.wav")
end
end
end
"player/die1.wav",
"player/die2.wav",
"player/die3.wav"
}
distance = 300
addhook("die","_die")
function _die(id)
for _,pl in ipairs(player(0,"table")) do
local x = (player(pl,"x") - player(id,"x"))^2
local y = (player(pl,"y") - player(id,"y"))^2
local dist = math.sqrt(x + y)
if dist < distance then
parse("sv_sound2 "..pl.." "..sounds[math.random(#sounds)])
parse("sv_sound2 "..pl.." anothersound.wav")
end
end
end
i mean custom sounds added to map with env_sound...
its adventure map and while playing, env_sound song loop is running. And when player dies, this loop or any other env_sound in map will disable so player can hear only death sound + short death song...
but after death song, all env_sounds will be enabled again...
well... maybe it is not possible, ill add only death sounds then...
its adventure map and while playing, env_sound song loop is running. And when player dies, this loop or any other env_sound in map will disable so player can hear only death sound + short death song...
but after death song, all env_sounds will be enabled again...
well... maybe it is not possible, ill add only death sounds then...
edited 1×, last 24.06.12 10:38:31 pm
Yeah it is possible, but you have to trigger that sound (It has to have a name) via the CS2D Script.
ok, i used only death sounds for now, thx for script
Ok, i need one more script... when player enters target trigger_move, text shows up on screen "Boss" and his health. It disapears when boss is dead. Boss is currently one of NPC´s and i want to see his health when fighting him. Is it possible?
Ok, i need one more script... when player enters target trigger_move, text shows up on screen "Boss" and his health. It disapears when boss is dead. Boss is currently one of NPC´s and i want to see his health when fighting him. Is it possible?
edited 1×, last 27.06.12 09:50:14 am

You didn't seed the random function, make it otherwise it wll be NOT random at all
A thousand may fall at your side, ten thousand at your right hand, but it will not come near you. You will only look with your eyes and see the recompense of the wicked. - Psalm 91:7-8 ESV
It's still random, it will just be the same on every start of the game--which no one will really care anyway, there are only 3 sound files.

It is not possible. You can't make a healthbar for a generic NPC.
lol yeah u can
Code:
1
2
3
4
2
3
4
object(0,"table")--table of all dynamic object id's, includes npcs
object(id,"typename")--has the value of "NPC" if its a default npc
object(id,"type")--the specific number for an npc (all zombies are type 30, etc)
object(id,"health")--the hp of the npc, of course
object(id,"typename")--has the value of "NPC" if its a default npc
object(id,"type")--the specific number for an npc (all zombies are type 30, etc)
object(id,"health")--the hp of the npc, of course
other:
object(id,"x"), object(id,"y"), object(id,"tilex"), and object(id,"tiley") can be used to locate the object, if u dont know its dynamic id (provided there arent other objects in range that the boss can be confused with)
then u only have to think about how to display the hp
this can be accomplished easily by using hudtxt2 with players in the boss area + with images which i dislike
will code for food


It is not possible. You can't make a healthbar for a generic NPC.
lol yeah u can
Code:
1
2
3
4
2
3
4
object(0,"table")--table of all dynamic object id's, includes npcs
object(id,"typename")--has the value of "NPC" if its a default npc
object(id,"type")--the specific number for an npc (all zombies are type 30, etc)
object(id,"health")--the hp of the npc, of course
object(id,"typename")--has the value of "NPC" if its a default npc
object(id,"type")--the specific number for an npc (all zombies are type 30, etc)
object(id,"health")--the hp of the npc, of course
other:
object(id,"x"), object(id,"y"), object(id,"tilex"), and object(id,"tiley") can be used to locate the object, if u dont know its dynamic id (provided there arent other objects in range that the boss can be confused with)
then u only have to think about how to display the hp
this can be accomplished easily by using hudtxt2 with players in the boss area + with images which i dislike
That only works for the entity, not for an individual one.



