Hi guys,
I am making a truck and a trailer. These are separate .pbo files and the truck will tow the trailer. I use a towing script, which is included in trailer's .pbo and activated through class user actions. A yellow user menu, "Connect Trailer", appears, when player gets close to the trailer. Here you can check the related lines below. It is from config.cpp of the trailer. I defined everything in config.cpp of
the trailer. class useractions
{
class connectTRAILER
{
displayName="Connect Trailer";
position="axis_connect";
radius=6
condition="(nearestobject [this, ""TRUCK550""]) distance this < 10 and alive this and this animationphase ""ani_connection"" == 0";
statement="[nearestobject [this, ""TRUCK550""],this,1.9,.19] exec ""\TRUCK550\tow.sqs""";
};
class disconnectTRAILER
{
displayName="Disconnect Trailer";
position="axis_connect";
radius=6
condition="(nearestobject [this, ""TRUCK550""]) distance this < 10 and alive this and this animationPhase ""ani_connection"" >= 0.5";
statement="this animate [""ani_connection"", 0]";
};
Now you see when the user menu appears...
Here, I want to add a condition statement for this user action menu, so when
the truck is not alive, the corresponding user menu, "Connect Trailer", doesn't appear anymore!
How can I write this conditon to open this menu if the nearest truck550 is alive? I don't know this strange language! :-\
You know, I can't use global variables cause if I use, problems arise when there are more than one couple of the same addon, in the game!
I tried this below, but it doesn't work. I know it looks funny and weird
but you can get the point!
can you correct it?
class connectTRAILER
condition="[alive [(nearestobject [this, ""TRUCK550""]) distance this < 10]] and alive this and this animationphase ""ani_connection"" == 0";
class disconnectTRAILER
condition="[alive [(nearestobject [this, ""TRUCK550""]) distance this < 10]] and alive this and this animationPhase ""ani_connection"" >= 0.5";
Regards