Home   Help Search Login Register  

Author Topic: Start with the same weapon  (Read 1218 times)

0 Members and 1 Guest are viewing this topic.

Offline Aldo15

  • OFP-addict
  • Former Staff
  • ****
    • My OFP missions
Start with the same weapon
« 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?

My OFP stuff
FMF Project by Aldo15. Coming soon.
If in the high school or university, Teachers add a new subject about how to make scripts, missions, for ofp. I'd be number one of my classroom

Walter_E_Kurtz

  • Guest
Re: Start with the same weapon
« Reply #1 on: 06 Aug 2011, 19:46:53 »
At the end of the previous mission use saveStatus to record the player's gear. Then in the Initialization of the new mission use loadStatus to return it to the player's inventory.

However, according to Nominesine you should use deleteStatus to make sure an entry is blank before writing to it with saveStatus.

Code: (exit.sqs) [Select]
deleteStatus "playerState"; player saveStatus "playerState"
Code: (init.sqs) [Select]
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. 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.
« Last Edit: 08 Aug 2011, 15:36:45 by Walter_E_Kurtz »

Offline Aldo15

  • OFP-addict
  • Former Staff
  • ****
    • My OFP missions
Re: Start with the same weapon
« Reply #2 on: 06 Aug 2011, 21:07:00 »
Thanks...

I'll try to make it, but if that script doesn't work, I'll ask you again
My OFP stuff
FMF Project by Aldo15. Coming soon.
If in the high school or university, Teachers add a new subject about how to make scripts, missions, for ofp. I'd be number one of my classroom

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re: Start with the same weapon
« Reply #3 on: 07 Aug 2011, 20:54:35 »
That is all good, except that the code in the init.sqs should be:
Code: [Select]
player loadStatus "playerState"