Forum

> > CS2D > Scripts > Play sound when moving over tile
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Play sound when moving over tile

14 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Play sound when moving over tile

Man Of Steel
User Off Offline

Zitieren
Hello everyone,

I am making my own map and i have some problems there, but i know that its will solve for using a script there, i'm Sure...

I'm not defining my map problem, k?
I'm directly gotta ask and request.

I want play sound on a tile, when we move those tiles so when a play a sound, but its happen with Counter-Terrorist force.tiles position: i have 2 tiles there i want play sound, and when counter-terrorists move those tiles so play another sound.

Tiles Positions:121|88,122|88

Please help me for this script

Thanks

Admin/Mod Kommentar

"Script needed" is a bad title. Please describe what you want next time. Fixed. /DC

alt Re: Play sound when moving over tile

DC
Admin Off Offline

Zitieren
This can also be done with the map editor only. Without script.s

• Put cs2d entity trigger_move entities on the tiles you want to trigger sounds with, you can enable "CTs only" if you only want CTs to trigger sounds
• Create cs2d entity env_sound entities and cofigure them for the sounds
• Give your env_sound entities names
• Link the env_sound entities to your trigger_move entities by entering the names of the env_sound entities in the trigger field of the corresponding trigger_move entity

alt Re: Play sound when moving over tile

Mora
User Off Offline

Zitieren
idk if it would work. Just the simple and quick thing:
Idk which sound type you exactly want, so i made two
1
2
3
4
5
6
7
addhook("movetile","_movetile")
function _movetile(id,x,y)
	if (x==121 or x==122) and y==88 then
		-- parse('sv_soundpos '..(x*32)..' '..(y*32)..' "soundfile'..player(id,"team")..'.ogg" '..id)
		-- parse('sv_sound2 '..id..' "soundfile'..player(id,"team")..'.ogg"')
	end
end

You can name your files like:
path/sound1.ogg
and
path/sound2.ogg
and if player team is 1 (tt) will be played sound1.ogg and if player team is 2 (ct) will be player sound 2.ogg

Didnt test it and wont do that.

alt hmm,

Man Of Steel
User Off Offline

Zitieren
@user DC: ,

But its not possible, We can put 2 (Others) Trigger_Move over one tile, i want when (T) Move Those tiles so play other sound and (CT) move those tiles so play other sound.
Not only for Cts, here mainly use a script.
________________

@user Mora: I really didn't understand what really you said, Read My thread for asking script again please.

Thnaks

alt Re: Play sound when moving over tile

Mora
User Off Offline

Zitieren
@user Man Of Steel: i did exactly what you want. You're never fucking concrete with your questions!
There is tested version.

1
2
3
4
5
6
7
addhook("movetile","_movetile")
function _movetile(id,x,y)
	if (x==2 or x==3) and y==2 then
		-- parse('sv_soundpos '..(x*32)..' '..(y*32)..' "soundfile'..player(id,"team")..'.ogg" '..id)
		parse('sv_sound2 '..id..' "soundfile'..player(id,"team")..'.ogg"')
	end
end

Change x and y and decide which sound type you want and then make a path with your sounds. Name them like:
sound1.ogg (or wav, so you'd need to change ogg to wav in lua), it will be TT sound
and sound2.ogg (or wav, you'd again need to change ogg to wav in this lua), it will be CT sound.

alt xD

Man Of Steel
User Off Offline

Zitieren
Compulsory question are below,

@user Mora:, where i will be write Tiles Position?
________________________________

And you means, i change x,y to my Sound path folder name ?, can you give me example, i'm confuse.

Mora_rus hat geschrieben
function _movetile(id,x,y)



Our sounds when cts and tt are move so play sounds are:

For Cts: sfx/!jail sounds/Weapons_OFF.wav
For tt: sfx/!jail sounds/Weapons_OFF.wav

Tile Position, there i wants to play both sound:

121|88

@user Mora: Don't Rage, i'm nab anyways

Please help a nab, but read my compulsory question plz

alt Re: Play sound when moving over tile

Mora
User Off Offline

Zitieren
Version for people with low iq:
1
2
3
4
5
6
7
8
9
10
addhook("movetile","_movetile")
function _movetile(id,x,y)
	if (x==121 or x==122) and y==88 then
		if player(id,"team")==1 then
			parse('sv_sound2 '..id..' "sfx/!jail sounds/Weapons_OFF.wav"')
		else
			parse('sv_sound2 '..id..' "sfx/!jail sounds/Weapons_OFF.wav"')
		end
	end
end

change the path, after
if player(id,"team")==1 then
you see path for TT (5 line), after
else
you see path for CT (7 line)

alt Not working!

Man Of Steel
User Off Offline

Zitieren
@user Mora: Listen, There no playing sound after moving ct and tt. However, there unbelievable silence, what you said about changing some line, in your below quote?

Mora_rus hat geschrieben
change the path, after if player(id,"team")==1 then you see path for TT (5 line), after else you see path for CT (7 line)

alt Re: Play sound when moving over tile

Mora
User Off Offline

Zitieren
Can i say fuck you, please?

IMG:https://i.imgur.com/NYkAjYV.png


your path is incorrect, there should be no "sfx/!jail sounds/Weapons_OFF.wav" but "!jail sounds/Weapons_OFF.wav"

1
2
3
4
5
6
7
8
9
10
addhook("movetile","_movetile")
function _movetile(id,x,y)
     if (x==121 or x==122) and y==88 then
          if player(id,"team")==1 then
               parse('sv_sound2 '..id..' "!jail sounds/Weapons_OFF.wav"')
          else
               parse('sv_sound2 '..id..' "!jail sounds/Weapons_OFF.wav"')
          end
     end
end

alt Clapping

Man Of Steel
User Off Offline

Zitieren
Mr.@user Mora: , Can i say Fuck you too?

You mistake again,
I said you: when Terrorist Move those Tiles so Play "weapons On" sound and Counter-Terrorist Move so play "Weapon off" sound, dude

please change this your mistake///

By the i wants to change Tile Position who i was gave you.

Please Change (x,y)Tile Set Position to 154|102,

If you do that, so over Work is successfully done it.

alt Re: Play sound when moving over tile

Mora
User Off Offline

Zitieren
user Man Of Steel hat geschrieben
Mr.@user Mora: , Can i say Fuck you too?

You mistake again,
I said you: when Terrorist Move those Tiles so Play "weapons On" sound and Counter-Terrorist Move so play "Weapon off" sound, dude

please change this your mistake///

By the i wants to change Tile Position who i was gave you.

Please Change (x,y)Tile Set Position to 154|102,

If you do that, so over Work is successfully done it.


No! Is all over. I'd never watch your threads again. Bye

alt Re: Play sound when moving over tile

script favor
User Off Offline

Zitieren
This should work

1
2
3
4
5
6
addhook('movetile','movetile_hook')
function movetile_hook(id,x,y)
	local s1 = Yourpath/sound
	parse("sv_sound2 "..s1)
	return 1
end

Good luck.

alt Re: Play sound when moving over tile

Rainoth
Moderator Off Offline

Zitieren
If you want to achieve that in map, all you have to do is make trigger_move trigger 2 trigger_if entities both checking different teams. You don't need scripts if its only for that one map.

alt xD...

Man Of Steel
User Off Offline

Zitieren
@user Mora: Okay fine,

@user Masea: : By the way i'm not Using Translator, my English is sucks anyways.

Okay Guys no problem i'm try to solve this problem myself.

Thanks for your works.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht