Home   Help Search Login Register  

Author Topic: Unlocking weapon crates based on kills/money  (Read 1346 times)

0 Members and 1 Guest are viewing this topic.

Offline punisher

  • Members
  • *
Unlocking weapon crates based on kills/money
« on: 06 Aug 2007, 22:28:52 »
The Gimp clan- pushing the limits of OFP
http://www.youtube.com/user/Pigdogmeat

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Unlocking weapon crates based on kills/money
« Reply #1 on: 06 Aug 2007, 23:22:55 »
Not that you need to lock or unlock anything, just add pistols to the crate or not. AFAIK there is no way to lock crates BTW.

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re: Unlocking weapon crates based on kills/money
« Reply #2 on: 07 Aug 2007, 01:44:16 »
As mandoble said, you just add the appropriate equipment to the crates when their money reaches a certain level using the addWeaponCargo command.
To do money then you will just need to create a variable such as missionMoney and add or remove the amount of money as you please. To count kills is a little harder. You probably will have to add an event handler to every target or OPFOR in the mission and see weather the player is the killer or not. Then you add to a variable such as myKills.
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

Offline punisher

  • Members
  • *
Re: Unlocking weapon crates based on kills/money
« Reply #3 on: 07 Aug 2007, 13:35:41 »
sounds complicated, im not sure i could do that. Maby an example?
The Gimp clan- pushing the limits of OFP
http://www.youtube.com/user/Pigdogmeat

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re: Unlocking weapon crates based on kills/money
« Reply #4 on: 07 Aug 2007, 17:18:45 »
Sure.

Make a couple triggers, and in the Condition lines put:
(PUNISH_MONEY > 1000)
(PUNISH_MONEY > 2500)
(PUNISH_MONEY > 10000)
etc. for all levels of money you want to unlock.

In the on Activation lines put:
unlock1_action = unlock1_crate addAction ["Unlock Pistols","unlock1.sqs"]
unlock2_action = unlock2_crate addAction ["Unlock MP5","unlock2.sqs"]
unlock3_action = unlock3_crate addAction ["Unlock M4","unlock3.sqs"]
etc.

In the on Deactivation lines put:
unlock1_crate removeAction unlock1_action
unlock2_crate removeAction unlock2_action
unlock3_crate removeAction unlock3_action
etc...

Then the scripts will look like the following:
Code: [Select]
;unlock1.sqs
;For Operation Flashpoint.

PUNISH_MONEY = PUNISH_MONEY - 1000

unlock1_crate addWeaponCargo ["Beretta",2]
unlock1_crate addMagazineCargt ["BerettaMag",8]

player removeAction unlock1_action
exit
Just change the unlock1 parts to the appropriate ones for each unlockable weapon, and change the weapons and magazine names. The names are in the comref if you're not sure. You just save those scripts in the mission directory.

Then, just have triggers in the on activation lines add money like this:
PUNISH_MONEY = PUNISH_MONEY + 1100
etc

And make sure that you initalized PUNISH_MONEY = starting amount at the start of the mission somewhere.
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

Offline punisher

  • Members
  • *
Re: Unlocking weapon crates based on kills/money
« Reply #5 on: 13 Aug 2007, 14:03:22 »
thanks for the help and your time we got the money working :D
The Gimp clan- pushing the limits of OFP
http://www.youtube.com/user/Pigdogmeat

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re: Unlocking weapon crates based on kills/money
« Reply #6 on: 14 Aug 2007, 15:09:52 »
That's great mate! :clap:
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Unlocking weapon crates based on kills/money
« Reply #7 on: 21 Aug 2007, 16:55:19 »
Take a look at the Weapons Buy Menu at the bottom of this page in the ED/Scripts/Weapons.
urp!