Jump to content

Luft08

Member
  • Content Count

    197
  • Joined

  • Last visited

  • Medals

Everything posted by Luft08

  1. I created a mission some time ago that uses the Global Mobilization DLC and the CBA_A3 mod. I have not run the mission for a long time and now when I start it I get error messages: Bad Vehicle Type Virtual AI Squad and mpmissions\__CUR_MP.gm_weferlingen_summer\mission.sqm/Mission/Entities/Item65.type:Vehicle class VirtualAISquad no longer exists I searched mission.sqm and found two references to VirtualAISquad. They refer to light emitters. I don't see the emitters in the Eden editor and when I comment out the offending classes and try to start the mission Arma 3 crashes. I don't know how to proceed.
  2. I wish to display card-like messages while in-game. A header, picture and text below then buttons. Is this possible? I'm trying to create a scenario that is more board game like. The players will get random cards that can add items or abilities if the card is used. I would like it to have a header on top then a nice picture with text below that and finally buttons that will allow them to use or save the card. Thanks.
  3. I want to execute a function after units reach their given waypoint but the function takes an argument. I wanted to use setWaypointStatements but the argument is in a private variable and it is not possible to place the argument into a global variable because the function gets executed by many AI units that require the argument have different values. Is there any way to do this?
  4. I can't seem to get a handle on locality. I understand it, I just can't seem to not get smacked in the face by it. The other day Harzach helped me identify my locality problem and I though I was being so careful but I once again have code that runs fine in single player but not on my dedicated server. When a player destroys an enemy vehicle I want to award that player points based on the vehicle type and send a hint message to only that player. When I create the vehicle I attach an event handler to it (from code that only runs on the server). LFT_MilitaryTraffic: if(!isServer) exitWith {}; // Delete dead vehicles for "_c" from 0 to ((count militaryVehicleArray) - 1) do { private _veh = militaryVehicleArray # _c; if(!alive _veh) then { militaryVehicleArray deleteAt _c; }; }; while {(count militaryVehicleArray) < MAX_VEHICLES } do { // Get Vehicle Type private _vehicleType = selectRandom vehicleTypeArray; // Get Random road positions for start private _posStart = [0,0]; private _startSeg = [] call LFT_GetRandomRoadSeg; _posStart = getPos _startSeg; // Spawn Vehicle. private _roadDir = [_startSeg] call LFT_GetRoadDirection; private _vehArray = [_posStart, _roadDir, _vehicleType, east] call BIS_fnc_spawnVehicle; private _vehObject = _vehArray # 0; private _group = _vehArray # 2; _group deleteGroupWhenEmpty true; _vehObject addEventHandler["Killed", { params ["_unit", "_killer", "_instigator", "_useEffects"]; [_unit, _killer] remoteExecCall ["LFT_AwardKillPoints"]; }]; if(_vehicleType == "O_Truck_02_Ammo_F") then { _vehObject addEventHandler["Killed", { params ["_unit", "_killer", "_instigator", "_useEffects"]; for "_c" from 1 to 10 do { private _bomb = "Bo_GBU12_LGB" createVehicle (getPos _unit); _bomb setDamage 1; }; }]; }; militaryVehicleArray pushBack _vehObject; // Send Vehicle // _group = _vehArray # 2; [_group] call LFT_SetWaypoint; }; I assume that the event handler will run on the server so I remoteExecCall a function (LFT_AwardKillPoints) that has been compiled and placed into a variable. The variable has been declared a public variable: initServer: if(!isServer) exitWith {}; private _year = 2035; private _month = 7; private _day = 19; private _hour = 12; private _min = floor random 60; setDate [_year, _month, _day, _hour, _min]; private _handle = [] execVM "scripts\initVariables.sqf"; waitUntil {scriptDone _handle}; LFT_RaptorMaintenance = compileFinal preprocessfilelinenumbers "scripts\LFT_RaptorMaintenance.sqf"; LFT_VehicleMaintenance = compileFinal preprocessfilelinenumbers "scripts\LFT_VehicleMaintenance.sqf"; LFT_MilitaryTraffic = compileFinal preprocessfilelinenumbers "scripts\LFT_MilitaryTraffic.sqf"; LFT_GetRandomRoadSeg = compileFinal preprocessfilelinenumbers "scripts\LFT_GetRandomRoadSeg.sqf"; LFT_SetWaypoint = compileFinal preprocessfilelinenumbers "scripts\LFT_SetWaypoint.sqf"; LFT_GetRoadDirection = compileFinal preprocessfilelinenumbers "scripts\LFT_GetRoadDirection.sqf"; LFT_AwardKillPoints = compileFinal preprocessfilelinenumbers "scripts\LFT_AwardKillPoints.sqf"; LFT_InitBuildingManagement = compileFinal preprocessfilelinenumbers "scripts\LFT_InitBuildingManagement.sqf"; publicVariable "LFT_RaptorMaintenance"; publicVariable "LFT_VehicleMaintenance"; publicVariable "LFT_MilitaryTraffic"; publicVariable "LFT_GetRandomRoadSeg"; publicVariable "LFT_SetWaypoint"; publicVariable "LFT_GetRoadDirection"; publicVariable "LFT_awardKillPoints"; addMissionEventHandler ["entityRespawned",{ params ["_unit"]; call { if (side _unit isEqualTo WEST) exitWith {_unit setpos getpos respawn_west_1}; }; }]; [] spawn LFT_MilitaryTraffic; serverReady = true; publicVariable "serverReady"; LFT_AwardKillPoints: params ["_unit", "_killer"]; if(player isEqualTo _killer) then { { private _unitType = _x # 0; private _unitTypeText = _x # 1; private _unitTypeScore = _x # 2; if(_unitType isEqualTo (TypeOf _unit)) exitWith { hint format ["You have destroyed a %1. +%2 Points!", _unitTypeText, _unitTypeScore]; // TODO - add _unitTypeScore to players total score. }; } forEach scoreTable; }; The function uses an array called scoreTable that has also been made public: initVariables.sqf: if(!isServer) exitWith {}; MAX_VEHICLES = 150; player_1_Score = 0; player_2_Score = 0; player_3_Score = 0; player_4_Score = 0; vehicleTypeArray = [ "O_APC_Wheeled_02_rcws_v2_F", "O_MRAP_02_F", "O_MRAP_02_hmg_F", "O_LSV_02_AT_F", "O_LSV_02_armed_F", "O_LSV_02_unarmed_F", "O_Truck_03_device_F", "O_Truck_03_ammo_F", "O_Truck_03_fuel_F", "O_Truck_03_medical_F", "O_Truck_03_repair_F", "O_Truck_03_transport_F", "O_Truck_03_covered_F", "O_Truck_02_Ammo_F", "O_Truck_02_fuel_F", "O_Truck_02_medical_F", "O_Truck_02_box_F", "O_Truck_02_transport_F", "O_Truck_02_covered_F" ]; scoreTable = [ ["O_APC_Wheeled_02_rcws_v2_F","Unarmed Ifrit",10], ["O_MRAP_02_F","Ifrit GMG",30], ["O_MRAP_02_hmg_F","Ifrit HMG",30], ["O_LSV_02_AT_F","Qilin (AT)",20], ["O_LSV_02_armed_F","Qilin (Mini-Gun)",20], ["O_LSV_02_unarmed_F", "Qilin (Unarmed)", 5], ["O_Truck_03_device_F","Tempest (Device)",10], ["O_Truck_03_ammo_F","Tempest (Ammo)",25], ["O_Truck_03_fuel_F","Tempest (Fuel)",25], ["O_Truck_03_medical_F","Tempest (Medical)",10], ["O_Truck_03_repair_F","Tempest (Repair)",25], ["O_Truck_03_transport_F","Tempest (Transport)",30], ["O_Truck_03_covered_F","Tempest (Covered Transport)",30], ["O_Truck_02_Ammo_F","Zamak Ammo",25], ["O_Truck_02_fuel_F","Zamak Fuel",25], ["O_Truck_02_medical_F","Zamak Medical",10], ["O_Truck_02_box_F","Zamak Repair",25], ["O_Truck_02_transport_F","Zamak Transport",30], ["O_Truck_02_covered_F","Zamak Transport (Covered)",30] ]; publicVariable "scoreTable"; mainIsland = [[9803.08,9978.81], 5000]; cityArray = [ ["GeorgeTown",[6093.99,10023.6],1000], ["BluePerl",[13436.6,11933.5],800], ["Kotomo",[10786.3,6455.53],400], ["Tanouka",[9029.22,10021.6],500] ]; militaryVehicleArray = []; Again, It works when I run it from my PC but not on a dedicated server. Any ideas? Thanks.
  5. Never mind... I just tested it out on the server after my long post and it is working. 🤪
  6. I made a super simple mission that has four helicopters named raptor_1, raptor_2, raptor_3 and raptor_4. I populated the main Tanoa island with opfor vehicles and have them running around. The players each take a helicopter and try to destroy as many vehicles as they can then come back and land on a pad to get rearmed, refueled and repaired. Everything works in single player mode but when I put the mission on a dedicated server the rearming, refueling and repair process does not work. The helopads each have a trigger: Type:None, Activation: Blufor, Activation Type: present. The condition field has: (raptor_1 in thisList || raptor_2 in thisList || raptor_3 in thisList || raptor_4 in thisList); The on Activation field has: [thisTrigger] remoteExecCall ["LFT_RaptorMaintenance"]; // Note I tried [thisTrigger] call LFT_RaptorMaintenance; but it didn't work either. The LFT_RaptorMaintenance function: params ["_trigger"]; if(raptor_1 inArea _trigger) then {[raptor_1] call LFT_VehicleMaintenance;}; if(raptor_2 inArea _trigger) then { [raptor_2] call LFT_VehicleMaintenance;}; if(raptor_3 inArea _trigger) then { [raptor_3] call LFT_VehicleMaintenance;}; if(raptor_4 inArea _trigger) then { [raptor_4] call LFT_VehicleMaintenance;}; The LFT_VehicleMaintenance function: params ["_vehicle"]; _vehicle setVehicleAmmo 1; _vehicle setFuel 1; _vehicle setDamage 0; How do I make this work on a dedicated server. As I said, it does work in single player. Thanks
  7. Each function is in it's own sqf file and I compile the files from the initServer.sqf file: if(!isServer) exitWith {}; private _year = 2035; private _month = 7; private _day = 19; private _hour = 6 + floor random 10; private _min = floor random 60; setDate [_year, _month, _day, _hour, _min]; private _handle = [] execVM "scripts\initVariables.sqf"; waitUntil {scriptDone _handle}; LFT_RaptorMaintenance = compileFinal preprocessfilelinenumbers "scripts\LFT_RaptorMaintenance.sqf"; LFT_VehicleMaintenance = compileFinal preprocessfilelinenumbers "scripts\LFT_VehicleMaintenance.sqf"; LFT_MilitaryTraffic = compileFinal preprocessfilelinenumbers "scripts\LFT_MilitaryTraffic.sqf"; LFT_GetRandomRoadSeg = compileFinal preprocessfilelinenumbers "scripts\LFT_GetRandomRoadSeg.sqf"; LFT_SetWaypoint = compileFinal preprocessfilelinenumbers "scripts\LFT_SetWaypoint.sqf"; LFT_GetRoadDirection = compileFinal preprocessfilelinenumbers "scripts\LFT_GetRoadDirection.sqf"; [] call LFT_MilitaryTraffic; serverReady = true; publicVariable "serverReady";
  8. Nope, but maybe I need to put in a few more logging statements to see what's happening on the client side.
  9. I placed diag_Log messages at the beginning of each function. Everything is being called so I assume that the code in the LFT_VehicleMaintenance function is failing when run on a dedicated server. params ["_vehicle"] _vehicle setVehicleAmmo 1; _vehicle setFuel 1; _vehicle setDamage 0;
  10. Thanks rowdied, I'll look over the code but what I really want is to understand why my code fails on the server.
  11. Good idea. Because it is running on the server I'll have to put in some logging messages to determine that.
  12. I wish to light the inside of a building during a night mission. (on a dedicated server) I found a post that seems like a solution but the light only works when the script runs locally so I put a call to the script in the initPlayerLocal.sqf file but that didn't help. In my initPlayerLocal method I have: [BaseLight_1, 0.5, 5.4] call LFT_LightSource; [BaseLight_2, 0.5, 1.8] call LFT_LightSource; BaseLight_1 and BaseLight_2 are logic objects. LFT_LightSource: /* NOTE: Runs locally. */ params["_light", "_intensity", "_height"]; _light setPosATL[(getPosATL _light select 0), (getPosATL _light select 1), _height]; BIS_lightEmitor01 = "#lightpoint" createVehicleLocal getPosATL _light; BIS_lightEmitor01 setLightColor [1, 1, 1]; BIS_lightEmitor01 setLightBrightness _intensity; BIS_lightEmitor01 setLightAmbient [1,1,1]; BIS_lightEmitor01 lightAttachObject [_light, [0, 0, 0.1]]; The code works perfectly when I run the mission from my PC.
  13. Luft08

    Lighting Problem

    In the initServer.sqf file I call a method that compiles several functions including the LFT_LightSource function. In the initServer.sqf file: _handle = [] execVM "scripts\common\compileMethods.sqf"; waitUntil {scriptDone _handle}; In the scripts\common\compileMethods.sqf file: if(!isServer) exitWith {}; inView = compileFinal preprocessfilelinenumbers "LFT_Common\inView.sqf"; isPrimaryAmmoLow = compileFinal preprocessfilelinenumbers "LFT_Common\isPrimaryAmmoLow.sqf"; LFT_Attack_Ground_Troops = compileFinal preprocessfilelinenumbers "LFT_Common\LFT_Attack_Ground_Troops.sqf"; LFT_LightSource = compileFinal preprocessfilelinenumbers "LFT_Common\LFT_LightSource.sqf";
  14. Luft08

    Lighting Problem

    I guess I don't understand what you mean when you say I don't need to broadcast the creation of a lightPoint. My code doesn't do that. The call to the LFT_LightSource function is placed in the initPlayerLocal.sqf file that gets run locally on every player's PC at the start of the mission so it should work but it doesn't. Very frustrating. I'll see if I can get your remoteExec way of doing it to work. Thanks for the help.
  15. Luft08

    Lighting Problem

    Yep, lightpoints and all commands are local. No joy.
  16. Luft08

    Lighting Problem

    Yes, I realize that createVehicleLocal is local. But I believe that creating a lightpoint must be done at the local level which is why I put the call into the initPlayerLocal.sqf file which is run locally. I'll try createVehicle but I don't have confidence that it will work. Thanks for you reply.
  17. I have a mission where opfor has taken control of a town. I have various weapon caches scattered throughout the town. When an AI unit gets low on ammo I want to set a waypoint to the nearest cache and when he arrives fill up his ammo. The problem is that I don't know how to test to see if he is low on ammo. (Not completely out, just low). Is there a function or event handler that can help me do this? Thanks.
  18. The wiki says that an endDestination of "0" will make the stalker return to original group waypoints after the endCondistion becomes true. Does anyone know if the waypointStatements are restored?
  19. Thanks, I'll do more testing. Just thinking here... Maybe I need to check to see if the AI is within 5 m or so of the cache and then attach him to the supply crate somehow? That would probably stop any animation but maybe I could detach him without moving him. I'll play around with it. It may not even be possible.
  20. I could do that with a vectorAdd. Would that make the AI come closer?
  21. Thanks, I went with: if(!isServer) exitWith {}; { private _index = soldiersResuppling find _x; if(_index == -1) then { if(alive _x) then { private _result = [_x] call isPrimaryAmmoLow; if(_result) then { // soldier has low ammo. soldiersResuppling pushBack _x; [_x] call goForAmmo; }; }; }; } forEach troopArray; isPrimaryAmmoLow: if(!isServer) exitWith {}; params["_AIUnit"]; private _primaryAmmoLow = false; private _allMags = magazines _AIUnit; private _consolidatedWepArray = _allMags call BIS_fnc_consolidateArray; private _wepMagTypeArray = primaryWeaponMagazine _AIUnit; private _wepMagType = _wepMagTypeArray # 0; private _magCount = 0; { private _magType = _x # 0; if(_magType == _wepMagType) exitWith { _magCount = _x # 1};; } forEach _consolidatedWepArray; // Should always be only 1 entry for primary weapon? Maybe better not to use forEach? if (_magCount == 0) then {_primaryAmmoLow = true;}; // Does not count the mag that is loaded. _primaryAmmoLow
  22. I guess "overuse" is subjective. The mission that I would like to release soon randomizes aspects that requires data from all buildings etc. So I spawn the function that does that as it's not critical that it complete prior to other things running.
  23. I'm writing some generic code and as one of the parameters I wish to pass in a function name to be called. Is it possible to put a function name into a string variable, pass that variable and then call that function? So for example let's say I wish to spawn civilians and then assign those civilians actions. I don't want my framework to have to define every conceivable action that the programmer may wish to implement so I wish to have the programmer write the action function him/her self and pass it in. My code would then spawn the civilian and pass it to the programmer's function to assign whatever action he/she has decided to implement. Never mind. It appears I can just do it. who would have thought it would be this easy? 🙂
×