Jump to content
Sign in to follow this  
Alex116

Error Zero Divisor, Multi-Dimensional array

Recommended Posts

Now if I'd like to remove the option from a player I would simply put this in a trigger?;
You could do but there is no need. IT is already included in the comms.sqf i provided that is why the option disappears, otherwise you would be able to continuously drop ATV's from the comms menu.

Share this post


Link to post
Share on other sites

I did found a use for it though.

I now have it set up that when the player is not present in a trigger area he gets the comms menu option.

And when he enters the trigger area it's removed from him again. This works great!

One more thing, if I may.

I have a function, which is stored in a SQF file. The function consists out of inline functions. (At least, I believe thats how it's called.)

How would I run a certain inline function, from another SQF file? I use

call SHK_Taskmaster_add;

to call for this function, though gives me the error; "Error in undefined variable in expression"

Now how would I define this variable?

Share this post


Link to post
Share on other sites

Been along time since i looked at Shuko's taskmaster but...

I believe all his functions are just global variables, this means that you just need to call compile shk_taskmaster.sqf at the start of your init.sqf for them to be available.

call compile preprocessFileLineNumbers "SHK_Taskmaster.sqf";

Share this post


Link to post
Share on other sites

Which is exactly what I have in my init.sqf.

call compile preprocessfilelinenumbers "shk_taskmaster.sqf";

And it works, whenever I call the variable from a trigger inside the editor like this;

if (isServer) then { ["Task2","Extraction","Exfiltrate out of the AO."] call SHK_Taskmaster_add; ["Task1","succeeded","Task2"] call SHK_Taskmaster_upd; }; 

However, when I try this;

Place object. (Intel -> Secret documents)

INIT:

   if (isServer) then { [this] execVM "sdocs.sqf"; };

sdocs.sqf;

_obj = (_this select 0);  

 _obj setVariable ["RscAttributeDiaryRecord_texture","a3\structures_f_epc\Items\Documents\Data\document_secret_01_co.paa", true];
[_obj,"RscAttributeDiaryRecord",["Top Secret Docs","These Docs outline the enemies defenses",""]] call bis_fnc_setServerVariable;
_obj setVariable ["recipients", west, true];
["Task2","Extraction","Get to teh choppa!"] call SHK_Taskmaster_add;
["Task1","succeeded","Task2"] call SHK_Taskmaster_upd;

It cannot reach the taskmaster variables because it tells me they are undefined.

Share this post


Link to post
Share on other sites
However, when I try this;

Place object. (Intel -> Secret documents)

Due to this being in an objects init it gets called on mission load before the init.sqf so the functions have not been defined yet. Shuko also has a variable you can check to see if his function are available. Add to the top of your sdocs.sqf ...

waitUntil { !(isNil "SHK_Taskmaster_initDone") && { SHK_Taskmaster_initDone } };

This will pause the script unitl SHK_Taskmaster_initDone is available (!isNil) and is true, meaning his functions have finished initializing.

Share this post


Link to post
Share on other sites

Mhmm, I've managed to get it to work. But not exactly how I would like.

I currently have the following scripts;

Object init(Secret Documents)

gatherintell = sdocs addAction ["<t color='#ffffff' size='1'>Gather Intelligence</t>","sdocs.sqf", [], 6, true, true, "",""];

sdocs.sqf

waitUntil { !(isNil "SHK_Taskmaster_initDone") && { SHK_Taskmaster_initDone } };  

_obj = (_this select 0);  

 _obj setVariable ["RscAttributeDiaryRecord_texture","a3\structures_f_epc\Items\Documents\Data\document_secret_01_co.paa", true];
[_obj,"RscAttributeDiaryRecord",["Top Secret Docs","These Docs outline the enemies defenses",""]] call bis_fnc_setServerVariable;
_obj setVariable ["recipients", west, true];
["Task2","Extraction","Get to teh choppa!"] call SHK_Taskmaster_add;
["Task1","succeeded","Task2"] call SHK_Taskmaster_upd;
[_obj,"init"] spawn bis_fnc_initIntelObject;

Now when I aproach the object it has two actions on it. Understandable since the secret document object has one of its own and I added one to it.

Now if I select the original "Pickup Intell" action, it gives me the INTELL ADDED notification that pops up, though it's empty since sdocs.sqf was not run yet, so the variables were not set to create such DiaryRecords.

I get this so far.

Now if I select my own added Gather Intelligence action, sdocs.sqf runs flawlessly. No errors. It sets the variables on the DiaryRecords. Because when I select the original "Pickup Intell" action after I select my own added Gather Intelligence action I get the intell added notification, only this time with the variables set.

So I currently have two actions, that both do different things. Now I would like to have a single action, my own added action to the object. That does both. Now the easiest way to accomplish this is find a way that when sdocs.sqf executes, I get the fancy intell added notification with the set variables from sdocs.sqf.

Is this possible? Is there a way to run the intell added pop up?

EDIT:

I've gotten a bit closer by changing the object from Intell -> Secret Documents (Other (Interactive)) to Objects (small) -> File (Top Secret).

This way the object is not interactive and will not have an "Take Intel" action on it. But only my own "Gather Intellligence" action.

Now upon selecting my own action, it executes sdocs.sqf. And because of this line;

 [_obj,"init"] spawn bis_fnc_initIntelObject;  

It creates a new "Take Intel" action and when selected this creates the fancy "Intel added" pop up.

Still cant figure out how to get this pop up in my own action though.

EDIT:

I have tried the following;

 [_obj,"init"] call bis_fnc_initIntelObject;

Changing "spawn" to "call", hoping it would directly execute, simulating the action was selected, but still no luck.

Edited by Alex116

Share this post


Link to post
Share on other sites

Place a Objects (small) -> File (Top Secret) and in its init field place ...

if ( isServer ) then {
this setVariable ["RscAttributeDiaryRecord_texture","a3\structures_f_epc\Items\Documents\Data\document_secret_01_co.paa", true];
[this,"RscAttributeDiaryRecord",["Top Secret Docs","These Docs outline the enemies defenses",""]] call bis_fnc_setServerVariable;
this setVariable ["recipients", west, true];
};

this addAction ["<t color='#ffffff' size='1'>Gather Intelligence</t>",{
[ _this, "action" ]  spawn bis_fnc_initIntelObject;
["Task2","Extraction","Get to teh choppa!"] call SHK_Taskmaster_add;
["Task1","succeeded","Task2"] call SHK_Taskmaster_upd;
}, [], 6, true, true, "",""]; 

So. If it is the server it sets up the necessary variables for the intel.

It then places your own action on the object that calls straight into an Intel Items 'action' phase rather than 'init' and sets up your tasks.

Think thats about right, have not put it through much testing other than to pick one up in editor preview to make sure it look ok. As always let me know how it goes.

EDIT: Sorry pasted wrong code had several open in my text editor, updated the above code

Merry Christmas

Larrow

Edited by Larrow
spelling + pasted wrong code doh

Share this post


Link to post
Share on other sites

As usual, works like a charm. Thank you for your time, you've taught me well.

Merry Christmas!

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  

×