Home   Help Search Login Register  

Author Topic: RUG Inventory 0.6 BETA  (Read 17880 times)

0 Members and 1 Guest are viewing this topic.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
RUG Inventory 0.6 BETA
« on: 24 Mar 2008, 23:17:02 »
Edit: Version 0.6 BETA out now!
Edit: Version 0.5 BETA out now!


Heh. I just keep churning these weird little things out don't I?  :D

From the readme blurb:

Quote
RUG Inventory v.0.6

This script-suite allows you to add a vehicle-variable driven and very customizable RPG-like inventory system to your
missions. Create your own items and inventories, and then freely move items from one inventory to the other - even allowing dropping it on the ground! Currently in BETA for testing. Not tested in MP, no support as of now.

Use: Try the test mission and read some of the comments on some of the scripts and functions to get a deeper understanding as to how things work. Currently does not contain all planned features, but that shouldn't limit the usability as of now.

Important when porting to your own mission is to copy the custom dialog (RUG_Controls.h and RUG_Inventory.h) as well as the #includes in the description.ext to your own description.ext. Do not move any of the scripts that are inside the RUG_Inventory folder anywhere else, and keep the RUG_Inventory folder in the main folder of your mission (I.e. MissionName\RUG_Inventory).

How to create your own items : see the description in the test mission's comments (specifically TestInventory.sqf).

How to create your own inventories : see the description in the test mission's comments (specifically RUG_Inventory.sqf and TestInventory.sqf, as well as Init.sqf)

How to easily add, remove and transfer items: use RUG_EasyAdd, RUG_EasyRemove and RUG_EasyTransfer. See their script headings for usage!

Advanced use : Use your imagination, and check out the test mission for some ideas.

Future implementation:
- Possible smarter use of the "leave on ground" inventory, currently leaves a permanent inventory on the ground + weaponholder if any item is ever dropped on the ground.
- Integrated shopping system. [DONE]
- Better-looking dialog. [Partly done]
- Better support and implementation of the default "use" action. [DONE]
- More example missions to showcase the scripts.
- More functions for more in-depth item/inventory-manipulation. [Mostly done]
- MP-testing if possible
- SP-campaign compatibility testing.
- Proper commenting of scripts!! [Mostly done]

Version history:

v.0.6 BETA
- Improved RUG_EasyAdd and RUG_EasyTransfer by adding an optional true/false switch for checking if there is space: they now output false and do not move any items if check is set to true and there is not enough size to add/transfer the items
- Added new function, RUG_Inventory_InitVehicleVars, which inits the necessary vehicle variables (RUG_Inventory_Size and RUG_Inventory_Name) independently of the RUG_Inventory.sqf script where they used to be initialized.
- Removed some more nil= appearances from some of the template items. Oops
- Added a "RUG_Inventory_Core.Intro" map to the package -> only contains the scripts and init files, and has properly named and ordered template items so as to avoid the clutter of the other test mission. For advanced users (um, that's me, I guess).
- Added some comments to the HireMan.sqf and BuyVehicle.sqf scripts -> note to users, there are many MUCH better ways of doing this, but since the scripts are there...

v.0.5 BETA
- Added RUG_EasyAdd, RUG_EasyRemove and RUG_EasyTransfer functions: allows for simplified item adding/removing/transfering of items. Also added custom resources and a sound to notify of items being added/removed using these commands. Instructions for use in their headers.
- Moved the bulk of the global variable initialization to RUG_Inventory_Init.sqf which should now be run to init the inventory system.
- Added a text to the ammo bag inventory screen instead of the standard one.
- Made all executions of RUG_Inventory.sqf and RUG_Inventory_Trade.sqf within the scripts use spawn instead of execvm.
- Added more comments to various scripts and added some more instructions to the in-game items.
- None of the scripts that require the string name of the item are case sensitive any longer.
- Added RUG_Inventory_Monitor.sqf script which simply checks for certain items that need to immediately affect a unit when they are added/removed. Currently used to switch the map/compass etc. on and off.
- Removed the nil = in front of a bunch of scripts. Oops for redefining engine commands!
- Fixed a problem by which the Your ammo inventory could be filled with size 0 items which would then be lost. Now you cannot put any items of any size inside an inventory with a size of 0.
- Minor fixes in various scripts etc.
- Changed the look of the inventory screen slightly - old look is available in ORIGINALRUG_Inventory.h if you want to revert to it :) New look has more space for general messages and slightly more space for descriptions, as well as a slightly larger picture.
- Added green (positive balance) and red (negative balance) text to the Balance number when trading

v.0.4 BETA
- Added examples for how to purchase stuff such as soldiers and vehicles
- Added a working system for transfering magazines between gear and inventory
- Fixed some minor issues with some of the existing items

v.0.3 BETA
- Added MANY new items + pictures, showcasing the various uses of the inventory system
- Spiffed up the dialog again slightly by adding item pictures
- Changes to Take/Drop/Use default actions : placing a code within the [{}] of the spawn will make that code launch if the action is successfully completed (take/drop/use). The code will have the following parameters : _this select 0 = _curValue (amount dropped/taken/used), _curSel (item dropped/taken/used), _i (number that indicates how many times the scripts have run - they will run once for every case of _curvalue. Useful for limiting the script running to just one for instance).
- Added integrated gear-menu functionality - simply press "G" while in inventory mode to access the gear menu of the object (if applicable), and then close the gear menu to return to the inventory. Still researching possibility of doing this in a reverse order.
- Added functionality to transfer all types of guns (main, secondary and pistols) from inventory to gear (via a special item). Also left some guns in the ammo box to showcase this.
- Added comments here and there

V.0.2 BETA
- Added a working trading system, invoked simply by changing the action to "RUG_Inventory_Trade.sqf".
- Changes to the way items are created due to the trading system - now requires a third element in the 9th entry : value
- Small changes to all scripts to accomodate for the trading system.
- Slight visual overhaul of the inventory screen - still pending further improvements.
- Added new function : RUG_Inventory_ftotalvalue : returns total value of inventory
- Added new scripts : RUG_Inventory_Trade.sqf and RUG_Inventory_TradeCheck.sqf
- Added ability to flag items undroppable/takeable/sellable/buyable (with default scripts).

v0.1 BETA
- Initial release

Wolfrug
24.3.2008

Hope you'll enjoy it! Sorry about the slightly soulless demo mission!

Wolfrug out.
« Last Edit: 27 Nov 2010, 10:22:34 by Wolfrug »
"When 900 years YOU reach, look as good you will not!"

Offline Loyalguard

  • Former Staff
  • ****
Re: RUG Inventory
« Reply #1 on: 25 Mar 2008, 09:45:41 »
Looks nice Wolfrug.  I'll check it out tonight.

Offline LeeHunt

  • Former Staff
  • ****
  • John 21:25
Re: RUG Inventory
« Reply #2 on: 26 Mar 2008, 17:04:20 »
i'll check it out this weekend- finally got my PC going again!

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory
« Reply #3 on: 26 Mar 2008, 18:23:02 »
Yaay. :) I'll get back to working on that shopping/bartering system ASAP. I think I'll make it a bit like in the Fallout games : money would just be another inventory item, and have a base value of 1 (or more!), and all other items would also have their own values (as determined by the mission maker) : one could then for instance trade in one Beef Jerky (Tm) worth 5 + one Rock Shaped Like Abraham Lincoln (worth 15) plus 20 Shiny Pebbles (worth 1 each) for a Hula Hoop (worth 35) and Random Junk (worth 5). Or somesuch :D

Then when it comes to RPG-stuff like skills affecting values and whatnot...well...I'll just try to build it in a way to make it easy enough to implement as well... :)

Do give comments.

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

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.2 BETA
« Reply #4 on: 30 Mar 2008, 23:19:58 »
Updated. Check first post. :)

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

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.3 BETA
« Reply #5 on: 07 Apr 2008, 22:40:44 »
Updated again, check first post. Changelog for 0.3 :

Quote
v.0.3 BETA
- Added MANY new items + pictures, showcasing the various uses of the inventory system
- Spiffed up the dialog again slightly by adding item pictures
- Changes to Take/Drop/Use default actions : placing a code within the [{}] of the spawn will make that code launch if the action is successfully completed (take/drop/use). The code will have the following parameters : _this select 0 = _curValue (amount dropped/taken/used), _curSel (item dropped/taken/used), _i (number that indicates how many times the scripts have run - they will run once for every case of _curvalue. Useful for limiting the script running to just one for instance).
- Added integrated gear-menu functionality - simply press "G" while in inventory mode to access the gear menu of the object (if applicable), and then close the gear menu to return to the inventory. Still researching possibility of doing this in a reverse order.
- Added functionality to transfer all types of guns (main, secondary and pistols) from inventory to gear (via a special item). Also left some guns in the ammo box to showcase this.
- Added comments here and there

;) Hey ed.depoters, are any of you actually checking this out or did you just SAY you were going to? Comments and suggestions for improvements much appreciated!

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

Offline Nexolate

  • Members
  • *
  • The lurking S.T.A.L.K.E.R.
Re: RUG Inventory 0.3 BETA
« Reply #6 on: 07 Apr 2008, 22:53:54 »
Just got the 'content deleted' message, just so you know.
"JOHNS_BUGGYS" ring any bells? I'm gonna go look it up now.

EDIT: Got the Addon, tried the test mission.
Based on what I can see, this script has limitless potential. I adore S.T.A.L.K.E.R. and this reminds me a lot of it, albeit a bit less refined (atm obviously).
I personally couldn't get the Rifle/Launcher Holsters to work, no idea why. Other than that, everything worked pretty much as expected.

Some day I'd love to see a S.T.A.L.K.E.R.-ish mission using this script, would be truly awesome.
« Last Edit: 07 Apr 2008, 23:22:55 by Nexolate »
You'll only notice me when it's too late.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.3 BETA
« Reply #7 on: 08 Apr 2008, 08:02:56 »
Baargh! Damned buggys. I use no addons in the mission, except I might have put one into it at some point. >_< I'll re-upload the .rar file sans the "addon requirement". Bloody 'ells.

As to the rifle/launcher holsters : they both require quite a bit of space in your inventory (something like 10 each); if you haven't got enough space to put it there, it will tell you in the general text area and nothing will happen. Also if the weapon you're swapping to (say, from a carbine to a full-sized sniper rifle) is larger than the space you've got it will also refuse the swap. Might've been it? :)

Haven't played Stalker, although I know I probably should! I doubt it's ever going to be possible to create an as refined inventory system with abstract items for ArmA as it would be for a game designed to have one, since pretty much everything would have to be made from scratch. But maybe, with enough patience, it could be done. :)

Thanks for the test! Gonna re-upload the file now >_< damned addons.

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

Offline Nexolate

  • Members
  • *
  • The lurking S.T.A.L.K.E.R.
Re: RUG Inventory 0.3 BETA
« Reply #8 on: 08 Apr 2008, 08:23:44 »
Baargh! Damned buggys. I use no addons in the mission, except I might have put one into it at some point. >_< I'll re-upload the .rar file sans the "addon requirement". Bloody 'ells.
Yeah I've had that happen to me loads of times, I put one Unit in for a small period of time then the whole thing throws shit at me. >_>

As to the rifle/launcher holsters : they both require quite a bit of space in your inventory (something like 10 each); if you haven't got enough space to put it there, it will tell you in the general text area and nothing will happen. Also if the weapon you're swapping to (say, from a carbine to a full-sized sniper rifle) is larger than the space you've got it will also refuse the swap. Might've been it? :)
That sounds right, I was carrying a fair load at the time so that was probably it.

Haven't played Stalker, although I know I probably should! I doubt it's ever going to be possible to create an as refined inventory system with abstract items for ArmA as it would be for a game designed to have one, since pretty much everything would have to be made from scratch. But maybe, with enough patience, it could be done. :)
Well yeah, it has a system similar to that where you can trade items among other Stalkers and aquire new items and ammunition from dead Stalkers or from secret "stashes". I know that creating a system of similar standard would require a lot of work, but atm you're pretty close! In my eyes, this sort of thing is the only way to incorporate RPG features without sucking the life out of the gamer. ;P

Anyways, hope this helps. I'll try out the next version, when it comes out.
Nexo.
You'll only notice me when it's too late.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.3 BETA
« Reply #9 on: 08 Apr 2008, 17:22:22 »
Didn't know that about Stalker - sounds like a cool game. :) I originally got the inspiration to create these scripts from agamoth's freedom fighter/resistance/post apocalypse units, so I guess the source is sort of the same in a way!

And yes, I'm a firm believer of making missions for scripts as well, and since I'm primarily a mission maker and only secondly a scripter, that's what I'm planning on doing. At some point in the future. :D Inbetween I have to design some kind of "character statistics" screen or somesuch to get that last little bit of RPG-feel. Then we've got an inventory, a conversation system (there're some floating about) and a stat screen...

But yes: this is just a Beta preview anyway, but I thought I'd get it out there in case someone ELSE were interested in it. Hopefully future versions will be more editor-friendly as well (i.e., more comments, better script-readability etc).

Anyone else?

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

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.4 BETA
« Reply #10 on: 22 Apr 2008, 12:55:26 »
Beta 0.4 out. :) Now has an example to show how you can use the inventory to hire mercenaries/buy vehicles, either ready-placed ones or dynamically createVehicle/United, as well as an item-script that allows you to transfer certain items of ammo from your "gear" to your "inventory". This is limited to one-shot items such as grenades, flares, rockets etc. since there's no reliable way to tell how much ammo is in your current mag. However you can have stores sell any kind of magazine.

Haven't yet gone through the scripts to clean them up and comment them, and I still want to fix a fairly major issue with the way the filler script works, but as far as I can tell this thing just plain...works. :D

Comments and suggestions welcome - especially aesthetic ones!

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

Offline ModestNovice

  • Members
  • *
Re: RUG Inventory 0.4 BETA
« Reply #11 on: 07 May 2008, 04:01:48 »
Thank You!!!!!!!  :clap:

have been looking for how to do this!!
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline ModestNovice

  • Members
  • *
Re: RUG Inventory 0.4 BETA
« Reply #12 on: 07 May 2008, 23:57:11 »
I have one question. I am using SPON Money for my mission. Is there a way I can substitute SPON Money's money values in? (HELP)

It also overwrites my current SPON Money and my paychecks script, it says my account balance  is 0 in my hint???
before it would say $8000. :dunno: [it seems to only be a little bug at the beginning then the next hint it sorts itself out  :scratch: Works Fine.]

[edit]
figured out how to remove default item  :-[ :D
still having problems with the money issue though.
« Last Edit: 08 May 2008, 06:04:35 by DaChevs »
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.4 BETA
« Reply #13 on: 08 May 2008, 06:04:13 »
Hello there DaChevs! Glad you're finding some use for my script! No need to double-post though :D You'll make hoz and h- nervous...

One caveat, which is pretty big if I'm guessing right what you want to use these for : there's no integrated multiplayer support as of yet, i.e., all inventory transactions at the moment are AFAIK entirely local. Since they depend on simple vehiclevariables though, there's no reason why someone more mp-savvy than myself couldn't make it work in MP as well. I guess :)

I've thought about how to implement things such as SPON money and other "variable-based" systems directly into RUG Inventory, but I didn't bother adding a function for that just yet since it's still in Beta (and likely to stay so until I get back to mah ArmA computer). However, using the functions already available in it there should be some possibility of making it work.

Since it's a lot harder however to manipulate RUG Inventory than a simple variable-based money system, it's probably for the best to change the SPON money values depending on the amount of "money" objects in the units RUG Inventory. So, for instance, have a simple looping script that runs every x seconds, and changes the SPON money values according to the amount of say "Money" in any one person's inventory. You can check how much of an item a unit is carrying using the RUG_Inventory_fstackcheck.sqf function (read script header for details on usage, one of the return values will be the total amount in the stack, which you can produce using select from the result of the call. Note that the functions are usually precompiled and can be called using a global variable named the same as the script without the sqf), although I'm not sure how to modify the SPON money values. If I don't remember wrongly, it's simply a vehiclevariable attached to each individual: so using something like Unit setVariable ["SPON_Money_Variable_Here", (RUG_Money_Amount_here)] should work out.

Sorry if this seems confusing, but I haven't really got anything here with me with which I can help verify these things, and besides as I told you I don't know exactly how SPON Money works so... :)

Good luck anyway!

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

Offline ModestNovice

  • Members
  • *
Re: RUG Inventory 0.4 BETA
« Reply #14 on: 08 May 2008, 06:11:57 »
Thanks Wolf!  :good:

sry for double post  :-[

seems to re-ensure some stuff.

is there a way to just show in the dialog itself the players cash, verified in SPON Money as: SPON_playerCashBalance, maybe if I make an item and have it show a formatted hint somehow?

I think I finally got how to add items and everything, but I'm not really getting how to use the remove...

So I just put in the class I want it to remove and it will remove one of those?

Again thanks for the help Wolfrug and love the system  :good:

Especially the Rifle Cases, fixed one of my biggest problems, the biggest being the inventory  :P
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.4 BETA
« Reply #15 on: 08 May 2008, 18:42:10 »
Hi there!

The fremove function is a little different to the add one, in that it returns TWO things: one is the new, modified inventory (which needs to be updated to the parent inventory, just as with the fadd function) and the other is a boolean variable which tells you whether or not the removing was successful. If I remember correctly the return value select 0 is the variable (true/false) and the select 1 is the actual inventory. It should tell you so in the RUG_Inventory_fremove.sqf script header :) I think that by default it removes ALL of the items, unless you tell it to remove less (the third entry in the arguments array, if I remember correctly - check the script header)

As to showing the SPON money in the inventory dialog : you're right, it goes both ways doesn't it, so you'd still have to update your SPON money in the RUG Inventory for it to work properly, whenever you buy something using the SPON money system. So basically you'd have to have a little function for that, maybe one that runs whenever you open the RUG Inventory dialog window and adds/removes cash depending on SPON_PlayerCashBalance. Well, assuming SPON_PlayerCashBalance is a simple global var with a number in it, you'd just do something like:

Note: Not tested! Do not know if it works! Might have wrong variables! Also: needs to have the scripts precompiled! (done automatically once RUG_Inventory.sqf gets to run once).

Code: [Select]
_money = SPON_Playercashbalance;
_inv = Player getvariable "RUG_Inventory";
_noMoneyInv = [_inv, "Money"] call RUG_Inventory_fremove;
_newInv = [(_noMoneyinv select 1), "Money", _money] call RUG_Inventory_fadd;
Player setvariable ["RUG_Inventory", _newInv];

I don't remember the exact wording of the functions, so you'll have to check those, but what basically happens up there is that the script first removes any mention of the object named "Money" from the player's inventory, and then adds the amount of money that is in the Spon_Playercashbalance variable. Finally it updates the player's inventory again. This little script would have to be run for instance before everything else is run in the RUG_Inventory.sqf script. :)

Glad you like the rifle holders - checked out the "ammo bag" object too? It works - if not as well as I'd like (since you can't count ammo in individual magazines, it could easily be used as a cheat to refill half-empty mags if used for anything but one-shot items).

Wolfrug out.


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

Offline ModestNovice

  • Members
  • *
Re: RUG Inventory 0.4 BETA
« Reply #16 on: 09 May 2008, 00:30:39 »
thanks I'll try this out. Yea I saw the ammo bag it is cool as well. I really like how this whole thing works and is really not hard to begin to understand, where you can create your own objects. Very cool :D


where do I run this from exactly?

and when I create an inventory item is it possible to have it give the player a magazine?

I think I know how, I'll just try some stuff out.
« Last Edit: 09 May 2008, 01:10:35 by DaChevs »
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.4 BETA
« Reply #17 on: 09 May 2008, 01:41:37 »
Giving a player a magazine is built into the ammo-bag script (which is under ItemActions). It's a very messy script I'm sorry to say, but still. I meant to create a dummy item that shows a magazine for 0.4 Beta, but I might've forgotten. :) Anyway, all you need to do to get the exact code necessary for creating a magazine item is to open up the ammocontrol script (something like ammocontrol.sqf under RUG_Inventory/ItemActions), and then scroll down to the very bottom of it. There will be a place there where a new item is being created as per Item = [[blah blah...]]; just copy that and change a couple of the important things...can't remember which exactly are what, but you should get a pretty good idea from the name of the local variables. The most important is basically the class name of the magazine, which I think comes straight after the "item name" of the item...anyway, check it out for a good idea.

And yes, it's meant to be fairly easy to create new items ^^ no good having an inventory system that only has a couple of items in it from default and no way to create new ones! Of course it can be used for other things as well, and once I get back to a computer with ArmA I might go about creating a PROPER demo mission that showcases some of the potential of the system...

Glad you're liking it!

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

Offline ModestNovice

  • Members
  • *
Re: RUG Inventory 0.4 BETA
« Reply #18 on: 09 May 2008, 01:51:49 »
thanks.  :)

so where do I add that SPON money code in? Rug_inventory or my Init.sqf?
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.4 BETA
« Reply #19 on: 09 May 2008, 02:09:23 »
Oh, right. Hum. I would saaay...add it right in the start of the script, before everything else, BUT : place it under an if {} do, such as this:

Code: [Select]
if {!RUG_Inventory_Open} do
{
_money = SPON_Playercashbalance;
_inv = Player getvariable "RUG_Inventory";
_noMoneyInv = [_inv, "Money"] call RUG_Inventory_fremove;
_newInv = [(_noMoneyinv select 1), "Money", _money] call RUG_Inventory_fadd;
Player setvariable ["RUG_Inventory", _newInv];
};

Since the way things currently work is that whenever the inventory is updated (i.e., an object is moved up/down or used) the filler script is run again via the RUG_Inventory.sqf script. As long as the inventory is open, the variable RUG_Inventory_Open (I think, maybe without the _ for the last part...) will be true. So by making that check it should run only once. For this whole to work you of course need to have the other script working as well that continually keeps SPON_Playercashbalance on par with the amount of money actually in the inventory...

Hmm. But you're right, I didn't get what you asked earlier. You just wanted an object that tells you how much money you have - which doesn't let you really move it around using RUG Inventory, but still lets you check how much you have. That's very easy - just edit for instance the default money object to do something like: {ctrlSetText [500, format ["Money left: %1", SPON_Playercashbalance]}; in the Action screen, and nothing at all ([{}]) in the drop/take screens. Also make it weigh and cost less than 0 to make it undroppable and untakeable, and just name it something like "wallet" :D

Wolfrug out.

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

Offline ModestNovice

  • Members
  • *
Re: RUG Inventory 0.4 BETA
« Reply #20 on: 09 May 2008, 02:14:44 »
thanks!  ;)

Theres an error in your BuyVehicle.sqf

line 28

 :dunno:
« Last Edit: 09 May 2008, 03:49:12 by DaChevs »
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.4 BETA
« Reply #21 on: 10 May 2008, 22:53:42 »
Huh...are you sure it's an error with the script and not with your custom item?  :scratch: Remember all of the ItemAction scripts are essentially "demo" scripts that are supposed to show you the potential of the system as opposed to being some kind of built-in features (with the possible exception of the guncontrol and ammocontrol scripts, since they were pretty involved to get working the way I wanted...). If something doesn't work, feel free to figure out a more useable item or system for what you want. :) Anyway I suggest you stick with SPON Money for buying vehicles and weapons and the like :D The trade system with RUG Inventory isn't that advanced, yet at least. :)

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

Offline ModestNovice

  • Members
  • *
Re: RUG Inventory 0.4 BETA
« Reply #22 on: 11 May 2008, 05:21:51 »
Well I didn't actually change an Item. I just tried to test the BuyVehicle.sqf and got an error  :scratch:

How can I add a certain amount of one item?

more than one.  :dunno:

I am trying to make a paycheck script with RUG Inventory.

What value would I use to add the money?

Player setVariable ["RUG_Inventory", ([Item1])];
then the amount of Item1 I want to add?

and how would I call it in a formatted message?

i.e. $%3? what would the value be?
« Last Edit: 11 May 2008, 09:02:47 by DaChevs »
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Wolfsbane

  • Former Staff
  • ****
  • Rubber Duckie! Mah rubber duckie!!
    • OFP Editing Center
Re: RUG Inventory 0.4 BETA
« Reply #23 on: 11 May 2008, 19:56:44 »
DaChevs, please read our Signatures Guidelines Here
Thanks. :)
« Last Edit: 12 Nov 2008, 14:34:50 by bedges »
The greatest days, with the greatest people.. OFPEC.. The friends are never forgot.

Offline ModestNovice

  • Members
  • *
Re: RUG Inventory 0.4 BETA
« Reply #24 on: 11 May 2008, 20:20:31 »
erm... :-[

sorry.  :good:
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.4 BETA
« Reply #25 on: 11 May 2008, 23:14:49 »
Adding items is done via the rug_inventory_fadd.sqf function found in the main rug_inventory folder. The main point of this function is actually to STACK the item itself to avoid having a whole inventory full of items with the same name and purpose. Now, in the demo mission and by default, this function is precompiled into the global variable RUG_Inventory_fadd   (if I remember correctly - you can check what precompiles where from RUG_Inventory.sqf). I believe that there is a description of how to use the fadd function in the script header of said script, so you might want to look there. However it goes something like this:

Code: [Select]
Player setvariable ["rug_inventory", ([(player getvariable "rug_inventory"), "MONEY", 1000] call RUG_Inventory_fadd)];
Or in a more readable form:

Code: [Select]
_newInv = [(player getvariable "rug_inventory"), MoneyItem, 1000] call RUG_Inventory_fadd;
player setvariable ["rug_inventory", _newInv];

MoneyItem being the global variable assigned to the item and the number (in this case 1000) being the amount. NOTE: for the above to work the script has to be precompiled (RUG_Inventory_fadd = compile loadfile "RUG_Inventory\RUG_Inventory_fadd.sqf"), which is done automatically in my demo mission or when RUG_Inventory.sqf is run for the first time (such as when opening your inventory). Furthermore, MoneyItem has to be assigned to a global variable as well - I think if you look through TemplateInventor1.sqf (or something like that) you should find examples on how it works.

And also note: my syntax might not be correct! Verify it yourself. But here's the short version of how things work:

Your inventories, stored in the "RUG_Inventory" variable, is simply an array of arrays. Each entry in the array is an item, which in itself is an array (as you've noticed when you've tried adding your own items). That is how you can easily create inventories by binding the items to global variables, as so: YourInv = [Item1, Item2, CrowBar, FunkyShoes1]; Player setvariable ["rug_inventory", YourInv]. However, the problems come when you start to stack items (as in more than one FunkyShoes, or more than one item of "money"). This is solved internally in the default Use/Take/Drop scripts -> and also when using the fadd and fremove functions. So basically, if it weren't for stacking, adding items would be a lot easier (removing them is a whole different matter though..).

Aaanyway...point of the whole thing is: I suggest you use the functions that come with the scripts. They should save you a lot of trouble :)

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

Offline ModestNovice

  • Members
  • *
Re: RUG Inventory 0.4 BETA
« Reply #26 on: 12 May 2008, 04:30:56 »
ah ok thanks  :)

Yea I looked at the header but couldn't really tell if it was a code to just add one or if it was multiple.
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
Re: RUG Inventory 0.4 BETA
« Reply #27 on: 30 May 2008, 22:25:53 »
 :good:
oh yeah.. this is really nice... great job and thanks for the outstanding cleanness in the scripts.. i have been wanting to learn about dialogs for some time now.
« Last Edit: 30 May 2008, 22:28:02 by loki72 »

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.4 BETA
« Reply #28 on: 31 May 2008, 00:21:05 »
You're welcome, but...cleanness of scripts?  :whistle: Aw man, if you think those are "clean" scripts, check out Spooner's. They're so clean you can't really even read them. :D Unless you're some kind of C++ geek I guess. Heh.

Note that the dialogs are made using the OFP Dialog maker (available in the Ed.Depot), but the actual functions surrounding them are of course made and figured out by yours truly. There are plenty of other ways to make dialogs tick, especially now with ArmA (such as dialog eventhandlers), what I've used is just one. Oh, and the only actual script that deals with the filling of dialogs and such is the RUG_Inventory_Filler.sqf ;)

Maybe the rest of the script can be of some use too :D

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

Offline ModestNovice

  • Members
  • *
Re: RUG Inventory 0.4 BETA
« Reply #29 on: 02 Jun 2008, 06:41:57 »
Yep I love this Wolfrug, thanks a whole bunch. I am using that tool too, its really nice, though I can't make something like this, I could do the actions, but not how you do, sweet  :good:

Though I am still not getting how I remove stuff from the inventory. I looked in the remove script, used the line, but kept getting an error message.

Well, I'll look through your drop script and see how you use that and will try to pull something together.
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Avallach

  • Members
  • *
Re: RUG Inventory 0.4 BETA
« Reply #30 on: 30 Aug 2008, 11:24:11 »
Sorry for reviving this topic *sigh*  :whistle:

but will be there any new update ? it looks so damnd promising !

also, how can I...umm..add more hireable mercenaries ? I tried something but it was not succesfull . Thank you for answer

Lee :good:

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.4 BETA
« Reply #31 on: 31 Aug 2008, 10:50:34 »
Hey there!

Thank you for the interest. :) I am going to work some more on this at some point, in particular making it more friendly to use for other people than me, so that people can actually use it in missions. Maybe one day I will figure out how to make it MP-compatible as well - we'll see, we'll see!

As for more mercenaries - in the test mission's main folder there's a .sqf file named Testmercenaries1.sqf. I suggest you copy-paste one of the entries there and make your own, as you wish. Here's what the different things mean (do not copy-paste this entry, since it'll pop up an error due to the //'s):

Quote
RI_Rifleman=
[

   ["Rifleman", "SoldierWB"], //If there is no named unit here, it will createVehicle the class specified.
   ["Default rifleman, armed with an assault rifle and grenades."], // Description that shows up in the main description field.
   ["Weapon: M4 Aim"], // Description that shows up in the small description field. Can be anything
   ["Skill: Recruit", 0.2], // Description that shows up in the second small description field -> second entry in the array needs to be the skill of the unit in question, from 0-1.
   ["Rank: Private", "PRIVATE"], // Description that shows up in the third small description field -> second entry in the array needs to be the actual rank of the unit in question, "PRIVATE", "CORPORAL", etc.
   ["\ca\characters\data\map_ico\i_wojak_ca.paa"], // Picture that shows up. Can be anything you want.
   [{nil=[{nil= [barracks1, 50, (_this select 1)] execvm "RUG_Inventory\ItemActions\HireMan.sqf"}] spawn RUG_Inventory_Use_Default}, "Hire"], //Default "use" action, after having bought the "contract". The parameters for HireMan.sqf should be: name of vehicle/Game logic where the unit will be spawned (barracks1 in this case), max distance from this object that you can be to be able to hire the unit in question (in this case 50), and _this select 1 (should never change, contains important data from the function).
   [{nil=[] spawn RUG_Inventory_Take_Default}], //Leave as is
   [{nil=[] spawn RUG_Inventory_Drop_Default}], //Leave as is.
   [5, 1, 200] // Numbers for the stack, same for all inventory items -> First entry is the number of units available (in this case 5), second is the "size" of each unit (in this case 1 - should probably be 0 for this kind of "item" though since they're more like contracts or whatever), and third is cost for each individual item (200 in this case).
];

So if you want to add for instance 5 low-skilled, private machine gunners to the lot, you can just change the top entry to read "SoldierWMG" and then change the description and such as you wish.

NB: for this to work you also need to add the new item to "testbox3" who is the guy currently "selling" mercenaries. This also means you need to name your "item", something like RI_MachineGunner. Just open up the init.sqf and add him to this list:

Quote
testBox3 setVariable ["RUG_Inventory", [RI_Rifleman, RI_JohnDoe, RI_Hummer, RI_VehReady, RI_MachineGunner]];

And Bob's Your Uncle!

Yes - I know, not the most intuitive way of doing things. This is why I need to make this whole system a little easier to use for other people than myself. But anyway, that's the jist of it.

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

Offline Avallach

  • Members
  • *
Re: RUG Inventory 0.4 BETA
« Reply #32 on: 01 Sep 2008, 18:49:59 »
Wow ! thank you for the big and informative answer  :good:

Quote
I know, not the most intuitive way of doing things.

That's not a problem, it's actually more fun. honestly  :P

Also, it's good to hear that you will continue your work, I recently started using it with some little test missions and it was totally new game( at least for me  ::))

Keep it up Wolf !

EDIT: oh and I have forgot my question hehe, is something wrong when the inventory window still shows "RUG_Inventory 0.2 ?"
I am 100% sure I have downloaded the 0.4 version, but hey , it can be just a little cosmetic bug , no problemo :cool2:
« Last Edit: 01 Sep 2008, 18:53:40 by Avallach »

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.4 BETA
« Reply #33 on: 02 Sep 2008, 10:13:51 »
No problem Avallach, happy someone's found some use for it :D

And yes - the inventory window displays the wrong version, and so does the top of the readme >_< Just a mistake, is all. If you've got the mercenary-hiring and all then you've got the latest version all right!

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

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.5 BETA
« Reply #34 on: 16 Feb 2009, 00:33:39 »
Updated to v.0.5!

Version history can be seen in the first post, but the short of it is:

Quote
v.0.5 BETA
- Added RUG_EasyAdd, RUG_EasyRemove and RUG_EasyTransfer functions: allows for simplified item adding/removing/transfering of items. Also added custom resources and a sound to notify of items being added/removed using these commands. Instructions for use in their headers
- Moved the bulk of the global variable initialization to RUG_Inventory_Init.sqf which should now be run to init the inventory system.
- Slight changes in RUG_Inventory.h (moved some controls around a little - the general text area should have some more space now)
- Added a text to the ammo bag inventory screen instead of the standard one.
- Made all executions of RUG_Inventory.sqf and RUG_Inventory_Trade.sqf within the scripts use spawn instead of execvm.
- Added more comments to various scripts and added some more instructions to the in-game items.
- None of the scripts that require the string name of the item are case sensitive any longer.
- Added RUG_Inventory_Monitor.sqf script which simply checks for certain items that need to immediately affect a unit when they are added/removed. Currently used to switch the map/compass etc. on and off.
- Removed the nil = in front of a bunch of scripts. Oops for redefining engine commands!
- Fixed a problem by which the Your ammo inventory could be filled with size 0 items which would then be lost. Now you cannot put any items of any size inside an inventory with a size of 0.
- Minor fixes in various scripts etc.
- Changed the look of the inventory screen slightly - old look is available in ORIGINALRUG_Inventory.h if you want to revert to it :) New look has more space for general messages and slightly more space for descriptions, as well as a slightly larger picture.
- Added green (positive balance) and red (negative balance) text to the Balance number when trading

Really the reason for this update is the first note there: the addition of the Easy... series of functions. These should streamline the adding and removing of items quite a bit. Second of all I updated the look of the inventory ever so slightly, but nothing big has happened. Thirdly, now that you use the new Easy... functions you'll get a sound effect and a picture and everything to tell you what you've done!

Not sure what else I might do with these scripts - not that anyone is USING them, mind :D. If anyone has any thoughts on what exactly holds people back from wanting to use them, please do share: ease of use, ugliness, don't see the point...?

Holding with the RPG set I've had in mind all along, however, I might next start working on some kind of skills or abilities-type system, based on RUG Inventory, but we'll see. I might also try to create an actual mission using this so that people can see it in action, but, but....scripting is the easy part...mission making on the other hand... :cool2:

Enjoy!

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

Offline cervantes

  • Members
  • *
Re: RUG Inventory 0.6 BETA
« Reply #35 on: 16 Aug 2009, 00:29:15 »
hi wolfrug i have any questions for you.

i make one bagpack for enhanced a gear of arma gear.

for this i use a rug inventory scripts.

i want use this for a binocular item type and ammo.

for this i define in items template script you ammo bag and you gear bag.

a ammo has define by deffault and with this we see a grenade items and launcher items ammo in rug inventory windows.

i need one script for detect all ammo type pistol, riffle, launcher and grenade items have you one idea for make this script?

i want also use this system for see two weapons items type ,pistol and binocular weapon type

for transfert this weapons type on rug inventory windows have you one idea how create this script?

my last question has do you speak french beacause im french :D thx for read and i wait you scriptor talents for help me at create this two scripts ^^.
« Last Edit: 16 Aug 2009, 02:22:44 by cervantes »

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.6 BETA
« Reply #36 on: 16 Aug 2009, 12:03:11 »
Hi cervantes!

I'm glad you're using my script and I hope you're having a good time with it. As to your questions, um, I'm not entirely sure what you're asking for (I do speak some French, so if you want to ask me again in that language you can, but I don't think I can reply in French - also these forums are entirely in English and it wouldn't be fair to start having a conversation in another language. PM in that case).

Binocular weapon types I have on purpose not created a default 'case' for (as in rifle case, launcher case etc): this is because by default there are only two options for the binocular slot, Laser Designator and Binoculars, and the LD is better than the Binos since it zooms AND can do other things. However if you want to create an ITEM that handles the changing of binoculars/laser designators/other binocular-slot items, that shouldn't be too hard at all. But maybe that's not what you're interested in?

As to your other question about finding all pistol rifle etc. items, I'm guessing you're wondering about why only e.g. grenades and launcher ammo show up in the bag? The reason is simple: there's no way to know how many bullets are left in the rest of the clip nor is there a way to make a certain clip have X amount of bullets in it. This means that if you say have 5 clips with 1 bullet each and they'd show up in the ammo bag, you could cheat and take them and then re-add them, which would give you 5 full clips. Is this what you're asking for though?

In that case, you need to go to RUG_Inventory\ItemActions\magControl.sqf. This is the script that controls the "ammo bag" item and turns "real" items into "rug inventory" items. There you will find a point that says:

Code: [Select]
// Create array of all magazines with only one round in it. Quit if none are found.

for "_i" from 0 to ((count _allMags) - 1) do
{
_curMag = _allMags select _i;
_count = getNumber (configFile >> "CfgMagazines" >> _curMag >> "count");
if (_count == 1) then {_MagazineArray = _MagazineArray + [_curMag]};
};

I think that if you simply change the if (count == 1) to if (true), then it should be fine - it'll just create a list of ALL your magazines, plain and simple.

If you want to mess around with the magazines weights and values, simply add stuff to the array that can be found slightly above:

Code: [Select]
_magazineParameters=
[
"Pistol", -1, 25,
"Rifle", -1, 1,
"Launcher", -1, 100,
"Stinger", 6, 1000,
"Strela", 6, 1000,
"Javelin", 6, 1000,
"Laserbatteries", 1, 50
];

Here you can add more magazines etc: "classname", size, value. -1 means it defaults. You shouldn't -really- have to do anything about it, except change the pistol value from 25 to something more appropriate (such as 1) since it counts per bullet: you might then also want to add the rifle grenades separately. This is of course only a question if you're using the built-in barter system or not.

Not sure what the rest of your questions are about. Maybe if you told me more specifically what you need these things for?

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

Offline cervantes

  • Members
  • *
Re: RUG Inventory 0.6 BETA
« Reply #37 on: 16 Aug 2009, 14:35:20 »
thx for you fast reply wolfrug :)

i want see a binocular or googles or LD in the rug inventory windows because i have create 4 items based on binocular config in classconfigweapons on my config.cpp.

one gaz mask one head poket light one old lantern and one first aid kit, when i add a weapon to unit

this items has on binocular slots of arma gear.


by default there are only two options for the binocular slot you just like to quote.

i want store a items in rug inventory window when a two slot has already use by two binocular items type.


my addons gaz mask exemple use a serial scripts for when a player has weapon gazmask a player activate a gaz mask for protect him.

watch this for understand ^^

http://www.youtube.com/watch?v=keKQL0FfUCQ

http://www.youtube.com/watch?v=RoXQjvZt_xg


my 3 others binoculars items use a script also

this script working only if a player has weapon this items in arma gear.


i use all items but when i have two options for the binocular slot already use by two binocular items

arma replace an items by another item, its for this i want store my two first items in the bagpack (rug inventory windows) for juggle withs my 4 items ;)

for a ammo its because my mod has a farmland zombie mod and i want add management of pistol weapons and ammunitions on the bag pack as resident evil.

its one survival horror and weapons and ammunition are counted and player manage ammunitions slots.

with two or more pistols type in inventory :)

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.6 BETA
« Reply #38 on: 16 Aug 2009, 21:21:20 »
Ah, I thought it was something like that. Well, you can create an item, or rather a bunch of new "items" for this, and make their "Use" script a custom one -> this custom Use script would then first check if there's already an item in the "binocular" slot (hasweapon bla bla bla), and if so, create another rug_inventory item and add it to the user's inventory, removeWeapon the item in the binocular slot and addweapon the rug_inventory weapon in stead. Here's how it might work (untested) -> add these lines to whatever .sqf you have running to initialize your rug_inventory items.


Code: [Select]

// Creates a script!
RUG_SwitchBinocUse =
{
// Script -> _Addweapon is taken from the Use script (see below)
_addweapon = _this select 0;
// Declare variables.
_weap = "";
_itemName = "";
// Checks which binocular is currently occupying the slot, just add all your pieces here! Basically, change _weap = to whatever you're looking for, and _itemname = to the global variable that represents the item in question.
for "_i" from 0 to (count weapons RUG_Inventory_Caller) do
{
if ((weapons RUG_Inventory_Caller (select _i)) == "Binocular") then
  {_weap = "Binocular"; _itemName = RUG_Binoculars};
if ((weapons RUG_Inventory_Caller (select _i)) == "LaserDesignator") then
  {_weap = "Laserdesignator"; _itemName = RUG_Laserdesignator};
if ((weapons RUG_Inventory_Caller (select _i)) == "YourWeapon") then
  {_weap = "YourWeapon"; _itemName = CER_YourName};
};
// Adds the _itemname (which is an item which should be created in an init file somewhere as a global variable) to the inventory of the caller.

if (_itemName !="") then {[RUG_Inventory_caller, _itemName] call RUG_EasyAdd};

// Removes the weapon found using the code above.
if (_weap !="") then {RUG_Inventory_Caller removeWeapon _weap};

// Adds the item in question!
RUG_Inventory_Caller addweapon _addweapon;
};

// The new items! Note the new code inside the []'s of the default USE action --> this code is run whenever the item is succesfully used (e.g., consumed). THIS is where you write down the cfg name of the item you want to add whenever this item is used, e.g. "Binocular", "Laserdesignator" etc.

RUG_LaserDesignator=
[

["Laser Designator Case"],
["Laser Designator in your inventory."],
["Size: 1"],
["Value: 100"],
[""],
[getText (configFile >> "CfgWeapons" >> "Laserdesignator" >> "picture")],
[{[{["LaserDesignator"] spawn RUG_SwitchBinocUse}] spawn RUG_Inventory_Use_Default}],
[{[] spawn RUG_Inventory_Take_Default}],
[{[] spawn RUG_Inventory_Drop_Default}],
[1, 1, 100]
];

RUG_Binoculars=
[

["Binoculars"],
["Binoculars in your inventory."],
["Size: 1"],
["Value: 100"],
[""],
[getText (configFile >> "CfgWeapons" >> "Binocular" >> "picture")],
[{[{["Binocular"] spawn RUG_SwitchBinocUse}] spawn RUG_Inventory_Use_Default}],
[{[] spawn RUG_Inventory_Take_Default}],
[{[] spawn RUG_Inventory_Drop_Default}],
[1, 1, 100]
];

CER_YourName=
[

["Your item"],
["Description here."],
["Size: 1"],
["Value: 100"],
[""],
[getText (configFile >> "CfgWeapons" >> "Laserdesignator" >> "picture")],
[{[{["CER_YourWeapon"] spawn RUG_SwitchBinocUse}] spawn RUG_Inventory_Use_Default}],
[{[] spawn RUG_Inventory_Take_Default}],
[{[] spawn RUG_Inventory_Drop_Default}],
[1, 1, 100]
];


Phew. This is a little ugly, but it should work! Hopefully you're at least a little used to working with RUG_Inventory to figure out what I'm doing here. :) The "problem" here is of course that there's no "empty" case as of yet - e.g., if you've already GOT all the pieces then this works fine (since you can just switch between them as you want), but if you're picking up another piece on the way, you can't "convert" your current binocular to an inventory item. For this to work you need a lot more scripting already - but that too is far from impossible. :) Maybe I've given you some ideas with this though - my RUG Inventory scripts were never meant to be all-inclusive by default, but rather as easy (as possible) to edit and change (mostly by adding new items) for anyone wishing to do so...

As to the ammunition thing: sorry, unless you figure out a way to count ammo in magazines as well as deleting or adding half-empty magazines, there's just no way it's going to work properly. Game limitation. :-( However, you CAN make inventory items that work as magazines (basically just items that when used addmagazine "whatever" to the user), but there's no way to do it the other way.

Good luck!

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

Offline cervantes

  • Members
  • *
Re: RUG Inventory 0.6 BETA
« Reply #39 on: 16 Aug 2009, 23:31:22 »
ok thank you very mutch wolfrug :)

for a script for detect all ammo types in arma gear its ok the script working very well ecepted a dosent count ammo in magazine but its one minor bug and limit of arma.

for a second script i have one error and d'ont understand all things i have add my all binocular item in list of script.

itemcontrol.sqf

// Creates a script!
Bag_SwitchBinocUse =
{
// Script -> _Addweapon is taken from the Use script (see below)
_addweapon = _this select 0;
// Declare variables.
_weap = "";
_itemName = "";
// Checks which binocular is currently occupying the slot, just add all your pieces here! Basically, change _weap = to whatever you're looking for, and _itemname = to the global variable that represents the item in question.
for "_i" from 0 to (count weapons Bag_Inventory_Caller) do
{
if ((weapons Bag_Inventory_Caller (select _i)) == "Binocular") then
  {_weap = "Binocular"; _itemName = Bag_Binoculars};
if ((weapons Bag_Inventory_Caller (select _i)) == "LaserDesignator") then
  {_weap = "Laserdesignator"; _itemName = Bag_Laserdesignator};
if ((weapons Bag_Inventory_Caller (select _i)) == "gaz_mask") then
  {_weap = "gaz_mask"; _itemName = Bag_gaz_mask};
if ((weapons Bag_Inventory_Caller (select _i)) == "firstaid_kit") then
  {_weap = "firstaid_kit"; _itemName = Bag_firstaid_kit};
if ((weapons Bag_Inventory_Caller (select _i)) == "lantern") then
  {_weap = "lantern"; _itemName = Bag_lantern};
if ((weapons Bag_Inventory_Caller (select _i)) == "head_lamp") then
  {_weap = "head_lamp"; _itemName = Bag_head_lamp};
};
// Adds the _itemname (which is an item which should be created in an init file somewhere as a global variable) to the inventory of the caller.

if (_itemName !="") then {[Bag_Inventory_caller, _itemName] call Bag_EasyAdd};

// Removes the weapon found using the code above.
if (_weap !="Binocular") then {Bag_Inventory_Caller removeWeapon _weap};

// Adds the item in question!
Bag_Inventory_Caller addweapon _addweapon;
};

// The new items! Note the new code inside the []'s of the default USE action --> this code is run whenever the item is succesfully used (e.g., consumed). THIS is where you write down the cfg name of the item you want to add whenever this item is used, e.g. "Binocular", "Laserdesignator" etc.

Bag_LaserDesignator=
[

   ["Laser Designator Case"],
   ["Laser Designator in your inventory."],
   ["Size: 1"],
   ["Value: 100"],
   [""],
   [getText (configFile >> "CfgWeapons" >> "Laserdesignator" >> "picture")],
   [{[{["LaserDesignator"] spawn Bag_SwitchBinocUse}] spawn Bag_Inventory_Use_Default}],
   [{[] spawn Bag_Inventory_Take_Default}],
   [{[] spawn Bag_Inventory_Drop_Default}],
   [1, 1, 100]
];

Bag_Binoculars=
[

   ["Binoculars"],
   ["Binoculars in your inventory."],
   ["Size: 1"],
   ["Value: 100"],
   [""],
   [getText (configFile >> "CfgWeapons" >> "Binocular" >> "picture")],
   [{[{["Binocular"] spawn Bag_SwitchBinocUse}] spawn Bag_Inventory_Use_Default}],
   [{[] spawn Bag_Inventory_Take_Default}],
   [{[] spawn Bag_Inventory_Drop_Default}],
   [1, 1, 100]
];

Bag_Gaz_mask=
[

   ["gaz mask"],
   ["The gas mask protects the wearer gas biochemical.write on gas mask box manufactured by umbrella corporation."],
   ["Size: 1"],
   ["Value: 100"],
   [""],
   [getText (configFile >> "CfgWeapons" >> "Gaz_mask" >> "picture")],
   [{[{["Gaz_mask"] spawn Bag_SwitchBinocUse}] spawn Bag_Inventory_Use_Default}],
   [{[] spawn Bag_Inventory_Take_Default}],
   [{[] spawn Bag_Inventory_Drop_Default}],
   [1, 1, 100]
];

Bag_firstaid_kit=
[

   ["first aid kit"],
   ["A tough-looking first aid kit that should get you back on your feet if you should get wounded in the line of duty. It contains among other things bandages, sterile dressing, stainless steel scissors, antiseptic cream, stainless splinter forceps and safety pins."],
   ["Size: 1"],
   ["Value: 100"],
   [""],
   [getText (configFile >> "CfgWeapons" >> "firstaid_kit" >> "picture")],
   [{[{["firstaid_kit"] spawn Bag_SwitchBinocUse}] spawn Bag_Inventory_Use_Default}],
   [{[] spawn Bag_Inventory_Take_Default}],
   [{[] spawn Bag_Inventory_Drop_Default}],
   [1, 1, 100]
];

Bag_lantern=
[

   ["Old lantern"],
   ["The old lantern has hot and enlightens into the dark."],
   ["Size: 1"],
   ["Value: 100"],
   [""],
   [getText (configFile >> "CfgWeapons" >> "lantern" >> "picture")],
   [{[{["lantern"] spawn Bag_SwitchBinocUse}] spawn Bag_Inventory_Use_Default}],
   [{[] spawn Bag_Inventory_Take_Default}],
   [{[] spawn Bag_Inventory_Drop_Default}],
   [1, 1, 100]
];

Bag_head_lamp=
[

   ["head lamp"],
   ["The Head lamp has one accessories for see into the dark manufactured by umbrella corporation."],
   ["Size: 1"],
   ["Value: 100"],
   [""],
   [getText (configFile >> "CfgWeapons" >> "head_lamp" >> "picture")],
   [{[{["head_lamp"] spawn Bag_SwitchBinocUse}] spawn Bag_Inventory_Use_Default}],
   [{[] spawn Bag_Inventory_Take_Default}],
   [{[] spawn Bag_Inventory_Drop_Default}],
   [1, 1, 100]
];


I do not know whats add in
_weap = "";
_itemName = "";

and in

if (_itemName !="") then {[Bag_Inventory_caller, _itemName] call Bag_EasyAdd};


i think a error has for this misunderstanding ^^


in itemtemplate.sqf

Item0=
[

   ["Empty Template"],
   ["Description field"],
   ["Item Data 1"],
   ["Item Data 2"],
   ["Item Data 3"],
   [""],
   [{[] spawn Bag_Inventory_Use_Default}],
   [{[] spawn Bag_Inventory_Take_Default}],
   [{[] spawn Bag_Inventory_Drop_Default}],
   [1, 1, 1]
];

Item1 =
[
   ["Your ammo"],
   ["An ammo bag, usually contains some of the soldier's ammo. Doesn't contain any clips with more than one round though."],
   ["Size : 0"],
   ["Value : 0"],
   ["Ammo bag"],
   ["\bagpack\ItemPics\ammobag.paa"],
   [{[Player] execvm "\bagpack\ItemActions\magcontrol.sqf"}, "Open"],
   [{ctrlSetText [500, "Cannot be moved from your inventory."]}],
   [{ctrlSetText [500, "Cannot be moved from your inventory."]}],
   [1, 0, 0]
];

Item2 =
[
   ["Your Gear"],
   ["An weapon bag, usually contains some of the soldier's weapons and items."],
   ["Size : 0"],
   ["Value : 0"],
   ["Gear bag"],
   ["\bagpack\ItemPics\gear.paa"],
        [{[player] execvm "\bagpack\ItemActions\itemControl.sqf"}, "Open"],
   [{ctrlSetText [500, "Cannot be moved from your inventory."]}],
   [{ctrlSetText [500, "Cannot be moved from your inventory."]}],
   [1, 0, 0]
];
« Last Edit: 17 Aug 2009, 08:12:20 by cervantes »

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.6 BETA
« Reply #40 on: 17 Aug 2009, 13:02:35 »
I can check this more properly for you when I get access to ArmA again, and I might as well while I'm at it create a dedicated script for this. But:

1) Why have you changed all the global variables (e.g. RUG_Inventory_Caller, RUG_Inventory_Take_Default) to Bag_? Unless you've actually edited -every single script- and changed the tag to Bag_, this WILL cause everything to break.

2) Why have you changed the folder name from RUG_Inventory to bagpack? This isn't as much of a biggie as long as you remember to change ALL of the compile preprocessfilelinenumbers in the initialization file (since practically all scripts used inside RUG Inventory are tied to global  variables) to the correct path - the recommendation is however that you do NOT change the name of the folder (all the default items also assume the path to be unchanged)!

3) Are you sure you're using the latest version (i.e. 0.6)? That version added a bunch of new scripts which make item transferral a LOT easier, and also fixed slews of other errors; the item code is still identical though, so any custom items you've made will still work (so it's fairly "backwards compatible").

Unless you really know what you're doing, do try to avoid editing the scripts themselves - instead create new items and new scripts for the items to achieve the functionality you want. As mentioned, I'll see about creating a proper script for this once I have the time - the ammo however I still can't do anything other about than what I suggested in my first post (i.e. edit the magControl.sqf script).


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

Offline cervantes

  • Members
  • *
Re: RUG Inventory 0.6 BETA
« Reply #41 on: 17 Aug 2009, 14:38:27 »
hi wolfrug its a last version of scripts 0.6 i have juste replace a variables rug_Inventory_Caller and others

by Bag_Inventory_Caller and other in all scripts and add all scripts in bagpack directories because its one addon.

bagpack.pbo a variables has just fore more easly read for me ^^.

this addon working at identical in mission directories but you now define a .h files or other in description.txt its in config.cpp

now just add on init of player: this exec "\bagpack\init.sqs";

in init.sqs : _this execvm "\bagpack\init.sqf";

_this addAction ["Open your bagpack", "\bagpack\Bag_Inventory.sqf"];

all script working very well no probléme for this ;)

in Template_Items.sqf i have modifiate this for see on screen:


Item0=
[

   ["Empty Template"],
   ["Description field"],
   ["Item Data 1"],
   ["Item Data 2"],
   ["Item Data 3"],
   [""],
   [{[] spawn Bag_Inventory_Use_Default}],
   [{[] spawn Bag_Inventory_Take_Default}],
   [{[] spawn Bag_Inventory_Drop_Default}],
   [1, 1, 1]
];

Item1 =
[
   ["Your ammo"],
   ["An ammo bag, usually contains some of the soldier's ammo. Doesn't contain any clips with more than one round though."],
   ["Size : 0"],
   ["Value : 0"],
   ["Ammo bag"],
   ["\bagpack\ItemPics\ammobag.paa"],
   [{[Player] execvm "\bagpack\ItemActions\magcontrol.sqf"}, "Open"],
   [{ctrlSetText [500, "Cannot be moved from your inventory."]}],
   [{ctrlSetText [500, "Cannot be moved from your inventory."]}],
   [1, 0, 0]
];

Item2 =
[
   ["Your Gear"],
   ["An weapon bag, usually contains some of the soldier's weapons and items."],
   ["Size : 0"],
   ["Value : 0"],
   ["Gear bag"],
   ["\bagpack\ItemPics\gear.paa"],
        [{[player] execvm "\bagpack\ItemActions\itemControl.sqf"}, "Open"],
   [{ctrlSetText [500, "Cannot be moved from your inventory."]}],
   [{ctrlSetText [500, "Cannot be moved from your inventory."]}],
   [1, 0, 0]
];

i have edit a magcontrol.sqf script and now a script working very well just need redefine a size of weapon because for the moment i take a primary and pistol in inventory windows but a binocular items has high size value ^^.

i see a problém but d'ont understand realy why its divisor.


 _divisor = 256;
if (_curweaponSizeARMA < _divisor) then {_divisor = 16};
_curweaponSizeBag = _curweaponSizeARMA / _divisor;
_curweaponValue = 0;
_index = 0;
if (_WeaponParameters find _curweapon > 0) then
   {
   _index = _WeaponParameters find _curweapon;
   }
   else
   {
   _index = _WeaponParameters find "Rifle";
   if (_divisor == 16) then {_index = _WeaponParameters find "binocular"};
   _unknownConfig = inheritsFrom (configFile >> "Cfgweapons" >> _curweapon);
   _launcherConfig = inheritsFrom (configFile >> "Cfgweapons" >> "pistol");
      if (_unknownConfig == _launcherConfig) then {_index = _WeaponParameters find "Rifle"};      
   };


when i change a divisor value by 1024 or 512 a size of binocular has divised by 2 or 4

but with 256 a value of lancher pistol or primary weapon has 0.25 or less and binocular 16

and if i use 1024 a binocular size has 4 but a primary weapon a lancher and pistol size has also divised by 4.

because a binocular has define type 4096.

if i test with other values exemple:

_curweaponSizeARMA = getNumber (configFile >> "Cfgweapons" >> _curweapon >> "value")

its ok for binocular item but all other weapon size has to less i want simulate a bagpack no a weapon box  :D

and with

_curweaponSizeARMA = getNumber (configFile >> "Cfgmagazines" >> _curweapon >> "type")

this d'ont working :confused:


watch this movie http://www.youtube.com/watch?v=XrptFMhiRRA

thanks you very mutch for you helping wolfrug :)
« Last Edit: 17 Aug 2009, 23:21:35 by cervantes »

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.6 BETA
« Reply #42 on: 18 Aug 2009, 06:36:30 »
Ah, if it's just a matter of size then it's easy to fix:

In guncontrol.sqf (under ItemActions), there's a list of weapons and their custom sizes:

Code: [Select]
_weaponParameters=
[
"Pistol", 2, 500,
"Rifle", 10, 1000,
"Launcher", 11, 1000,
"M4", 8, 1200,
"M4GL", 8, 1500,
"M4AIM", 8, 1400,
"M4A1SD", 8, 1900,
"M4SPR", 8, 2000,
"M4A1GL", 8, 1600,
"G36K", 9, 2000,
"G36C", 8, 2000,
"G36A", 9, 2000,
"MP5A5", 6, 1500,
"MP5SD", 6, 1800,
"M249", 11, 4000,
"M240", 12, 4500,
"M24", 10, 5000,
"M107", 11, 6000,
"Javelin", 14, 7000,
"AKS74U", 8, 1500,
"AKS74UN", 8, 1900,
"AKS74PSO", 8, 2000,
"PK", 12, 4500,
"KSKV", 11, 5500,
"6G30", 8, 4000
]; 

"config name", size, value

Just add your items there with proper (small) sizes, and you'll be all set! :D

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

Offline cervantes

  • Members
  • *
Re: RUG Inventory 0.6 BETA
« Reply #43 on: 18 Aug 2009, 14:02:42 »
ok i see but this working only for a riffle for a moment i d'ont add a pistol but i d'ont understand why for a binocular weapon a size d'ont change  :confused:
a script has:

Code: [Select]
Bag_DEBUG_IndexList = [];

//weapon type control for Bag Inventory.  

_Bag_Inventory_Display = 1821791422;
_MainList = 100;
 _InvMainText = 101;
 _InvData1 = 102;
 _InvData2 = 103;
_InvDesc = 200;
 _ItemData1 = 201;
 _ItemData2 = 202;
 _ItemData3 = 203;
_InvPic = 300;
_InvAction1 = 400;
 _InvAction2 = 401;
 _InvAction3 = 402;
 _InvSlider = 403;
 _InvSliderNr = 404;
_InvGen = 500;
_SecondList = 600;
_InvSecondText = 601;
_BalanceText = 700;
 _BalanceNr = 701;



//Loads item data from listbox, and exits if more than one is used/it's used from another inventory than the main.

if (lbCurSel _MainList == 0) exitWith {ctrlSetText [_InvGen, "Has to be used from the top list."]};
_curList = _MainList;
_curSel = lbCurSel _curList;
_value = lbValue [_CurList, _curSel];
_curValue = round (sliderPosition _InvSlider);
if (_curValue < 0 OR _curvalue > 1) exitWith {ctrlSetText [_InvGen, "Must use only one!"]};
_middlevalue = _value - _curvalue;
_dataString = lbData [_CurList, _curSel];
_data = call compile _dataString;
_curItemName = _data select 0;
_curItemDesc = _data select 1;
_curItemData1 = _data select 2;
_curItemData2 = _data Select 3;
_curItemData3 = _data Select 4;
_curItemPic = _data Select 5;
_curItemAction1 = _data select 6;
_curItemAction2 = _data select 7;
_curItemAction3 = _data select 8;
_curItemNumbers = _data select 9;
_curItemSize = _curItemNumbers select 1;
_curItemValue = _curItemNumbers select 2;


// Secondary weapon control. Controls Bag Inventory --> gear screen moves.
if ((count _this) > 1) exitWith

{
private ["_WeaponClassName", "_weaponsizeBag", "_type", "_weapons", "_medic", "_normal", "_bigslots", "_smallslots", "_unitclass", "_bigslotsfree", "_smallslotsfree", "_canadd"];

// Grabs name of weapon, its size and type from the extra info attached to the weapon.

_WeaponClassName = _curItemName select 1;
_WeaponSizeArmA = _curItemData1 select 1;
_type = _curItemData2 select 1;
//hint format ["Stuff: %1, %2, %3", _WeaponClassName, _WeaponSizeArmA, _type];

// This variable (_canadd) is set to false if there's not enough space in your gear

_canadd = true;
_weapons = weapons Bag_Inventory_Caller;

// Medics have less space for both large and small gear. This check varies the slots accordingly

_medic = 10311;
_normal = 11399;
_bigSlots = 12;
_smallslots = 8;
_unitClass = getNumber (configFile >> "CfgVehicles" >> (typeOf Bag_Inventory_Caller) >> "weaponSlots");
if (_unitClass == _medic) then {_bigSlots = 8; _smallslots = 4};

// Assumes all slots are free

_bigslotsfree = _bigslots;
_smallslotsfree = _smallslots;

// Quick loop that checks the total slot-size of each weapon, and depending on type and size, removes free slots from either pistol or main inventory.

for "_i" from 0 to ((count _weapons) - 1) do
{
_curweapon = _weapons select _i;
_curweaponSizeARMA = getNumber (configFile >> "Cfgweapons" >> _curweapon >> "type");
_divisor = 256;
if (_curweaponSizeARMA < _divisor) then {_divisor = 16};
_slotsize = _curweaponsizearma / _divisor;
if (_divisor == 256) then {_bigslotsfree = _bigslotsfree - _slotsize} else {_smallslotsfree = _smallslotsfree - _slotsize};
};

// Final check for main/pistol weapon: if the weapon in question is too big, _canadd will be made false

if (_type == 256) then
{
if ((_bigslotsfree - (_weaponsizeBag/_type)) < 0) then {_canadd = false};
//hint format ["Big ammo: %1", _bigslotsfree];
};
if (_type == 16) then
{
if ((_smallslotsfree - (_weaponsizeBag/_type)) < 0) then {_canadd = false};
hint format ["Small ammo: %1", _smallslotsfree];
};

// Adds the weapon and deletes the item/tells you there's not enough room.

if (_canadd) then
{
Bag_Inventory_weaponAdd = _WeaponClassName;
_n=[{Bag_Inventory_Caller addweapon Bag_Inventory_weaponAdd}] spawn Bag_Inventory_Use_Default;
}
else {ctrlSetText [_InvGen, "Not enough room in your gear!"]};

// End of script
};


// Gets who's inventory should be opened, and creates a temporary object for the ammo bag
_Owner = _this select 0;
_InventoryObject = "logic" createvehicle getpos _owner;

//Defines default weapons worth and optionally size. "Pistol", "Rifle" and "Launcher" and "binocular"

_WeaponParameters=
[
"Pistol", 2, 500,
"Rifle", 10, 1000,
"Launcher", 11, 1000,
"binocular", 0, 20,


"gaz_mask", 1, 20,
"lantern", 1, 20,
"head_lamp", 1, 20,
"firstaid_kit", 1, 20,
"bag_pack", 16, 1000,




"mp5special", 16, 1200,
"old_rifle", 16, 1200,
"mosberg", 16, 1200,
"remington", 16, 1200,
"M4", 16, 1200,
"M4GL", 16, 1500,
"M4AIM", 16, 1400,
"M4A1SD", 16, 1900,
"M4SPR", 16, 2000,
"M4A1GL", 16, 1600,
"G36K", 16, 2000,
"G36C", 16, 2000,
"G36A", 16, 2000,
"MP5A5", 10, 1500,
"MP5SD", 10, 1800,
"M249", 16, 4000,
"M240", 16, 4500,
"M24", 20, 5000,
"M107", 16, 6000,
"Javelin", 16, 7000,
"AKS74U", 16, 1500,
"AKS74UN", 16, 1900,
"AKS74PSO", 8, 2000,
"PK", 30, 4500,
"KSKV", 16, 5500,
"6G30", 16, 4000
];


//Grab weapons and exit if < 1

_allweapons = weapons _owner;
if (count _allweapons < 1) exitWith {ctrlSetText [_InvGen, "No weapons available!"]};
_weaponArray = [];

// Create array of all weapons with only one round in it. Quit if none are found.

for "_i" from 0 to ((count _allweapons) - 1) do
{
_curweapon = _allweapons select _i;
_count = getNumber (configFile >> "Cfgweapons" >> _curweapon >> "count");
if (true) then {_weaponArray = _weaponArray + [_curweapon]};
};

if (count _weaponArray < 1) exitWith {ctrlSetText [_InvGen, "No appropriate weapons available!"]};

// Deletes the ammo-bag in question for the duration of the transferal to prevent weird duplications.

_Inv2array = [(_owner getVariable "Bag_Inventory"), (_curItemName select 0), 1] call Bag_Inventory_fremove;
_Inv2 = _Inv2array select 1;
Bag_Inventory_Main = _Inv2;
_owner setVariable ["Bag_Inventory", _Inv2];

// Create all the necessary items from the aquired weapons.

_weaponItemArray = [];

for "_i" from 0 to ((count _weaponArray) - 1) do
{
_curweapon = _weaponArray select _i;
_curweaponCount = getNumber (configFile >> "Cfgweapons" >> _curweapon >> "count");
_curweaponSizeARMA = getNumber (configFile >> "Cfgweapons" >> _curweapon >> "type");
_divisor = 256;
if (_curweaponSizeARMA < _divisor) then {_divisor = 16};
_curweaponSizeBag = _curweaponSizeARMA / _divisor;
_curweaponValue = 0;
_index = 0;
if (_WeaponParameters find _curweapon > 0) then
{
_index = _WeaponParameters find _curweapon;
}
else
{
_index = _WeaponParameters find "Rifle";
if (_divisor == 16) then {_index = _WeaponParameters find "binocular"};
_unknownConfig = inheritsFrom (configFile >> "Cfgweapons" >> _curweapon);
_launcherConfig = inheritsFrom (configFile >> "Cfgweapons" >> "pistol");
if (_unknownConfig == _launcherConfig) then {_index = _WeaponParameters find "Launcher"};
};

_ValueSelect = _WeaponParameters select (_index + 2);
_curweaponValue = _ValueSelect * _curweaponCount;
if ((_WeaponParameters select (_index + 1)) > 0) then
{
_curweaponSizeBag = _WeaponParameters select (_index + 1)
};
Bag_DEBUG_IndexList = Bag_DEBUG_IndexList + [_index];
//hint format ["%1", Bag_DEBUG_IndexList];

_weaponItemArray =
_weaponItemArray +
[[
[getText (configFile >> "Cfgweapons" >> _curweapon >> "displayName"), _curweapon],
["This is a full weapons or items. If you have space in your gear, you can move it there from your inventory by using it."],
["Size : " + (str(_curweaponSizeBag)), _curweaponSizeArma],
["Value : " + (str(_curweaponValue)), _divisor],
["Weapons"],
[getText (configFile >> "Cfgweapons" >> _curweapon >> "picture")],
[{["In", "Inventory"] execvm "\bagpack\ItemActions\weapons_Control.sqf"}, "Equip"],
[{[] spawn Bag_Inventory_Take_Default}],
[{[] spawn Bag_Inventory_Drop_Default}],
[1, _curweaponSizeBag, _curweaponValue]
]];

_owner removeweapon _curweapon;

};

// Gives the temporary inventoryobject the inventory and assigns its name.

_InventoryObject setVariable ["Bag_Inventory", _weaponItemArray];
_InventoryObject setVariable ["Bag_Inventory_Name", (_curItemName select 0)];

// Remembers the original caller/target

_caller = Bag_Inventory_Caller;
_target = Bag_Inventory_Target;

// Closes the old dialog and starts a new one

closeDialog 0;
sleep 0.2;

nil = [_InventoryObject,_owner, 0, [_InventoryObject,_owner]] spawn Bag_Inventory_MainWindow;
sleep 0.2;

// Changes start text to give proper info
ctrlSetText [_InvGen, "You have opened your weapons bag. Use Take to put weapons or items into your inventory: close this dialog to return to the normal inventory screen."];

// Removes the gear eventhandler to prevent cheating.
(findDisplay _Bag_Inventory_Display) displaySetEventHandler ["KeyDown", ""];

// A little loop to check for closing of the ammo dialog, so that the old dialog can be opened again.
_loop = true;
while {_loop} do
{
if (scriptDone Bag_InventoryOpen) then {sleep 0.2; if (scriptDone Bag_InventoryOpen) then {_loop = false}};
sleep 0.2;
};

// Create a list of all the weapons that remain in the ammo bag

_weaponItemArrayNew = _InventoryObject getVariable "Bag_Inventory";

// Adds back all the weapons there are.

for "_i" from 0 to ((count _weaponItemArrayNew) - 1) do
{
private ["_curitem", "_curItemclassname"];
_curItem = (_weaponItemArrayNew select _i);
_curItemClassName = ((_curItem select 0) select 1);
_owner addweapon _curItemClassName;
_owner selectweapon _curItemClassName;
};

// Adds back the original ammo bag to the inventory

_Inv = _owner getVariable "Bag_Inventory";

_Item=
[

_curItemName,
_CurItemDesc,
_CurItemData1,
_CurItemData2,
_CurItemData3,
_CurItemPic,
_CurItemAction1,
_CurItemAction2,
_CurItemAction3,
_curItemNumbers
];

_Invarray = [_Inv, _Item, 1] call Bag_Inventory_fadd;
Bag_Inventory_Main = _Invarray;
_owner setVariable ["Bag_Inventory", _Invarray];

// Restarts the original inventory screen

[_target, _caller, 0, [_target, _caller]] spawn Bag_Inventory_MainWindow;

// Deletes the logic object

deleteVehicle _InventoryObject;

_owner selectweapon _curItemClassName;


but a value d'ont change for this item

"gaz_mask", 1, 20,
"lantern", 1, 20,
"head_lamp", 1, 20,
"firstaid_kit", 1, 20,
"bag_pack", 16, 1000,

 :D

i think its because a type of binocular has 4096 :p i have test change a divisor no effect on size now very strange
« Last Edit: 18 Aug 2009, 15:44:56 by Wolfrug »

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: RUG Inventory 0.6 BETA
« Reply #44 on: 19 Aug 2009, 07:42:17 »
How are the chances to see this in a2 Wolfrug?   :)

Offline cervantes

  • Members
  • *
Re: RUG Inventory 0.6 BETA
« Reply #45 on: 20 Aug 2009, 20:48:03 »
hi there i have one last question ^^ all script now working very well one good thing ^^

now i want add a picture visual effect on description and replace a text by picture with text.


Item1 =
[
   ["Your ammo"],
   [{_text = Text "\bagpack\fonts\font1"}],
   ["Size : 0"],
   ["Value : 0"],
   ["Ammo bag"],
   ["\bagpack\ItemPics\ammobag.paa"],
   [{[Player] execvm "\bagpack\ItemActions\magcontrol.sqf"}, "Open"],
   [{ctrlSetText [500, "Cannot be moved from your inventory."]}],
   [{ctrlSetText [500, "Cannot be moved from your inventory."]}],
   [1, 0, 0]
];

but [{_text = Text "\bagpack\fonts\font1"}], d'ont working any idea?

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.6 BETA
« Reply #46 on: 22 Aug 2009, 15:52:56 »
Hey cervantes,

Sorry for not being so responsive, I've meant to test some things but then I didn't have the time, and had nothing else to say. :-[ Anyway, I'm glad you got it to work with the binoculars!

As to your current problem: you don't need the {} code brackets, nor the text = thing. Pictures are basically put into the same line as text, so at least in principle it should be possible to make the description text into a picture, by just putting the path to it there. E.g., "\bagpack\fonts\font1". Note however that that simply makes the whole text into a picture - AFAIK you can't "mix" pictures and text, you'd have to have a separate text-only area then.

You can always edit the dialog itself of course, move the pictures etc. around to wherever you want. :)

PS: @kju: I tested it just now. Some additions to the controls + disableSerialization in all the scripts = it works! Might release an A2 'version', but only after I've poked around with it for a while in that case. As of now, it's easy enough to do yourself. :)

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

Offline cervantes

  • Members
  • *
Re: RUG Inventory 0.6 BETA
« Reply #47 on: 23 Aug 2009, 14:46:32 »
ok thx i search this ^^

"\bagpack\fonts\font1" d'ont working if i found a solution i you post this ;)
« Last Edit: 23 Aug 2009, 15:41:43 by cervantes »

Offline PunkyPL94

  • Members
  • *
Re: RUG Inventory 0.6 BETA
« Reply #48 on: 27 Nov 2010, 10:01:15 »
Can you upload this script again ?

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG Inventory 0.6 BETA
« Reply #49 on: 27 Nov 2010, 10:23:27 »
Reuploaded.  :good: Thanks for making me aware it had disappeared.

Enjoy!

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