The second : I want behind every palm (obj) a wall.
Forum
Scripts
2 codes of script.
2 codes of script.
6 replies
1

The second : I want behind every palm (obj) a wall.
http://cs2d.com/help.php
1
2
3
4
5
6
2
3
4
5
6
addhook("die","playDie")
function playDie()
	if player(id,"health") == 0 then
		parse("sv_sound2 "..id.." song1")
	end
end
RebornDuck: , your scripting skills are getting better and better.
RebornDuck has writtenThis is for the first code. Untested but I think it works.
1
2
3
4
5
6
2
3
4
5
6
addhook("die","playDie")
function playDie()
	if player(id,"health") == 0 then
		parse("sv_sound2 "..id.." song1")
	end
end
You should add a math random, i think he mean that.
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
songs = 	{
				--// paths to all available sounds (separated with comma, as in example below)
				"song1.wav",
				"song2.wav",
				"song3.wav"
			}
addhook("die", "onDie")
onDie = function(id)
	parse("sv_sound2 "..id.." '"..songs[math.random(1, # songs)].."'")
end
RebornDuck: When player dies, his/her HP equals zero, so...And more important mistake you made it's no "id" parameter in function "playDie", where you use it in "parse" command.
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
for x = 0, map('xsize') do
	for y = 0, map('ysize') do
		if entity(x, y, 'exists') then
			if entity(x, y, 'int0') == 0 then
				--create a wall on the x and y
			end
		end
	end
end
Idk what wall you mean, nor how to spawn a dynwall on a location.
1

Offline