Jump to content

red62

Member
  • Content Count

    8
  • Joined

  • Last visited

  • Medals

Community Reputation

1 Neutral

About red62

  • Rank
    Private

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Alright, what I may do then is expose a public function fnc_getRole from the roles_server.sqf that the clients can use, and then the server hands out a role, increments the index, and pushes it back out to the mission namespace with publicvariable all in a couple instructions. Thanks for all the help, can I +rep you guys somehow?
  2. red62

    Player Loaded into Game

    I use waitUntil { sleep 1; (!isNull player && time > 0) }; and it seems to work well.
  3. It looks like that was it. Once I waited until the variables were actually defined, like you said, all functionality seems to work (at least for just me, in our dedicated server). Thank you so much for the help. Do you think there is going to be an issue with users claiming the same role because the new value isn't getting updated fast enough? I am imagining a situation where two players are executing the script at the same time and they both access the variable at the same time. The publicvariable instruction may not get executed in time and the two users would get the same role. Do you think this is possible?
  4. Update to this, I spent another 5 hours on it and decided to split the work into client and server to see if I could make that work. Now, inside my initPlayerLocal I call a script roles_client.sqf which calls this code for each person with their role: player addAction ["Show Role", "hint (_this select 3); systemChat (_this select 3); (_this select 1) removeAction (_this select 2)", _roleDesc]; I thought this should work fine since it is being executed on each player for their unit, and it does work fine in SP. It adds the action to the player in multiplayer but the problem is neither the hint or the systemchat show up once you select it (it does get removed afterwards though). I have also tried using remoteExec like so: [player, ["Show Role", "hint (_this select 3); systemChat (_this select 3); (_this select 1) removeAction (_this select 2)", _roleDesc]] remoteExec ["addAction", player]; My roles_server.sqf is below : And my full roles_client.sqf: Any help is much appreciated. I am at a loss
  5. Good morning all. I have been working on a mission for a week or so where 80% of the players slot a generic "civilian" role, and then an array of the actual roles are randomized in a script I wrote (called by a simple trigger on the map) and distributed to each player through systemChat when they load in. The script works perfectly fine in SP and about half the time in MP, with a seemingly random probability. When I test it in MP with 3-4 people on our dedicated server, some of us get a systemChat with our role and some do not. I am wondering if this has to do with the VM trying to systemChat the player before they load in, or some other issue with how I have implemented my script, but I appreciate any help. My script, roles.sqf, follows:
  6. Thanks for the help, it looks like it works now! One more thing, I tried to write a script to assign the correct net in ACRE to each unit based on their squad, using the ACRE api. It seems to have worked in singleplayer, but when we tested it in multiplayer it seemed to work about 50% of the time and assign a random channel the other 50% of the time (aka one of the other squads' net). Here is the code: //preset fireteam group colours //[3, this] execVM "radioDefault.sqf"; sleep 10; private ["_channel", "_unit"]; _channel = _this select 0; _unit = _this select 1; Sleep 5; waitUntil { ([] call acre_api_fnc_isInitialized) }; { [(["ACRE_PRC343"] call acre_api_fnc_getRadioByType), _channel] call acre_api_fnc_setRadioChannel; } forEach units group _unit; I am calling [3, this] execVM "radioDefault.sqf"; in the init of each squad lead, replacing the 3 with the correct net. I am wondering if this is not the correct way to try to work this script in, and instead if I should include some code in initPlayerLocal to run individually and switch on the player's group.
  7. The documentation page for find (https://community.bistudio.com/wiki/find) says that it returns -1 if it is not found... But I tried the logic color = if (((roleDescription _x) find "B ") >= 0) then { "BLUE" } else { "RED" }; with no luck. Every squad member is still colored RED
  8. I am trying to assign different team colors using assignTeam, depending on their role description in a squad (Where a role description would look like 1'1A Team Lead, 1'1B Assistant Automatic Rifleman etc). This is what I have currently, I have tried to make this work for a couple hours with no luck. It looks like the "roleDescription" function doesn't return anything when called on the unit in the forEach. //preset fireteam group colours //id = ["RED", this] execVM "Teams.sqf"; sleep 10; private ["_type", "_unit"]; _type = _this select 0; _unit = _this select 1; Sleep 5; { color = if (((roleDescription _x) find "A ") > 0) then { "BLUE" } else { "RED" }; _x assignTeam color; } forEach units group _unit; I am calling it from the squad lead's init using ["RED", this] execVM "quickteams.sqf"; . The first param is unused as of now. The script currently just assigns everyone in the team to RED, which I interpret as it not finding "A " in any of the unit's role descriptions (even though I set them myself and can view them in the editor). I appreciate the help.
×