Jump to content
Dr. Epav

Making a Ambient Speech System

Recommended Posts

Being relatively new in scripting, I was wondering if anybody could help me figure out how to make functions use random values. I currently have a basic system that relies on event-handler. This is what I currently have in a separate script (talkerWest02).

(

//Ambient speech system

//cheers
this addEventHandler ["FiredNear",{say3D "vo_soldier_west_02_cheer01"}];

 

//panic
this addEventHandler ["Explosion",{say3D "vo_soldier_west_02_panic_explode_01"}];


//Death yells and moans
this addEventHandler ["Killed",{say3D "placeholder"}];

)

 

(the description.ext is already hard to read for one full speech tree, and im planning on adding another 7 or 8 (4 for each faction))

This is unfinished script that i have for one soldier. I'm thinking each soldier should have its own speech script that can be executed on initialization. However, I don't know how to randomize the chances of each different line occurring, make sure that when one gets picked no others are allowed to execute for a certain time (around 10 secs, to make sure there's not too much talking), how to mute/replace the current speech (soldiers now say when they are moving, must have been added in a recent patch), and how bad of a impact on performance this might have.

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/selectRandom

and 

https://community.bistudio.com/wiki/selectRandomWeighted

You may want to add a delay to the sound playing with "sleep" for less chatter.

And since event handlers exist in scheduled environment then you don't have to worry.

https://community.bistudio.com/wiki/sleep

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×