Jump to content
Sign in to follow this  
drunken officer

switch *.paa when animation is done

Recommended Posts

Hello guys.

I need help. It's my very first time, that i try to work with scripts.

I've a 3D object, with a big door and a trafficlight (red & green). The light should shining red, when the door is not complete open. When it's open, then switch to green.

initPhase 0 = close

initPhase 1 = open

Here is what i've, but i dont have a working *.paa file. The doorlight-selection is green all the time.

step 1

select in the 0.000 LOD some faces and create a selection "doorlight".

step 2

create in the config.cpp a hiddenselction and in the model.cfg by "selections"

class Land_policebase: police_Housebase 
{....
hiddenSelections[] = {"doorlight"};
...};
class EventHandlers
         {
              init = "_this exec ""\polizei\data\garagenlicht.sqs""; ";
		   };

step 3

useraction in the config.cpp

class Open_door_pb_aussenhof
{....
condition="this animationPhase ""door_pb_aussenhof"" < 0.5";
statement="this animate [""door_pb_aussenhof"", 1];this say'alarm3';";            
};

class Close_door_pb_aussenhof : Open_door_pb_aussenhof{
condition="this animationPhase ""door_pb_aussenhof"" >= 0.5";
statement="this animate [""door_pb_aussenhof"", 0];this say'alarm3' ";
};

step 4

create the garagenlicht.sqs file. Here i checked other files, but i'm a greenhorn :mad:

_blah = _this select 0;
_anim = animationsPhase "door_pb_aussenhof";
{
while {_anim < 1} do
{
_blah setobjecttexture [0, "\polizei\grafik\redlight.paa"]
};
};
{
while {_anim = 1} do {
_blah setobjecttexture [0, "\polizei\grafik\greenlight.paa"]
};
};

Thx for help

Edited by Drunken Officer

Share this post


Link to post
Share on other sites

Just put it in the action class:

class Open_door_pb_aussenhof {
condition="this animationPhase ""door_pb_aussenhof"" < 0.5";
statement="this animate ['door_pb_aussenhof', 1];this say'alarm3';this setobjecttexture [0, '\polizei\grafik\redlight.paa'];";            
};

class Close_door_pb_aussenhof : Open_door_pb_aussenhof {
condition="this animationPhase ""door_pb_aussenhof"" >= 0.5";
statement="this animate ['door_pb_aussenhof', 0];this say'alarm3';this setobjecttexture [0, '\polizei\grafik\greenlight.paa'];";
};

Share this post


Link to post
Share on other sites

Hm, with this version, the light switch from green to red and back, when i use the action menue.

But i need it, that the green light only shinning, when door_pb_aussenhof = 1. If it x < 1 then i need the red light-

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  

×