Jump to content
Goro

Serious issues w/ multiple commands

Recommended Posts

Hey y'all folks!

Let me get this from the very beginning. My hard drive broke down about 2 weeks ago, resulting in all the data lost. I've started to rework on my projects, and I managed to retrieve some codes, but I've run into very unspecific issues. The only problem is, I have problem with basic functions!

_gen = _this select 0;
_caller = _this select 1;
_id = _this select 2;
_gen removeAction _id;
cuttext ["", "black out", 8];
_caller switchmove "Acts_TerminalOpen";
sleep 10;
cuttext ["", "black in", 4];
_caller switchmove "";
triobj1 setdamage 1;
lamp1 setdamage 0;
lamp2 setdamage 0;
lamp3 setdamage 0;
lamp4 setdamage 0;
lamp5 setdamage 0;
lamp6 setdamage 0;
hint "You've successfully secured this place!";
cuttext ["You've successfully secured this place!", "plain down"];

The first 4 selections are: Object, Player, ID of the action. The 4th line is supposed to remove the action since it's been done. The purpose of this code is very, very simple - get player into animation, restore the light (repair custom-placed lamps) and notify player about it. triobj1 is a object which fires up a trigger responsible for giving out task.

 

Now the issue:

After firing up the script, Arma popped me this:

_gen = _this select 0

It said that there's undefined variable in _this.

Afterall, it could not recognize the _caller, so the animation state would not play at all.

The rest of the script would be executed no problem.

 

 

Now there is even weirder issue:

if (alive station1) do {
"Station_NoPower.sqf" remoteExec ["ExecVM"];
};

The purpose of this code is to check whenever that object is alive and if it is, execute a script called station_nopower, as you can see.

The only problem is, that Arma 3 pops me up an error saying Such command as IF does NOT exist at all!

 

What the heck is going on? My Arma is all up to date, I verified the cache twice, still the same problem. I've been a mission dev for about a year now, and never had such a problem before. Thanks in advance for any replies guys!

Share this post


Link to post
Share on other sites
4 minutes ago, Goro said:

Hey y'all folks!

Let me get this from the very beginning. My hard drive broke down about 2 weeks ago, resulting in all the data lost. I've started to rework on my projects, and I managed to retrieve some codes, but I've run into very unspecific issues. The only problem is, I have problem with basic functions!


_gen = _this select 0;
_caller = _this select 1;
_id = _this select 2;
_gen removeAction _id;
cuttext ["", "black out", 8];
_caller switchmove "Acts_TerminalOpen";
sleep 10;
cuttext ["", "black in", 4];
_caller switchmove "";
triobj1 setdamage 1;
lamp1 setdamage 0;
lamp2 setdamage 0;
lamp3 setdamage 0;
lamp4 setdamage 0;
lamp5 setdamage 0;
lamp6 setdamage 0;
hint "You've successfully secured this place!";
cuttext ["You've successfully secured this place!", "plain down"];

The first 4 selections are: Object, Player, ID of the action. The 4th line is supposed to remove the action since it's been done. The purpose of this code is very, very simple - get player into animation, restore the light (repair custom-placed lamps) and notify player about it. triobj1 is a object which fires up a trigger responsible for giving out task.

 

Now the issue:

After firing up the script, Arma popped me this:

_gen = _this select 0

It said that there's undefined variable in _this.

Afterall, it could not recognize the _caller, so the animation state would not play at all.

The rest of the script would be executed no problem.

 

 

Now there is even weirder issue:


if (alive station1) do {
"Station_NoPower.sqf" remoteExec ["ExecVM"];
};

The purpose of this code is to check whenever that object is alive and if it is, execute a script called station_nopower, as you can see.

The only problem is, that Arma 3 pops me up an error saying Such command as IF does NOT exist at all!

 

What the heck is going on? My Arma is all up to date, I verified the cache twice, still the same problem. I've been a mission dev for about a year now, and never had such a problem before. Thanks in advance for any replies guys!

 

1 I don't understand the link with your broken HD event...

2 your first code should be inside an addAction

3 if then (if do doesn't exist)

4 I don't know why you need to remoteExec this poor sqf... but it's another problem.

 

Share this post


Link to post
Share on other sites

Hey!

Thanks for the reply.

2)It is inside an AddAction

3)I'll test it right now

4)I've always been using RemoteExec no matter the script - to make sure it's propely executed in multiplayer. ExecVM alone wouldn't solve the problem anyways

Share this post


Link to post
Share on other sites

UPDATE:

Replacing "do" with "then" seemed to do the trick.

However, I'm still having difficulties with "_this" variable being unrecognized by the game.

The script is ran by addaction, on a power generator.

Share this post


Link to post
Share on other sites

The more you remoteExec data, especially scripts!, the more you jam your network. Some scripts will never fire at all due to scheduler slot times.

You should post something consistent. The entire addAction for instance. You want help but people have to guess your code.

If, as you say, the code is in an addAction, there is at least a mistake: You have to spawn it if you want a scheduled code (with sleep inside). Right now, that can't work, I confirm.

Share this post


Link to post
Share on other sites

"Station_NoPower.sqf" remoteExec ["ExecVM",0];

 

or

 

"Station_NoPower.sqf" remoteExec ["ExecVM",0,true];

 

Might help.

 

 

If you want to declare arguments in a remoteExec, try this:

 

[[object, player, ID of action],"Station_NoPower.sqf"] remoteExec ["ExecVM",0,true]; // Just an example

Share this post


Link to post
Share on other sites
1 minute ago, phronk said:

"Station_NoPower.sqf" remoteExec ["ExecVM",0];

 

or

 

"Station_NoPower.sqf" remoteExec ["ExecVM",0,true];

 

Might help.

Not really.

Share this post


Link to post
Share on other sites
33 minutes ago, phronk said:

If you want to declare arguments in a remoteExec, try this:

 

[[object, player, ID of action],"Station_NoPower.sqf"] remoteExec ["ExecVM",0,true]; // Just an example

Hey, thanks for the response fam, I'll try to have a workaround with this one. I'll let you know by tomorrow!

 

40 minutes ago, pierremgi said:

The more you remoteExec data, especially scripts!, the more you jam your network. Some scripts will never fire at all due to scheduler slot times.

You should post something consistent. The entire addAction for instance. You want help but people have to guess your code.

If, as you say, the code is in an addAction, there is at least a mistake: You have to spawn it if you want a scheduled code (with sleep inside). Right now, that can't work, I confirm.

 

I'll let you know about the addaction code as soon as I get back in game.

Share this post


Link to post
Share on other sites

UPDATE:

It was the cause of a decent addaction script. Instead, I figured out a new way to spawn the script:

objectname addaction ["Action Name", {[[_this,"somescript.sqf"],"BIS_fnc_execVM",true] call BIS_fnc_MP;}];

It seems to be working like a charm. I decided to share it with you guys, so other folks facing the same problem will be provided with a solution

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

×