Weapon-Fetish 26 Posted June 17 Hello , im working on a Script that spawns ai , let them loot all cargos at base marker und return it back to its base. Homever i do fail on executing the sript over a addaction. here is the Code im using // initPlayerLocal.sqf // Funktion zum Hinzufügen der Aktion player addAction ["Set Base Marker", { [] remoteExecCall ["setBaseMarker.sqf", 2]; }]; // Aktion nach Respawn wieder hinzufügen player addEventHandler ["Respawn", { player addAction ["Set Base Marker", { [] remoteExecCall ["setBaseMarker.sqf", 2]; }]; }]; // setBaseMarker.sqf if (isServer) then { if (markerExists "Base") then { deleteMarker "Base"; }; createMarker ["Base", position player]; "Base" setMarkerPos (position player); "Base" setMarkerShape "ICON"; "Base" setMarkerType "mil_dot"; "Base" setMarkerColor "ColorRed"; sleep 1; // Kurze Verzögerung, um sicherzustellen, dass der Marker erstellt wurde so the addaction appears , but the sqf doesent run after it , i debugged allready with hints Share this post Link to post Share on other sites
major-stiffy 279 Posted June 17 try { null = execVM "setBaseMarker.sqf" } remoteExec ["call", 0]; 2 Share this post Link to post Share on other sites
Weapon-Fetish 26 Posted June 17 i tryed . But didnt got it to work . i now noticed in Sp that its throwing a syntax error at line 4 missing ) in setBaseMarker.sqf i dont get it tbh , gpt4 also wasnt a help Share this post Link to post Share on other sites
major-stiffy 279 Posted June 17 Can you show your script here? Some one may be able to see the error and fix it. Share this post Link to post Share on other sites
Weapon-Fetish 26 Posted June 17 oh ah i reffered to setBaseMarker.sqf . but yeah i actually try to fix the rest of my spawn_and_loot.sqf . arma throws also a syntax error in spawn_and_loot.sqf at line 139 saying a ; is missing......wich is not that drives me crazy here the code //spawn_and_loot.sqf // Parameter private _spawnMarkers = ["Raiderbase1", "Raiderbase2", "Raiderbase3"]; // Liste der Spawn-Markierungen private _targetMarkerName = "Base"; // Name des Markers, zu dem die KI laufen soll private _minUnits = 1; // Minimale Anzahl der zu spawnenden Einheiten private _maxUnits = 15; // Maximale Anzahl der zu spawnenden Einheiten private _lootRadius = 200; // Radius um den Zielmarker, in dem gelootet wird private _storageRadius = 400; // Radius um den Zielmarker, in dem der Loot verstaut wird private _repeatMinTime = 3600; // Minimum-Zeit in Sekunden bis zum Wiederholen des Skripts (1 Stunde) private _repeatMaxTime = 10800; // Maximum-Zeit in Sekunden bis zum Wiederholen des Skripts (3 Stunden) // Liste der möglichen Einheitenklassen mit Min und Max Anzahl private _unitClasses = [ ["O_Soldier_F", 1, 5], // Standard-Soldaten ["O_medic_F", 0, 2], // Medics ["O_officer_F", 0, 1], // Offiziere ["O_Soldier_AR_F", 0, 3], // Automatische Schützen ["O_Soldier_LAT_F", 0, 2] // Leichte Panzerabwehrschützen ]; // Liste der Kisten und Fahrzeuge (inklusive CUP) private _lootableTypes = [ // Vanilla Arma 3 Kisten "Box_NATO_Support_F", "Box_East_Ammo_F", "Box_IND_Ammo_F", "Box_FIA_Ammo_F", "B_CargoNet_01_ammo_F", "Land_CargoBox_V1_F", "Box_NATO_Support_F", // Vanilla Arma 3 Fahrzeuge "B_Truck_01_box_F", "O_Truck_03_covered_F", "I_Truck_02_covered_F", // CUP Kisten "CUP_USBasicAmmunitionBox", "CUP_USSpecialWeaponsBox", "CUP_USVehicleBox", "CUP_B_RUBasicAmmunitionBox", "CUP_B_RUSpecialWeaponsBox", "CUP_B_RUVehicleBox", "CUP_B_GERBasicAmmunitionBox", "CUP_B_GERSpecialWeaponsBox", "CUP_B_GERVehicleBox", "CUP_B_US_BasicAmmunitionBox", "CUP_B_US_SpecialWeaponsBox", "CUP_B_US_VehicleBox", "CUP_B_CZBasicAmmunitionBox", "CUP_B_CZSpecialWeaponsBox", "CUP_B_CZVehicleBox", // CUP Fahrzeuge "CUP_B_MTVR_Repair_USA", "CUP_B_MTVR_Ammo_USA", "CUP_B_MTVR_Refuel_USA", "CUP_B_HMMWV_Unarmed_USA", "CUP_B_HMMWV_M2_USA", "CUP_B_HMMWV_TOW_USA", "CUP_B_HMMWV_Crows_M2_USA", "CUP_B_HMMWV_Crows_MK19_USA", "CUP_B_HMMWV_Ambulance_USA", "CUP_O_UAZ_Unarmed_RU", "CUP_O_UAZ_MG_RU", "CUP_O_UAZ_AGS30_RU", "CUP_O_UAZ_SPG9_RU", "CUP_O_GAZ_Vodnik_RU", "CUP_O_GAZ_Vodnik_BPPU_RU", "CUP_O_BTR60_RU", "CUP_O_BTR70_RU", "CUP_O_BTR80_RU", "CUP_O_BRDM2_RU", "CUP_O_BRDM2_ATGM_RU", "CUP_B_LR_Transport_CZ_D", "CUP_B_LR_MG_CZ_D", "CUP_B_LR_Special_CZ_D", "CUP_B_LR_Transport_GB_W", "CUP_B_LR_MG_GB_W", "CUP_B_LR_Special_GB_W", "CUP_I_Datsun_PK", "CUP_I_Datsun_PK_Random", "CUP_I_Datsun_4seat" ]; // Funktion zum Spawnen der Gruppe private _spawnGroup = { params ["_spawnMarker", "_unitClasses", "_minUnits", "_maxUnits"]; private _spawnPos = getMarkerPos _spawnMarker; private _group = createGroup east; // Setze hier die gewünschte Seite (east, west, independent) private _unitCount = floor random (_maxUnits - _minUnits + 1) + _minUnits; // Zufällige Anzahl zwischen min und max // Erstelle eine Liste der zu spawnenden Einheiten private _unitsToSpawn = []; { private _unitType = _x select 0; private _minCount = _x select 1; private _maxCount = _x select 2; private _count = floor random (_maxCount - _minCount + 1) + _minCount; // Zufällige Anzahl zwischen min und max für diese Einheit for "_i" from 1 to _count do { _unitsToSpawn pushBack _unitType; }; } forEach _unitClasses; // Mische die Liste und wähle die benötigte Anzahl von Einheiten aus _unitsToSpawn = _unitsToSpawn call BIS_fnc_Shuffle; _unitsToSpawn resize _unitCount; // Spawne die Einheiten { _group createUnit [_x, _spawnPos, [], 0, "FORM"]; } forEach _unitsToSpawn; _group }; // Funktion zum Looten von Kisten private _lootCrates = { params ["_group", "_radius"]; private _units = units _group; private _centerPos = position (leader _group); private _crates = nearestObjects [_centerPos, _lootableTypes, _radius]; { private _unit = _x; { _unit action ["Gear", _crate]; } forEach _crates; } forEach _units; }; // Funktion zum Bewegen der Gruppe zu einem Marker und zurück private _moveAndLoot = { params ["_group", "_targetMarker", "_lootRadius", "_spawnMarker", "_storageRadius"]; private _targetPos = getMarkerPos _targetMarker; private _spawnPos = getMarkerPos _spawnMarker; _group move _targetPos; waitUntil { sleep 1; {_x distance _targetPos < 50} count (units _group) == count (units _group) }; [_group, _lootRadius] call _lootCrates; _group move _spawnPos; waitUntil { sleep 1; {_x distance _spawnPos < 50} count (units _group) == count (units _group) }; // Loot in Container verstauen private _storagePos = _spawnPos; private _containers = nearestObjects [_storagePos, _lootableTypes, _storageRadius]; { private _unit = _x; private _inventory = assignedItems _unit + uniformItems _unit + vestItems _unit + backpackItems _unit; { private _item = _x; _unit removeItem _item; (_containers select 0) addItemCargo [_item, 1]; } forEach _inventory; } forEach units _group; // Gruppe in Verteidigungsmodus versetzen _group setBehaviour "AWARE"; _group setCombatMode "RED"; _group setFormation "STAG COLUMN"; _group setSpeedMode "LIMITED"; {_x doMove _spawnPos} forEach units _group; leader _group setTask ["TASK_SENTRY", "SENTRY"]; }; // Funktion zum Erstellen eines Markers für die Gruppe private _createGroupMarker = { params ["_group", "_markerName"]; private _marker = createMarker [_markerName, position (leader _group)]; _marker setMarkerType "mil_dot"; _marker setMarkerColor "ColorRed"; [] spawn { while {true} do { private _group = _this select 0; private _markerName = _this select 1; if (count (units _group) > 0) then { _markerName setMarkerPos position (leader _group); } else { deleteMarker _markerName; breakOut "loop"; }; sleep 1; }; } [_group, _markerName]; }; // Hauptskript private _mainFunction = { params ["_spawnMarkers", "_targetMarkerName", "_minUnits", "_maxUnits", "_lootRadius", "_storageRadius"]; while {true} do { private _spawnMarker = _spawnMarkers select floor random count _spawnMarkers; private _group = [_spawnMarker, _unitClasses, _minUnits, _maxUnits] call _spawnGroup; // Erstelle einen Marker für die Gruppe _createGroupMarker = [_group, format ["Group_%1", _spawnMarker]] call _createGroupMarker; // Bewege die Gruppe zur Zielmarkierung, lootet Kisten, kehrt zum Spawn zurück [_group, _targetMarkerName, _lootRadius, _spawnMarker, _storageRadius] call _moveAndLoot; // Wartezeit bis zur nächsten Ausführung des Skripts private _waitTime = floor random (_repeatMaxTime - _repeatMinTime + 1) + _repeatMinTime; sleep _waitTime; }; }; // Starte das Hauptskript [_spawnMarkers, _targetMarkerName, _minUnits, _maxUnits, _lootRadius, _storageRadius] call _mainFunction; Share this post Link to post Share on other sites
major-stiffy 279 Posted June 18 Good luck, all of that is above my pay grade. Share this post Link to post Share on other sites
Weapon-Fetish 26 Posted June 18 Can be Closed now . i worked all my way trough it together with gpt 4 and got it working. now some fine tune and release . But thanks for reading guys ! Edit, well ..nope its Impossible . It dosent follows its own Syntax , trohwing Syntax Errors even If the spelling ist correct and when i follow and add ; where it Not has to bee it Breaks the variables Share this post Link to post Share on other sites
pierremgi 4851 Posted June 18 That's the case, it seems better to rework all codes, starting by a short description about what you want to do. Example: marker commands are global, why remote execute them? markerExists is not a command. What should be spawned, where, when?... Share this post Link to post Share on other sites