Jump to content
Sign in to follow this  
piedebeouf

undefined

Recommended Posts

hello , I've got some problems . when I star the mission I have an eerror undefined variable : the code is :

soundOff == "";

while{true}do{

waitUntil{soundOff != ""};

switch(soundOff)do

{

case "objet1": {Car2 say "hello1";};

case "objet2": {Car3 say "hello2";};

case "objet3": {Car2 say "hello3";};

case "objet4": {Car3 say "hello4";};

case "objet5": {car1 say "hello5";};

case "objet6": {Car4 say "hello6";};

case "objet7": {Car4 say "hello7";};

};

soundOff = "";

sleep 0.2;

};

it's say that the error is in ligne 4 : while{true}do{waitUntil{soundOff != ""};switch(soundOff)do . in soundoff ??? I don't interstand this and how could I resolve this?

thanks a lot for your help

Share this post


Link to post
Share on other sites

The problem is with your first line:

soundOff == "";

That doesn't assign soundOff to an empty string, it checks if it's equal to an empty string. Change it to this:

soundOff = "";

like you have it near the end of the script.

Share this post


Link to post
Share on other sites

thanks for your answer , I found this also to put in the init.sqf :

if (isNil "soundoff") then

{

soundoff = "";

};

seem to work also .

thanks for your fast reply

Share this post


Link to post
Share on other sites

Yup, that's a better way since if it's already set to a value it won't reset it. :)

Share this post


Link to post
Share on other sites

hi there,

how i can fix this?

_Transporter = _this select 0;
_Unit = _this select 1;


//// Check for action
_BTK_CargoDrop_ActionAdded = _Transporter getVariable "BTK_CargoDrop_ActionAdded";
if (_BTK_CargoDrop_ActionAdded) exitWith {};


//// If no action continue here
_Transporter setVariable ["BTK_CargoDrop_ActionAdded", true];
_CargoAction = _Transporter addAction [("<t color=""#fadfbe"">" + ("Load cargo") + "</t>"),"BTK\Cargo Drop\Engine.sqf",["LoadCargo"], 5, false, false, "", "vehicle _this == player"];


//// remove Action
waitUntil {(_Unit distance _Transporter > 20) || !(alive _Unit) || !(alive _Transporter)};
_Transporter removeAction _CargoAction;
_Transporter setVariable ["BTK_CargoDrop_ActionAdded", false];

error is on _unit

thaks

anjan

Share this post


Link to post
Share on other sites

A way to capture errors would be:

_Transporter = [_this, 0, objNull, [objNull]] call BIS_fnc_param;
_Unit = [_this, 1, objNull, [objNull]] call BIS_fnc_param; 

Your script will still fail since if you're not feeding it _unit properly it'll use the default of objNull, which means that it won't be alive and the actions will be removed.

Share this post


Link to post
Share on other sites

You're right same error.

Hmm i dont get it.

Its an old arma2 script I want to use for arma3 and there is more than this part.

It works but with errors.

If you have time would you look thru it with me?

Share this post


Link to post
Share on other sites

How are you calling it?

0 = [_someVehicle, _someUnit] execVM "mytransportfile.sqf"';

Oh, wait, that's only part of it? Post it all if you can please, maybe to pastebin.com if it's too long for here.

Share this post


Link to post
Share on other sites

Here is a dropbox link.

I call it with:

execVM "BTK\Cargo Drop\Start.sqf";

Thank you

PS. if you want to test it make a new mission place a ch-49 and a quad near by.

Edited by Anjan-Riot

Share this post


Link to post
Share on other sites

You need to pass a vehicle and a unit (player)

[myhelicopter,player] execVM "BTK\Cargo Drop\Start.sqf"; 

Share this post


Link to post
Share on other sites

Did you change myhelicopter to whatever the name of your plane/heli is?

Share this post


Link to post
Share on other sites

Tried last night and it wasn't there, but got it now.

Looks like the problem is line 20 of BTK\Cargo Drop\Init.sqf. Change that line to add ", player" as shown in red:

	{[_x[color="#FF0000"], player[/color]] execVM "BTK\Cargo Drop\InitAction.sqf";} forEach (nearestObjects [player, ["Air"], 30]);

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  

×