Jump to content
ducdragger99

Beginner question about addAction

Recommended Posts

I have made a base with multiple flags that I use as arsenals.  I have made it where the flags are able to be raised and lowered, however, when the player raises or lowers the flag, only the player sees the flag move.

 

Example:

Player 1 goes up to flag and uses the "raise flag" action.

Player one sees the flag go from the lower position to the upper position.

Player 2 does not see the flag move.

 

How can I get one person to raise/lower the flag and it appear raised or lowered for all players?

 

Here is what I have in the flags init:

 

call{this setFlagAnimationPhase 0.1;}; this addAction["Raise Flag",{RangeFlag3 setFlagAnimationPhase 1.0;}]; this addAction["Lower Flag", {RangeFlag3 setFlagAnimationPhase 0.1;}];

Share this post


Link to post
Share on other sites

I have been trying to get remoteExec to function, but it seems i'm not understanding something.

 

["AmmoboxInit",[this,true]] call BIS_fnc_arsenal; call{this setFlagAnimationPhase 0.1;}; this addAction[["Raise Flag",] remoteExec {RangeFlag3 setFlagAnimationPhase 1.0;}]; this addAction[["Lower Flag",] remoteExec {RangeFlag3 setFlagAnimationPhase 0.1;}];

 

i'm getting an error of 

Init missing:[

Share this post


Link to post
Share on other sites

setFlagAnimationPhase has local effects which means you need to remoteExec this command in particular.

 

Instead of:

RangeFlag3 setFlagAnimationPhase 1.0;

do this:

[RangeFlag3, 1.0] remoteExec ["setFlagAnimationPhase"];

 

Also, consider formatting the code to make it easier on yourself. It will be much simpler to spot errors like the missing [.

Share this post


Link to post
Share on other sites
59 minutes ago, _foley said:

setFlagAnimationPhase has local effects which means you need to remoteExec this command in particular.

 

Instead of:


RangeFlag3 setFlagAnimationPhase 1.0;

do this:


[RangeFlag3, 1.0] remoteExec ["setFlagAnimationPhase"];

 

Also, consider formatting the code to make it easier on yourself. It will be much simpler to spot errors like the missing [.

_foley, 

 

I inserted the following and i am still getting the [ error.  My vision isn't the greatest, but I do not see where I am missing a bracket.

 

["AmmoboxInit",[this,true]] call BIS_fnc_arsenal;

call{this setFlagAnimationPhase 0.1;};

 this addAction[["Raise Flag",] remoteExec [RangeFlag3, 1.0] remoteExec ["setFlagAnimationPhase"]];

 this addAction[["Lower Flag",] remoteExec [RangeFlag3, 0.1] remoteExec ["setFlagAnimationPhase"]];

 

 

 

 

Share this post


Link to post
Share on other sites

Ok, so i've tired many different combinations, but I still come up with the same results.  

The ability is there to move the flag up and down, and it works.  However, the remoteExec is not working.  

 

*Player 1 raises flag

*Player 2 still sees flag at low position.

 

Here is the code I used.  It is not returning any errors.

 

["AmmoboxInit",[this,true]] call BIS_fnc_arsenal; //Add arsenal

 

call{this setFlagAnimationPhase 0.1;};  //Set Flag height to low on start

 

this addAction["Raise Flag",{RangeFlag1 setFlagAnimationPhase 1.0;}]  //Raise Flag (works on client side)

remoteExec [{"RangeFlag1 setFlagAnimationPhase",0}];  //raise flag on all clients (does not work)

 

this addAction["Lower Flag",{RangeFlag1 setFlagAnimationPhase 0.1;}]  //Lower Flag (works on client side)

remoteExec [{"RangeFlag1 setFlagAnimationPhase",0}];  //lower flag on all clients (does not work)

Share this post


Link to post
Share on other sites

To reiterate what @_foley said,

 

Instead of this:

this addAction [
	"Raise Flag",
	{
		RangeFlag1 setFlagAnimationPhase 1.0;
	}
];

do this:

this addAction [
	"Raise Flag",
	{
		[RangeFlag1, 1.0] remoteExec ["setFlagAnimationPhase"];
	}
];

...etcetera.

  • Like 3

Share this post


Link to post
Share on other sites
17 hours ago, Harzach said:

To reiterate what @_foley said,

 

Instead of this:


this addAction [
	"Raise Flag",
	{
		RangeFlag1 setFlagAnimationPhase 1.0;
	}
];

do this:


this addAction [
	"Raise Flag",
	{
		[RangeFlag1, 1.0] remoteExec ["setFlagAnimationPhase"];
	}
];

...etcetera.

Ok cool.  Thanks for the example.  I'm very new to this and I have a reading comprehension problem, so the visual aid REALLY helps.  You guys are great, I appreciate the time and effort.  I will give this a go, and hopefully it works.  Thanks again, I will post with an update

 

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

×