I've used a common scripts dir long time for my campaigns, for example the PMC Real War is heavily using PMC\ scripts dir setup as all the campaign missions call the various scripts from this dir.
Now I recently realized that when I'm making missions, I hardly do anymore those "dumb editor" missions where you place units and save... For me now its pretty much few units in editor and then init.sqf launches PMC\PMC_war.sqf script which starts to cause horrible war/mission to happen
![Smile :)](./images/smilies/icon_smile.gif)
So for example I have millions of missions with these common script names:
PMC_airsupport.sqf - A10/AH1 air support script.
PMC_artillery.sqf - fake ass artillery script, nothing special.
PMC_BLUFOR_convoy.sqf - looping BLUFOR convoy for PMC_targets locations.
PMC_corpses.sqf - neverending loop to slowly go through the corpses array and when we have reached corpse limit, delete the first corpse.
PMC_killed.sqf - is ran for all killed units, it places the dead body into an corpses array.
PMC_Mandoble_VTE.sqf - VTE suitable setting varibles for Mandoble bombs.
PMC_mlrs.sqf - fake ass MLRS script, nothing special.
PMC_mortars.sqf - fake ass mortars script, nothing special.
PMC_objectives.sqf - creates objective markers/triggers from the PMC_targets array randomly.
PMC_OPFOR_convoy.sqf - looping BLUFOR convoy for PMC_targets locations.
PMC_plotWaypoints.sqf - Plots long distance (>6km) waypoints.
PMC_targets.sqf - creates targets array from "PMC_?" gamelogics.
PMC_weather.sqf - random weather.
PMC_weatherForecast.sqf - weather forecast.
etc the list continues...
Now it would be foolish to keep many mission dirs with these exact same scripts, what if you modify one... how the hell can you remember which mission dir then contains the latest edits, it would be insane to keep track of them as you never would remember to copy the edited mission to all the other dirs. Of course you need to copy the scripts from the common dir, into the mission dir when you release the mission for other people or MP server to use.
So its very good to have the common scripts dir and place my commnly used scripts there.
Now, okay so whats the point here? The point of this topic is how to organize your scripts even more so that one script only is like a function performing one specific task. Its little difficult to explain without any practical example... but lets say you have a helo creation script, well you should not hardcode the starting/spawning location into the script, but to pass it as parameter instead. This way you can launch the helo creation script like:
Code: Select all
[startLocation, targetLocation] execVM "PMC\PMC_Helo_BLUFOR.sqf";
Anyone have any idea what I'm babbeling about here?
![Smile :)](./images/smilies/icon_smile.gif)
Would anyone have any suggestions or feedback, anykind of ideas etc to improve this method, or tell a story how you organize your scripts?
Reference: Root\Scripts\ directory topic.