iV - Ghost 50 Posted November 26, 2017 I'm not sure how to create my question... What I wanna do: I wanna spawn my own created tasks via script. Every task has his own file (Girna_T1.sqf, ...). The objects, markers and units are created in the 3den editor and by ALiVE. Till now I have 11 files. My XXX.sqf's look approximately like this: // CHECK SERVER if (!isServer) exitWith {}; // VARIABLES iV_taskAssigned = format [localize "STR_iV_TaskAssigned", localize "STR_iV_TaskTitle_ComSystems"]; iV_taskSucceeded = format [localize "STR_iV_TaskSucceeded", localize "STR_iV_TaskTitle_ComSystems"]; iV_taskFailed = format [localize "STR_iV_TaskFailed", localize "STR_iV_TaskTitle_ComSystems"]; // TIMEOUT sleep 3; // CREATE TASK, ASSIGN AND SET STATE if (alive ([5251, 5027] nearestObject 32009) && alive ([5251, 5027] nearestObject 31966) && alive ([5251, 5027] nearestObject 31939)) then { // CREATE TASK [west, // 0: Task owner(s) ["Mike26_T2"], // 1: Task name [task name, parent task name] [localize "STR_iV_TaskDesc_ComSystems", localize "STR_iV_TaskTitle_ComSystems", "Marker_Mike26_3"], // 2: Task description ["description", "title", "marker"] "Marker_Mike26_3", // 3: Task destination false, // 4: Task state (or true to set as current) 3, // 5: Task priority (Higher priority is selected first) false, // 6: Show notification (default: true) "destroy", // 7: Task type as defined in the CfgTaskTypes true // 8: Shared (default: false) ] call BIS_fnc_taskCreate; // ASSIGN TASK assignedTask = true; publicVariable "assignedTask"; ["TaskAssigned", ["", iV_taskAssigned]] call BIS_fnc_showNotification; // TRIGGER FOR SUCCEEDED END _triggerSucceeded = createTrigger ["EmptyDetector", [5251, 5027, 0], true]; _triggerSucceeded setTriggerArea [0, 0, 0, false, 0]; _triggerSucceeded setTriggerActivation ["NONE", "", false]; _triggerSucceeded setTriggerTimeout [8, 8, 8, false]; _triggerSucceeded setTriggerType "NONE"; _triggerSucceeded setTriggerStatements [ // CONDITIONS "!alive ([5251, 5027] nearestObject 32009) && !alive ([5251, 5027] nearestObject 31966) && !alive ([5251, 5027] nearestObject 31939)", // ON ACTIVATION "['Mike26_T2', 'Succeeded', false] call BIS_fnc_taskSetState; ['TaskSucceeded', ['', iV_taskSucceeded]] call BIS_fnc_showNotification; assignedTask = false; publicVariable 'assignedTask';", // ON DEACTIVATION "" ]; } else { hint localize "STR_iV_TaskNotAvailable"; assignedTask = false; publicVariable "assignedTask"; }; I wanna make all with localize & stringtable so I can make original (english), english and german. My problem: Till now my biggest problem is that every time I created more than one task my iV_taskSucceeded will be overwritten from the latest XXX.sqf and the notification is wrong. I'm no good coder and I can't get it working. I try now for hours. Has somebody an idea how to fix that? Share this post Link to post Share on other sites
HazJ 1289 Posted November 27, 2017 Make your variables local. Add _ in front of them, like so: _iV_taskAssigned _iV_taskSucceeded _iV_taskFailed Share this post Link to post Share on other sites
iV - Ghost 50 Posted November 27, 2017 This is a way I've tried too. My notification is then only "any" and not "The task "1%" is completed." Share this post Link to post Share on other sites
HazJ 1289 Posted November 27, 2017 This is all done in the same file, correct? EDIT: Sorry, I just realised you are setting that inside a trigger on act. Change iV_taskSucceeded in the on act part to: ['TaskSucceeded', ['', format [localize ""STR_iV_TaskSucceeded"", localize ""STR_iV_TaskTitle_ComSystems""]]] call BIS_fnc_showNotification; Why are you using format with just strings? Usually you'd have it return something like so: format ["Name: %1", name player]; Share this post Link to post Share on other sites
iV - Ghost 50 Posted November 27, 2017 I had hoped we can connect all with a unique taskID which were defined in the top of every XXX.sqf. And in the createTask and the Trigger should only be the placeholder that grab the conditions from the XXX.sqf. In the best case the trigger should be spawned by a seperate file (..\functions\iV_fnc_spawnTrigger.sqf) so we can reduce the filesize. Maybe something like this: _taskID = "CampRogain_T1"; _taskAO = "CampRogain"; _taskMarker = format ["Marker_%1", _taskAO]; _taskType = "documents"; _createTaskConditions = "alive Info1_CampRogain"; _createSucceededTriggerConditions = ... // CREATE TASK, ASSIGN AND SET STATE if (_createTaskConditions) then { // CREATE TASK [west, ["_taskID"], "_taskMarker", false, 3, false, "_taskType", true] call BIS_fnc_taskCreate; ... Share this post Link to post Share on other sites
iV - Ghost 50 Posted November 28, 2017 Now I'am working with a taskID. Example (Kamino_T1.sqf): // CHECK SERVER if (!isServer) exitWith {}; // VARIABLES private ["_taskID", "_taskMarker", "_taskTitle", "_taskDescription", "_taskMarkerType"]; _taskID = "Kamino_T1"; _taskMarker = "Marker_Kamino_1"; _taskTitle = format [localize "STR_iV_TaskTitle_ComSystem", localize "STR_iV_Kamino"]; _taskDescription = localize "STR_iV_TaskDesc_ComSystem"; _taskMarkerType = "destroy"; // TIMEOUT sleep 3; // CREATE TASK, ASSIGN AND SET STATE if (alive ([6438, 5347] nearestObject 29623)) then { // CREATE TASK [west, [_taskID], [_taskDescription, _taskTitle, _taskMarker], _taskMarker, false, 3, false, _taskMarkerType, true] call BIS_fnc_taskCreate; // ASSIGN TASK assignedTask = true; publicVariable "assignedTask"; ["TaskAssigned", ["", _taskTitle]] call BIS_fnc_showNotification; // TRIGGER FOR SUCCEEDED END _triggerSucceeded = createTrigger ["EmptyDetector", [6438, 5347, 0], true]; _triggerSucceeded setTriggerArea [0, 0, 0, false, 0]; _triggerSucceeded setTriggerActivation ["NONE", "", false]; _triggerSucceeded setTriggerTimeout [8, 8, 8, false]; _triggerSucceeded setTriggerType "NONE"; _triggerSucceeded setTriggerStatements [ // CONDITIONS "!alive ([6438, 5347] nearestObject 29623)", // ON ACTIVATION "['Kamino_T1', 'Succeeded', false] call BIS_fnc_taskSetState; ['TaskSucceeded', ['', format [localize ""STR_iV_TaskSucceeded_ComSystem"", localize ""STR_iV_TaskTitle_atKamino""]]] call BIS_fnc_showNotification; assignedTask = false; publicVariable 'assignedTask';", // ON DEACTIVATION "" ]; } else { hint localize "STR_iV_TaskNotAvailable"; }; And the part from the stringtable.xml looks like this: <Key ID="STR_iV_TaskTitle_ComSystem"> <Original>%1 - Radio tower</Original> <English>%1 - Radio tower</English> <German>%1 - Sendeturm</German> </Key> <Key ID="STR_iV_TaskDesc_ComSystem"> <Original>There is a communication system in the area of operations (AO).<br/>Find and destroy them for us.</Original> <English>There is a communication system in the area of operations (AO).<br/>Find and destroy them for us.</English> <German>Im Einsatzgebiet (AO) befindet sich eine Kommunikationsanlage.<br/>Finden und zerstören Sie sie für uns.</German> </Key> <Key ID="STR_iV_TaskSucceeded_ComSystem"> <Original>The radio tower %1 was destroyed.</Original> <English>The radio tower %1 was destroyed.</English> <German>Der Sendeturm %1 wurde zerstört.</German> </Key> <Key ID="STR_iV_atKamino"> <Original>at Kamino</Original> <English>at Kamino</English> <German>bei Kamino</German> </Key> My problem: The notificazion is still not right. Lokks like he don't use format in the trigger. The notification is exact: "The radio tower was destroyed." but should be: "The radio tower at Kamino was destroyed." Share this post Link to post Share on other sites