LUA: Playing a sound for a specific player only

Discussions about ET modding (sdk code, player/weapon modeling)

Moderators: Forum moderators, developers

Post Reply
uber-noob
Posts: 285
Joined: Sat Dec 20, 2003 2:02 pm
Location: Germany
Contact:

LUA: Playing a sound for a specific player only

Post by uber-noob »

Bani, in your answer to the request from RoadKillPuppy to add a et.G_SlotSound() function here: http://wolfwiki.anime.net/index.php/Tal ... ua_Mod_API you said that we can do this with tempentities. I tried it with ETPro 3.2.5, and although I know how to do this in game code I can't get it to work with LUA. There are multiple points of failure:

I can't get ps.origin from the client entity as this field is unknown to LUA.

I can't spawn the tempentity with SVF_SINGLECLIENT or EV_GLOBAL_CLIENT_SOUND as event, and as there seems to be no documentation related to the available events I'm stuck on this.

And I can't set s.eventParm on the tempentity as this fiel is also unknown to LUA.

Just for comparison, this is how it works in game code:

Code: Select all

snd = G_SoundIndex("somesound.wav");
tempent = G_TempEntity( ent->client->ps.origin, EV_GLOBAL_CLIENT_SOUND );
tempent->s.teamNum = (ent->client - level.clients);
tempent->s.eventParm = snd;
This is how I tried it within LUA:

Code: Select all

soundindex = et.G_SoundIndex( "somesound.wav" )
origin = et.gentity_get ( clientNum, "ps.origin" )
tempent = et.G_TempEntity( origin, SVF_SINGLECLIENT)
et.gentity_set( tempent, "s.teamNum", clientNum )
et.gentity_set( tempent, "s.eventParm", soundindex )
What did I wrong, or isn't this possible with the current LUA version?
User avatar
RoadKillPuppy
Posts: 207
Joined: Thu Apr 08, 2004 9:21 am
Location: Belgium!
Contact:

Post by RoadKillPuppy »

I have to bump this one up the ladder as I never got this working for playsound.lua...
User avatar
bani
Site Admin
Posts: 2780
Joined: Sun Jul 21, 2002 3:58 am
Contact:

Post by bani »

i'll poke at this when i get some time. maybe gotenks or im2good wants to make use of their uber lua skillz and try it.
User avatar
=FF=im2good4u
Posts: 3821
Joined: Wed Feb 05, 2003 7:30 am
Location: The Netherlands, HOLLAND
Contact:

Post by =FF=im2good4u »

wel the simpel way is

Code: Select all

et.trap_SendServerCommand(clientnum,"mu_play sound.wav")
ill add it to da wiki whne i remember it :D (i might be muplay instead)

the prob of this simpel way is that the sound get played as a background sound
Phenomenon
Posts: 5
Joined: Wed Jul 05, 2006 3:01 am

Post by Phenomenon »

Have a look at my WolfWiki user page. There is a function that does exactly what you want (et.G_ClientSound()). You must have ETPro 3.2.6 beta test release 1 installed on your server.

have phun
Post Reply