Erwin23p 34 Posted April 30, 2020 Hello, I have a problem with some fsm from a mission, I've got an fsm that executes another one and I've got no problem sending some variables to the new fsm but I'm trying to retreive a variable and it just doesn't work. That's what I got: Spoiler _fsmName = "tasks\" + _mission + ".fsm"; _fsm = [_crew, _crewLeader, _basePositions, _usedBases, _groups, _missionNumber] execFSM _fsmName; //and a waituntil the _fsm is completed, then I got this: _fsmResult = _fsm getFSMVariable "_result"; The executed fsm works right and all that but when I try to use _fsmResult with an if statement it tells me that it's not defined. and in the end statement of the other FSM I've got this: _result = true; or false. I've been using this function in other missions and it used to work well, now it just doesn't work. Share this post Link to post Share on other sites
opusfmspol 282 Posted April 30, 2020 Have you tried to use setFSMVariable ? Share this post Link to post Share on other sites
Erwin23p 34 Posted April 30, 2020 Yes, just after executing the fsm: _fsm = [_crew, _crewLeader, _basePositions, _usedBases, _groups, _missionNumber] execFSM _fsmName; _fsm setFSMVariable ["_result", false]; Share this post Link to post Share on other sites
opusfmspol 282 Posted April 30, 2020 Not tested, but try this: _fsm setFSMVariable ["_handle", _fsm]; _fsm setFSMVariable ["_result", false]; and inside the running _fsm: _handle setFSMVariable ["_result", true]; 1 Share this post Link to post Share on other sites
opusfmspol 282 Posted April 30, 2020 Are the set variables still available after an FSM has completed (reached end state)? I've never tested for that. 1 Share this post Link to post Share on other sites
Erwin23p 34 Posted April 30, 2020 I thought about that, I'm going to try acceding a variable while in the middle of the fsm. Thanks I will try it. Share this post Link to post Share on other sites
Erwin23p 34 Posted May 1, 2020 Working well now, I defined the variable a state box just before the end box, put a timer condition between and used this to make the "outer" fsm notice that the _fsm is finished: { _x setVariable ["startTasking",true,true]; } forEach (units _crew); _result = true; _t = time + 10; on the outer fsm I got this in the precondition: if (time > _timer) then { _startTrigger = _crewLeader getVariable ["startTasking",false]; _timer = time + 5; }; then a condition box seeking _startTrigger true. Thanks a lot! easy solution yet I was so blind... Share this post Link to post Share on other sites