Jump to content
Official BF Editor Forums
Sign in to follow this  
PiratePlunder

Python To Play In Game Sounds

Recommended Posts

We need to use a sound to alert all players when something happens in a gamemode - i could send everyone a rank event, but that would seem overkill. I thought maybe i could spawn an effect bundle with a sound in it, but when i've tested it it never worked (havent yet whacked up the halfvolumedistance etc in case its playing at 0.0/0.0/0.0 when i create the object) even though the effect did.

I know that theres rcon invoke playsound - but how the hell you would set it up (what parameters does it use, do you need to set up all the properties used in a template sound etc), has anyone done it?

Share this post


Link to post
Share on other sites

How about creating a map-wide ambient sound with its volume set to 0 ? Upon your ( dramatic :P ) event , you could pump up its volume through python. If the name of the sound is the same in all maps , that would probably be the easiest way .

Share this post


Link to post
Share on other sites

The way to do this is to spawn a PCO which immediately self-destructs (due to having a high critical damage) and attaching an effect to this PCO's destruction. Give the effect a sound which is not 3d and has huge cull distances. Then your python just needs to create a spawner at the origin for this object, and the server takes care of the rest.

Share this post


Link to post
Share on other sites

Fantastic - that worked perfectly. And to overcome strange sounds occuring at round start, i just set the volume to 0 in the tweak and then up it in the python.

Its all working like a dream. Not often you get to say that working with BF2.

Edited by PiratePlunder

Share this post


Link to post
Share on other sites

May I ask, what a PCO is? Then maybe I will know what to do, to get the same results :D .

Share this post


Link to post
Share on other sites

Thank you. But maybe an example of a Player controlled object? Is it a staticobject, or a object like a gun (where its controllable) ?

Sorry, and thanks for the fast reply. :D

Dogbox

Share this post


Link to post
Share on other sites

Look at some code ( something which you should have done weeks ago :P ) - everything a player can enter is a PCO = 'PlayerControlObject' . Vehicles , stationary guns and of course the soldier body itself, although its role is a bit different from the other stuff.

Share this post


Link to post
Share on other sites

Thank you for that explanation! :D

Dogbox

Share this post


Link to post
Share on other sites

My idea to play a in game sounds with python is: Create bundle and effect bundle. The effect bundle start the in game sound

and the effect bundle is the child of bundle.

Is this work?

How to spawn it in game with python? (to spawn object I'm always use gameLogic.createObject [objectname])

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...