Home   Help Search Login Register  

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

0 Members and 1 Guest are viewing this topic.

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?   :)