Jump to content
Sign in to follow this  
sdarcon

Task (objective) with multiple conditions and scripting (MP)

Recommended Posts

My current wip will have a bit more complicated tasks that require multiple conditions, such as most of the enemies slain, a specific officer terminated, or something purely scripted, such as using an enemy laptop (with addAction). If this was an SP mission, I'd simply do most of it by scripting (since I like simple programming). But MP has a few complications caused by certain scripts only being run by a single client. Furthermore, I want each and every one of these conditions to post a Hint for every player, updating them on what the group as a whole has achieved so far and what's left until the task is completed.

If it's just taking out most of enemies and a specific officer, I can get away easily enough with two triggers monitoring those and executing scripts. But what is the best way of adding an addAction condition to this? The addAction script is only run by the player that used the object hosting the action, as far as I know and have seen during beta testing.

1) I could have the script alter a variable, public the variable, and a third trigger monitoring the variable to launch a script on all clients. Would "spamming" triggers like this start to affect the game speed eventually, if I had a few of such complicated tasks, thus multiplying the number of triggers?

2) An OFP era tutorial advices to make an "eternal" loop run on the server/clients monitoring a variable change, which would then run a script when the change happens. This, honestly, looks very old-fashioned and thus dubious to me, but maybe I'm just prejudiced. Would respawning also hamper this?

Or is there some way to force a script to be run by all clients, even if it's only a single client that executed it (a safe way, not exploitable by hackers if I release the mission publicly)? That might solve most of my problems. Basically I'm looking for the most elegent and CPU efficient way to do this.

If this was too jumbled, I'll gladly clarify any point.

Share this post


Link to post
Share on other sites

You couls use either publicvariable + publicvariableeventhandler or BIS_fnc_MP.

Share this post


Link to post
Share on other sites
You couls use either publicvariable + publicvariableeventhandler or BIS_fnc_MP.

This is very interesting! Thanks! I'll need to study these options more carefully to decide which one to choose. But both look elegant indeed, that is, just what I need.

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  

×