yokai134
Member-
Content Count
5 -
Joined
-
Last visited
-
Medals
Community Reputation
10 GoodAbout yokai134
-
Rank
Rookie
-
yokai134 started following Join in progress help or example and [JIP] Help, script not behaving as expected
-
[JIP] Help, script not behaving as expected
yokai134 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello, I have been able to work on a basic JIP script to better understand how JIP works and getting it to work correctly if a player joins after the start. All the script does now is when a player joins, it strips their gear then moves them to an object's location after 15 seconds. Simple enough. If they respawn, it starts over. That works, I can spam respawn that same unit and everything executes correctly. The server then should clean up all WEST units that are not within 20m of the spawn point if they are not active players (aka player disconnect). However, the problem I am having is when I switch slots in to the lobby to test if someone leaves / joins then I will spawn where I left as that unit or if I switch slots then the old unit is there and alive and I spawn next to them without having to wait 15 seconds. It doesn't clean up the previous unit or two until I switch another time but I still spawn with those previous units instead of spawning at the respawn point then being moved to that area. So I'm at a loss of why its not behaving as intended. The are no errors thrown in the RPT other than the body not being there for respawn. Any help in getting a proper behaving JIP script would be great. I have tried looking online and there is no clear examples for JIP missions. Trying to use existing missions doesn't work since everyone serializes/obfuscates them. Not looking for someone to write me the code but more of trying to figure out why this is not behaving as I wanted described above. Thanks. Below is the code I am using. init.sqf enableSaving [false,false]; setViewDistance 500; if(isServer) then { call compile preprocessfile "functions.sqf"; onPlayerDisconnected {[] spawn FNC_RemoveUnit}; }; initPlayerLocal.sqf call compile preprocessfile "functions.sqf"; [player,false] spawn FNC_SetupPlayer; functions.sqf FNC_RemoveUnit = { diag_log format["[DEBUG] A player has left the game or left to the lobby! Cleaning up unused bodies..."]; { if(side _x == WEST && (_x distance (getMarkerPos "respawn_west")) > 20) then { diag_log format["[DEBUG] Found unused body... Removing..."]; _x setDamage 1; sleep 1; deleteVehicle _x; }; }forEach allUnits; }; FNC_SetupPlayer = { private ["_unit"]; _unit = _this select 0; _unit allowDamage false; _unit removeAllEventHandlers "killed"; _unit removeAllEventHandlers "respawn"; _unit setPos (getMarkerPos "respawn_west"); waitUntil {player == player && (_unit distance (getMarkerPos "respawn_west")) < 20}; waitUntil {local player && !isNull player}; [_unit] call FNC_RemoveGear; _unit addEventHandler ["respawn",{[_this select 0] spawn FNC_PlayerRespawned}]; _unit addEventHandler ["killed",{[_this select 0] spawn FNC_PlayerKilled}]; sleep 15; _unit allowDamage true; _unit setPos (getPos neochori_ao); if(isNil{_unit getVariable "uid"}) then { _unit setVariable ["uid",(getPlayerUID _unit),true]; }; }; FNC_RemoveGear = { private ["_unit"]; _unit = _this select 0; removeAllContainers _unit; removeAllWeapons _unit; removeAllAssignedItems _unit; removeHeadgear _unit; removeGoggles _unit; }; FNC_PlayerKilled = { private ["_unit"]; _unit = _this select 0; [_unit] spawn { _u = _this select 0; sleep 10; deleteVehicle _u; }; }; FNC_PlayerRespawned = { private ["_unit"]; _unit = _this select 0; [_unit] call FNC_SetupPlayer; }; description.ext showCompass = 1; showGPS = 1; showWatch = 1; disabledAI = 0; respawn = "BASE"; respawnDelay = 5; -
Join in progress help or example
yokai134 replied to yokai134's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Init.sqf if(isServer) then { diag_log "[DEBUG] Starting Mission Server Init"; [] execVM "Server\init.sqf"; }; true spawn { if(!isDedicated) then { titleText ["Please wait for your player to setup", "BLACK", 0]; waitUntil {player == player}; client_initEH = player addEventHandler ["Respawn", {removeAllWeapons (_this select 0);}]; }; }; if(!isDedicated) then { waitUntil {player == player}; _ownedDLCs = getDLCs 1; //if(332350 in _ownedDLCs) then { hasMarksmanDLC = true;}; [] execVM "Client\init.sqf"; }; Client's Init.sqf playerCompiledScripts = false; playerSetupComplete = false; player call compile preprocessFileLineNumbers "Client\PlayerVariables.sqf"; player call compile preprocessFileLineNumbers "Client\PlayerVariableFunctions.sqf"; player call compile preprocessFileLineNumbers "Client\clientCompile.sqf"; waitUntil{playerCompiledScripts}; 0 = ["player","ai","allsides"] execVM "Client\player_markers.sqf"; waitUntil {player == player && !isNil{PlayArea}}; waitUntil {time > 2}; player call playerSetup; waitUntil {playerSetupComplete}; if(!isNil "client_initEH") then {player removeEventHandler ["Respawn", client_initEH];}; player addEventHandler ["Respawn", {[_this] call playerRespawn;}]; player addEventHandler ["Killed", {[_this select 0,_this select 1] call playerKilled;}]; [] execVM "Client\playerHUD.sqf"; PlayerVariableFunctions.sqf // Just one example of PV "PlayArea" addPublicVariableEventHandler { private ["_arr","_pt","_rad"]; _arr = _this select 1; _pt = _arr select 0; _rad = _arr select 1; CenterPoint = _pt; CenterRadius = _rad; } Server Init.sqf call compile preProcessFile "server\functions.sqf"; call compile preProcessFile "server\ai_Functions.sqf"; call compile preProcessFile "server\unitFunctions.sqf"; call compile preProcessFile "server\privateVariables.sqf"; call compile preProcessFile "server\publicVariables.sqf"; call compile preProcessFile "server\publicVariableEventHandlers.sqf"; PlayArea = [Paros,1000]; diag_log "[DEBUG] Broadcasting play area to clients"; publicVariable "PlayArea"; // Rest of setup down here There's some code. I used PV to announce where the mission will be taking place to the client. However if a new client joins later, they don't get the PlayArea variable passed to them even though they have null/nil values set initially. I am not sure if its due to nothing being called OnPlayerConnected perhaps or the client side variable isnt initialized before the server sends it? I can add more of my code I use, but I didn't want to make too long of a reply nor add non-relevant code. -
Hello, I have been trying to create a mission that allows players to join at the start of the mission or the end. I attempted to write a JIP function that when a client joined, the server would send the client the requested variables, but have been unsuccessful in my attempts. I also tried to find examples but many are out of date, for Arma 2 or URLs from forums/sites to others' forums/sites are dead and not leading me anywhere. I was wondering if anyone knew of a tutorial or could help me figure out how to do / handle JIP players. I'm not looking at doing a lot just when a player joins the server at the start or during the mission, the server sends the client needed variables for the mission and best ways of sending variables to/from server/client. I've read that using publicVariable was bad and to use BIS_FNC_MP and vice versa. So any help or direction would be greatly appreciated as the documentation for the Arma scripting language is not all there or is a bit lacking in examples. Thanks
-
@Johny or any other Developer So odd question as I've been reading this. If a server owner allows donations/purchases to get weapons/vehicles/exp/in-game(server) money faster or such but does not limit those items to just donators/purchasers then is that allowed because they're (those who don't donate/purchase) not blocked from using it but those who do get something in return. If that doesn't make sense just think of P2W MMOs and such where you can unlock item A in 10 hours of grinding or buy a booster and unlock item A in say 30 minutes or buy item A and get it instantly. I dont run a server or anything but these discussions just have me wondering since I really didn't clearly see this brought up
- 297 replies
-
- arma
- monetization
-
(and 1 more)
Tagged with:
-
I have been currently working on a mission in the 2D editor and been having some problems with a script and positions. On the map in the editor I have multiple logic units (logic locations) grouped to a central unit (logic cities/depots/airports). In one of my scripts I have it create units at each of the units' positions. The problem is it either wont create them or wont place them where the currently selected unit in the group is. For instance from the SQM I have a logic location position[]={8896.167,265.38239,5263.6489}; However when I run the mission and have a hint tell me the position it will report the X is 9021 and the Y is 5350 (vertically its still 0) and not what they should be from their exact position when they're placed such as the position above. If I create the same mission in the 3D editor it will create the units correctly at the correct location but the 3D editor will sometimes run my scripts multiple times when called only once and I dont have really any additional buildings and such hence using the 2D editor. Nothing in any script moves any objects from its spawn nor do any of the units have placement radius greater than 0. I am unsure of why this is happening and tried to search for anything related to it but to no avail (hence the newly created account as my last resort for finding the solution to this problem). If there is a solution to this please point me in the right direction. If any one can explain why this is happening I would be very grateful and if more info is needed please let me know.