I tried orderDroidLoc() with dorder_move but it acts the same as dorder_scout when player units are nearby.

NullBot uses DORDER_MOVE all the time when retreating from combat and it works. As far as i remember, on the first level of the campaign you also have scavengers retreating after few of them are dead; you may fail to notice this effect because they die too quickly anyway, but i tested it carefully(c) and it worked.

Yeah... I failed to notice that group management makes units scout and it was overriding my commands. Adding some extra conditions for vtol units did what I needed. I will be able to test and improve the campaign vtol related stuff fully once I finish cam2-c since it is the first mission with vtol rearming pads. That said cam2-2 is completed and works like it should again.

Hmm, the hook system is all broken. I've no idea how or why it worked before.

On game load from a saved game, first the global scope of libcampaign is executed, and hooks are properly installed and original event handlers are stored for future use, then saved script state from the savegame data is poured over, replacing all original events with improperly (de)serialized handlers that existed before the save. Because we cannot serialize javascript functions at all, of course it all breaks.

Is it possible that we used to load savegame data before executing the script's global scope, but a last-minute change in load order has broken everything? Unlikely, but i have no other explanation, because i'm sure it worked, i had saves for all levels and no errors whatsoever.

Anyway, i suggest we move all hook calls from global scope to a function, say __camResetHooks(), implement eventGameInit() and eventGameLoaded() to call it (directly, not as hooks!) in libcampaign, and say in documentation that we forbid user level scripts from defining eventGameInit() or eventGameLoaded() (because it's already defined in the library).

An alternative trick would be to move poorly serializable data out of the way in eventGameSaving() and put it back in eventGameSaved(), but that's tricky.

Also, we could make a native API function like excludeFromSavedGames(string), which would avoid mentioning or serializing the global variable with the given name in save files. The list of such variables itself should be saved. Such function could also be used to decrease savegame size.

Implementing such a function would be trivially simple, because we already maintain such an exclusion list internally. But wouldn't it be better to have a prefix (or private object) you could give globals to avoid them being saved?

findResearch() now has an optional second parameter that gives the player to search for. (I did not test this.)donateObject() can now take a structure as well. It will ignore transfers that would take a player beyond building limits. (I did test this. Seems to work.)

Per wrote:findResearch() now has an optional second parameter that gives the player to search for. (I did not test this.)

Tested and it works.

Finished up 2-6(s). I have moved the extra victory condition callback into its own function so that it can be used in something other than the standard victory (nothing seems to break from what I can tell). And updated the off-world victory code to support extra win conditions also. So I will start with 2-7(s) now.

I will finish off 2-8(s) and the last Beta mission since I am done with 2-7 now. Not quite sure what I will do about the transporter for the Beta escape mission, but it seems like a good challenge.

I have been working on a fix for an ancient research related bug for the campaign (research not granted correctly). This involved reworking the three campaign tech trees into one and using findResearch() to complete all the required research up to the passed in item. Currently, if an enemy gets vehicle-metals-07, they actually only have the benefits of one defense upgrade and not any of the previous upgrades. Similar issues affect the player upon campaign transition as well. Because of this I must convert 3-a to test everything properly.

Missions 2-7/2-8/2-B have been completed. Additionally, I fixed 1-1s "let me win" not letting a player to skip through the power module part by cheating. And made minor fixes for the campaign library.

I am at the last Beta mission. Are droids saved in some list somewhere when the transporter exits the map (would multiple transport loads in the same mission just remove previous ones)? If not, I would have to copy the components/experience and create a copy of the droid upon entering 3-a. From there I guess I would destroy all remaining droids on map when the timer is zero and then play the last video sequence. Also the Collective transporter could drop of scouts (cyborgs/weaker tanks) at their LZ which is unused in the WZ Script version. Should I enable this?