Jump to content
thy_

Showing subtitles only for nearby players

Recommended Posts

Oi, pessoal, tudo bem com vocês?

 

I have a question around BIS_fnc_EXP_camp_playSubtitles. We can find out many topics here about how can insert subtitles in a NPC (unit) to using directSay (your_audio_file_name.ogg) but I have no clue how set my trigger to show the subtitles only for players around the NPC.

 

Context: if my player gets close less than 10 meters from npc, that one will say "Oi, tudo bem com você?" to me, and the subtitle should show up with "Hello there, how are you?". There are at least 3 players in different positions around a huge map. 

 

How can I show the subtitles only for close ones?  

 

// It's a simple trigger none/none

//condition

(alive npc01) && {(player03 distance npc01) < 10};

//on act

npc01 directSay "npc01_speech01"; 
["JOHN DOE","Hi there, how are you?",0] spawn BIS_fnc_EXP_camp_playSubtitles;

 

IMPORTANT: the perfect solution should show the subtitles up without the editor to set which specific player(s) will see the subtitles.

 

Share this post


Link to post
Share on other sites

Do you want the subtitles to show over and over again or just once?

 

Share this post


Link to post
Share on other sites

once. 

Share this post


Link to post
Share on other sites

In code you can use simple waituntil

 


 

waituntil { sleep 1; ((alive npc01) && ((player03 distance npc01) < 10)) };


//on act 


npc01 directSay "npc01_speech01"; 

["JOHN DOE","Hi there, how are you?",0] spawn BIS_fnc_EXP_camp_playSubtitles;

 

 

Hope that helps

Share this post


Link to post
Share on other sites
6 hours ago, gc8 said:

In code you can use simple waituntil

 

Thanks for your answer, but I am not sure if I explained well what I need. I didn't know waituntil was allowed to determine which players will see the subtitles. 

 

Let me try but not sure if that will works as I need. 

Share this post


Link to post
Share on other sites

When I put...

waituntil { sleep 1; ((alive npc01) && ((player03 distance npc01) < 10)) };

...in trigger condition, an error comes. waitUntil and Sleep don't work directly into a trigger, I guess. So I tried the whole code line in a file.sqf and called it in my trigger condition, but a generic error happens. 

Share this post


Link to post
Share on other sites
11 hours ago, thy_ said:

When I put...


waituntil { sleep 1; ((alive npc01) && ((player03 distance npc01) < 10)) };

...in trigger condition, an error comes. waitUntil and Sleep don't work directly into a trigger, I guess. So I tried the whole code line in a file.sqf and called it in my trigger condition, but a generic error happens. 

 

that code should be in .sqf file like init.sqf for example. the code "waits there" until player03 is close and then continues further down in the script

 

if you want to use trigger just put the line without waituntil to the trigger condition:

 

((alive npc01) && ((player03 distance npc01) < 10))

 

  • Like 1

Share this post


Link to post
Share on other sites
On 7/29/2020 at 4:11 AM, gc8 said:

that code should be in .sqf file like init.sqf for example. the code "waits there" until player03 is close and then continues further down in the script

 

So, player01, player02 and player04, those will be 1km far from the talkative npc01 wouldn't see the subtitles, right?

Share this post


Link to post
Share on other sites
11 hours ago, thy_ said:

 

So, player01, player02 and player04, those will be 1km far from the talkative npc01 wouldn't see the subtitles, right?

 

if you run the code on single client only that client will see the subtitles. Or at least to my knowledge the subtitles command isn't broadcasted to all clients. if you run the code on server you have to tell the client to show the subtitles

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

×