tydansie 2 Posted April 5 Hey guys, used chatgpt to help create a script for a recon mission, trying to get it to work but i'm unsuccessful so far. What i'm attempting to create is if a player and his team is contacted by the enemy, they will hunt/pursue the team until the play and his team can avoid detection for 5mins. if they team successfully breaks contact and remains un-detected the enemy groups will return to patrolling the area. I'm also wanting to include a visible timer for the player. chatgpt has given me this... I saved it into a "recon.sqf" notepad file. i'm using: [] execVM "recon_mission.sqf"; to call the script in the mission initialization under attributes. any idea how to get it work? Quote // Define mission parameters enemySpawnPos = getMarkerPos "enemySpawn"; playerStartPos = getMarkerPos "playerStart"; intelLocation = getMarkerPos "intelLocation"; searchRadius = 100; // Radius for searching for the player resetDelay = 300; // Delay in seconds before enemy units return to patrolling spawnDelay = 60; // Delay in seconds between enemy spawns // Function to spawn enemy units spawnEnemies = { while {true} do { _enemy = createAgent ["O_Soldier_F", [enemySpawnPos select 0, enemySpawnPos select 1, 0], [], 0, "CAN_COLLIDE"]; sleep spawnDelay; }; }; spawn spawnEnemies; // Create player's unit playerUnit = createAgent ["B_Soldier_F", playerStartPos, [], 0, "CAN_COLLIDE"]; // Define mission tasks taskRecon = playerUnit addTask ["Reconnaissance", "", intelLocation]; taskRecon setTaskState "Assigned"; // Define detection function detectPlayer = { private ["_timerStarted"]; _timerStarted = false; while {true} do { sleep 10; if (alive playerUnit) then { _detectPlayer = playerUnit findNearestEnemy [[], true] < searchRadius; if (_detectPlayer != playerUnit) then { hint "Enemy has detected you! All enemy units are converging on your location!"; { _x move getPos playerUnit; } forEach allUnits; if (!_timerStarted) then { _timerStarted = true; resetTimer = true; } } else { if (_timerStarted) then { _timerStarted = false; } }; }; }; }; spawn detectPlayer; // Timer for resetting enemy units to patrol resetTimer = false; resetCountdown = { private ["_timeLeft"]; while {true} do { if (resetTimer) then { _timeLeft = resetDelay; while {_timeLeft > 0} do { sleep 1; _timeLeft = _timeLeft - 1; hintSilent format ["Returning to patrol in %1 seconds", _timeLeft]; }; if (resetTimer) then { hintSilent "Enemy units are returning to patrol."; { _x move (enemySpawnPos + [random 100 - 50, random 100 - 50, 0]); } forEach allUnits; resetTimer = false; }; }; sleep 1; }; }; spawn resetCountdown; // Handle mission failure handleMissionFailure = { while {true} do { sleep 5; if !(alive playerUnit) then { hint "You were eliminated by enemy forces! Mission failed."; taskRecon setTaskState "Failed"; endMission "END1"; }; }; }; spawn handleMissionFailure; Share this post Link to post Share on other sites