Jump to content
Sign in to follow this  
igneous01

Question about FSM - state-condition chain - not working after second

Recommended Posts

So, i finally looked at the BIS example of the conversation system, at first i couldnt figure out how the hell it all went together. But i think i got it now.

i managed to get my sentences working, the conversation menu working for the player, and the ai responding to the first response the player does. Unfortunatly it doesnt keep going for some reason.

fsmchain.jpg

It first begins in the init, where I have the topics added and the first speech started.

{_x setVariable ["BIS_noCoreConversations", TRUE]} forEach [player, Inf_Friend]; //disables core conversations ("hi - ssup" etc.)

player kbAddTopic ["briefing", "kb\briefing.bikb", "", {call compile preprocessFileLineNumbers "kb\briefing_cooper.sqf"}]; //no need for FSM, hence the empty quotes
Inf_Friend kbAddTopic ["briefing", "kb\briefing.bikb", "kb\briefing_miles.fsm"];

Inf_Friend kbTell [cooper, "briefing", "InfFriendTalk01"];

then in the player eventhandler I have the responses:

BIS_convMenu = [];

// if i am close enough to him and he hasnt said anything before, he will first respond
if (_from == Inf_Friend && _sentenceId == "" && !(_this kbWasSaid [_from, _topic, "InfFriendTalk01", 999999])) then {
BIS_convMenu = BIS_convMenu + [["Talk To Him", _topic, "SniperTalk01", []]] // add action to talk to him
};

switch (_sentenceId) do {

// once i have talked to him, he responds with a second statement, i will have to respond again
case "InfFriendTalk02": {
       BIS_convMenu = BIS_convMenu + [["Respond", _topic, "SniperTalk02", []]];
};

// when he finishes talking, choices appear to accept or decline mission
case "InfFriendTalk03": {
	 BIS_convMenu = BIS_convMenu + [["Accept.", _topic, "SniperTalkAccept", []]];
	 BIS_convMenu = BIS_convMenu + [["Refuse.", _topic, "SniperTalkRefuse", []]];
}
};

BIS_convMenu

as you can see, i want it to begin as a manual conversation, but the player has to start it in order to continue. I cant figure out how to make the FSM work like this, so i added the respond there to make things easier for me.

but now the problem.

As soon as he talks first, I respond, then he talks again, I get the option to respond again. However after this nothing happens. even tho in the condition of the fsm (in the pic) it says _sentenceID == "SniperTalk02"

so what is wrong here exactly? Why doesnt it want to move into the next state, perhaps im checking the wrong thing? anybody know?

any help would be really appreciated, been stuck for an hour on this part.

---------- Post added at 19:41 ---------- Previous post was at 18:45 ----------

EDIT***

Never Mind again, looks like i figured it out (i need to stop posting, i always end up figuring it out afterwards)

Needed to use kbWasSaid as condition, now it works no problems. Didnt even know you could add objectives inside as well. thats really convenient!

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  

×