Jump to content

SpaydCBR

Member
  • Content Count

    99
  • Joined

  • Last visited

  • Medals

  • Medals

Everything posted by SpaydCBR

  1. This seems like it should be easy but there doesn't seem to be a way to do it. Basically I was to set up a vehicle to be an infantry respawn position ONLY for members of a certain group, so each group gets their own assigned vehicle that only they can respawn at. This seems to work: [group player, _veh] call BIS_fnc_addRespawnPosition; But how do I do it if I want it to be a specific group and not necessarily the players'? If, for example, I have a group called B Alpha 1-1 (default group name for first group in editor). Then how do I check if some player is in group B Alpha 1-1, and how would I use B Alpha 1-1 as the first parameter in the addRespawnPosition function call? Doing if (group player == "B Alpha 1-1") then {...}; doesn't work because I guess you can't compare groups with strings, but removing the quotes also obviously doesn't work either. I tried using groupID but that just returns a string and not a group. So how do I simply check if a unit is in a specific group, so I can make a specific vehicle be a respawn position for a specific group?
  2. @sarogahtyp That's exactly what I did in post #6 :) You can't actually group a squad with an empty vehicle (didn't work when I tried at least), so I used a crewed vehicle, grouped it, got the group name from it, then deleted the crew before calling the addRespawnPosition function on the vehicle. @bull_a Interesting. Not exactly what I'm looking for, but that's my bad. The question is more about how to call the addRespawnPosition for a specific group and not exactly how to check if a unit is part of a specific group. I just asked that because I thought if I knew how to check if a unit is in a specific group then I'd know how to call the function, and wanted to keep the question simple, but I think I just confused everybody haha. I think your code needs an actual unit, but that might not necessarily exist (maybe no players join one squad) so I don't think that code helps me. The allGroups command does sound like something I could use though so this code could be slightly modified for what I want (just call the function for all groups), so thank you! Sometimes it's hard to find what commands are out there in the wiki. I tried using 'group' and 'Group' as keywords in the search but 'allGroups' never showed up. Maybe I should be using Ctrl+F in the commands page instead :)
  3. Thanks for your responses sarogahtyp. The full idea is this: In my mission I have 2 teams (BLUFOR and OPFOR. All human players) with 4 squads of 8 (B Alpha 1-1, O Alpha 1-1, etc) on EACH team. I want each squad to get their own set of 2 transport vehicles that only members of that squad can use as a respawn position. I'm not an expert in scripting, so correct me if I'm wrong. I think if I do it your way then every client would have to run the code locally to work correct, because only client knows what 'player' is? I was hoping I could run this only on server since it's supposedly better, and to do that I would need to get a reference to all the groups somehow. I know my code doesn't run on server yet, but I believe I can make it run on server and should still work I think. Should I create the groups in a script instead of placing them in the editor, so I can save the groups in variables? Would they still be "joinable" if I do it that way?
  4. I tried groupID before, but it won't work since I need to put a group type in the function call. I also tried syncing the module to the group and that didn't seem to work either :( There doesn't seem to be an "easy" way to do this. So I came up with an ugly workaround. I added a "crewed" vehicle, grouped it to the respective group, and called the following in its init //Get group of the vehicle _vehGroup = group _this; //Delete crew { deleteVehicle _x; } forEach crew _this; //Set up infantry respawn for this group [_vehGroup, _this] call BIS_fnc_addRespawnPosition; [_this,5,0,-1,{},0,2,1,true,true,0,false] call BIS_fnc_moduleRespawnVehicle; Seems to work just fine, but I don't like it. Is there a more "graceful" way to do this?
  5. Thanks for the response. I've edited my post to hopefully make it more clear. Basically, if I have a known group name (B Alpha 1-1), how do I check if a player is in that group? (How do I check player is in group B Alpha 1-1)
  6. Hello all, I have multiple vehicles set up as infantry respawn positions using the Respawn Module, which automatically adds markers to the vehicles indicating it's a respawn position. I want to remove these markers because I will be using different ones, but I haven't been able to figure out how. Does anybody know how to remove the markers?
  7. SpaydCBR

    Respawn warp

    I don't know if it matters, but it looks like you have an extra }; at the end there
  8. SpaydCBR

    Arsenal help

    Ok, so I think I figured out what you meant about going through the config, and I think I solved my problem. Here's the code I came up with in case anybody was wondering. _magazines = []; _magConfig = configFile >> "CfgMagazines"; for "_i" from 0 to (count _magConfig)-1 do { _magazines pushBack (configName(_magConfig select _i)); }; _backpacks = []; _backpackConfig = configFile >> "CfgVehicles"; for "_i" from 0 to (count _backpackConfig)-1 do { _backpacks pushBack (configName(_backpackConfig select _i)); }; [_box, _magazines] call BIS_fnc_addVirtualMagazineCargo; [_box, _backpacks] call BIS_fnc_addVirtualBackpackCargo; Seems to be working fine, but those of you that understand this better please let me know if there's something wrong/bad about it.
  9. I'm making a PvP mission, in which there is an ammobox that will serve as a Virtual Arsenal to customize your loadout. The contents of this box differ for each side and class. It seems to be working but I have a few questions. 1- How do I disable the "Import" button in the Arsenal? Do I even need to? I'm not sure what it does but I don't want people to be able to import loadouts that shouldn't be available to them. 2- How do I add all ammo and backpacks? I've been using this method to add items and weapons //arsenal.sqf ​//called from initPlayerLocal.sqf [AmmoBox, ["%All"]] call BIS_fnc_addVirtualMagazineCargo; [AmmoBox, ["%All"]] call BIS_fnc_addVirtualBackpackCargo; switch (playerSide) do { case west: { [AmmoBox,[<manuallyTypedListOfWeapons>]] call BIS_fnc_addVirtualWeaponCargo; [AmmoBox,[<manuallyTypedListOfItems>]] call BIS_fnc_addVirtualItemCargo; if (typeOf player == "B_soldier_LAT_F") then { [AmmoBox,[<listOfLaunchers>]] call BIS_fnc_addVirtualWeaponCargo; }; }; case east: {...}; } The first two lines I got from the Wiki don't seem to work. 3- Is there a better way to do all this? Is there a way to automatically add side specific gear instead of manually typing them in and having to update it every time new gear is released? Or anything else anyone can think of?
  10. SpaydCBR

    Arsenal help

    That sounded like a good idea, but I tried [AmmoBox,["%All"]] call BIS_fnc_removeVirtualWeaponCargo; and it didn't work :( . I think the "%ALL" just doesn't work. What is this config and how do I go through it? I'm sorry if that's a stupid question :)
  11. I was in a test mission messing around with the debug console trying to understand the difference between local exec, global exec and server exec. This is what I've learned and please correct me if I'm wrong: Code I used to test was hint "Hello" 1- Local means only the machine that called the code will execute it. I tested this with a friend and only I was able to see the hint. 2- Global means all clients will execute the code. This time both of us saw the hint. 3- Server means only the server will execute the code. This time only I saw the hint. I assume it's because my client was also the server since I was hosting the mission. Then I tried to do the same test in a dedicated server (btw, is it possible to make my "local" dedicated server joinable by my friends?) 4- When I ran locally, I saw the hint 5- When I ran globally, I saw the hint 6- When I ran on server, I did NOT. I assume it's because this time, my client was not the server, so I couldn't see server executed code. Then I tried a new bit of code "B_MRAP_01_F" createVehicle getMarkerPos "respawn_west" 7- When I ran locally, I saw the vehicle spawn 8- When I ran globally, I saw TWO vehicles spawn. I assume it ran once for my client and once on the server itself? 9- When I ran on server, I saw the vehicle spawn. At this point I'm confused as to why I saw the "result" of the createVehicle command when run on the server in a dedicated environment but not the hint.
  12. SpaydCBR

    Question about locality

    I see. Thanks. I'd like to read that thread if you don't mind finding the link. I tried searching for "createVehicle vs createVehicleLocal" but that didn't find anything. I also got to read up on headless clients now. I have no idea what that is haha.
  13. SpaydCBR

    Question about locality

    I thought of another question regarding this topic. Is it better to execute as much of the code as possible on the server, or on all the clients? I presume clients, as to not clog up the server to keep the experience smooth for other players.
  14. SpaydCBR

    Question about locality

    Ah, I see. Thanks for the info guys! Very helpful.
  15. SpaydCBR

    Vehicle Respawn Module

    Man you just unlocked a whole new world for me! Haha, thanks
  16. SpaydCBR

    Vehicle Respawn Module

    This worked wonderfully! Thanks larrow! I do just have one last simple question about this. How do you know the names of the variables for the modules when using getVariable/setVariable? Like in _delay = (_respawnModule getVariable ["Delay","0"]) call BIS_fnc_parsenumber; How do you know that "Delay" is a variable in the respawn module?
  17. I'd suggest focusing on MP scripting. There's plenty of scripting guides like Fockers' that explain SQF really well, but I've yet to see a comprehensive MP scripting guide and would really appreciate one. Especially one that teaches the latest methodologies and standards. I think releasing in chunks would be better since that allows you to get feedback quicker and get people learning something as soon as possible ;)
  18. SpaydCBR

    Vehicle Respawn Module

    Also, for some reason I cannot fathom, the code is spawning 4 vehicles when I run this on a dedicated server :(
  19. Hello guys, I'm just wondering how to call this function for a newly spawned vehicle. Basically a vehicle will spawn mid game, and become a respawn position for infantry that they can select in the respawn menu The wiki just has this to say https://community.bistudio.com/wiki/BIS_fnc_moduleRespawnPosition
  20. That worked! Thank you, but why does simply placing the module in the editor, giving it the variable name "respawnPoint", then calling _pos = getMarkerPos "mkr_alpha_west_car_1"; _veh = "B_MRAP_01_hmg_F" createVehicle _pos; respawnPoint synchronizeObjectsAdd [_veh]; in a script not have the same effect? Also, how do you know the variable names?
  21. SpaydCBR

    Vehicle Respawn Module

    Man I've been racking my brain trying to figure this out and I really don't see why this is so hard. I guess I just don't really understand what a module actually is under the hood. I'd really appreciate some help. This is what I want: 1- Sector starts out neutral and is devoid of any vehicles. 2- One side captures the sector and are awarded a set of vehicles at that area as well as a new respawn position. 3- These vehicles respawn at their starting positions as long as the team maintains control of that sector. 4- These vehicles should also be respawn positions for infantry. 5- The vehicles cease to respawn once ownership of the sector switches to the other side, and that other sides' set of vehicles spawn with the same above conditions. This is what I have: 1- A working sector control mechanism, that gets captured correctly 2- Triggers that correctly activate a new respawn position only for the side that owns the sector 3- The same triggers call the following code (as well as other things, but this is the one that's relevant) remoteExec ["CBR_fnc_spawnvehicles_west"] 4- I have a fn_spawnvehicles_west.sqf function in my mission folder with the following contents _pos = getMarkerPos "mkr_alpha_west_car_1"; _veh = "B_MRAP_01_hmg_F" createVehicle _pos; [_veh,10,-1,-1,[{},[]],0,1,1,true] call BIS_fnc_moduleRespawnVehicle; sleep 30; [_veh, true] call BIS_fnc_moduleRespawnVehicle; hint "NO MORE RESPAWNS" (I'm using a sleep 30, instead of the condition of ownership change, so I can test the module without having to switch sides then recapture the sector) This spawns the vehicle fine and the vehicle respawns after 10 seconds of being destroyed fine, but after 30 seconds I get the hint as I should but the vehicle continues to respawn, so I'm not really sure how to fix this. I also want the vehicle to be an infantry respawn position that they can select in the respawn menu, but the wiki has no information on how to use BIS_fnc_moduleRespawnPosition :/ Is there a better way to accomplish what I want? I mean I imagined there'd be a way I could just place the modules with the settings I want in the editor, and simply sync newly spawned vehicles to it using code to "draw the imaginary sync line". The modules work perfectly fine when I do everything in the editor, but I don't want the vehicles to exist yet.
  22. Thanks but neither call nor spawn worked :( . Also, is there a way to set type, side, and who to show it to like in the editor? I'd only want this to be a respawn position for one side.
  23. SpaydCBR

    Vehicle Respawn Module

    Ok, please excuse my noobiness but I have a few questions about this. I have a trigger in the editor with a condition, and in the on activation field it simply calls the following script to spawn a vehicle _pos = getMarkerPos "mkr_alpha_west_car_1"; _veh = "B_MRAP_01_hmg_F" createVehicle _pos; [_veh,10,-1,-1,<code>,0,1,1,true] call BIS_fnc_moduleRespawnVehicle; This seems to work perfectly fine but I have a few questions: 1- What do I put in for <code> if I don't want anything executed. I've tried "null" and "[]". Both don't seem to cause any issues (The vehicle respawns fine) but the debugger complains, and I don't like complaints! 2- If I want to spawn more than one vehicle, how do I attach them all to the same module like I could in the editor? 3- Without a reference to the module, how can I disable it if I want the vehicles to stop respawning once another trigger condition is met?
  24. SpaydCBR

    Vehicle Respawn Module

    Is there any way to disable the module that has been initialized like this once a trigger is activated to stop the vehicle from respawning anymore?
  25. Hello guys, I want to spawn a set of vehicles once a trigger is activated. I have that part done. What I also want is those vehicles to be new infantry respawn positions in the respawn menu and they should respawn once destroyed. The respawn position and vehicle respawn modules work pretty well when the vehicles already exist, but they don't seem to work when I use synchronizedObjectsAdd to sync newly spawned vehicles to those existing modules. This is the code I've been using _pos = getMarkerPos "alpha_west_car_1"; _veh = "B_MRAP_01_hmg_F" createVehicle _pos; vehspawn_alpha synchronizeObjectsAdd [_veh]; vehinfspawn_alpha synchronizeObjectsAdd [_veh]; The first 2 lines seem to be working fine, but I don't think the second two are doing anything. Any ideas? Thanks!
×