Jump to content
Sign in to follow this  
dreadedentity

ContainerOpened EH broken?

Recommended Posts

Wondering if it's broken or if I'm just using it wrong. This is the code I tried:

_obj = _this select 0;

_obj addEventHandler ["ContainerOpened",
{
_openedContainer = _this select 0;
_unit = _this select 1;
hint "Fuck this shit.";

if (side _unit != west) then
{
	_unit action ["CancelAction", _unit];
	hint "You are not allowed to access this container";
};
}];

Run the script in an ammobox's init line, passing "this" to get the object. Tested by using an Op4 rifleman to run up and used both "Inventory" option, and "Rearm" option. Neither comment shows up. Also tested replacing ContainerOpened with InventoryOpened and transposing _this select 0 & _this select 1 (I understood from the wiki that they're opposite from ContainerOpened for some reason).

What's wrong here?

Share this post


Link to post
Share on other sites

ContainerOpened doesn't seem to work for me either. So I settled for this instead, although I think you said you had tried this method.

player addEventHandler ["InventoryOpened",
{ 
if (_this select 1 == _obj) then 
{
	_unit = _this select 0;
	_container = _this select 1;
	hint format ["%1 Opened %2",_unit,_container]
};
}];  

Share this post


Link to post
Share on other sites
Try dev branch, it might not be on stable yet.

Completely innocent question, what are the benefits to using the dev branch? Would code written with it work in stable releases, or would clients have to run dev branch also? I downloaded it once before to play around with rotorlib but it was extremely difficult for me to fly with it.

Share this post


Link to post
Share on other sites
Completely innocent question, what are the benefits to using the dev branch? Would code written with it work in stable releases, or would clients have to run dev branch also? I downloaded it once before to play around with rotorlib but it was extremely difficult for me to fly with it.
On dev branch you get to try new features early and can provide useful feedback to BIS about bugs. It's not really meant for optimal gameplay, it doesn't really enhance the arma experience, its basically a beta.

About the code, I would say it works 95% of the time on both, its really down to the scripting commands you are using. Part of the dev branch are new commands that are not backwards compatible.

As for rotorlib, it was in the dev stage and I've heard its been tweaked. rotorlib is meant to be closer to realism and therefore more challenging, but I'm pretty sure the first version of A3 rotorlib was pretty buggy.

Share this post


Link to post
Share on other sites
Completely innocent question, what are the benefits to using the dev branch? Would code written with it work in stable releases, or would clients have to run dev branch also? I downloaded it once before to play around with rotorlib but it was extremely difficult for me to fly with it.

If you're a code bug, then use dev branch. You'll get access to new commands way early and such. You should very easily be ble to switch between stable and dev for when you want to play public games etc.

Edited by Iceman77

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  

×