Deadth 1 Posted March 22, 2017 I'm building a multiplayer mission using ALiVE, ACE, and some other mods, which is intended to be a big 3 way factional battle, with BLU_F and OPF_F to be playable while leaving IND_F unplayable as the initial occupying force to be conquered. So far so good, still tweaking some of the objective modules and taors for balance, but I already have the support and logistics all functioning well thanks to lots of reading and studying of wikis. I can call in artillery and airstrikes just fine, and so on. I must admit, however, that I'm not a very good scripter and I often have to look up how others have done things in order to figure out something. My understanding of it, in regards to everything from syntax to eventhandlers is very very limited, so thanks in advance to this great, very knowledgeable community. So here's my question: I currently have players spawn in solo, ungrouped to any AI, but I want the player to have the option, with a radio command, to spawn a group of their choosing (one of the presets from the cfgGroups list I suppose), and have it join them under their command. As a second feature, when the unit the character is playing dies I would like the player to have the ability to respawn in the group, taking control of one of the other AI in his squad, which I generally already know how to set up IF the units are already set to be "playable" (respawn = 4; in description.ext), but have no idea how to set up if we spawn them ingame as initially unplayable AI. I have no idea how to do this. I have tried other options, such as just linking an unplayable group to the player in the editor, or even making all the units in the group playable for selection, but I ran into various issues, such as not being able to command the group if I selected a unit other than the leader to play from the lobby (obviously) or just having too many units spawning all over waiting for another player to join in order to command them all, or if I want to play ungrouped I'd have all these hangers on. All these issues I felt severely limited my options and I was getting rather frustrated. I finally decided, that for what I want to do, giving an initially solo player the chance to choose a group to command or none at all would be a fun option for the player and lead to a great range of diverse outcomes for how they want to experience the mission. Please bear with me and my lack of knowledge in this, and any help that leads to a solution is greatly appreciated. Share this post Link to post Share on other sites
Deadth 1 Posted March 23, 2017 Ok heres what I have so far. Using a player named eplayer01, I have a trigger in the editor for radio Alpha, named Call Infantry Assault with the following in the activation field: if (eplayer01 == player) then { null = execVM "EgroupInfAssault.sqf"; }; In the EgroupInfAssault.sqf file I have this: hint "EgroupInfAssault.sqf initialized"; _grp = [getPos player, EAST, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfAssault")] call BIS_fnc_spawnGroup; {_grp join player} forEach _this; I can get the group to spawn all around the player now, but I still can't get them to join his group. Still testing. Any ideas? Share this post Link to post Share on other sites
Deadth 1 Posted March 23, 2017 Hot damn I got it! Well, part of it. I can now get the spawned units to join my player with the following code in the .sqf file: hint "EgroupInfAssault.sqf initialized"; _grp = [getPos player, EAST, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfAssault")] call BIS_fnc_spawnGroup; {[_grp] join player} forEach units _grp; I still have some more tweaking to do and will get back with my results. I want to make sure that this wont spawn the group on every other player in the game. I'll get back with my results soon. Share this post Link to post Share on other sites
Midnighters 152 Posted March 23, 2017 1 hour ago, Deadth said: Hot damn I got it! Well, part of it. I can now get the spawned units to join my player with the following code in the .sqf file: hint "EgroupInfAssault.sqf initialized"; _grp = [getPos player, EAST, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfAssault")] call BIS_fnc_spawnGroup; {[_grp] join player} forEach units _grp; I still have some more tweaking to do and will get back with my results. I want to make sure that this wont spawn the group on every other player in the game. I'll get back with my results soon. yes, glad to see you are getting this to work. Share this post Link to post Share on other sites
Deadth 1 Posted March 23, 2017 Ok I tested this over my LAN and here's what I have so far: Players are able to use the radio to summon an AI group which immediately spawns at a marker placed at the appropriate base, and squads up with the player. I only have 2 groups to choose from for each side for now, triggered by Alpha and Bravo for the west player, Foxtrot and Golf for the east player Trigger activation field, for radio Alpha: if (side player == west) then { null = execVM "WgroupInfAssault.sqf"; }; WgroupInfAssault.sqf: hint "WgroupInfAssault spawned at base"; _grp = [getMarkerPos "Wspawn01", WEST, (configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfAssault")] call BIS_fnc_spawnGroup; {[_grp] join player} forEach units _grp; {setPlayable _x} forEach units _grp; (setPlayable doesn't work as intended, this is stated on the wiki. I left it in in case it ever does get fixed, in order to be able to use GROUP spawn to jump into another unit in the squad upon death. Until this gets working correctly, I'm using BASE spawn.) I removed certain radio channels from being accessible depending on side, retaining Alpha thru Echo for west, Foxtrot thru Juliet for east (had to do this because having west and east both use Alpha, for example, caused the west player to spawn a group not only for himself but for the east player as well): initPlayerLocal.sqf // This removes radio channels from players depending on side. if (side player == east) then { 1 setRadioMsg "NULL"; 2 setRadioMsg "NULL"; 3 setRadioMsg "NULL"; 4 setRadioMsg "NULL"; 5 setRadioMsg "NULL";}; if (side player == west) then { 6 setRadioMsg "NULL"; 7 setRadioMsg "NULL"; 8 setRadioMsg "NULL"; 9 setRadioMsg "NULL"; 10 setRadioMsg "NULL";}; The only problem I'm having now (aside from setPlayable not functioning), is whenever there is more than one player on the same side and any single player on that side triggers the group spawn, a duplicate group ALSO spawns and links up with every other player on that same side. Any ideas how to remedy this? Share this post Link to post Share on other sites
Deadth 1 Posted March 25, 2017 Nobody has any idea? I'm trying now to figure out how to make a trigger in a script that will execute the WgroupInfAssault.sqf file because I read somewhere that triggers in the editor will fire for every player no matter what and to make a trigger that will fire a script for only one player I have to make the trigger itself inside of a script, but in what file? The initServer.sqf? The initPlayerLocal.sqf? And I keep getting syntax errors with this: // Radio triggers for east _tr1 = createTrigger ["EmptyDetector", [0,0,0]]; _tr1 setTriggerActivation ["FOXTROT", "PRESENT", true]; _tr1 setTriggerStatements ["this", null = execVM "EgroupInfAssault.sqf", ""]; _tr2 = createTrigger ["EmptyDetector", [0,0,0]]; _tr2 setTriggerActivation ["GOLF", "PRESENT", true]; _tr2 setTriggerStatements ["this", null = execVM "EgroupWeaponsSquad.sqf", ""]; I'm still trying tho. Share this post Link to post Share on other sites
killzone_kid 1332 Posted March 25, 2017 On 3/23/2017 at 9:07 PM, Deadth said: {[_grp] join player} forEach units _grp; this expression makes no sense Share this post Link to post Share on other sites
Deadth 1 Posted March 25, 2017 (edited) Well it works as far as making the units join the player. That's not the problem. The problem is the units duplicate for each player on the server and then join each player, instead of just the one who used the radio trigger. I give up. I've googled and googled for 3 days and this final piece of the puzzle evades me. I'm just going to make a separate spawn script, and separate trigger, for every possible player, for every squad I guess. I don't think this is going to work as I intend either. I'm so close to solving this, I've solved everything else on my own. This is the only problem left. Edited March 26, 2017 by Deadth Share this post Link to post Share on other sites
Deadth 1 Posted March 26, 2017 Very special thanks to galzohar for a comment he posted on a thread 7 years ago that I discovered, which I used to solve my problem with the duplicate squads. Everything is working now as intended, including the expression that allegedly made no sense but somehow works just fine. God bless you galzohar. Share this post Link to post Share on other sites
kauppapekka 27 Posted March 26, 2017 The thing about the expression not making sense is that you seem to have found a working way to use the join command, which shouldn't be possible according to the syntax or at least implied. https://community.bistudio.com/wiki/join The way one should be using the join command according to the syntax is: units _grp join player; So you might want to change your script to use the "correct" way. 1 Share this post Link to post Share on other sites
killzone_kid 1332 Posted March 26, 2017 30 minutes ago, kauppapekka said: The thing about the expression not making sense is that you seem to have found a working way to use the join command that shouldn't be possible according to the syntax or at least implied. https://community.bistudio.com/wiki/join The way one should be using the join command according to the syntax is: units _grp join player; So you might want to change your script to use the "correct" way. The reason it somehow works is because in many cases when group is passed to command instead of required object (provided there is no strict check in place) the group leader would be used. In this case on each iteration current group leader will be joined to the new group, then new leader selected in the old group so that on next iteration it will be moved to new group then rinse and repeat. REALLY spastic way that might work, however it seems to be neither optimal nor reliable way of doing it. Messing with forEach array is never clever while the loop is on. Finally I get my answer why people use "It is Arma to you" when they cannot make it work. This is clear example when ignorance can get you there. 1 Share this post Link to post Share on other sites
Deadth 1 Posted April 2, 2017 On 3/26/2017 at 3:49 PM, killzone_kid said: The reason it somehow works is because in many cases when group is passed to command instead of required object (provided there is no strict check in place) the group leader would be used. In this case on each iteration current group leader will be joined to the new group, then new leader selected in the old group so that on next iteration it will be moved to new group then rinse and repeat. REALLY spastic way that might work, however it seems to be neither optimal nor reliable way of doing it. Messing with forEach array is never clever while the loop is on. Finally I get my answer why people use "It is Arma to you" when they cannot make it work. This is clear example when ignorance can get you there. Thanks for the insulting way to "help" someone who obviously went through a lot of effort to figure this out and ended up figuring out a way to make it work by searching through endless threads going back years. I understand now that despite my initial compliments to this community in my OP this was the wrong place to try to learn anything or ask for any help. Wont happen again trust me. 1 Share this post Link to post Share on other sites
Grumpy Old Man 3547 Posted April 2, 2017 Just now, Deadth said: Thanks for the insulting way to "help" someone who obviously went through a lot of effort to figure this out and ended up figuring out a way to make it work by searching through endless threads going back years. I understand now that despite my initial compliments to this community in my OP this was the wrong place to try to learn anything or ask for any help. Wont happen again trust me. First of all, kk explained why such a wonky solution worked in the first place and that it's bad practice. Usage examples, syntax and commands can be found on the wiki, which is always up to date, so you can grasp within a glance how to use a command. Currently your primary problem (as stated in the thread title) has been solved, you could always open up a new thread about your duplication and locality issue, instead of waiting one week. kk surely didn't mean his post in an insulting way. Usually posting the solution to your problem helps others. Share this post Link to post Share on other sites
Niktus Acid 0 Posted April 18, 2017 (edited) Hello people I'm creating a mission for playing with some friends but there is a feature that I can't get it to work: I'm trying to make each player join a scripted AI group automatically by proximity on mission start and again after each respawn... I can get it work on single player without any problems, but as soon as I run mission on my hosted server, it doesn't work anymore. I've tried to execute eze_join_neares_group.sqf using this: { _null = [] execVM "eze_join_nearest_group.sqf"; } remoteExecCall ["bis_fnc_call", 0]; and this: ["eze_join_nearest_group.sqf","BIS_fnc_execVM",true,true ] call BIS_fnc_MP; Nothing works, can somebody figure out what am I doing wrong? Thank you so much! This is my code:init.sqf player addEventhandler ["Respawn", { _null = [] execVM "eze_join_nearest_group.sqf"; }]; player addMPEventHandler ["Respawn", { _null = [] execVM "eze_join_nearest_group.sqf"; }]; eze_join_nearest_group.sqf if (!isDedicated) then { private["_side","_check","_list","_selectedGroup","_getGroup","_sideGroup"]; _side = side player; _check = true; while {_check} do { _list = (player nearEntities ["Man", 25]) - allPlayers; if (count _list > 0) then { _selectedGroup = _list select 0; _getGroup = group _selectedGroup; _sideGroup = side _getGroup; if (_sideGroup isEqualTo _side) then { player setRank playerRank; { _x setRank "SERGEANT"; } forEach units _getGroup; [player] join _getGroup; systemChat format["YOU JOINED A GROUP, FOLLOW ALL ORDERS... SIR YES SIR!"]; _check = false; }; } else{ systemChat format["NO GROUP ASSIGNED YET"]; }; sleep 15; }; }; Edited April 18, 2017 by Niktus Acid to correct writing Share this post Link to post Share on other sites
kauppapekka 27 Posted April 20, 2017 How aboutonPlayerRespawn.sqf execVM "eze_join_nearest_group.sqf"; https://community.bistudio.com/wiki/Event_Scripts 1 Share this post Link to post Share on other sites
Niktus Acid 0 Posted April 23, 2017 Yes, I figured out later that I was missing that little detail... Thanks for your answer kauppapekka! Share this post Link to post Share on other sites