Jump to content

Recommended Posts

Is it possible to add an action to all objects through the description.ext?

 

like?

 

class CfgVehicles 
{
	class LIB_AmmoCrates_NoInteractive_Large 
	{
		class UserActions
		{
			class CollectPoints
			{
				displayNameDefault = "Collect";
						showWindow = 0;
						hideOnUse = 1;
				displayName="Collect";
				position="action";
				radius=0.10000;
				onlyForPlayer = 1;
				condition = true;
				statement = "this addAction ["Collect", {myCurator addCuratorPoints 0.15}]";
			};
		};	
	};
};

 

which the code doesn't work because i keep getting the  (something) instead of ''' error.

 

Anyway if its possible, i want to do this route instead of doing init code as this would mean that all objects placed by editor or Zeus would be affected.

Share this post


Link to post
Share on other sites
1 hour ago, HazJ said:

In addon, yes. In mission, kinda. You can define it in a config as a STRING but you'll need to call compile it to work properly.

https://community.bistudio.com/wiki/call

https://community.bistudio.com/wiki/compile

https://community.bistudio.com/wiki/getText

Not really worth it if you ask me. Pointless.

 

Hmm any examples of someone doing what I'm trying to do? after reading those wiki's I'm even more confused on what I'm suppose to be doing.

Share this post


Link to post
Share on other sites

Sure but first... What are you trying to do? Why not use the addAction in code, no need for it to be in the configs. Unless you are making an addon, say a vehicle with action on it.

Share this post


Link to post
Share on other sites
Just now, HazJ said:

Sure but first... What are you trying to do? Why not use the addAction in code, no need for it to be in the configs. Unless you are making an addon, say a vehicle with action on it.

 

Applying it globally will ensure that its attached the object regardless if its placed by Zeus, script, or the Eden editor.

In this case i just wanted to add functionality to this useless ammo box. If i did it via script, then i would have to add an event handler to the curator which is a pain in the ass to have it sift through all your addons checking if you placed something it needs to manipulate.

Here its just implied that if there is an ammo box anywhere on the map, that the player can go up to it and get curator points. I probably will do this to add functionality to other props, so that the curator has an incentive to place certain items that otherwise would be useless.

Share this post


Link to post
Share on other sites

Is this ammobox custom? You can add it via config (addon way), better of asking someone else for that. Maybe here:

https://forums.bohemia.net/forums/forum/162-arma-3-addons-configs-scripting/

There is another way. You can use normal SQF code in the PBO. Assuming the addon is required by every client you can just add local action. If it server addon then you'll need to most likely remoteExec it. Let me know. Server-side way:

// modified example from my project
class CfgPatches
{
	class addonClass
	{
		name = "Addon Name";
		author[] = {"Author"};
		url = "URL"; // optional, "" for none
		requiredVersion = 1;
		requiredAddons[] = {"HazWSConfigs"};
		units[] = {};
		weapons[] = {};
	};
};

class CfgFunctions
{
	class addonClass // same as class above
	{
		class main
		{
			class postInit
			{
				postInit = 1;
				file = "addonClass\server\server_init.sqf";
			};
		};
	};
};
// in server_init.sqf
// remoteExec addAction or whatever...

As I said though, if all addons use it. Just do it locally. No need for this server-side way, etc...

Share this post


Link to post
Share on other sites

can you just make a addaction with the condition for it, that way even if zeus places it it should still show up and function the same?

Share this post


Link to post
Share on other sites

You can just add it normally as I originally said, with plain SQF, regardless if it is locally per client, global from server, or where-ever. I also provided alternative solutions. I think he is a little confused... @hank kelley - Please provide more info. Is this an ammobox placed or what?

Share this post


Link to post
Share on other sites
5 hours ago, HazJ said:

You can just add it normally as I originally said, with plain SQF, regardless if it is locally per client, global from server, or where-ever. I also provided alternative solutions. I think he is a little confused... @hank kelley - Please provide more info. Is this an ammobox placed or what?

No it is not placed. I want it so that if it ever was placed by the editor/script/zeus, it will already function the way i wanted it to function. All LIB_AmmoCrates_NoInteractive_Large was going to be a box that i was going to add an add action too.

Spoiler
9 hours ago, HazJ said:

Is this ammobox custom? You can add it via config (addon way), better of asking someone else for that. Maybe here:

https://forums.bohemia.net/forums/forum/162-arma-3-addons-configs-scripting/

There is another way. You can use normal SQF code in the PBO. Assuming the addon is required by every client you can just add local action. If it server addon then you'll need to most likely remoteExec it. Let me know. Server-side way:



// modified example from my project
class CfgPatches
{
	class addonClass
	{
		name = "Addon Name";
		author[] = {"Author"};
		url = "URL"; // optional, "" for none
		requiredVersion = 1;
		requiredAddons[] = {"HazWSConfigs"};
		units[] = {};
		weapons[] = {};
	};
};

class CfgFunctions
{
	class addonClass // same as class above
	{
		class main
		{
			class postInit
			{
				postInit = 1;
				file = "addonClass\server\server_init.sqf";
			};
		};
	};
};


// in server_init.sqf
// remoteExec addAction or whatever...

As I said though, if all addons use it. Just do it locally. No need for this server-side way, etc...

 

I am a little confused on why i need to mess with patched and functions to make this work?

 

Share this post


Link to post
Share on other sites

You don't have to do it like that. That was more server-side approach that I shown above.

Share this post


Link to post
Share on other sites

You cannot edit the configFile in description.ext as far as I'm aware, so you cannot give custom "init" eventhandlers or useractions to a vehicle config.

This only works through making an addon.

 

If you want to have an addAction that works without adding it to every spawned vehicle you have few options:

  • Add it to the player.
  • Use a mission eventhandler such as getInMan/InventoryOpened/... to give an addAction.
  • Use a loop that checks all objects in the mission and adds the action when required.

Share this post


Link to post
Share on other sites
14 hours ago, Sgt. Dennenboom said:

so you cannot give custom "init" eventhandlers

You could with CBA. And then addAction inside the init script.

Share this post


Link to post
Share on other sites
7 hours ago, Dedmen said:

You could with CBA. And then addAction inside the init script.

 

I am working with the CBA Addon. Would it be part of the mission or a seperate addon?

 

 

Share this post


Link to post
Share on other sites
On 13.6.2018 at 8:11 PM, hank kelley said:

 

I am working with the CBA Addon. Would it be part of the mission or a seperate addon?

 

 

Like belbo posted above. You can add the eventhandler as part of your init.sqf (Btw Commy recommends to use the initPost handler)

Or you can add them in your description.ext as a eventhandler config.

https://github.com/CBATeam/CBA_A3/wiki/Extended-Event-Handlers-(new)#extended_initpost_eventhandlers

^ Description.ext option

Share this post


Link to post
Share on other sites

Forgive me for the dumb question that's possibly been answered/unrelated to the post, but I've been trying to create a script in my mission that renames weapons, vehicles and equipment like how ACE does. Also want to change some stats for some items (looking at the CSAT fatigues specifically). Would this be done via the call and compile commands or by some other approach? I'm not using CBA or any other mods so that the mission file itself has no dependencies.

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

×