Jump to content
Sign in to follow this  
silentleopard

activate trigger by opening crate

Recommended Posts

I'm new to eden editor and I started making SP missions. I learned a few things on my own but I would like to know how to activate a trigger as the player opens a crate and looks in it's inventory.

Share this post


Link to post
Share on other sites

Or perhaps ContainerOpened.

Place this in your crate's init field:

crateOpen = false;
this addEventHandler ["ContainerOpened", {
	params ["_container", "_unit"];
	crateOpen = true;
}];

Place a trigger, change the condition field to "openCrate," then put whatever you need in the onAct field. 

Depending on what you are doing, you might not even need the trigger.

*edit* - basically the same as M1ke_SK's example, only I'm using a global variable instead of setting a variable on the object.

  • Like 1

Share this post


Link to post
Share on other sites

1. name your container in editor "container1" (without quotes)

2. put this code to initServer.sqf in mission root directory (if it does not exist, create one)

//initServer.sqf

container1 addEventHandler ["ContainerOpened", {
	params ["_container", "_unit"];

	_container setVariable ["opened", true, true];
}];

3. put in condition of your trigger this code

container1 getVariable ["opened", false]

4. profit

  • Like 2

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  

×