Jump to content

Recommended Posts

I would like some help in getting the "BIS_fnc_holdActionAdd" command to be shown in one of the three objects at random.

 

I looked through BiWiki several times for the "selectRandom" and "BIS_fnc_selectRandom" functions, but in the attempts I made, none worked :(

 

I do not understand English, so I use the browser "Chrome" to translate the pages, like here in the forum, so for me to understand easily is quite complicated.

 

If anyone can help me with this, I will be most grateful.

 

The code I tried, but I think there must be several things wrong :(

 

file init.sqf

_note1 = [noteP1];
_note2 = [noteP2];
_note3 = [noteP3];
_notepad = [_note1, _note2, _note3];
selectRandom _notepad;

sleep 2;

[ _notepad ,"Pegar o código","imagem\note.paa","imagem\cod.paa","_x distance _target < 2","_x distance _target < 2",{hint "Pegando o código"},{},{execVM "arquivo.sqf"},{ },[],15,nil,true,false] call BIS_fnc_holdActionAdd;

* Learning code without knowing anything about it, and still in a language you misunderstand, should be like an English, trying to learn Arabic in a Russian translation dictionary.

 

Share this post


Link to post
Share on other sites
3 hours ago, snakeplissken said:

If anyone can help me with this, I will be most grateful.

 

Hello, changed your script a little, maybe this works for you

private _notepad = selectRandom [noteP1, noteP2, noteP3];

[
	_notepad ,
	"Pegar o código",
	"imagem\note.paa",
	"imagem\cod.paa",
	"(_this select 0) distance (_this select 1) < 2",
	"(_this select 0) distance (_this select 1) < 2",
	{hint "Pegando o código"},
	{},
	{[] execVM "arquivo.sqf"},
	{},
	[],
	15,
	0,
	true,
	false
] call BIS_fnc_holdActionAdd;

 

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, snakeplissken said:

 

* Learning code without knowing anything about it, and still in a language you misunderstand, should be like an English, trying to learn Arabic in a Russian translation dictionary.

 

 

HAHAHAHA. This made my day man.

 

Thank you

  • Like 1

Share this post


Link to post
Share on other sites
10 hours ago, Nikander said:

 

Hello, changed your script a little, maybe this works for you


private _notepad = selectRandom [noteP1, noteP2, noteP3];

[
	_notepad ,
	"Pegar o código",
	"imagem\note.paa",
	"imagem\cod.paa",
	"(_this select 0) distance (_this select 1) < 2",
	"(_this select 0) distance (_this select 1) < 2",
	{hint "Pegando o código"},
	{},
	{[] execVM "arquivo.sqf"},
	{},
	[],
	15,
	0,
	true,
	false
] call BIS_fnc_holdActionAdd;

 

I tried the above tip but it showed this error below
8oEGNWS.jpg

 

 

12 hours ago, csk222 said:

Good HoldAction Discussion.

I looked at the link you posted, and how to use the "random" function is different from the way I want to use it.

I tried to get a line here and another to see if it would work out what I want, but I did not succeed :(

 

 

Just to better explain what I want, and ..


In the scenario there are three objects, this I would like one of these objects to appear in the "HoldAction" function.
The three objects must remain on the scene to hinder the search for the correct object with the function.

Share this post


Link to post
Share on other sites
8 hours ago, snakeplissken said:

I tried the above tip but it showed this error below
8oEGNWS.jpg

 

That error has nothing to do with that script. Are you running any mods??

Share this post


Link to post
Share on other sites
On 18/02/2017 at 3:14 AM, BlacKnightBK said:

That error has nothing to do with that script. Are you running any mods??

No, nothings mods

 

Just the game.

 

What I did was use the script placed here inside the topic in file init.sqf of mission.

Share this post


Link to post
Share on other sites
46 minutes ago, snakeplissken said:

No, nothings mods

 

Just the game.

 

What I did was use the script placed here inside the topic in file init.sqf of mission.

 

The error you are showing has nothing to do with that script mate. The reason I assumed it was a mod is because the screenshot you are showing does not display a file path. And i am pretty sure it has nothing to do with that script because all the variables in the screenshot are not in the script.

 

Mind running it again and give me what it shows you in the rpt file???

 

Thanks

  • Like 1

Share this post


Link to post
Share on other sites
//_note1 = [noteP1];//can't work, function needs an object not an array
//_note2 = [noteP2];
//_note3 = [noteP3];

//private _notepad = [Revo_notepad_1, Revo_notepad_2, Revo_notepad_3]; 
//selectRandom _notepad;//Returned array entry needs to be stored in a variable

private _notepad = selectRandom [Revo_notepad_1, Revo_notepad_2, Revo_notepad_3];

[
    _notepad,//Contained and array of objects, see explaining for select random above
    "Pegar o código",
    "imagem\note.paa",
    "imagem\cod.paa",
    "_this distance _target < 2", //Use _this for the object instead of _x, see the documentation on the wiki
    "_this distance _target < 2", //Use _this for the object instead of _x, see the documentation on the wiki
    {hint "Pegando o código"},
    {},{execVM "arquivo.sqf"}
    ,{},
    [],
    15,
    nil,
    true,
    false
] call BIS_fnc_holdActionAdd;

I fixed some mistakes and explained what was wrong.

 

 

  • Like 1

Share this post


Link to post
Share on other sites
13 hours ago, BlacKnightBK said:

The error you are showing has nothing to do with that script mate. The reason I assumed it was a mod is because the screenshot you are showing does not display a file path. And i am pretty sure it has nothing to do with that script because all the variables in the screenshot are not in the script.

 

Mind running it again and give me what it shows you in the rpt file???

 

Thanks

 

12 hours ago, R3vo said:

//_note1 = [noteP1];//can't work, function needs an object not an array
//_note2 = [noteP2];
//_note3 = [noteP3];

//private _notepad = [Revo_notepad_1, Revo_notepad_2, Revo_notepad_3]; 
//selectRandom _notepad;//Returned array entry needs to be stored in a variable

private _notepad = selectRandom [Revo_notepad_1, Revo_notepad_2, Revo_notepad_3];

[
    _notepad,//Contained and array of objects, see explaining for select random above
    "Pegar o código",
    "imagem\note.paa",
    "imagem\cod.paa",
    "_this distance _target < 2", //Use _this for the object instead of _x, see the documentation on the wiki
    "_this distance _target < 2", //Use _this for the object instead of _x, see the documentation on the wiki
    {hint "Pegando o código"},
    {},{execVM "arquivo.sqf"}
    ,{},
    [],
    15,
    nil,
    true,
    false
] call BIS_fnc_holdActionAdd;

I fixed some mistakes and explained what was wrong.

 

 

 

Many, many thanks to you who have taken a moment of your time to help me.

 

The script posted here worked perfectly.

 

The difference the script posted by Revo to the Nikander script, is the removal of "(_this select 0)" and "(_this select 1)".

 

Give to see the Nikander script that works perfectly well.

 

Many, many thanks to @Revo and many, many thanks to @Nikander and @BlacKnightBK.

 

  • Like 1

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

×