Jump to content

cklymowsky

Member
  • Content Count

    42
  • Joined

  • Last visited

  • Medals

Everything posted by cklymowsky

  1. HI All, I would like to add a feature to my multiplayer game for the player to select which map they would like to spawn in, either Tanoa, Altis, Stratis or Malden. Is there a way to do this similar to "class Params" in the description .ext file? class Params { class MapSelection??? { title = "...."; values[] = {...}; // When 'texts' are missing, values will be displayed directly instead default = ...; //file = "setViewDistance.sqf"; // (Optional) Script called when player joins, selected value is passed as an argument }; class ViewDistance { title = "View distance (in metres)"; values[] = {500,1000,2000,5000}; // When 'texts' are missing, values will be displayed directly instead default = 2000; //file = "setViewDistance.sqf"; // (Optional) Script called when player joins, selected value is passed as an argument }; class Daytime { title = "Time of Day"; texts[] = {"Dawn", "Morning","Day","Dusk","Evening","Night"}; values[] = {4,6,12,19,20,0}; default = 12; function = "BIS_fnc_paramDaytime"; // (Optional) Function called when player joins, selected value is passed as an argument isGlobal = 1; // (Optional) 1 to execute script / function locally for every player who joins, 0 to do it only on server }; };
  2. Thanks Larrow, I actually had to increase initPlayerLocal.sqf up to waitUntil { time > 2 }; before I stopped getting undefined variable errors, and BIS_fnc_moduleSector_sectors would give the sectors. I assume my script setUpSector requires this much time. My thought was that by running setUpSector that calls createSector embedded within it, with preInit in the description.ext, all the sectors would be created and initialized before initPlayerLocal?
  3. HI All, I'm having problems with my script obtaining BIS_fnc_moduleSector_sectors and I think it is related to a timing issue? In my description.ext below, setUpSector creates sectors on the map. I added preInit thinking this would be done early on (as per https://community.bistudio.com/wiki/Initialization_Order) when loading the MP game, but do not notice much difference between postInit and preInit. description.ext class CfgFunctions { class BEAKS { class SetUp { file = "functions\SetUp"; class setUpSector {postInit = 1}; //{postInit = 1}; {preInit = 1}; not sure which to use class sectorDistances {}; } } }; fn_sectorDistances.sqf, waitUntil {!isNull player}; fn_Draw3Dsectors = { { //...script to display distance of sectors } forEach BIS_fnc_moduleSector_sectors; }; private ["_addNew"]; _addNew = ["BIS_id", "onEachFrame", "fn_Draw3Dsectors"] call BIS_fnc_addStackedEventHandler TRUE The BIS_fnc_moduleSector_sectors works when BEAKS_fnc_sectorDistances is called below for some reason? initPlayerLocal.sqf waituntil {!isnil "bis_fnc_init"}; waitUntil {!isNull player}; [] call BEAKS_fnc_sectorDistances; hint format ["BIS_fnc_moduleSector_sectors: \n %1", BIS_fnc_moduleSector_sectors]; HOWEVER, I get an "Error Undefined variable in expression: bis_fnc_modulesector_sectors" with the hint statement? How to I get BIS_fnc_moduleSector_sectors recognized?
  4. cklymowsky

    Sector Module Scripting

    Thanks Larrow, this works. So the waitUntil { time > 0 }; is what it controlling the timing. But timing of what exactly? Correct, player position is just for testing.
  5. cklymowsky

    Sector Module Scripting

    Thanks Larrow, I'm back working on my MP game using your updated version, and integrating into my own script. I am trying to generate sectors before the game starts, and I don't want to call spawnSector from initPlayerLocal or initServer. So I am calling setUpSector with {postInit = 1} from the description.ext. The sector module "ModuleSector_F" will not spawn, yet all the params are shown in the hint message, and I am not getting any error messages...any ideas what's going wrong? I stripped everything out from your example mission, to try and figure it out, and only have the following: in the mission folder: description.ext, mission.sqm in folder functions>>SetUp>> createSectorExecution.hpp, fn_createSector.sqf, fn_setUpSector.sqf description.ext createSectorExecution.hpp class BEAKS_fnc_createSector { jip = 0; allowedTargets = 2;}; //No JIP, Can only be remoteExecuted to the Server fn_setUpSector.sqf //waitUntil { time > 0 }; //Exit if we are not the server if (!isServer) exitWith {}; //Create a plain old default sector ["myLoadingScreen", "this text does not display for some reason..."] call BIS_fnc_startLoadingScreen; //Usage basic _baseName = [position player,"Sector 1","S",nil,nil,EAST] call BEAKS_fnc_createSector; "myLoadingScreen" call BIS_fnc_endLoadingScreen; fn_createSector.sqf
  6. HI All, I've tried writing a script to spawn boats spread out along a shoreline (reliably in the water), but takes quite a while to spawn them reliably (up to a minute or more). Has anyone got a better script, better idea on how to do this or can suggest improvements to my script below?
  7. HI All, I can't figure out how to solve this nested for do loop to get it to work. I'm getting the following error despite defining my variable at the start. Excerpt from rpt file with error message: 17:01:59 File functions\SetUp\fn_createMarkers.sqf [BEAKS_fnc_createMarkers], line 18 17:01:59 Error in expression <sectorPairArray pushBack [_firstSector, |#|_otherSector]; }; _i = _i +1; }; para> 17:01:59 Error position: <_otherSector]; }; _i = _i +1; }; para> 17:01:59 Error Undefined variable in expression: _othersector My script with the nested "for" "do" loop contains the following: params ["_firstSector","_otherSector","_sectorPairArray"]; // get unique pairs of sectors _firstSector = objNull; _otherSector = objNull; _sectorPairArray = []; __I = 0; hint format ["allSectorsArray: \n %1", allSectorsArray]; for "_i" from 0 to (count allSectorsArray - 1) do { _firstSector = allSectorsArray select _i; _i = __I; for "_i" from __I to (count allSectorsArray - 1) do { _i = _i +1; _otherSector = allSectorsArray select _i; _sectorPairArray pushBack [_firstSector, _otherSector]; }; _i = _i +1; }; allSectorsArray is a global variable array of sectors.
  8. cklymowsky

    HELP with nested "for" "do" loop

    OK thanks Larrow, Yours is 0.0179ms and my for do loop is 0.0.0274ms. Thanks again!
  9. cklymowsky

    HELP with nested "for" "do" loop

    Thanks both to Grump and Harzach, appreciate the ongoing support and patience. Your feedback did help! Now finally got it working with: allSectorsArray = [0,1,2,3,4,]; for "_i" from 0 to (count allSectorsArray - 1) do { _firstSector = allSectorsArray select _i; __I = _i+1; for "_j" from __I to (count allSectorsArray - 1) do { _otherSector = allSectorsArray select _j; _sectorPairArray pushBack [_firstSector, _otherSector]; }; }; //_sectorPairArray returns [[0,1],[0,2],[0,3],[0,4],[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]] Not sure it there was better way to do this?
  10. cklymowsky

    HELP with nested "for" "do" loop

    Thanks Harzach, Not sure if I was using params correctly, I though you could use it similar to private, but in this case I wasn't calling in a variable. I set otherSector = objNull; to define it, thinking this was the problem. Instead I found the issue and it does what I want it to do with the following:
  11. cklymowsky

    HELP with nested "for" "do" loop

    Not sure what is wrong with "_i" in for "_i" from __I to (count allSectorsArray - 1) do { as it is used as the VARNAME in the example of Control Structures: https://community.bistudio.com/wiki/Control_Structures#for-from-to-Loop I am setting _i equal to __I (another variable) that gets it value every time it goes through the outer loop and using it as the STARTVALUE in the inner loop. I fixed the +1 to + 1.
  12. Thanks, but how do I find these? Currently I use "ground" in my script for blacklist areas: _randomPosAroundPlayerinWater = [[[_pos, 250]],["ground"]] call BIS_fnc_randomPos;
  13. Thanks, I went with the following, it can create 12 boats spread apart along the shore line, most of the time. Sometimes it spawns them under water of on shore land despite being scripted not to. I may have to create a loop that check the status of each boat, and respawn it if it is on land or underwater.
  14. Hi All, Does anyone know how to fix the following message "Config: someinputafter EndOfFile." that always pops-up at the start on my MP missions on the Create Game Screen? Thanks
  15. cklymowsky

    Sector Module Scripting

    HI All, I set the following, so that all the sectors would be displayed on screen in a MP game by initializing with: _logic remoteExecCall ["BIS_fnc_moduleSector", 0, FALSE]; createSector.sqf //Exit if we are not the server if !( isServer ) exitWith {}; params ["_pos",["_baseName","",[""]],["_side","",[EAST,""]]]; _pos = [_this,0,[],[[],objNull,""],3] call BIS_fnc_param; _pos = _pos call BIS_fnc_position; //Create the sector logic _logic = (createGroup sideLogic) createUnit ["ModuleSector_F",_pos,[],0,"NONE"]; //ModuleSectorDummy_F ModuleSector_F _logic remoteExecCall ["BIS_fnc_moduleSector", 0, FALSE]; //Default setting, which are optional //_designation = ""; //if ((_baseName find "CONTROL POINT") >= 0) then {_designation = _baseName select [14,1]}; //_logic setVariable ["Designation",_designation, TRUE]; // ADD Sector Numbers only works when remoteExecCall on initializing, TESTING _logic setVariable ["Designation","", TRUE]; _logic setVariable ["Name",_baseName, TRUE]; And noticed that the "Designation" variable now works! How ever I get the following error, yet it still works, how can I clear this error? waituntil {|#|!isnil {_logic getvariable "finalized"}}> Error position: <!isnil {_logic getvariable "finalized"}}> Error Generic error in expression File A3\modules_f\Multiplayer\functions\fn_moduleSector.sqf [BIS_fnc_moduleSector], line 70
  16. HI All, I'm using the following scripts to update the respawn sectors in a MP COOP game. It works, however, every time more than one player dies the RESPAWN MENU generates multiple respawn sectors of the same type, depending on how many players are dead, which looks confusing. How should I modify this so that the RESPAWN MENU only uses the latest sectors from the last player that died? description.ext respawnTemplates[] = {"MenuInventory","MenuPosition"}; onPlayerRespawn.sqf //run on all player clients incl. player host and headless clients if (!isDedicated) then { //Once the player has respawned //Remove all sector respawn positions [ "REM_ALL" ] call TAG_fnc_respawnPositions; }; onPlayerKilled.sqf //When player dies //For every sector { //If the sector is owned by the players side if ( ( _x getVariable "Owner" ) isEqualTo playerSide ) then { //Add a respawn position [ "ADD", _x ] call TAG_fnc_respawnPositions; }; }forEach BIS_fnc_moduleSector_sectors; initPlayerLocal.sqf initServer.sqf
  17. Thanks Larrow, Switching from playerSide to player, resolves the duplication of sector names in the RESPAWN MENU, with on slight, very minor issue, the RESPAWN MENU for a player already dead, will not be updated with the sector "Name" of a newly captured sector, until they die and the list of sector "Name" are updated. Still works even though an area with a same sector is available to respawn in. during this time.
  18. Thanks gokitty1199, You're correct, I had to remove the addMissionEventHandler, then it worked.
  19. HI All, I'm trying to play my start-up music for every client that joins the game, but so far it only plays on the host? initPlayerLocal.sqf _handle1 = addMissionEventHandler ["PlayerConnected",{playMusic "MenuMusic"}]; ... //BI RESPAWN MENU - IDD 58 PLAY MenuMusic if (!isDedicated) then { waitUntil {!(isNull (findDisplay 58))}; if (isNil "BEAK_MUSIC_INIT") then { BEAK_MUSIC_INIT = 1; playMusic "MenuMusic"; _music = addMusicEventHandler ["MusicStop",{playMusic (_this select 0)}]; waitUntil {isNull (findDisplay 58)}; removeMusicEventHandler ["MusicStop",_music]; playMusic ""; }; }; I tried placing it in init.sqf but has same effect...still not sure how to broadcast script to all clients.
  20. HI All, I've read remoteExec and CfgRemoteExec but yet I still cannot get my function, fn_sectorDistances.sqf, to display for the host or all players that join. fn_sectorDistances is supposed to show the distance from the player to the sector... description.ext class CfgRemoteExec { // List of script functions allowed to be sent from client via remoteExec class Functions { file = "functions\SetUp"; class sectorDistances {}; // allowedTargets = 0 can target only clients }; }; and in initPlayerLocal.sqf //show distances to all sectors for all players remoteExec ["fn_sectorDistances", 0, true]; I've stored fn_sectorDistances.sqf in a sub-folder folder in: functions>>SetUp Am I executing it from the right location? Have I set up class CfgRemoteExec correctly?
  21. allSectorsArray = ...sectors created using BIS_fnc_sectorModule I have tried using publicVariable "allSectorsArray"; which I think is the same as missionNamespace setVariable ["sectorsArray",allSectorsArray, TRUE]; and have also tried defining allSectorsArray = ...sectors created using BIS_fnc_sectorModule inside of init.sqf as per http://killzonekid.com/arma-scripting-tutorials-variables-part-3/ yet they all yield the same results: on host I get: TRUE call bis_fnc_moduleSector: [BIS_fnc_moduleSector_sector2_751, BIS_fnc_moduleSector_sector2_756, ...] on the client: TRUE call bis_fnc_moduleSector: [L Bravo 1-5:1 REMOTE, L Bravo 1-6:1 REMOTE, ...] My question is why aren't any of these methods transferring the global variable allSectorsArray to the clients the same way as it appears on the host? Is this because you cannot transfer sectors as variables because they are not supported by these commands? SOLUTION: I used publicVariable "controlPointsArray"; even if this generates [L Bravo 1-5:1 REMOTE, L Bravo 1-6:1 REMOTE, ...] as sectors and had to change my sectorDistance.sqf from _picture = switch (_x getVariable "Name") do { case "1 CONTROL POINT":{"\A3\ui_f\data\map\markers\military\flag_CA.paa"}; }; to if (_x in controlPointsArray) then {_picture = "\A3\ui_f\data\map\markers\military\flag_CA.paa"}; As it could not get the value from, since the public value in was not set to true.
  22. Thanks gokitty1199, BUT, the problem is TRUE call bis_fnc_moduleSector in the fn_sectorDistances.sqf. When I test with the following: { _bis_fnc_moduleSector = TRUE call bis_fnc_moduleSector; hint format ["TRUE call bis_fnc_moduleSector: \n %1 ", _bis_fnc_moduleSector]; } remoteExec ["bis_fnc_call", 0, true]; On the host I get an array sectors that works with fn_sectorDistances.sqf, but on the client I dont't get the same array, and as a result fn_sectorDistances.sqf doesn't work. on host I get: TRUE call bis_fnc_moduleSector: [BIS_fnc_moduleSector_sector2_751, BIS_fnc_moduleSector_sector2_756, ...] on the client: TRUE call bis_fnc_moduleSector: [L Bravo 1-5:1 REMOTE, L Bravo 1-6:1 REMOTE, ...] I can't even import a global variable allSectorsArray = TRUE call BIS_fnc_moduleSector; through: initServer.sqf [[allSectorsArray],"functions\SetUp\fn_sectorDistances.sqf"] remoteExec ["execVM", 0, true]; It gives the same results as in hint message above. HOW do I broadcast a variable to other clients the same way it would show up on the server and host?
  23. I tried placing it in initServer.sqf thinking it could broadcast to all players initServer.sqf //show distances to all sectors for all players remoteExec ["BEAKS_fnc_sectorDistances", 0]; ...but it only works on the host. How can I get fn_sectorDistances to run on all players. fn_sectorDistances.sqf
  24. HI ALl, Not sure what I'm doing wrong here. I want to create a marker via scripting, then tag it in createDiaryRecord, so that in the mission briefing when you select the marker name the map move to the position. So far I only have the tag in present but when you click the underlined text RADIO TOWER 1 in the briefing map nothing happens? fn_diaries.sqf _randomPosMapNoWater = [nil, ["water"]] call BIS_fnc_randomPos; marker = createMarker ["GOHERE", _randomPosMapNoWater]; marker setMarkerShape "RECTANGLE"; marker setMarkerSize [100,100]; player createDiaryRecord ["Diary", ["RADIO TOWER", "Capturing the <marker name = marker>RADIO TOWER 1</marker> allows you to ..."]]; Nevermind, The name in <marker name = marker>RADIO TOWER 1</marker>has to be the sting in createMartker "GOHERE".
  25. HI All, I'm running a script in the InitServer.qsf that randomly generates sectors on the map, but this takes a few seconds to position them. During this time the map flashes and the CONTINUE button is enabled, but the sectors haven't finished being placed. HOW do I make the loading screen black and disable the CONTINUE button, until the script is finished? Thanks in advance
×