PDA

View Full Version : Addaction Woes



goose4291
Aug 12 2012, 16:59
I'm trying to make a mission using the excellent Namalsk crisis mod at the moment but am having slight problems.

I'm trying to script it so that the player has to turn the power on using a generator (Which will turn the laboratory lights on also) before they can download files from a computer.

At the moment I have this in the generators initialisation lines:



_genAct = generator addAction ["Switch on generator", "generator.sqf"] And this is the SQF





_gen = _this select 0
_caller = _this select 1
_id = _this select 2
_gen ns_aii_l_status=1;
_gen removeAction _id;


Can anyone tell me where I've gone wrong in regards to restoring of power? I've obviously got the AII module down also

OnlyRazor
Aug 12 2012, 17:03
I don't know much about these things, but I think that in SQF, you have to add a semicolon after each line, making the code:


_gen = _this select 0;
_caller = _this select 1;
_id = _this select 2;
_gen ns_aii_l_status=1;
_gen removeAction _id;


If you haven't yet, put -showscripterrors into the launch parameters of the game (right click on the icon, then select properties, enter the text into the 'Target' zone, I believe). That said, may be some more things wrong in the script, but I don't know what they are.

SaMatra
Aug 12 2012, 18:55
Not sure what you trying to do but setting vehicle\unit variable works like this:


_gen setVariable ["ns_aii_l_status", 1, true]; // true for sending this new value to all players in game

kylania
Aug 12 2012, 19:19
I think that code won't work for the lights either, apparently the ns_aii_l_status thing is some global variable based on the map, so simply


ns_aii_l_status = 1;

should work, but in my tests it didn't. The lights were always on. Tried setting that variable on the module as well and that didn't do anything. Maybe I was doing it wrong. heh