Hello all!
Now, I understand questions pertaining to "loadStatus and weaponpools" and such are advanced, why I'm writing here. Also I generally feel confident I can answer most questions on my own only through consulting the COMREF and hands-on testing, but this thing has me seriously stumped. And frustrated. Here's the basic layout:
I'm modding Tacrod's excellent ADCS 0.1 BETA system (I believe you can find it in the User Missions section in the official forums), which is basically a dynamic campaign system that randomly assigns a mission type and then randomly generates the location/enemy/friendly forces etc. Bareboned, but very nicely done.
Anyway, I've wanted to add some more persistant elements to this, and I have some larger plans in the pipeline as well, but the first things I wanted to do was just change it so that instead of, as in the default scripts, getting a full squad spawned on me at the beginning of every mission, I'd have a persistent squad that gains experience and to which I can assign weapons and roles and so on. Alright, weaponpool up and working no problem, but the persistance is an issue.
Basically I use init.sqs and exit.sqs. I haven't the scripts with me right now, but the basic layout is as follows: Each soldier in the squad is named U1->U8, the player being u0. In the init.sqs of every mission in the campaign, I simply loadStatus every member, and then run a short snippet removing all the units who are dead :
? {!alive _x : deleteVehicle _x} forEach [array of u0-u8 here]
And in the exit.sqs I first deleteStatus everyone
{deleteStatus _x}foreach [array of status string-names here]
and then saveStatus them again.
Now, I found some problems with the deleteStatus command : essentially it didn't seem to work as I wanted it to, so I removed it, and the mission played well for a while : people killed didn't turn up in the next mission, ammo and weapons were stored. And then it just randomly stopped working. Some of my units returned for no reason, sometimes all of them returned, sometimes their custom experience levels stopped working, their ranks didn't transfer over...blargh. Basically all the signs of "the load/saveStatus commands aren't functioning".
Once I get home I can post you the mission and you can see it for yourself, but the very heart of my question is simple:
loadStatus = loads saved status, which includes health levels, rank, skill level, name, weapon loadout + possible other things (confirmed)
saveStatus = saves all of the above into "string name", accessible with loadStatus.
deleteStatus = removes the "string name" and the saved status from the objects.sav or wherever, WITHOUT for that automatically removing any already loaded statuses!
So, essentially, all I should need to have a unit carrying over from mission to mission would be:
init.sqs
unit1 loadStatus "unit1"
?!alive unit1 : deleteVehicle unit1
exit.sqs
deleteStatus "unit1"; unit1 saveStatus "unit1"
The above is essentially my code. Why doesn't it work, always? It works sometimes, sometimes it doesn't. It works for one or two missions, then stops. ARGH!
It's driving me nuts, quite frankly.
Thanks anyway!
Wolfrug out,