Diaverso Carrasco 1 Posted August 23, 2020 I have a setup for a GUI. It works perfectly. But, I don't know how to add an sqf call in this script _selectedIndex = lbCurSel 456; if(_selectedIndex == 0) exitWith { hint "Teleport to Formacion/Arsenal"; null = [] spawn execVM "formacion_arsenal.sqf"; closeDialog 0; }; if(_selectedIndex == 1) exitWith { hint ""; closeDialog 0; }; if(_selectedIndex == 2) exitWith { hint ""; closeDialog 0; }; if(_selectedIndex == 3) exitWith { hint ""; closeDialog 0; }; With this script when I interact with the GUI it shows me the hint, but it doesn't load the sqf file file sqf: _tele = _this select 0; _caller = _this select 1; _caller setPos (getpos (formacion)); This script has to teleport you to the mark called "formation" but it does nothing Share this post Link to post Share on other sites
Larrow 2819 Posted August 23, 2020 You pass nothing to the script.... 56 minutes ago, Diaverso Carrasco said: [] spawn execVM "formacion_arsenal.sqf"; So it has no idea what _caller is... 56 minutes ago, Diaverso Carrasco said: _tele = _this select 0; _caller = _this select 1; _caller will be nil. 1 Share this post Link to post Share on other sites
Diaverso Carrasco 1 Posted August 24, 2020 6 hours ago, Larrow said: You pass nothing to the script.... So it has no idea what _caller is... _caller will be nil. It is a script to teleport you to a position. This is the video from where I got the script Share this post Link to post Share on other sites
wogz187 1086 Posted August 24, 2020 @Diaverso Carrasco, Here's a very simple teleport script, Spoiler you_simpleTeleport= { params [["_caller"], ["_loc"]]; _caller setpos (getpos _loc); }; //[player, formation] call you_simpleTeleport; and a slightly better one, Spoiler you_fnc_teleport= { params [["_caller", player], ["_location", locationNull]]; titleText ["Teleporting", "BLACK FADED", 0.2]; playsound ["Orange_PeriodSwitch_Pre_01", true]; sleep 0.5; _caller setPos (getPos (_location)); titleCut ["", "BLACK IN", 5]; }; //[player, formation] spawn you_fnc_teleport; No need to call a .sqf just paste the function into your init file and call (spawn) any time. Have fun! 1 Share this post Link to post Share on other sites
Diaverso Carrasco 1 Posted August 24, 2020 13 hours ago, wogz187 said: @Diaverso Carrasco, Here's a very simple teleport script, Hide contents you_simpleTeleport= { params [["_caller"], ["_loc"]]; _caller setpos (getpos _loc); }; //[player, formation] call you_simpleTeleport; and a slightly better one, Hide contents you_fnc_teleport= { params [["_caller", player], ["_location", locationNull]]; titleText ["Teleporting", "BLACK FADED", 0.2]; playsound ["Orange_PeriodSwitch_Pre_01", true]; sleep 0.5; _caller setPos (getPos (_location)); titleCut ["", "BLACK IN", 5]; }; //[player, formation] spawn you_fnc_teleport; No need to call a .sqf just paste the function into your init file and call (spawn) any time. Have fun! Init.sqf you_fnc_teleport= { params [["_caller", player], ["formacion", locationNull]]; titleText ["Teletrasnportando", "BLACK FADED", 0.2]; playsound ["Orange_PeriodSwitch_Pre_01", true]; sleep 0.5; _caller setPos (getPos (formacion)); titleCut ["", "BLACK IN", 5]; }; //[player, formation] spawn you_fnc_teleport; I understand that where it says "_location" it has to be changed by variable name? _selectedIndex = lbCurSel 456; if(_selectedIndex == 0) exitWith { hint "Teletransportado a Formacion/Arsenal"; [player, formation] spawn you_fnc_teleport; closeDialog 0; }; if(_selectedIndex == 1) exitWith { hint ""; closeDialog 0; }; if(_selectedIndex == 2) exitWith { hint ""; closeDialog 0; }; if(_selectedIndex == 3) exitWith { hint ""; closeDialog 0; }; Error image: Share this post Link to post Share on other sites
wogz187 1086 Posted August 24, 2020 @Diaverso Carrasco, To answer your original question more directly, Spoiler null = [player, formacion] spawn execVM "formacion_arsenal.sqf"; That way it works with your buttons! Otherwise, The function call (spawn) is configurable, [player, formation] spawn you_fnc_teleport; Either variable can be any object. The first variable will be moved to the position of the second variable. [any_obj, any_obj] spawn you_fnc_teleport; You may want to try placing some helpers (object-->signs-->helpers), naming them: "helper_1", "helper_2", and then try, [player, helper_1] spawn you_fnc_teleport; The function itself needs to be loaded in either the mission init file (init.sqf) or in the editor's init dialog box. Have fun! Spoiler To just "make it work": 1) create a helper object and name it "helper_1" 2) paste the function AND call directly into the in-game debug console call with: [player, helper_1] spawn you_fnc_teleport; 3) hit Enter and poof you teleported! Share this post Link to post Share on other sites
Diaverso Carrasco 1 Posted August 24, 2020 @wogz187 Sorry, I'm not good at weapon 3 scripts. Excuse me, but I did what you told me and the teleport does not do well or gives me an error. I send you a video for you to see.: Share this post Link to post Share on other sites
wogz187 1086 Posted August 25, 2020 @Diaverso Carrasco, Sorry. I said, "Marker", I should have said "Helper". Specifically objects-->signs-->helpers, pick your favourite flavor of arrow! The script did work but since the position was invalid (would need getmarkerpos) you went to default locationNull. Check this out, Spoiler We can replace the default "_loc" with "player", this way an invalid location will result in no move, you_fnc_teleport= { params [["_caller", player], ["_loc", player]]; titleText ["Teleporting", "BLACK FADED", 0.2]; playsound ["Orange_PeriodSwitch_Pre_01", true]; sleep 0.5; _caller setPos (getPos (_loc)); titleCut ["", "BLACK IN", 5]; }; Here's a button to call the function, you_useTeleport=[ player, "Use Teleport", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "isNull objectParent player", "alive player", {}, {}, { [player, helper_1] spawn you_fnc_teleport; }, {}, [], 2, 0, false, true] call BIS_fnc_holdActionAdd; Paste all of the above into init.sqf or the Editor Init Dialog. Have fun! 1 Share this post Link to post Share on other sites
Diaverso Carrasco 1 Posted August 26, 2020 On 8/25/2020 at 2:09 AM, wogz187 said: @Diaverso Carrasco, Sorry. I said, "Marker", I should have said "Helper". Specifically objects-->signs-->helpers, pick your favourite flavor of arrow! The script did work but since the position was invalid (would need getmarkerpos) you went to default locationNull. Check this out, Hide contents We can replace the default "_loc" with "player", this way an invalid location will result in no move, you_fnc_teleport= { params [["_caller", player], ["_loc", player]]; titleText ["Teleporting", "BLACK FADED", 0.2]; playsound ["Orange_PeriodSwitch_Pre_01", true]; sleep 0.5; _caller setPos (getPos (_loc)); titleCut ["", "BLACK IN", 5]; }; Here's a button to call the function, you_useTeleport=[ player, "Use Teleport", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "isNull objectParent player", "alive player", {}, {}, { [player, helper_1] spawn you_fnc_teleport; }, {}, [], 2, 0, false, true] call BIS_fnc_holdActionAdd; Paste all of the above into init.sqf or the Editor Init Dialog. Have fun! Thanks 🙂 1 Share this post Link to post Share on other sites
Robustcolor 30 Posted September 6, 2020 On 8/24/2020 at 5:02 AM, wogz187 said: you_fnc_teleport = { params [["_caller", player], ["_location", locationNull]]; titleText ["Teleporting", "BLACK FADED", 0.2]; playsound ["Orange_PeriodSwitch_Pre_01", true]; sleep 0.5; _caller setPos (getPos (_location)); titleCut ["", "BLACK IN", 5]; }; //[player, formation] spawn you_fnc_teleport; How would you call this with an addAction from an editor placed object in a MP environment? Share this post Link to post Share on other sites
wogz187 1086 Posted September 7, 2020 @Robustcolor, The "_caller" can be anybody so it should be something like, Spoiler null= [this, "Use Teleport", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "alive _this", "_this distance _target < 3", {}, {}, { [(_this select 1), helper_1] spawn you_fnc_teleport; }, {}, [], 2, 0, false, true] call BIS_fnc_holdActionAdd; Pasted into the init dialog box of the desired object. Substitute "helper_1" with the name of the exit point. Can be added to multiple objects with same or different exits. Remember to load the function, you_fnc_teleport= { params [["_caller", player], ["_location", player]]; titleText ["Teleporting", "BLACK FADED", 0.2]; playsound ["Orange_PeriodSwitch_Pre_01", true]; sleep 0.5; _caller setPos (getPos (_location)); titleCut ["", "BLACK IN", 5]; }; Have fun! 1 Share this post Link to post Share on other sites