Jump to content
  • 0

Using a trigger to animate bargate (ZavoraAnim)


Achmed

Question

Im trying to get a bargate to open automatic when you approach it by using a trigger however no matter what i try i cant get it to work.

 

This is the code i use to place the bargate

_vehicle_25 = objNull;
if (true) then
{
  _this = createVehicle ["ZavoraAnim", [15483.672, 9045.5664, 0.35535103], [], 0, "CAN_COLLIDE"];
  _vehicle_25 = _this;
  _this setDir 110.07224;
  _this setVehicleVarName "gate";
  gate = _this;
  _this setVehicleInit "this allowDammage false;this enableSimulation false;this animate [""bargate"",1]";
  _this setPos [15483.672, 9045.5664, 0.35535103];
};

and this is the code used in the trigger

		class Item4
        {
            position[]={15483.672,0.35535103,9045.5664};
            a=100;
            b=100;
            activationBy="WEST";
            repeating=1;
           	interruptable=1;
           	age="UNKNOWN";
           	name="trader7";
           	expCond="(player distance trader7) < 60;";
           	expActiv="TitleText[""Now Entering Trader 7"",""PLAIN DOWN""]; canbuild = false; inTraderCity = ""Trader 7""; gate animate [""bargate"",0];";
           	expDesactiv="TitleText[""Now Leaving Trader 7"",""PLAIN DOWN""]; canbuild = true; inTraderCity = ""Any""; gate animate [""bargate"",1];";
           	class Effects
           	{
           	};
	    };

The gate closes initially so i know first bit of code is working correctly its just the trigger that's the problem.

 

Can anyone spot why its not working on the trigger? I know the trigger works as i get the text saying entering trader 7

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

switch it to a if command?

 

_vehicle_25 = objNull;
if (true) then
{
_this = createVehicle ["ZavoraAnim", [15483.672, 9045.5664, 0.35535103], [], 0, "CAN_COLLIDE"];
_vehicle_25 = _this;
_this setDir 110.07224;
_this setVehicleInit "this allowDammage false;this enableSimulation false;this animate [""bargate"",1]";
_this setPos [15483.672, 9045.5664, 0.35535103];
if (gate_open) then {_this animate ["bargate",0]; } else {_this animate ["bargate",1];}
};
Link to comment
Share on other sites

  • 0

the first block of code works fine though so wouldn't it be something to do with the trigger that's the problem?

 

could it be because the item is spawned server side and the trigger is client side?

 

Yea i been having issues like that. I found the only real way for the server and client to work is using "publicvaraible".

Link to comment
Share on other sites

  • 0

Yea i been having issues like that. I found the only real way for the server and client to work is using "publicvaraible".

Was there a successful fix for this, as trying to build my ai island and would love something like this.

 

If not, would I just use the code above to set them to be animated down at server start?

 

Many thanks,

 

Shane

Link to comment
Share on other sites

  • 0
_this setVehicleInit "this allowDammage false;this enableSimulation false;this animate [""bargate"",1]";

I don't know my arse from my elbow when it comes to this stuff, and I am not having a go at your spelling, but you spelled "Damage" wrong. Would that matter?  

Link to comment
Share on other sites

  • 0

Im trying to get a bargate to open automatic when you approach it by using a trigger however no matter what i try i cant get it to work.

 

This is the code i use to place the bargate

_vehicle_25 = objNull;
if (true) then
{
  _this = createVehicle ["ZavoraAnim", [15483.672, 9045.5664, 0.35535103], [], 0, "CAN_COLLIDE"];
  _vehicle_25 = _this;
  _this setDir 110.07224;
  _this setVehicleVarName "gate";
  gate = _this;
  _this setVehicleInit "this allowDammage false;this enableSimulation false;this animate [""bargate"",1]";
  _this setPos [15483.672, 9045.5664, 0.35535103];
};

and this is the code used in the trigger

		class Item4
        {
            position[]={15483.672,0.35535103,9045.5664};
            a=100;
            b=100;
            activationBy="WEST";
            repeating=1;
           	interruptable=1;
           	age="UNKNOWN";
           	name="trader7";
           	expCond="(player distance trader7) < 60;";
           	expActiv="TitleText[""Now Entering Trader 7"",""PLAIN DOWN""]; canbuild = false; inTraderCity = ""Trader 7""; gate animate [""bargate"",0];";
           	expDesactiv="TitleText[""Now Leaving Trader 7"",""PLAIN DOWN""]; canbuild = true; inTraderCity = ""Any""; gate animate [""bargate"",1];";
           	class Effects
           	{
           	};
	    };

The gate closes initially so i know first bit of code is working correctly its just the trigger that's the problem.

 

Can anyone spot why its not working on the trigger? I know the trigger works as i get the text saying entering trader 7

 

Just trying to figure this out myself, on the init shouldn't you leave a space in-between init values?

 

On the mission I'm making at the moment my code is:

 

  _this setVehicleInit "this addEventHandler [""HandleDamage"", {false}]; this enableSimulation false; this animate [""bargate"",1];";

 

I find that this allowDamage false didn't work, but addEventHandler does (My AI Base uses barriers which I don't want players running over).

 

Would the error on the following line be causing the problems:

 

expDesactiv="TitleText[""Now Leaving Trader 7"",""PLAIN DOWN""]; canbuild = true; inTraderCity = ""Any""; gate animate [""bargate"",1];";

 

Shouldn't it be:

 

xpDesactiv="TitleText[""Now Leaving Trader 7"",""PLAIN DOWN""]; canbuild = true; inTraderCity = ""Trader 7""; gate animate [""bargate"",1];";

 

Still learning coding for my own server and AI Island as I have mentioned, no harm in testing ^^.

 

Shane

Link to comment
Share on other sites

  • 0
	class Vehicles
	{
		items=1;
		class Item0
		{
			position[]={6277.0088, 0.18027619, 7817.2988};
			azimut=-245.55611;
			special="NONE";
			id=100;
			side="EMPTY";
			vehicle="ZavoraAnim";
			skill=0.60000002;
			text="barGate1";
			init="this allowDammage false; this enableSimulation true; this animate [""bargate"",1]; this SetVectorUp [0,0,1];";
		};
	};

put that class into your mission.sqm - above class Markers

and this is the trigger i use.. and it works.

 

        class Item2
        {
            position[]={6344.8081,304.99023,7806.7598};
            activationBy="WEST";
            repeating=1;
            interruptable=1;
            age="UNKNOWN";
            name="zonestary";
            expCond="(player distance zonestary) < 100;";
            expActiv="barGate1 animate [""bargate"",0];";
            expDesactiv="barGate1 animate [""bargate"",1];";
            class Effects
            {
            };
        };

cheers

Edited by jOoPs
bbcode-war
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...