Jump to content
Sign in to follow this  
kdk11

Creating conversations between AI and UNITS

Recommended Posts

I am just wondering if this http://forums.bistudio.com/showthread.php?91875-New-conversation-system-how-to is still the correct way to go about creating conversations between AI and Playable units? Also I would like to know how I would go about putting this system into my mission so that when one task is complete, only then would you be able to speak to the AI for task 2?

Share this post


Link to post
Share on other sites

Use a if statement

_taskResult = taskState taskOne;

if(_taskResult == "Succeeded") then
{
 //add your conversation
};

If you need me to break this down further let me know.

Share this post


Link to post
Share on other sites

I sure do lol I have no idea what I need to do in editor and in any other files outside of the in game editor. I will appreciate your help a lot thanks! :)

Share this post


Link to post
Share on other sites

Okay the command taskState (http://community.bistudio.com/wiki/taskState) returns certain values which are Strings. So by assigning the local variable "_taskResult" to equal the taskState of task object "taskOne" we can test if the task was successful or failed or whatever. This way you can have different dialogs depending on each return variable that taskState gives you. So in the if statement we are checking to see if the the state of taskOne is succeeded. If it is then add your conversation you want.

Share this post


Link to post
Share on other sites

Nope am not grasping that mate. sorry.

Share this post


Link to post
Share on other sites

You don't need to use the conversation system to make AI talk. Simple sideChat commands will suffice. Or even just titleText.

Are you not understanding the code Johnson wrote up there? or something else?

Share this post


Link to post
Share on other sites
Okay the command taskState (http://community.bistudio.com/wiki/taskState) returns certain values which are Strings. So by assigning the local variable "_taskResult" to equal the taskState of task object "taskOne" we can test if the task was successful or failed or whatever. This way you can have different dialogs depending on each return variable that taskState gives you. So in the if statement we are checking to see if the the state of taskOne is succeeded. If it is then add your conversation you want.

I dont grasp this lol I just figured out how when going into a trigger side chat pops up. So now I need to try figure how to make these triggers only fire once a task is complete before it. For examply my squad clear a town. once town is clear. then it becomes possible to talk to AI along with the task changing from clear town to talk to civilians.

Share this post


Link to post
Share on other sites

First things first... you have in place a task that you've created and you set it as SUCCEEDED when the town is clear? Lets assume your task ID is tskClearTown.

There's the command taskState. This command will return a value of the current state of a task. The syntax for this command is:

_currentStateOfTask = taskState tskClearTown;

When the town is clear and we set tskClearTown to SUCCEEDED we use the taskState command it'll return SUCCEEDED. In the example above I save that value to a variable I made up called _currentStateOfTask but we don't need to for your trigger. For your trigger we could just use this as the condition:

taskState tskClearTown == "SUCCEEDED"

That's saying, This trigger is activated when the state of the tskClearTown task is equal to "SUCCEEDED". Or, when the town is clear.

Got all that? If not, ask. :)

Now, the tricky part is what you mean by "possible to talk to AI" because that'll depend on how you're letting them talk to them currently. Can you explain how you want it to happen? Then we can make the pieces fit to that idea.

Edited by kylania

Share this post


Link to post
Share on other sites

//if you want to be constantly checking if a task has been completed use the code below

while {task1 taskState != "Succeeded"} do//creates a loop that will continue until condition is broken
{
     waitUntil {task1 taskState == "Succeeded"};//hold script until the task is completed
     unit sideChat "Put message here";//message that unit says
};

hope that helps

Share this post


Link to post
Share on other sites

taskState "tskClearTown" == "SUCCEEDED"

When I try put that in the trigger I get this "taskstate: Type string, expected Task.

for now I would just like a dialogue conversations between the UNIT and the AI...

Edited by KDK11

Share this post


Link to post
Share on other sites

Oops, forgot it was an object and not the name of the task. Remove the " " around tskClearTown :)

Share this post


Link to post
Share on other sites

would i put this in the same trigger that detects all the opfor are dead?

Share this post


Link to post
Share on other sites

No. That trigger would do any number of things. You could skip all of this and just have that trigger do it all.

OPFOR NOT PRESENT onAct:

[["tskClearTown", "SUCCEEDED"], "BIS_fnc_taskSetState", true, true] spawn BIS_fnc_MP;
[[west, "tsktalkToAI", ["You can talk to your contact about the next part of the mission now!", "Get More Info", "Contact"], aiContactUnit, true], "BIS_fnc_taskCreate", true, true] spawn BIS_fnc_MP;

That will wait till the town is clear, succeed the clear town task and make a new task to talk to an AI named aiContactUnit.

Share this post


Link to post
Share on other sites
[["clr1", "SUCCEEDED"], "BIS_fnc_taskSetState", true, true] spawn BIS_fnc_MP;

error type script expect nothing comes up with the pointer moved inbetween these two

 [[west, "tsktalkToAI", ["You can talk to your contact about the next part of the mission now!", "Get More Info", "Contact"], c1, true], "BIS_fnc_taskCreate", true, true] spawn BIS_fnc_MP;

Share this post


Link to post
Share on other sites

You might have a typo somewhere else? Worked inside a trigger for me with the 0 =

Share this post


Link to post
Share on other sites

[["clr1", "SUCCEEDED"], "BIS_fnc_taskSetState", true, true] spawn BIS_fnc_MP;
0 = [[west, "tsktalkToAI", ["You can talk to your contact about the next part of the mission now!", "Get More Info", "Contact"], aiContactUnit, true], "BIS_fnc_taskCreate", true, true] spawn BIS_fnc_MP;

Like so?

I have placed a few triggers around so that they trigger conversations once you come into distance. However I have like 6/7 triggers for one conversation. Is there a way to put them all into one trigger? I have been using this...

Ghost1 sideChat "Ok men SITREP...."; msg7 = "done"

in the on act and the condition

msg6 == "done"

It works but I know its from Arma 2 and am sure there is a easier/better way to do it then that. As in my mission you have to speak to a few civs to find the one who will give the info up

Share this post


Link to post
Share on other sites

When you put characters in double quotes it makes it a string object. So just take off the double quotes.

Share this post


Link to post
Share on other sites

Instead of all those triggers and variables just use something like a script or even a GameLogic and waypoints. That way you can time the messages and whatever you want. You can even have the waypoints wait for a trigger or value to be set to continue.

Edited by kylania

Share this post


Link to post
Share on other sites

Yeah I have it all setup now. Just trying to figure out how to make them come active after the task "assigned" comes up for searching for intel. then and then only can you speak to them.

Share this post


Link to post
Share on other sites

What exactly is "them" and how exactly are you "talking to them"? :)

Share this post


Link to post
Share on other sites

I just placed triggers around each of the civis that become active when blufor walk near them. Using the arma 2 way I said earlier :)

Share this post


Link to post
Share on other sites

is that sarcastic? lol

---------- Post added at 02:26 ---------- Previous post was at 02:22 ----------

Should I inbox you with a link to my mission and you will be to see? As I am rubbish at trying to describe these things

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
Sign in to follow this  

×