Jump to content
Sign in to follow this  
elijk88

Need Help with RemoveAction

Recommended Posts

I have a script that activates when a player walks in the trigger that adds actions to perform specific animations. The player gets the actions fine on the action menu and all the animation works perfect in single player mode but does not work on the network for all players. In addition, I have been trying to remove the actions once the player move >11 meters away from the civilian but the script is not removing the actions. :confused:Here is the code:

Gestures.sqf

[spoiler]_gest1 = {player addaction [ _x select 1, "plamov.sqf", [(_x select 0)]} forEach [["AmovPercMstpSnonWnonDnon_ContemptSlap", "Contempt Slap"],
["AmovPercMstpSnonWnonDnon_GoAway", "Go away"]];
myLoc = createLocation ["NameVillage",(player modeltoworld [0,0,0]), 0.4 ,1.75];
myLoc setRectangular true;
myLoc attachObject [player,[0,0,0]];

myLoc2 = createLocation ["NameVillage",(guy modeltoworld [0,0,0]), 0.4,1.75];
myLoc2 setRectangular true;
myLoc2 attachObject [guy,[0,0,0]];

_gest2 = {player addAction [_x select 1, "plamovkiss.sqf",[(_x select 0)],5,false,true,"","(getpos civ1) in myloc && (getpos player) in myLoc2"]} foreach
[
["AmovPercMstpSnonWnonDnon_Kiss", "Kiss Greeting"]
];

_gest3 = {player addAction [_x select 1, "plamov_Handshak.sqf",[(_x select 0)],5,false,true,"","(getpos civ1) in myloc && (getpos player) in myLoc2"]} foreach
[
["AmovPercMstpSnonWnonDnon_Handshak", "Handshake"]
];

_gest4 = {player addAction [_x select 1, "plamov_HandshakKissHeartGreeting.sqf",[(_x select 0)],5,false,true,"","(getpos civ1) in myloc && (getpos player) in myLoc2"]} foreach
[
["AmovPercMstpSnonWnonDnon_HandshakKissHeartGreeting", "Handshake Kiss Greeting"]
];[/spoiler]



plamov.sqf


[spoiler]_anim = (_this select 3) select 0;
publicexec ["true","_this switchmove ''",civ1]; //guy switchmove "";
publicexec ["true","_this switchmove ''",civ1]; //guy switchmove ""; 
publicexec ["true","_this switchmove ''",civ1]; //guy switchmove "";
civ1 playmove _anim;[/spoiler]



plamovkiss.sqf


[spoiler]_anim = (_this select 3) select 0;
//civ1 switchmove "";
publicexec ["true","_this switchmove ''",civ1]; 
_dist = 1.6;
_pos = getpos player;_pos2 = getpos civ1;
if (primaryweapon player != "") then 
{
player playmove "AmovPercMstpSobkWrflDnon";
player disablegeo [false, true, true, true];
_dist = 1.6;
};
waituntil {animationstate player == "AmovPercMstpSobkWrflDnon" || animationstate player == "AmovPercMstpSnonWnonDnon"};
civ1 setpos (player modeltoworld [-0.2,_dist,0]);
player setpos (player modeltoworld [0,0.7,0]);
civ1 setdir ((getdir player) - 190);  civ1 playmove _anim;
sleep 0.2;
player playmove _anim;
waituntil {animationstate civ1 == _anim};
waituntil {animationstate civ1 != _anim};
civ1 setpos _pos2; player setpos _pos;
player disablegeo [false, false, false, false];[/spoiler]



plamov_Handshak.sqf


[spoiler]publicexec ["true","_this switchmove ''",civ1]; 
_dist = 1.45;
_pos = getpos player;
_pos2 = getpos civ1;
if (primaryweapon player != "") then 
{
player playmove "AmovPercMstpSobkWrflDnon";
player disablegeo [false, true, true, true];
_dist = 1.4;
};
waituntil {animationstate player == "AmovPercMstpSobkWrflDnon" || animationstate player == "AmovPercMstpSnonWnonDnon"};
civ1 setpos (player modeltoworld [-0.175,_dist,0]);
player setpos (player modeltoworld [0.175,0,0]);
civ1 setdir ((getdir player) - 180); civ1 playmove _anim; civ1 say "greet_informal";
sleep 0.2;
player playmove _anim;
waituntil {animationstate civ1 == _anim};
waituntil {animationstate civ1 != _anim};
civ1 setpos _pos2; player setpos _pos;
player disablegeo [false, false, false, false];[/spoiler]



plamov_HandshakKissHeartGreeting.sqf


[spoiler]_anim = (_this select 3) select 0;
//civ1 switchmove "";
publicexec ["true","_this switchmove ''",civ1]; 
_dist = 1.45;
_pos = getpos player;
_pos2 = getpos civ1;
if (primaryweapon player != "") then 
{
player playmove "AmovPercMstpSobkWrflDnon";
player disablegeo [false, true, true, true];
_dist = 1.4;
};
waituntil {animationstate player == "AmovPercMstpSobkWrflDnon" || animationstate player == "AmovPercMstpSnonWnonDnon"};
civ1 setpos (player modeltoworld [-0.05,_dist,0]);
player setpos (player modeltoworld [0.05,0,0]);
civ1 setdir ((getdir player) - 180); civ1 playmove _anim; civ1 say "greet_informal";
sleep 0.2;
player playmove _anim;
waituntil {animationstate civ1 == _anim};
waituntil {animationstate civ1 != _anim};
civ1 setpos _pos2; player setpos _pos;
player disablegeo [false, false, false, false];[/spoiler]



ActRem.sqf


[spoiler]player removeAction _gest1;
hint "Actions removed"; [/spoiler]

Thanks in advance!

Share this post


Link to post
Share on other sites

You could put this in the trigger/a second trigger with same size area.

Blufor Present, Repeated (If you want)

Activation - this and ((getpos (thislist select 0)) select 1 < 11)

Trigger - (thislist select 0) removeAction _gest1;

OR

Trigger - nul = execVM "ActRem.sqf";

The hint will be displayed globally, so If its multiplayer you might want to remove it.

Sorry if it doesn't work, I'm in school and can't test it. If it doesn't ill post a working solution here when I get home.

Share this post


Link to post
Share on other sites

Thaks BlueBlood but I tried placing another trigger with "nul = [] execVM "ActRem.sqf" and the script executes because the hint displays but the actions are not removed. I did not understand your first suggestion of placing "this and ((getpos (thislist select 0)) select 1 < 11)" in the activation field and didn't know were to place this code "Trigger - (thislist select 0) removeAction _gest1;"

Share this post


Link to post
Share on other sites

It seems overly complicated, couldn't you get away with just giving the addaction to the civilian. That way they should need removing

the player should only see the action if in both in the area and player is within 4 meters of civ1

one example.

{player addAction [_x select 1, "plamovkiss.sqf",[(_x select 0)],5,false,true,"","(getpos civ1) in myloc && player distance civ1 < 4"]} foreach [ ["AmovPercMstpSnonWnonDnon_Kiss", "Kiss Greeting"] ];

Share this post


Link to post
Share on other sites

I just noticed what I wrote, I'm sorry about that I must have been tried

placing "this and ((getpos (thislist select 0)) select 1 < 11)" in the activation field
That needs to go in the Condition field.

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  

×