Play3r 147 Posted September 29, 2018 (edited) hello anyone I'm making a SP game and i want the player to contact a oldman for info in a town, when the player get in 2 mtr from the oldman i want the oldman to look at the player and the SUBTITLES is shown on screen but i want the script to jump to the subtitle in the EXITWITH if the player runs in to the oldman one more time. i have a trigger with this type: none ACT: none Repeat is ticked \/ COND :TRUE ACT : 0 = oldman spawn { waitUntil {sleep .1; player distance2d oldman < 2}; oldman lookAt player; oldman disableai "move"; _handle = execVM "TALK\oldman.sqf"; }; In my OLDMAN.SQF : // _handle = execVM "TALK\oldman.sqf"; if (oldmandone < 0) exitWith {_handle = [] spawn {["OLDMAN", "I have already given you my information.."] spawn BIS_fnc_showSubtitle};}; <-- i want this to be told to player if he turns to the oldman again in mission _handle = [] spawn {["OLDMAN", "Hello sir, if you go into the barn you will find"] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "some things that might could help you with your mission."] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "It is all we got, if you need anything else,"] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "you have to find it somewhere else."] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "Good luck, i have work to do.."] spawn BIS_fnc_showSubtitle}; sleep 5; oldmandone = oldmandone + 1; oldman enableai "move"; I think i have to make it run in a loop so it can do the exitwith but i don't know how to do it. can it be done in the trigger. i have tried with [ at the beginning by the if (oldmandone <0 and a ] call BIS_fnc_loop; but no joy Any one with a idea how to solve this problem for me. Edited September 29, 2018 by Play3r spell check Share this post Link to post Share on other sites
CSLALUKI 30 Posted September 29, 2018 No need to do it with triggers, remove them.. just put this into your init.sqf for example: // dialog will be shown only once, when you meet old man for the first time wasHere = 0; [] spawn { while {wasHere != 1} do { waitUntil {(player distance2d oldman)<2}; oldman lookAt player; oldman disableai "move"; wasHere = wasHere + 1; //the condition "wasHere != 1" will throw false next time _handle = [] spawn {["OLDMAN", "Hello sir, if you go into the barn you will find"] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "some things that might could help you with your mission."] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "It is all we got, if you need anything else,"] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "you have to find it somewhere else."] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "Good luck, i have work to do.."] spawn BIS_fnc_showSubtitle}; }; // some other code if wasHere is 1 => if the player come back }; Cheers! Share this post Link to post Share on other sites
pierremgi 4886 Posted September 29, 2018 just change for: 0 = [] spawn { if (!isNil "oldmandone") exitWith {["OLDMAN", "I have already given you my information.."] spawn BIS_fnc_showSubtitle}; ["OLDMAN", "Hello sir, if you go into the barn you will find"] spawn BIS_fnc_showSubtitle; sleep 8; ["OLDMAN", "some things that might could help you with your mission."] spawn BIS_fnc_showSubtitle; sleep 8; ["OLDMAN", "It is all we got, if you need anything else,"] spawn BIS_fnc_showSubtitle; sleep 8; ["OLDMAN", "you have to find it somewhere else."] spawn BIS_fnc_showSubtitle; sleep 8; ["OLDMAN", "Good luck, i have work to do.."] spawn BIS_fnc_showSubtitle; oldmandone = true; oldman enableai "move" }; Share this post Link to post Share on other sites
Play3r 147 Posted September 30, 2018 15 hours ago, CSLALUKI said: No need to do it with triggers, remove them.. just put this into your init.sqf for example: // dialog will be shown only once, when you meet old man for the first time wasHere = 0; [] spawn { while {wasHere != 1} do { waitUntil {(player distance2d oldman)<2}; oldman lookAt player; oldman disableai "move"; wasHere = wasHere + 1; //the condition "wasHere != 1" will throw false next time _handle = [] spawn {["OLDMAN", "Hello sir, if you go into the barn you will find"] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "some things that might could help you with your mission."] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "It is all we got, if you need anything else,"] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "you have to find it somewhere else."] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "Good luck, i have work to do.."] spawn BIS_fnc_showSubtitle}; }; // some other code if wasHere is 1 => if the player come back }; Cheers! Hi CSLALUKI your script works , but there is something wrong it writes the line _handle = [] spawn {["OLDMAN", "I have already given you my information.."] spawn BIS_fnc_showSubtitle}; when the WASHERE still is 0 after the first text part,, i have changed a little part in the script : // dialog will be shown only once, when you meet old man for the first time wasHere = 0; _talk = [] spawn { while {wasHere != 1} do { waitUntil {(player distance2d oldman)<2}; oldman lookAt player; oldman disableai "move"; _handle = [] spawn {["OLDMAN", "Hello sir, if you go into the barn you will find"] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "some things that might could help you with your mission."] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "It is all we got, if you need anything else,"] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "you have to find it somewhere else."] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "Good luck, i have work to do.."] spawn BIS_fnc_showSubtitle}; oldman enableAI "move"; sleep 10; wasHere = wasHere + 1; //the condition "wasHere != 1" will throw false next time }; // some other code if wasHere is 1 => if the player come back _handle = [] spawn {["OLDMAN", "I have already given you my information.."] spawn BIS_fnc_showSubtitle}; }; i have given the oldman a chance to get away with the sleep 10 command but the last line is still shown with the first contact, do i need some kind of {player distance2d oldman } command before the subtitle command, i have tried with the ""waitUntil {(player distance2d oldman)<2}; "" command but i get a error Share this post Link to post Share on other sites