Jump to content
Sign in to follow this  
sweofp

Campaign memory

Recommended Posts

Hello!

I wonder what and were to write if I want to keep information like surviving squad members, weapons and ammo from mission to mission. And if it´s possible to keep like destroyed houses and cars and so on from mission to mission.

Thanks

Share this post


Link to post
Share on other sites

http://www.ofpec.com/COMREF/letterA.php#addWeaponPool

http://www.ofpec.com/COMREF/letterA.php#addMagazinePool

http://www.ofpec.com/COMREF/letterS.php#saveStatus

http://www.ofpec.com/COMREF/letterL.php#loadStatus

http://www.ofpec.com/COMREF/letterS.php#saveVar

Keeping every little detail is impossible unless you build the campaing inside a single mission.

Keeping track of a squad, a few vehicles and some key buildings is quite simple. Basicly, save status of everything you want to in the end of a mission and restore at the beginning of the next.

Share this post


Link to post
Share on other sites

Thank you!

But were will this go? Do I exec these from within the mission or in the descr. file?

Is there an exampel?

Share this post


Link to post
Share on other sites

They are scripting commands so they go into scripts or triggers. For example, when the conditions to end the mission are met, run a script to save stuff:

1 exec "savestuff.sqs"

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">bridge1dmg = getDammage object 123123

saveVar "bridge1dmg"

savingDone=true

Then the init.sqs for all the following missions (init.sqs is run automaticly):

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">object 123123 setDammage bridge1dmg

Share this post


Link to post
Share on other sites

saveStatus etc save their info into a file called "objects.sav".

each campaign keeps its own seperate copy (OFP\users\<PROFILE>\saved\campaigns\objects.sav), and single missions save in a temporary folder.

I was investigating using saveStatus and saveIdentity for a unit reduction script. They are able to save hundreds of status's and identities. The problem is each save/load freezes the game for ~1/100th of a second which was annoying when done during the mission. I have no idea what the limit of saved variables could be.

You could try saving the damage of each building using the saveVar and a variable name linked to the object ID number. You could create a looping script that checks the typeOf each object to ensure it is a building (with many different class names), then check if its dammage is 1. This would reduce the number of variables that need saving to a maximum of several thousand (assuming this number is possible), but would take a long time for the script to run.

To load them, create a script that retrieves the object ID number from the variable name itself, then setDammage the appropriate saved variable.

The problem with this method (brute force) is you are checking every object on the map, which would have to waste alot of time. You could build a list of building IDs, but that would be boring smile_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×