Jump to content

Recommended Posts

Posted

Hey everyone. Here again. With another questions. I'm sure not the last time.

 

I started with Qbasic and am slowly learning c++ and .lua.

 

I was wondering if anyone had a script where;

 

player touch-->call .wav file

 

(I know this is probably the most basic way of saying it, so I hope you all can understand my request.)

-7H3V1RU5

Posted

Leadwerks already comes with the necessary scripts:

 

CollisionTrigger.lua -> attach this to your trigger brush

Noise.lua -> attach this to a pivot - your sound source location on the map

 

Set Playing to false in Noise script and do a Flowgraph link between Trigger brush's Collision() function and Noise script's Play() function.

Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)

Posted

Works great!!!!

 

Now I want to make it to where it only plays that .wav file on the first collision. Is there a code for -stop after play=1? And not sure how to make it only play the sound once.

-7H3V1RU5

Posted

To play a sound once you can set a flag outside of your main loop. In c++ it could be

 

bool soundplayed = false;

 

Then in main loop put if (soundplayed == false)

{

mysound->Play();

soundplayed = true;

}

 

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

×
×
  • Create New...