OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Aldo15 on 06 Aug 2011, 16:18:38
-
Hi
I wanna making a campaign, but I have a question: I want to start with weapon of previous mission for example: If I have a M16 and then I take a Ak74. I want to start with that weapon. How do I do that?
-
At the end of the previous mission use saveStatus (http://www.ofpec.com/COMREF/index.php?action=details&id=275&game=All) to record the player's gear. Then in the Initialization of the new mission use loadStatus (http://www.ofpec.com/COMREF/index.php?action=details&id=202&game=All) to return it to the player's inventory.
However, according to Nominesine (http://www.ofpec.com/forum/index.php?topic=27101.msg185926#msg185926) you should use deleteStatus (http://www.ofpec.com/COMREF/index.php?action=details&id=101&game=All) to make sure an entry is blank before writing to it with saveStatus.
deleteStatus "playerState"; player saveStatus "playerState"player loadStatus "playerState"NB. Like init.sqs the game should automatically run exit.sqs at the end of a mission.
If you fancy something more advanced try the WeaponPool Tutorial from Vektorboson's Homepage (http://home.arcor.de/vektorboson/). It's old (dating from December 2002), but shows the functioning of the Resistance campaign with weapons carrying over in the player's group.
Edit: corrected the command in init.sqs - thanks to Raptorsaurus for pointing it out.
-
Thanks...
I'll try to make it, but if that script doesn't work, I'll ask you again
-
That is all good, except that the code in the init.sqs should be:
player loadStatus "playerState"