RealLocutus 3 Posted July 31 Hi, I am working on my next mission and in this one I would like to do it a bit different. The mission should be a Search & Rescue Mission with AI and found Intel giving hints where the captured soldiers are. What I want to do? I want to set up a pulled over civ car with an Police Patrol car and two officers. But they should not be there when the players get there first - they should spawn as soon as they have reached the crash site. The problem is the players should first drive to the point where the last contact was. There they will find some evidence. To get there they have to drive the main road and somewhere take a turn on to a side path. At this point I don't want the above mentioned situation to be there. After they have searched the crash site they have to drive back to the main road. As soon as they get there they will see the police car and the civ - and my goal is that they think "Oh that was not there before, maybe we can ask the police if they have seen something?". So is there a way to spawn a group of vehicles and civilians through a trigger or somhow else? Thanks. Share this post Link to post Share on other sites
Joshua9797 38 Posted July 31 I think the easiest way would be to place everything in the editor beforehand, make it invisible, and disable the simulation. (This will also remove the collision). You can either check the boxes under the attributes or use the Hide/Show module. Then, you can make everything visible again at a certain point via a trigger. You can either embed the code directly in the trigger or link the module to the trigger. If you still want to spawn the vehicles and NPCs, I recommend looking into createVehicle, createUnit, and setDir. _side = east; private _group = createGroup _side; _spawnPoint = [0,0,0]; _myAI = _group createUnit ["O_Soldier_F", _spawnPoint, [], 0, "NONE"]; [_myAI, 300] remoteExec ["setDir"]; 1 Share this post Link to post Share on other sites
JCataclisma 78 Posted July 31 Although I like Joshua's suggestion better, here's a very rough version of what I often use for random situations - but you would of course adjust positioning to something like "Marker" or "trigger" instead of "player". 😉 I am very poorly-skilled regarding triggers and markers, but the code bellow would most likely be in the "Activation field" of a trigger, which could have in the "Condition field" the presets "ANYPLAYER" and "PRESENT". _newPoliceTruck = createVehicle ["B_GEN_Offroad_01_gen_F", [0,0,0], [], 20, "NONE"]; _newPoliceTruck setPos [getPos player # 0, (getPos player # 1) + 30, getPos player # 2]; _newDriver = (createGroup CIVILIAN) createUnit ["B_GEN_Commander_F", [0,0,0],[],0, "NONE"]; (group _newDriver) addVehicle _newPoliceTruck; _newDriver assignAsDriver _newPoliceTruck; _newDriver moveInDriver _newPoliceTruck; _newGuy = (group _newDriver) createUnit ["B_GEN_Soldier_F", [0,0,0],[],0, "NONE"]; _newGuy assignAsCargo _newPoliceTruck; _newGuy moveinCargo _newPoliceTruck; Share this post Link to post Share on other sites
JCataclisma 78 Posted July 31 Ok, I have just tested a more efficient way, and it works nice. I think it will fit better in what you want. First, add a marker (F6) where you want to spawn the police vehicle. In this case, I called it "policeAmbush" (change its name in the code bellow with what you use). Then, I've placed a trigger (F3) on the place the players should reach to activate the surprise car, with these settings: -Type: None -Activation: Any Player -Activation Type: Present ......... -Condition: this ...... -On /Activation: (all the code bellow) _newPoliceTruck = "B_GEN_Offroad_01_gen_F" createVehicle getMarkerPos "policeAmbush"; _newDriver = (createGroup CIVILIAN) createUnit ["B_GEN_Commander_F", [0,0,0],[],0, "NONE"]; (group _newDriver) addVehicle _newPoliceTruck; _newDriver assignAsDriver _newPoliceTruck; _newDriver moveInDriver _newPoliceTruck; _newGuy = (group _newDriver) createUnit ["B_GEN_Soldier_F", [0,0,0],[],0, "NONE"]; _newGuy assignAsCargo _newPoliceTruck; _newGuy moveinCargo _newPoliceTruck; 1 Share this post Link to post Share on other sites
RealLocutus 3 Posted August 1 @JCataclisma - Thanks. Just tested your way and works fine. Only 2 things that are now unclear for me 1) How do I change the rotation of the vehicle - they now spawn heading 0 (north) - I want to adjust it so that it looks like they have stopped a vehicle on the side of the road. I already found out how I can spawn a second vehicle. 2) How can I add a interactable thing that adds a text to the Tasks (or something else) on the map screen? I want that it looks like you can talk to the police driver and ask him something - and he gives you the information as a message to your Tasks or so. (not to the briefing as this is already filled at the start of the mission) Share this post Link to post Share on other sites
Joshua9797 38 Posted August 2 1) With a setDir after createVehicle: _dir = 300; _newPoliceTruck, _dir] remoteExec ["setDir"]; 2) The following adds an action to the driver (mouse wheel menu). When this is selected, a hint will be displayed for all players and the task description will be changed. (Please assign the task a unique ID (variable name), e.g., "TSK_myTask"). if (isServer) then { _newTaskDescription = "new description text"; [_newDriver, ["Talk to", { ["Mission description was changed!"] remoteExec ["hint"]; ["TSK_myTask", [ _newTaskDescription, (("TSK_myTask" call BIS_fnc_taskDescription) select 1), (("TSK_myTask" call BIS_fnc_taskDescription) select 2) ]] call BIS_fnc_taskSetDescription; } , [], -1000, true, true, "","(_this distance _target < 5)"]] remoteExec ["addAction"]; }; (I am currently unable to test the code) Share this post Link to post Share on other sites
Joshua9797 38 Posted August 2 Another idea would be to create a new diary entry: if (isServer) then { [_newDriver, ["Talk to", { ["New Diary added!"] remoteExec ["hint"]; _newDiaryTitle = "New Infos"; _newDiaryText = "My new Diary Text<br/><br/>This is the new Text in a new line"; { [_x, ["Diary", [_newDiaryTitle, _newDiaryText, "\a3\missions_f_oldman\data\img\holdactions\holdAction_talk_ca.paa"], taskNull, "", true]] remoteExec ["createDiaryRecord"]; } forEach allPlayers; } , [], -1000, true, true, "","(_this distance _target < 5)"]] remoteExec ["addAction"]; }; Share this post Link to post Share on other sites
Joshua9797 38 Posted August 2 I just tested the version with the new diary. Unfortunately, you have to attach the AddAction to the vehicle because it's not visible on the driver from the outside. I also added a condition so that the action is no longer visible once it has been executed. Otherwise, you could add an infinite number of diaries. Please use the adjusted code: if (isServer) then { JFR_Diary_created = false; publicVariable "JFR_Diary_created"; [_newPoliceTruck, ["Talk to", { ["New Diary added!"] remoteExec ["hint"]; _newDiaryTitle = "New Infos"; _newDiaryText = "My new Diary Text<br/><br/>This is the new Text in a new line"; { [_x, ["Diary", [_newDiaryTitle, _newDiaryText, "\a3\missions_f_oldman\data\img\holdactions\holdAction_talk_ca.paa"], taskNull, "", true]] remoteExec ["createDiaryRecord"]; } forEach allPlayers; JFR_Diary_created = true; publicVariable "JFR_Diary_created"; } , [], -1000, true, true, "","(JFR_Diary_created == false) && (_this distance _target < 5)"]] remoteExec ["addAction"]; }; 1 1 Share this post Link to post Share on other sites
RealLocutus 3 Posted August 19 Sry for the late answer - I had finally the time to work on my mission again and tested it. Works perfectly fine. Thanks. 1 Share this post Link to post Share on other sites