Jump to content
Sign in to follow this  
Redphoenix

Copying Toolkit Functionality

Recommended Posts

I'm trying to copy the functionality of the toolkit onto the jerrycan.

My config so far looks like this:

class CfgPatches
{
class RVE_JerryCan
{
	units[] = {};
	weapons[] = {};
	requiredVersion = 0.1;
	requiredAddons[] = {"A3_Structures_F_Items_Vessels"};
};
};
class CfgVehicles
{	
class Item_ToolKit;
class RPA_Item_JerryCan: Item_ToolKit
{
	scope = 2;
	scopeCurator = 2;
	displayName = "Jerry Can";
	author = "BI; edited by RP";
	picture = "\RPA_Refined_Vehicles_v3\rpa_misc\rpa_jerrycan\jerrycan.paa";
	model = "\A3\Structures_F\Items\Vessels\CanisterFuel_F.p3d";
	vehicleClass = "Items";
	class TransportItems
	{
		class RPA_Item_JerryCan
		{
			name = "JerryCan";
			count = 1;
		};
	};		
};
};
class CfgWeapons
{	
class ToolKit;
class RPA_Item_JerryCan: ToolKit
{
	scope = 2;		
	allowedSlots[] = {801,701,901};	

	displayName = "Jerry Can";			
	picture = "\RPA_Refined_Vehicles_v3\rpa_misc\rpa_jerrycan\jerrycan.paa";
	model = "\A3\Structures_F\Items\Vessels\CanisterFuel_F.p3d";	
	descriptionShort = "For refueling all sorts of vehicles.";
	class ItemInfo
	{
		mass = 120;
		uniformModel = "\A3\Structures_F\Items\Vessels\CanisterFuel_F";
		type = 401;		
		scope = 2;
	};
};	
};

But whenever I place it in the editor and press preview, it dissapears after 2 or 3 seconds.

Then I also have this config:

class CfgPatches
{
class RVE_JerryCan
{
	units[] = {};
	weapons[] = {};
	requiredVersion = 0.1;
	requiredAddons[] = {"A3_Structures_F_Items_Vessels"};
};
};
class CfgVehicles
{	
class Land_CanisterFuel_F;
class RPA_Item_JerryCan: Land_CanisterFuel_F
{
	scope = 2;
	scopeCurator = 2;
	displayName = "Jerry Can";
	author = "BI; edited by RP";
	picture = "\RPA_Refined_Vehicles_v3\rpa_misc\rpa_jerrycan\jerrycan.paa";
	model = "\A3\Structures_F\Items\Vessels\CanisterFuel_F.p3d";
	vehicleClass = "Items";
	class TransportItems
	{
		class JerryCan
		{
			name = "JerryCan";
			count = 1;
		};
	};		
};
};
class CfgWeapons
{	
class InventoryItem_Base_F;
class JerryCanItem: InventoryItem_Base_F
{
	type = 620;
	allowedSlots[] = {901};
};
class ItemCore;
class RPA_JerryCan: ItemCore
{
	scope = 2;		
	allowedSlots[] = {801,701,901};	

	displayName = "Jerry Can";			
	picture = "\RPA_Refined_Vehicles_v3\rpa_misc\rpa_jerrycan\jerrycan.paa";
	model = "\A3\Structures_F\Items\Vessels\CanisterFuel_F.p3d";	
	descriptionShort = "Un coup de picouse et roule ma poule";
	class ItemInfo: JerryCanItem
	{
		mass = 120;
		uniformModel = "\A3\Structures_F\Items\Vessels\CanisterFuel_F";
		type = 401;		
		scope = 2;
	};
};	
};

That makes the Jerrycan visible in the editor, and I can place it, but it doesn't have an inventory.

So, which config could I use to achieve my goal?

Share this post


Link to post
Share on other sites

When you say inventory. Do you mean being able to carry it in a player inventory. Or being able to store items in the jerry can ?

Share this post


Link to post
Share on other sites
When you say inventory. Do you mean being able to carry it in a player inventory. Or being able to store items in the jerry can ?

I want it to beahve like an item the player can pick-up into his inventory, so he can use it later.

Share this post


Link to post
Share on other sites

I think you just need the CFG weapons part then and it should work. If you want it to work like the toolkit then enherit from the toolkit class. Just change the name, model , picture, mass etc.

Share this post


Link to post
Share on other sites
I think you just need the CFG weapons part then and it should work. If you want it to work like the toolkit then enherit from the toolkit class. Just change the name, model , picture, mass etc.

The idea is that the jerrycan can (obviously) be used to refuel vehicles. That's the goal in the end.

Share this post


Link to post
Share on other sites

Maybe try rewriting RPA_Item_JerryCan from 0, inherit everything that inherits Item_ToolKit from some base classes, include every parameter. Maybe it will help.

Or just create your own class that uses JerryCans' models and textures.

Edited by Tachi

Share this post


Link to post
Share on other sites

You mean like making a new config inheriting from item, or whatever the first parent of all items ist.

I could try that.

Share this post


Link to post
Share on other sites

So, I have it right now like that:

class CfgPatches 
{ 
   class RVE_JerryCan 
   { 
       units[] = {"RPA_Item_JerryCan"}; 
       weapons[] = {"RPA_JerryCan"}; 
       requiredVersion = 0.1; 
       requiredAddons[] = {"A3_Structures_F_Items_Vessels","A3_Structures_F"}; 
       magazines[] = {}; 
   }; 
}; 
class CfgWeapons 
{     
   class InventoryItem_Base_F; 
   class ItemCore; 
   class JerryCanItem: InventoryItem_Base_F 
   { 
       type = 620; 
       allowedSlots[] = {901}; 
   }; 
   class RPA_JerryCan: ItemCore 
   { 
       scope = 2; 
       displayName = "Jerry Can"; 
       icon = "iconObject_2x1";         
       picture = "\RPA_Refined_Vehicles_v3\rpa_misc\rpa_jerrycan\jerrycan.paa"; 
       model = "\A3\Structures_F\Items\Vessels\CanisterFuel_F.p3d"; 
       class ItemInfo: JerryCanItem 
       { 
           mass = 80; 
           //uniformModel = "\A3\Structures_F\Items\Vessels\CanisterFuel_F"; 
       }; 
   };     
}; 
class CfgVehicles 
{     
   class Items_base_F; 
   class RPA_Item_JerryCan: Items_base_F 
   { 
       mapSize = 0.15;         
       author = "BI; edited by RP";     
       scope = 2; 
       scopeCurator = 2; 
       displayName = "Jerry Can";             
       vehicleClass = "Items";             
       class TransportItems 
       { 
           class RPA_JerryCan 
           { 
               name = "RPA_JerryCan"; 
               count = 1; 
           }; 
       }; 
   }; 

};  

But again, it has no inventory so I cannot open it.

Am I missing something crucial here?

Edited by RedPhoenix

Share this post


Link to post
Share on other sites

I dont know if anyone have said this but have you tryed:

class RPA_Jerrycan: ToolKit{

scope = 2;

displayName = "Jerry Can";

icon = "iconObject_2x1";

picture = "\RPA_Refined_Vehicles_v3\rpa_misc\rpa_jerrycan\jerrycan.paa";

model = "\A3\Structures_F\Items\Vessels\CanisterFuel_F.p3d";

class ItemInfo: JerryCanItem

{

mass = 80;

//uniformModel = "\A3\Structures_F\Items\Vessels\CanisterFuel_F";

};

};

sure you might have to change some things. But check the toolkit config in weapons_f/items/config.bin.

and why would you want it to have a inventory?

Create a couple if classes like 25% full, 50% , 75% and 100%. Everytime you fill you use eatch 25% increment.

This way you can have fuel in the jerrycan and still save info about it.

Take care

Share this post


Link to post
Share on other sites

I was messing around with this and didn't manage to make it work on time. I had to switch to a different method: I made a magazine with the fuel cannister model

class CfgMagazines
{
class Default;
class CA_magazine: Default{};
class SUPER_can: CA_magazine
{
	allowedSlots[] = {901};
	ammo = "Default";
	count = 1;
	descriptionShort = "";
	descriptionUse = "";
	displayName = "Fuel cannister";
	displayNameShort = "";
	initSpeed = 0;
	mass = 80;
	maxLeadSpeed = 0;
	maxThrowHoldTime = 2;
	maxThrowIntensityCoef = 1.4;
	minThrowIntensityCoef = 0.3;
	model = "\A3\Structures_F\Items\Vessels\CanisterFuel_F.p3d";
	modelSpecial = "";
	nameSound = "";
	nameSoundWeapon = "";
	picture = "\ArmAgeddon\data\cannister.paa";
	quickReload = 0;
	reloadAction = "";
	scope = 2;
	selectionFireAnim = "zasleh";
	simulation = "ProxyMagazines";
	sound[] = {"A3\sounds_f\dummysound",0.000316228,1,10};
	type = "2*  256";
	useAction = 0;
	useActionTitle = "";
	value = 5;
	weaponPoolAvailable = 1;
	weight = 0;
};
};

and used a function adding an action "refuel" to the player:

private ["_vehs"];

_vehs = if (typeName _this == "OBJECT") then {[_this]} else {_this};
{
_x addAction [
	"<t color='#FF0000'> Refuel Vehicle </t>",
	{
		private ["_vehicle","_player"];
		_vehicle = _this select 0;
		_player  = _this select 1;
		_refuel = [[_vehicle],"SUPER_fnc_refuel",true,false,true] call BIS_fnc_MP;
		_player removeMagazine "SUPER_can";
	},
	0,
	1.5,
	true,
	true,
	"",
	"'SUPER_can' in ((getMagazineCargo
		backpackContainer _this) select 0)"
];
} forEach _vehs;

where SUPER_fnc_refuel is :

private["_vehicle"];
_vehicle = _this select 0;
if (local _vehicle) then
{
_vehicle setFuel (fuel _vehicle + 0.1);
};

How do you define the action of the fuel cannister with your Item method?

I didn't find how it is done for the medikit and toolkit?

Share this post


Link to post
Share on other sites

This is the way Lappihuan and I wanted to go as well. We haven't our own function yet, but I'm sure it would be somewhat similar to yours. Thanks anyway!

But currently I have decided to drop the A3 vanilla model as it causes too many problems. Thus I've created a new one which should be working without problems.

Share this post


Link to post
Share on other sites

hmm, it is weird, I have no issues with the model. But I only need to place it in "loot positions" in buildings. To avoid spawning it in the air, I precompute the building positions in an array by spawning a massive object on the BI building positions, waiting for it to fall and then register and diag_log its position (the building positions are slightly above ground). An other solution would be to attach the fuel cannister to a dummy invisible massive object.

Share this post


Link to post
Share on other sites

So, I'm back on this.

My actual config looks like this:

class CfgPatches
{
   class RVE_JerryCan
   {
       units[] = {"RPA_Item_JerryCan","JerryCanItem"};
       weapons[] = {"RPA_JerryCan"};
       requiredVersion = 0.1;
       requiredAddons[] = {"A3_Structures_F_Items_Vessels","A3_Weapons_F","A3_Weapons_F_Items"};
   };
};

class CfgWeapons
{      
   class InventoryItem_Base_F;
   class JerryCanItem: InventoryItem_Base_F
   {
   type = 620;
   //allowedSlots[] = {901};
   allowedSlots[] = {801,701,901};
   };

   class Default;
   class ItemCore: Default
   {
       type = 131072;
       model = "\A3\weapons_F\ammo\mag_univ.p3d";
       picture = "\A3\Weapons_F\Data\clear_empty.paa";
       muzzles[] = {};
       class Armory
       {
           disabled = 1;
       };
   };
   class RPA_JerryCan: ItemCore
   {
       scope = 2;
       displayName = "Jerry Can";
       descriptionShort = "$STR_A3_cfgWeapons_ToolKit1";
       picture = "\RPA_Refined_Vehicles_v3\rpa_misc\rpa_jerrycan\jerrycan.paa";
       model = "\RPA_Refined_Vehicles_v3\rpa_misc\rpa_jerrycan\rpa_jerrycan.p3d";
       class ItemInfo: JerryCanItem
       {
           mass = 80;
           model = "\RPA_Refined_Vehicles_v3\rpa_misc\rpa_jerrycan\rpa_jerrycan.p3d";
       };
   };
};

class CfgVehicles
{   
   class EAST_Box_Base;    
   class RPA_Item_JerryCan: EAST_Box_Base
   {
       scope = 2;
       scopeCurator = 2;
       displayName = "Jerry Can";
       author = "BI; edited by RP";
       picture = "\RPA_Refined_Vehicles_v3\rpa_misc\rpa_jerrycan\jerrycan.paa";
       model = "\RPA_Refined_Vehicles_v3\rpa_misc\rpa_jerrycan\rpa_jerrycan.p3d";
       vehicleClass = "Items";
       class TransportWeapons
       {

           class RPA_JerryCan
           {
               name = "RPA_JerryCan";
               count = 1;
           };

       };      
   };
};

The thing is, that everytime I load this I get this error:

zwischenablage01tnito.jpg

But for me I can't see what's wrong with my config, as I have defined RPA_Jerrycan in cfgWeapons.

Right now there spawns "something" in the inventory, but it seems to be a dummy: It has no name, no picture, no description whatsoever....

Share this post


Link to post
Share on other sites

Maybe (could be wrong):

class RPA_JerryCan: TransportWeapons
           {
               name = "RPA_JerryCan";
               count = 1;
           };

Share this post


Link to post
Share on other sites

it was the array

{

name = "RPA_JerryCan";

};

Thanks to kju, I know now it is:

{

weapon = "RPA_JerryCan";

};

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×