Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
-Killet-

Get Intel to all Clients with HoldActionKey

Recommended Posts

Hey guys!

Total Rookie comeing to scripts and need help with a smaller problem.

 

I wan´t a function where players on a dedicated server,  can walk up to a object and with the holdactionkey get intel, and new tasks etc.

And also send the intel aswell as create the task for all players on the server.

 

Thing is I have got everything working (sorta)

For some reason the intel and the new task thats being created is only being created for the player thats interacting with the object.

 

example, a group of players walks up to the object. 
Only one of them interacts with the object thats giving them Intel in a intel tab. after a while it creates a new task.

 

Only the player that picked it up can see it on the map.


Played through a couple of missions and sure it´s emmersive thats players need to share the intel, however it causes some problems that not everyone can see it.

 

here is the setup i´m using:

 

on the mission I place down 1 object and nameing it in the veriable field: Intel1

 

Then i place down a trigger with:

 

Quote

Condition:

player distance intel1 < 5

 

 

Quote

On Act:
this = [] execVM "scripts\intel\intel1.sqf";

 

Heres whats inside intel1, I know theres alot of stuff, but might aswell keep it all so you pros can see whats wrong.
 

Quote

[

    intel1, // Name of the object

 

"Hack Satcomms", //Title of Action

 

"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", // The Icon Shown on screen (Check Description for this Icon!)

"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", //Progress Icon shown on screen (Changes Icon when you start the Action)

 

"player distance intel1 < 5", //The Condition for the Action to be Shown

"player distance intel1 < 5", //The Condition for the Action to Progress

 

{hint "Hacking Started";

 

[contractor, reb1, reb2, reb3, reb4] join opfordude;

}, // The Code executed when the action starts 

{}, // The code executed on every Progress tick

{

    hint "Intel collected press M to see more.";

    ["TaskSucceeded",["","C130"]] call BIS_fnc_showNotification;

 

    player createDiarySubject ["Intel","Intel"];

 

    (_this select 1) createDiaryRecord ["Intel", ["Intel",

    "<br/> ====================================================

    <br/> Blah blah blah

    <br/> intelstuff blah blah blah

 

    "]];

    //Blow up tulga

    ied1 setdamage 1;

    sleep 3;

    ied2 setdamage 1;

    ied3 setdamage 1;

    sleep 1;

    ied4 setdamage 1;

    sleep 5;

    ied5 setdamage 1;

    sleep 3;

 

    //Recon Tulga

    task1 = player createSimpleTask ["taskName1"];

    task1 setSimpleTaskDescription ["Something is going on in <marker name= 'tulga_marker'> Tulga </marker>, recon the area and see what you can find out.","Recon Tulga",""];

    task1 setTaskState "Assigned";

    player setCurrentTask task1;

    sleep 3;

    ["Taskassigned",["","Recon Tulga"]] call BIS_fnc_showNotification;

 

    //Find The last create

    task2 = player createSimpleTask ["taskName2"];

    task2 setSimpleTaskDescription ["

    We have found two of the crates, one still remaining.

    <br/> Look through your intel, find the last crate and destroy it.","The Last Crate",""];

    task2 setTaskState "Assigned";

    player setCurrentTask task2;

    sleep 3;

    ["Taskassigned",["","The Last Crate"]] call BIS_fnc_showNotification;


 

    }, //The code executed on Completion

{hint "You let go of space Key, Hack Aborted"}, // The code Executed when the player is Interrupted (Player Lets go of key)

[], // Arguments Passed to script ( We will not use this right now)

30, // The Duration (How long will it take for the Action to be Completed in Seconds)

1, //Priority

true, // Remove the Action when the Action has been Complete (True or false)

false // Show in Unconscious State (Unsure about this too but false works:)

] remoteExec ["BIS_fnc_holdActionAdd",[0,-2] select isDedicated,true];//This allows for the script to work on MP servers.

 

 



Thank you all!

 

BR

Killet

Share this post


Link to post
Share on other sites

Put that code that only has local effect (like createDiarySubject ) in a separate code block (between '{' and '}').  And remote execute that to all clients with remoteExec.

 

(If you can't get it to work paste all the code you have in something like pastebin.com and link it here and I'll try to do it)

Share this post


Link to post
Share on other sites

Hey mate!

Thanks for your reply!

 

 

 

https://pastebin.com/B6aZbs1Z

Ive uploaded the code to pastebin here. Hope it will work. Will do some homework about the remoteExec aswell.

If you would like to show an example it´s much appreciated =)

Share this post


Link to post
Share on other sites

I rewrote it to another script with less text in it. but still cant get it to work.

I get the action still and I can perform the action

however now nothing happens after the action is performed, and no new mission pops up.

 

https://pastebin.com/nCT12X0B

 

also changed the veriable from  _localThingsScript to _intel1script but that should´t matter since it´s just the name of it?

Correction:

Apperently yes it did affect it.

Veriablename didn´t like numbers, smiply by changeing the name to _intelscriptone instead solved the problem.

 

THANK YOU  Stanhope <3

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Variable names may contain numbers, just not at the start. This applies to functions and classes as well. Whether it is good practice or not is a different topic altogether... :happy:

Share this post


Link to post
Share on other sites

Was running a mission yasterday and it went all good.

Only issue I had was that The task complete was spammed alot of times.

Not sure whats causing it.

 

I suppose it has something to do with the remoteExec as I was playing around with it.

example:

Quote

 

 [[], _intelscriptone] remoteExec ["spawn", -2, false];     //Function doesn´t work 

 [[], _intelscriptone] remoteExec ["spawn", 0, false];     //Function does work but players getting spammed with task complete. However new task and all intel stuff works as perfect it can get! =)

 

 

I read about the remoteExec but can´t get why the players kept getting spammed.

 

Example of one of my taskcomplete scripts from last nights mission

Quote

 

_artone = {

hint "Artillery 1 Destroyed";

["TaskSucceeded",["","Destroy Artillery 1"]] call BIS_fnc_showNotification;

task3 setTaskState "Succeeded";

};

[[], _artone] remoteExec ["spawn", 0, false];

 

 

Thank you for all your help! 

 

Share this post


Link to post
Share on other sites

I'm presuming setTaskState has global effect, take it out of the remoteexec code and put it in the onCompletion of the holdaction itself.

 

Also, I should've asked this before but: is it a dedicated MP or a hosted MP environment?

  • Like 1

Share this post


Link to post
Share on other sites

I just did it like that and it seems to work =)
It is hosted dedicated. 

I think everything is 100% 

Thank you once again!

Share this post


Link to post
Share on other sites
Sign in to follow this  

×