Jump to content

Recommended Posts

here´s one for you... I have this Sensor-Class in my mission.sqm

class Item0
       {   
           position[]={4691,0.436,13432};
           a=200;
           b=200;
           rectangular=1;
           activationBy="WEST";
           repeating=1;
           interruptable=1;
           age="UNKNOWN";
           name="sensor1";
           expCond="(vehicle player) in thislist;";
           expActiv="sensor1= [] execVM ""scripts\awesome\sensor_enter.sqf"";";
           expDesactiv="terminate sensor1; titleText [""You've left the Sensor."", ""PLAIN DOWN"", 3];";
           class Effects;
       };

All is fine, works great, hooray!

Now I want to start a script on leaving the sensor... I figured changing it to:

class Item0
       {   
           position[]={4691,0.436,13432};
           a=200;
           b=200;
           rectangular=1;
           activationBy="WEST";
           repeating=1;
           interruptable=1;
           age="UNKNOWN";
           name="sensor1";
           expCond="(vehicle player) in thislist;";
           expActiv="sensor1= [] execVM ""scripts\awesome\sensor_enter.sqf"";";
           expDesactiv="sensor1= [] execVM ""scripts\awesome\sensor_leave.sqf"";";
           class Effects;
       };

Computer says NO... Sensor is broken. Strangely enough, I failed to find a proper documentation about the sensor stuff, esp. "expDesactiv".

Anybody got an idea how to fire a script on ENTERING and LEAVING a sensor?

Share this post


Link to post
Share on other sites

I think it's because you have the Sensor and the script handle with the same name.

I had something like this happen before. just change the name of the trigger.

Share this post


Link to post
Share on other sites

Like this? Clarify, please...

...
name="sensor";
expCond="(vehicle player) in thislist;";
expActiv="sensorEnter= [] execVM ""scripts\awesome\sensor_enter.sqf"";";
expDesactiv="sensorLeave= [] execVM ""scripts\awesome\sensor_leave.sqf"";";
...

Share this post


Link to post
Share on other sites

as long as they are not name="sensor"; the handles can be the same as each other or how you have them now is fine.

Share this post


Link to post
Share on other sites

The problem you have is that unless you know who's leaving the trigger or it's the last unit leaving it won't work.

taikonaut's should work because he is checking to see if a known unit has left the trigger (vehicle player) in thislist

if you have multiple known units in the trigger you could run a distance check to see if they have moved beyond the area.

cond

{_x distance thistrigger > 50 } count [man1,man2,man3] != 0

on act

null=[] execvm "yourscriptorcode.sqf"

that assumes you know the units your checking man1,man2,man3

Share this post


Link to post
Share on other sites

You mean something like this?

		class Item9
	{
		position[]={6057.55,0,2491.35};
		a=100;
		b=100;
		activationBy="WEST";
		repeating=1;
		interruptable=1;
		age="UNKNOWN";
		name="base";
		expCond="{_x distance thistrigger > 200 } count [man1,man2,man3] != 0";
		expActiv="base = [] execVM ""custom\map_updates\base_entry.sqf"";";
		expDesactiv="null =[] execVM ""custom\map_updates\base_leave.sqf"";";
		class Effects
		{
			titleType="TEXT";
			titleEffect="PLAIN DOWN";
			title="You are in a Adminbase! You will be warned!";
		};
	};

Edited by masterking3000

Share this post


Link to post
Share on other sites

Looking at it with a clear head what I posted won't work it will only tell you when the first unit leaves the trigger area.

Share this post


Link to post
Share on other sites

Sorry for the necro however I see this didn't have a solid answer to it;

 

            expCond       = "(player distance mysensor) < 50;";
            expActiv      = "TitleText[""You have come within 50m of mysensor"",""PLAIN DOWN""];";
            expDesactiv   = "TitleText[""You are no longer within 50m of mysensor"",""PLAIN DOWN""];";
 

 
expCondition

The condition to be met for expActiv to trigger.

expActive

What to do when expCondition is met, i.e (vehicle player) setDamage 1;

expDesactive

What to do when expCondition is no longer true.
 

 
expActive and expDesactive will only fire once, every time the expCondition criteria is (or isn't) met. At least this is how I've seen it in action.

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  

×