Jump to content
Wyntech

Global effect from BIS_fnc_holdActionAdd

Recommended Posts

My problem is simple: 

once a player has activated a hold-action by holding space, an object in front of them is hidden, and another object appears. A sound must also play. 

If I (host) activate this, my players can see the effects. If one of my players activate the hold-action, only that individual can see the effect. For the others, nothing changes, including me. 

 

I used remoteExec to add the hold action, but not for the effects that occur when it is activated. What is the solution so that when a client activates the hold action, all on the server can see the effects as well?

Share this post


Link to post
Share on other sites

Remote exec the code that's ran on the completion of the action as well. 

Share this post


Link to post
Share on other sites

Welcome on BI forum

 

remoteExec the add Action (hold or not) is useful if you spawn an object and then making this action visible by all players.

No need to remoteExec it if this command/function is in init field of an edited object. Any player will run the add Action (hold) if placed in this init field.

 

Now, the second point, even if players can see/act your add Action (hold or not), the code will work locally.

That means, you have to consider the arguments and effects localities for EACH command/function you run from this code.

Example:  arguments_global.gifeffects_global.gif  doesn't need to be remote exec.

effects_local.gif  needs to be remote exec on each PC you want to see this effect (sounds with playMusic, playSound are EL usually)

arguments_local.gif is a little bit tricky. If the object is on the same PC as the player who triggers the action (same locality), you don't need to remote exec for Arguments, and Effects locality applies. Example: usually an hosted server hosts the objects like empty cars, crates, and the player as host can run AL code on it, not the other players.

You can check that, with a car which will change its locality along with the driver.

If you want to avoid this locality problem, you need to remoteExec on the PC which own the object.

Example with playMoveNow arguments_local.gif  effects_global.gif for a code making on a remote unit, a prisoner animation. Even if the effect is global, you need to reach the unit on the PC which owns it :

 [ oneUnitHere, {oneUnitHere playMoveNow "AmovPercMstpSsurWnonDnon" } ] remoteExec ["call",oneUnitHere ];

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Thank you for the help, folks! 

This will help me tremendously. 

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

×