charliereddog 9 Posted April 6, 2017 I've built a simple MP mission using the 3d editor and am now trying to polish it up a little. The "end" trigger for the last task goes off when 2 static planes are destroyed. What I'd like from that point is: 1) A friendly attack heli to pop up, take out remaining targets and take up a over watch position 2) a chinook containing a squad or more of friendly troops to land and disembark before taking off again 3) fade to black/end mission. Now I can probably do all this very ham-fisted but what is the "correct" way of doing it? Should I have the objects in editor and in game from start of mission? Spawn them in? Your assistance and advice is appreciated. Share this post Link to post Share on other sites
Grumpy Old Man 3551 Posted April 6, 2017 Easiest most beginner friendly way would be to work with triggers and use enableSimulationGlobal once your wanted condition comes true. Place all desired units where you want them to be, can even place the chopper mid-air. Use this in the init.sqf or somewhere else to initialize the function upon mission start: TAG_fnc_wakeUp = { params ["_vehicle"]; _vehicle enableSimulationGlobal false; _vehicle hideObjectGlobal true; waitUntil {simulationEnabled _vehicle}; _vehicle hideObjectGlobal false; {_vehicle reveal [_x,4]} forEach allUnits}; }; Then in both attackchopper and transportchopper init fields put this: this spawn TAG_fnc_wakeUp; Use this inside the triggers onAct that activates after both of your jets are dead: AttackChopper1 enableSimulationGlobal true; TransportChopper1 enableSimulationGlobal true; This way you could place both choppers mid-air, put infantry inside the transport chopper and give both vehicles waypoints with seek and destroy or transport unload where you want them to. Also allows you to create bloated missions with a lot of task branching and complex/long missions with lots of objectives without being too hard on the performance. Cheers 3 Share this post Link to post Share on other sites
charliereddog 9 Posted April 6, 2017 That is precisely what I was hoping for. Clear, concise and directly to the point. Thanks man. Can I just check, I don't need to sync any triggers to waypoints to hold the units there like I would normally? Edit: Should the init line go in the Composition or object init? Share this post Link to post Share on other sites
sarogahtyp 1109 Posted April 7, 2017 13 hours ago, charliereddog said: Should the init line go in the Composition or object init? Which line do u mean? Share this post Link to post Share on other sites
Grumpy Old Man 3551 Posted April 7, 2017 7 hours ago, charliereddog said: That is precisely what I was hoping for. Clear, concise and directly to the point. Thanks man. Can I just check, I don't need to sync any triggers to waypoints to hold the units there like I would normally? Edit: Should the init line go in the Composition or object init? Like sarogahtyp said, what line do you mean? I wrote in my above post what to put where. If you're confused about the function just place it inside the init.sqf. Cheers Share this post Link to post Share on other sites
charliereddog 9 Posted April 7, 2017 Quote 19 hours ago, Grumpy Old Man said: Then in both attackchopper and transportchopper init fields put this: this spawn TAG_fnc_wakeUp; You wrote that. When I add a chopper to the editor, and select it's attributes, I have a Initialization section for Composition, and another one for object. (I assume because it's some sort of group with the crew etc?)....Which one do I put the code in? Does the function need to be run on all clients and the server or just the server? (Still trying to get my head around locality) Share this post Link to post Share on other sites
Grumpy Old Man 3551 Posted April 7, 2017 Can't see anything about composition in the objects attribute window. Are you using mods? Put the lines into the object init field. Just the server should be fine. Cheers Share this post Link to post Share on other sites
johnnyboy 3803 Posted April 7, 2017 19 hours ago, Grumpy Old Man said: This way you could place both choppers mid-air, put infantry inside the transport chopper and give both vehicles waypoints with seek and destroy or transport unload where you want them to. Also allows you to create bloated missions with a lot of task branching and complex/long missions with lots of objectives without being too hard on the performance. Beautiful in its simplicity. I'm adopting this approach going forward. I like placing uints in the editor rather than spawning them, as I can then see they are all exactly where I want them. But with disabling and hiding, I don't get the performance hit. And you've made it simple to trigger when to re-enable them. Thanks GOM! 1 Share this post Link to post Share on other sites
Grumpy Old Man 3551 Posted April 7, 2017 You could even further simplify it by using the actual condition inside the wakeUp function. Lets say you want to wake up after jet1 and jet2 are dead: //function for init.sqf: TAG_fnc_wakeUp = { params ["_vehicle","_condition"]; _vehicle enableSimulationGlobal false; _vehicle hideObjectGlobal true; waitUntil {call _condition}; _vehicle enableSimulationGlobal true; _vehicle hideObjectGlobal false; systemchat format ["Activated %1",typeof _vehicle]; {_vehicle reveal [_x,4]} forEach allUnits; }; //vehicle init field: _sleep = [this,{!alive jet1 AND !alive jet2}] spawn TAG_fnc_wakeUp; Good thing is you can layout waypoints, even for groups inside cargo and it will work just fine. Cheers Share this post Link to post Share on other sites
charliereddog 9 Posted April 7, 2017 Ah. Maybe the composition init is from ACE or CBA? Didn't realise I still had them enabled. Should I do the same with the cargo units or are they automatically taken care of? Share this post Link to post Share on other sites
Grumpy Old Man 3551 Posted April 7, 2017 Every unit inside the chopper will have its simulation disabled, no need to worry about them. Cheers Share this post Link to post Share on other sites
charliereddog 9 Posted April 7, 2017 Sorry, but this is not working for me. The choppers are still there at the beginning of the mission....? Share this post Link to post Share on other sites
Grumpy Old Man 3551 Posted April 7, 2017 My crystal ball is awol, why don't you tell me what exactly isn't working? How do you initialize the function? Where did you spawn the function from? "is not working" is very vague. Working fine here. Cheers 1 Share this post Link to post Share on other sites
charliereddog 9 Posted April 8, 2017 It "is not working" as in, the helicopters are visible. They fly along their way points. The code does absolutely nothing. That kind of "is not working". I did exactly as you said to do. Function in init.sqf, code lines in the init fields of the choppers calling the function. If I replace the call to the function with this enablesimulationglobal false; this hideobjectglobal true; then the helicopter disappears and all is well. All I've then done is add the reveal and hideobjectglobal false commands to the trigger checking for the planes being alive. So I think this works and you have given me the keys to work it out. I just couldn't get your exact method to work. Share this post Link to post Share on other sites
sarogahtyp 1109 Posted April 8, 2017 21 minutes ago, charliereddog said: I did exactly as you said to do. Function in init.sqf, code lines in the init fields of the choppers calling the function. If I replace the call to the function with not calling the function. You have to spawn it. this is essential because the waitUntil will not work propper wit a call. this spawn TAG_fnc_wakeUp; but if u ve found ur own solution then everything should be fine :-) Share this post Link to post Share on other sites
charliereddog 9 Posted April 8, 2017 I didn't mean call as in "call". I used the code as suggested which has spawn. Share this post Link to post Share on other sites