Jump to content
Jubal Savid

How to make Ai talk to player

Recommended Posts

Here is what I am wanting. Right now a man will ride in on a motor cycle and greet the players say

rider: "You have prayed and God has answered!"

player1: "What have our brought us?" 

Rider "Four grenades".

I have successfully gotten the rider to say the sentence but his name, Baschir, does not appear when he says it. 

It reads "Independent: You have prayed and God has answered!" but i want it to say "Baschir: You have prayed and God has answered!"
 

any tips?

  • Like 1

Share this post


Link to post
Share on other sites

Hello there Jubal Savid  !

 

#First post ?!

Welcome to Bis Forums !

 

First , the best is to post your code or method that you are using , in order to understand how to understand the issue and help you better.

 

To get the name , you need to use a format and add  the : name

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

Share this post


Link to post
Share on other sites

Im using the trigger method 

I have a unit called "Baschir" who is coded with "setgroupID ["Baschir"]"

He drives into a trigger that has "Baschir in thisList" in the condition field

The activation field is says Baschir globalChat "You have prayed and God has answered!"

  • Like 1

Share this post


Link to post
Share on other sites

Globalchat and more

unitName, globalChat "chatText"

 

player, globalChat "This is what I want to say!";

player, globalChat "What?";

 

Save it in a file named.     mychat.sqf  (NOT .TXT)

Put this file in the root of your mission save folder.

 

Set trigger Activated by Blufor.

In activation field of trigger put.

nul = execVM "mychat.sqf";

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites

So I have it in the missions file, but its saying "file not found" in game when the trigger activates

 

Share this post


Link to post
Share on other sites
1 minute ago, Jubal Savid said:

"file not found"

 

The file must be a .sqf and

check the name of the file , in the trigger , it should be with the extention .sqf , as the example from major-stiffy.

Share this post


Link to post
Share on other sites

its there, now i put it in the missions folder, but i didnt put it in any specific part of the missions folder.

Or did you mean the mission files itself example "tak.zargabad" 

Spoiler

 

Share this post


Link to post
Share on other sites
24 minutes ago, Jubal Savid said:

Or did you mean the mission files itself example "tak.zargabad" 

Yes. If the folder name is tak.zargabad then inside that folder should be a mission.sqm

 

Put the mychat.sqf inside the same folder.

Share this post


Link to post
Share on other sites

Did you save the mission in the editor called tak.zargabad ? I assume you are making a mission on the zargabad terrain. Search your c: drive for your mission as you saved it.  tak.zargabad      ???

If you did there will be a mission.sqm file inside the saved mission folder on your C drive.

 

Quote

I don't see a mission.sqm anywhere in the mission file


Then you either didn't save your mission in the editor or your looking in the wrong location for the folder.

 

 

 

 

Share this post


Link to post
Share on other sites
1 minute ago, Jubal Savid said:

None of my missions are in file format

 

are you searching in your documents , arma 3 profile ?

Share this post


Link to post
Share on other sites

I put the file in but its giving me a different error. its a gibberish error so i dont know what its called

Share this post


Link to post
Share on other sites
10 hours ago, Jubal Savid said:

its giving me a different error

 

Write or add a picture with the error.

Share this post


Link to post
Share on other sites
14 hours ago, major-stiffy said:

Globalchat and more

unitName, globalChat "chatText"

 

player, globalChat "This is what I want to say!";

player, globalChat "What?";

These will not work at all, comma has no place in .sqf syntax, not with any amount of beer.

 

Using sideChat you will only see the group ID and the index of the group member (Alpha 1-5 etc.), not the name.

Using globalChat you will only see the side (Civilian) in front of the message.

 

The only proper way using the vanilla system for having AI chatter with visible names in white font (directChat doesn't exist for some weird reason, but I'm past that...) is to use kbTell.

 

A quick showcase to this is to define a basic function so messages are properly transmitted for MP:

//init.sqf or wherever you seem fit
GOM_fnc_transmitMessage = {
params ["_from","_to","_sentence"];

[_from,["Randomsentence", "protocol.bikb"]] remoteExec ["kbAddtopic",0];
[_from,[_to, "Randomsentence", "Randomsentence", ["Randomsentence", {}, _sentence, [] ]]] remoteexec ["kbtell",0];
true
};

//protocol.bikb in mission root
class Sentences
{

		class randomsentence
	{
		text = "%Randomsentence";
		speech[]={%Randomsentence};
		class Arguments
		{
			class Randomsentence {type = "simple";};
		};
	};
};

class Arguments{};
class Special{};
startWithVocal[] = {hour};
startWithConsonant[] = {europe, university};

//to make one unit speak to another:
_talk = [baschir,player,"Hello"] call GOM_fnc_transmitMessage

You can also give the unit first and last names, using setName:

this setname ["Abdullah Abd-Allah","Abdullah","Abd-Allah"]

I believe there's also a more recent function to display chat in the lower center of the screen, no idea, believe it's different from titleText or so...

 

Cheers

  • Like 2

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

×