Home   Help Search Login Register  

Author Topic: Detecting Magazines.. in an ammo crate?  (Read 1722 times)

0 Members and 1 Guest are viewing this topic.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Detecting Magazines.. in an ammo crate?
« on: 04 Nov 2007, 16:48:04 »
Hi there

I have a script to run through the magazines a player has and does some other stuff that works fine.

However I need a slightly tweaked script (using same method) of detecting the magazines in an ammo crate.

Magazines _unit works for units that can carry weapons or magazines (eg vehicles or people). However Magazines _crate gives an empty array.

I need a way to detect the magazines and put the types into a array like it does on a player. Is this possible?

Thanks :)

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Detecting Magazines.. in an ammo crate?
« Reply #1 on: 04 Nov 2007, 18:49:46 »
Sadly no.  :(

The commands "getWeaponCargo" and "getMagazineCargo" sadly do not exist as of yet. Maybe if we ask BIS nicely they'd provide us with some?

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Detecting Magazines.. in an ammo crate?
« Reply #2 on: 04 Nov 2007, 19:23:58 »
Thats a shame.

What I have is a cash system, that keeps money as a magazine (custom addon). Each worth different amounts.

I can get the check to constantly check if the money on the player changes, and then add it up into a variable. However now it comes to buy things, theres no easy option about it.
I thought an ammo crate would be best option as the player can put money into it, and then I can count it until full amount is reached.

So, this other 'manual' method would be difficult for amounts. There is multiple combinations of notes you can have. And the player won't have all them

To get 1000 for example.

100 x 10
100x 2 + 200 x 4
200 x 5
500 x 2
500 x 2 + 5 x 100
1000 x 1
Etc...

I would need to check individually each combination and see if it exists?
For big money, it will be difficult (and I mean big amounts of money : 100000000  for one money slot:P).

Would like to know if theres a better way. I don't know if its a good idea to continue my problem in this thread as its irrelevent from the original issue. Maybe I should start a new one?

Thanks for your help :)
« Last Edit: 04 Nov 2007, 19:28:28 by JasonO »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Detecting Magazines.. in an ammo crate?
« Reply #3 on: 04 Nov 2007, 19:47:48 »
You may:
- Store the money as vehicleVariable for player and ammo crate.
- Provide a dialog with different weapons and ammos and their respective costs.
- The player selects a weapon if enough money. The money is transferred to the vehicle var of the crate and substracted from the player.
- Optionally the player may "sell" a weapon and get money in exchange.

This way you dont need any addon. But you'll need a manager of vehicle variables in the server and the clients, as these variables are local.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Detecting Magazines.. in an ammo crate?
« Reply #4 on: 04 Nov 2007, 23:45:38 »
I've been threatening to release SPON Money for a while now, since it has been "nearly" finished for ages. This pretty much does what you need.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Detecting Magazines.. in an ammo crate?
« Reply #5 on: 05 Nov 2007, 14:55:31 »
Its very similar with what we have now. We have cash and a bank system and you can transfer cash into and out of the bank, or transfer some to other players. However, we now wanted to make it so people can bank their cash more often and be limited to what they are carrying. We also wanted you to be able to store cash in cars and dump it somewhere etc. So, Al Simmons sent our mod team some notes which represented different amounts as magazines.

For paying we want a way to remove these magazines from the player, but as I have already said I don't know any easier method of dedecting how someone has 4750 for example. Yes you can check for 47 $100 notes, but what if he has other money? It would need to check every single combination that exists and be manually adedd to the map.
« Last Edit: 05 Nov 2007, 16:00:02 by JasonO »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Detecting Magazines.. in an ammo crate?
« Reply #6 on: 05 Nov 2007, 19:30:01 »
Mandoble's idea to keep the value in an object variable, but only make it into actual money objects when you drop it or put it in cargo/box makes most sense. Personally, I don't really see that much is gained by having physical money objects, especially since it then means your mission requires addons (as well as all the unnecessary burden of having to make change), but if that doesn't bother you...

I realise I mentioned my scripts to you a good while ago, but I can't blame you for working on something for yourselves instead of waiting on a promise ;P Nothing like waiting for an unreleased/unfinished script for getting you nowhere.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Detecting Magazines.. in an ammo crate?
« Reply #7 on: 07 Nov 2007, 16:04:24 »
Well, the script we use is from OFP, and just reworked for ArmA.

Addon's isn't a problem - it's for a mod with a single RPG mission.

Not to sure on vehicleVariable's as of yet. Will have to look into it to get any idea how I can get it to work of how I want.