dekela 129 Report post Posted September 8, 2018 I'm trying to have players load in with the last stance they were in, so if they log out crouched, they will be crouched when next loading in. I have it partly working, as in it saves the stance to the data base, but it only sometimes applies the stance to the player when logging in. This is what i have done so far exile.ini Spoiler [loadPlayer] SQL1_1 = SELECT p.id, SQL1_2 = p.name, SQL1_3 = p.account_uid, SQL1_4 = p.damage, SQL1_5 = p.hunger, SQL1_6 = p.thirst, SQL1_7 = p.alcohol, SQL1_8 = p.oxygen_remaining, SQL1_9 = p.bleeding_remaining, SQL1_10 = p.hitpoints, SQL1_11 = p.direction, SQL1_12 = p.position_x, SQL1_13 = p.position_y, SQL1_14 = p.position_z, SQL1_15 = p.assigned_items, SQL1_16 = p.backpack, SQL1_17 = p.backpack_items, SQL1_18 = p.backpack_magazines, SQL1_19 = p.backpack_weapons, SQL1_20 = p.current_weapon, SQL1_21 = p.goggles, SQL1_22 = p.handgun_items, SQL1_23 = p.handgun_weapon, SQL1_24 = p.headgear, SQL1_25 = p.binocular, SQL1_26 = p.loaded_magazines, SQL1_27 = p.primary_weapon, SQL1_28 = p.primary_weapon_items, SQL1_29 = p.secondary_weapon, SQL1_30 = p.secondary_weapon_items, SQL1_31 = p.uniform, SQL1_32 = p.uniform_items, SQL1_33 = p.uniform_magazines, SQL1_34 = p.uniform_weapons, SQL1_35 = p.vest, SQL1_36 = p.vest_items, SQL1_37 = p.vest_magazines, SQL1_38 = p.vest_weapons, SQL1_39 = p.money, SQL1_40 = a.score, SQL1_41 = a.kills, SQL1_42 = a.deaths, SQL1_43 = c.id, SQL1_44 = c.name, SQL1_45 = p.temperature, SQL1_46 = p.wetness, SQL1_47 = a.locker,SQL1_48 = p.stance SQL1_49 = FROM player p SQL1_50 = INNER JOIN account a SQL1_51 = ON a.uid = p.account_uid SQL1_52 = LEFT JOIN clan c SQL1_53 = ON c.id = a.clan_id SQL1_54 = WHERE p.account_uid = ? Number of Inputs = 1 SQL1_INPUTS = 1 OUTPUT = 1,2-STRING,3-STRING,4,5,6,7,8,9,10,11,12,13,14,15,16-STRING,17,18,19,20-STRING,21-STRING,22,23-STRING,24-STRING,25-STRING,26,27-STRING,28,29-STRING,30,31-STRING,32,33,34,35-STRING,36,37,38,39,40,41,42,43,44-STRING,45,46,47,48-STRING [updatePlayer] SQL1_1 = UPDATE player SET SQL1_2 = name = ?, SQL1_3 = damage = ?, SQL1_4 = hunger = ?, SQL1_5 = thirst = ?, SQL1_6 = alcohol = ?, SQL1_7 = oxygen_remaining = ?, SQL1_8 = bleeding_remaining = ?, SQL1_9 = hitpoints = ?, SQL1_10 = direction = ?, SQL1_11 = position_x = ?, SQL1_12 = position_y = ?, SQL1_13 = position_z = ?, SQL1_14 = assigned_items = ?, SQL1_15 = backpack = ?, SQL1_16 = backpack_items = ?, SQL1_17 = backpack_magazines = ?, SQL1_18 = backpack_weapons = ?, SQL1_19 = current_weapon = ?, SQL1_20 = goggles = ?, SQL1_21 = handgun_items = ?, SQL1_22 = handgun_weapon = ?, SQL1_23 = headgear = ?, SQL1_24 = binocular = ?, SQL1_25 = loaded_magazines = ?, SQL1_26 = primary_weapon = ?, SQL1_27 = primary_weapon_items = ?, SQL1_28 = secondary_weapon = ?, SQL1_29 = secondary_weapon_items = ?, SQL1_30 = uniform = ?, SQL1_31 = uniform_items = ?, SQL1_32 = uniform_magazines = ?, SQL1_33 = uniform_weapons = ?, SQL1_34 = vest = ?, SQL1_35 = vest_items = ?, SQL1_36 = vest_magazines = ?, SQL1_37 = vest_weapons = ?, SQL1_38 = temperature = ?, SQL1_39 = wetness = ?,SQL1_40 = stance = ? SQL1_41 = WHERE id = ? Number Of Inputs = 40 SQL1_INPUTS = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40 ExileServer_object_player_database_update Spoiler /** * ExileServer_object_player_database_update * * Exile Mod * exile.majormittens.co.uk * © 2015 Exile Mod Team * * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. */ private["_player", "_playerID", "_playerPos", "_data", "_extDB2Message"]; _player = _this; _playerID = _player getVariable["ExileDatabaseID", -1]; _playerPos = getPosATL _player; _data = [ _player getVariable ["ExileName",""], damage _player, _player getVariable ["ExileHunger", 100], _player getVariable ["ExileThirst", 100], _player getVariable ["ExileAlcohol", 0], getOxygenRemaining _player, getBleedingRemaining _player, _player call ExileClient_util_player_getHitPointMap, getDir _player, _playerPos select 0, _playerPos select 1, _playerPos select 2, assignedItems _player, backpack _player, (getItemCargo backpackContainer _player) call ExileClient_util_cargo_getMap, (backpackContainer _player) call ExileClient_util_cargo_getMagazineMap, (getWeaponCargo backpackContainer _player) call ExileClient_util_cargo_getMap, currentWeapon _player, goggles _player, handgunItems _player, handgunWeapon _player, headgear _player, binocular _player, _player call ExileClient_util_inventory_getLoadedMagazinesMap, primaryWeapon _player, primaryWeaponItems _player, secondaryWeapon _player, secondaryWeaponItems _player, uniform _player, (getItemCargo uniformContainer _player) call ExileClient_util_cargo_getMap, (uniformContainer _player) call ExileClient_util_cargo_getMagazineMap, (getWeaponCargo uniformContainer _player) call ExileClient_util_cargo_getMap, vest _player, (getItemCargo vestContainer _player) call ExileClient_util_cargo_getMap, (vestContainer _player) call ExileClient_util_cargo_getMagazineMap, (getWeaponCargo vestContainer _player) call ExileClient_util_cargo_getMap, _player getVariable ["ExileTemperature", 0], _player getVariable ["ExileWetness", 0], stance _player, _playerID ]; _extDB2Message = ["updatePlayer", _data] call ExileServer_util_extDB2_createMessage; _extDB2Message call ExileServer_system_database_query_fireAndForget; true ExileServer_object_player_database_load Spoiler /** * ExileServer_object_player_database_load * * Exile Mod * exile.majormittens.co.uk * © 2015 Exile Mod Team * * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. */ private["_data", "_oldPlayerObject", "_playerUID", "_stance", "_sessionID", "_position", "_direction", "_player", "_clanID", "_clanName", "_clanData", "_clanGroup", "_devFriendlyMode", "_devs", "_headgear", "_goggles", "_binocular", "_primaryWeapon", "_handgunWeapon", "_secondaryWeapon", "_currentWeapon", "_uniform", "_vest", "_backpack", "_uniformContainer", "_vestContainer", "_backpackContainer", "_assignedItems"]; _data = _this select 0; _oldPlayerObject = _this select 1; _playerUID = _this select 2; _sessionID = _this select 3; _name = name _oldPlayerObject; _position = [_data select 11, _data select 12, _data select 13]; _direction = _data select 10; _stance = (_data select 47); _player = (createGroup independent) createUnit ["Exile_Unit_Player", _position, [], 0, "CAN_COLLIDE"]; _player setDir _direction; _player setPosATL _position; _player disableAI "FSM"; _player disableAI "MOVE"; _player disableAI "AUTOTARGET"; _player disableAI "TARGET"; _player disableAI "CHECKVISIBLE"; _clanID = (_data select 42); _clanName = (_data select 43); if !(stance _player isEqualTo _stance) then { if (_stance isEqualTo "PRONE") then { _player switchMove "amovppnemstpsraswrfldnon"; }; if (_stance isEqualTo "CROUCH") then { _player switchMove "amovpknlmstpsraswrfldnon"; }; }; if !((typeName _clanID) isEqualTo "SCALAR") then { _clanID = -1; _clanData = []; } else { _clanData = missionnamespace getVariable [format ["ExileServer_clan_%1",_clanID],[]]; if(isNull (_clanData select 5))then { _clanGroup = createGroup independent; _clanData set [5,_clanGroup]; _clanGroup setGroupIdGlobal [_clanData select 0]; missionNameSpace setVariable [format ["ExileServer_clan_%1",_clanID],_clanData]; } else { _clanGroup = (_clanData select 5); }; [_player] joinSilent _clanGroup; }; _player setDamage (_data select 3); _player setName _name; _player setVariable ["ExileMoney", (_data select 38), true]; _player setVariable ["ExileScore", (_data select 39)]; _player setVariable ["ExileKills", (_data select 40)]; _player setVariable ["ExileDeaths", (_data select 41)]; _player setVariable ["ExileClanID", _clanID]; _player setVariable ["ExileClanData", _clanData]; _player setVariable ["ExileName", _name]; _player setVariable ["ExileOwnerUID", _playerUID]; _player setVariable ["ExileDatabaseID", _data select 0]; _player setVariable ["ExileHunger", _data select 4]; _player setVariable ["ExileThirst", _data select 5]; _player setVariable ["ExileAlcohol", _data select 6]; _player setVariable ["ExileTemperature", _data select 44]; _player setVariable ["ExileWetness", _data select 45]; _player setVariable ["ExileIsBambi", false]; _player setVariable ["ExileXM8IsOnline", false, true]; _player setOxygenRemaining (_data select 7); _player setBleedingRemaining (_data select 8); _player setVariable ["ExileLocker", (_data select 46), true]; [_player, _data select 9] call ExileClient_util_player_applyHitPointMap; _devFriendlyMode = getNumber (configFile >> "CfgSettings" >> "ServerSettings" >> "devFriendyMode"); if (_devFriendlyMode isEqualTo 1) then { _devs = getArray (configFile >> "CfgSettings" >> "ServerSettings" >> "devs"); { if (_playerUID isEqualTo (_x select 0)) exitWith { if (_name isEqualTo (_x select 1)) then { _player setVariable ["ExileMoney", 500000, true]; _player setVariable ["ExileScore", 100000]; }; }; } forEach _devs; }; _player call ExileClient_util_playerCargo_clear; _headgear = _data select 23; if (_headgear != "") then { _player addHeadgear _headgear; }; _goggles = _data select 20; if (_goggles != "") then { _player addGoggles _goggles; }; _binocular = _data select 24; if (_binocular != "") then { _player addWeaponGlobal _binocular; }; _primaryWeapon = _data select 26; if (_primaryWeapon != "") then { _player addWeaponGlobal _primaryWeapon; removeAllPrimaryWeaponItems _player; { if (_x != "") then { _player addPrimaryWeaponItem _x; }; } forEach (_data select 27); }; _handgunWeapon = _data select 22; if (_handgunWeapon != "") then { _player addWeaponGlobal _handgunWeapon; removeAllHandgunItems _player; { if (_x != "") then { _player addHandgunItem _x; }; } forEach (_data select 21); }; _secondaryWeapon = _data select 28; if (_secondaryWeapon != "") then { _player addWeaponGlobal _secondaryWeapon; { if (_x != "") then { _player addSecondaryWeaponItem _x; }; } forEach (_data select 29); }; _currentWeapon = _data select 19; if (_currentWeapon != "") then { _player selectWeapon _currentWeapon; }; { _player addWeaponItem [_x select 0, [_x select 1, _x select 2, _x select 3]]; } forEach (_data select 25); _uniform = _data select 30; _vest = _data select 34; _backpack = _data select 15; if (_uniform != "") then { _player forceAddUniform _uniform; }; if (_vest != "") then { _player addVest _vest; }; if (_backpack != "") then { _player addBackpackGlobal _backpack; }; _uniformContainer = uniformContainer _player; if !(isNil "_uniformContainer") then { { _uniformContainer addWeaponCargoGlobal _x; } forEach (_data select 33); { _uniformContainer addMagazineAmmoCargo [_x select 0, 1, _x select 1]; } forEach (_data select 32); { _uniformContainer addItemCargoGlobal _x; } forEach (_data select 31); }; _vestContainer = vestContainer _player; if !(isNil "_vestContainer") then { { _vestContainer addWeaponCargoGlobal _x; } forEach (_data select 37); { _vestContainer addMagazineAmmoCargo [_x select 0, 1, _x select 1]; } forEach (_data select 36); { _vestContainer addItemCargoGlobal _x; } forEach (_data select 35); }; _backpackContainer = backpackContainer _player; if !(isNil "_backpackContainer") then { { _backpackContainer addWeaponCargoGlobal _x; } forEach (_data select 18); { _backpackContainer addMagazineAmmoCargo [_x select 0, 1, _x select 1]; } forEach (_data select 17); { _backpackContainer addItemCargoGlobal _x; } forEach (_data select 16); }; _assignedItems = _data select 14; if !(_assignedItems isEqualTo []) then { { _player linkItem _x; } forEach _assignedItems; }; _player addMPEventHandler ["MPKilled", {_this call ExileServer_object_player_event_onMpKilled}]; if (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "thermalVision") isEqualTo 0) then { _player addEventHandler ["WeaponAssembled", {(_this select 1) disableTIEquipment true;}]; }; if (getNumber(missionConfigFile >> "CfgSimulation" >> "enableDynamicSimulation") isEqualTo 1) then { if ((canTriggerDynamicSimulation _player) isEqualTo false) then { _player triggerDynamicSimulation true; _player enableDynamicSimulation true; }; }; [ _sessionID, "loadPlayerResponse", [ (netId _player), str (_player getVariable ["ExileScore", 0]), (_player getVariable ["ExileKills", 0]), (_player getVariable ["ExileDeaths", 0]), (_player getVariable ["ExileHunger", 100]), (_player getVariable ["ExileThirst", 100]), (_player getVariable ["ExileAlcohol", 0]), (_player getVariable ["ExileClanData", []]), (_player getVariable ["ExileTemperature", 0]), (_player getVariable ["ExileWetness", 0]) ] ] call ExileServer_system_network_send_to; [_sessionID, _player] call ExileServer_system_session_update; true Can anyone see what I am missing, or if there is another file that needs to be altered. Thanks Share this post Link to post Share on other sites
Z80CPU 527 Report post Posted September 13, 2018 Hello again @dekela, What I will do is to use 'generic' commands and 'program logic' to illustrate what may work for you. I will allow you to 'convert' these into SQF. DB loads stance dbstance = loaded db stance stancecount = 0 :SetStance set stance wait 5 (seconds) cs = current stance if cs = dbstance goto ExitLoop stancecount = stancecount +1 if stancecount > 6 then hint "Unable To Set Stance!": goto ExitLoop (6 = 30 seconds) goto SetStance :ExitLoop ... ... ... What this will do is to load the stance, then try to set it. It will then wait 5 seconds and check. If set, exit. If not, try again. This will set/check for a total of 6 times before it 'gives up' and exits out. 6 seconds would equal 30 seconds which I feel is not 'too long', but that would be up to you. I noticed that at times, the loading of the player can 'lag', other times it does not. The above will (or should) overcome this 'thing'. Now, you MAY have to insert this code in some other piece of code such as displaying the status bar (if you use one). It's not 'pretty', but it WOULD work. I can do this in SQS with no issue, it would be 'work' for me in SQF as I am not an expert in it. Good luck! Share this post Link to post Share on other sites
dekela 129 Report post Posted September 13, 2018 Thanks @Z80CPU I'll look into it. I was thinking of just writing a separate script for this, but figured database_load would work but typical arma Share this post Link to post Share on other sites
Z80CPU 527 Report post Posted September 13, 2018 You're more than welcome! Good luck with it! Share this post Link to post Share on other sites
Beowulfv 305 Report post Posted September 14, 2018 Does Bohemia connect stances with number values or classes? Just curious, I know of the animation classes, but are they the same as crouch prone stand and the rest? Share this post Link to post Share on other sites
dekela 129 Report post Posted September 14, 2018 When using stance player it save as a string to the database as CROUCH, PRONE etc. You can't use setunitpos on player so need to make them play an animation instead Share this post Link to post Share on other sites