Jump to content

anaximandross

Member
  • Content Count

    80
  • Joined

  • Last visited

  • Medals

Everything posted by anaximandross

  1. I'm working on writing a script that assembles objects using the bohemia object mapper function. This function is called from multiple objects that are spawned in by another script. I'm using _this select 0, but its returning this: [228ae7e56080# 620815: vergepost_01_f.p3d,bis_o2_4896,0,<null>] Here is the script: And this is the addAction that is calling the above:
  2. @pierremgi I've been working on this script for about two weeks now, and you've just helped me get the final touches on it! Thank you so much!!!!
  3. I actually just fixed my first problem, and I THINK you just fixed my second one as soon as I got that! Let me try this out, and i will report back in a few minutes.
  4. anaximandross

    Type object expected array

    Oh my gosh, I never even read that section. Thank you for the help! I should be able to figure that out now. Thank you so much! 🤦‍♂️
  5. anaximandross

    Type object expected array

    @Schatten so how do I get the position of the object that is calling the script? I finally realize that's where my issue lies haha
  6. anaximandross

    Type object expected array

    Hmm, let me retest it and see what I get. How do I fix the error that you got though? Also, what is that test snippet for? EDIT: When I changed it to (_this select 2) params ["....]; it threw the same error as yours did.
  7. anaximandross

    Type object expected array

    @Schatten Sure! Here it is.
  8. anaximandross

    Type object expected array

    There isn't one. I think I was having some sort of issue with locality, so I set _storPost = getPos _facilityPosition. but I changed it to _this to see if that would work. When I added that line, it threw this error:
  9. anaximandross

    Type object expected array

    Oh ok, that makes sense! Thanks! So, that first script works just fine now. Do you have any ideas on how to pass the locations to the second script, the assembler? Right now its throwing this error:
  10. anaximandross

    Type object expected array

    what does that do, and why does it work? I have that in another script, and it works perfectly but I don't understand it!
  11. I've got a script running pretty well, except for the very end of it. I'm passing an array, _markerLocationArray into the end of this function, and when I go to get the positions of each of the markers in the array, I get an error stating that a string is being returned instead of a position. To be specific, its the last ten lines or so that are throwing the error. The line_position = getMarkerPos _x is the error line. Thanks in advance! if(!isServer) exitWith{}; //params ["_marker", "_foodCost"]; if(!isServer) exitWith{}; //add a new parameter for array of markers being passed into createBasePlots (_this select 3) params ["_marker","_foodCost","_markerLocationArray"]; base_num = (_this select 3) select 2; _markerLocationArray = (_this select 3) select 3; //Counts number of enemies around the desired marker _units = []; {if (side _x == east && {_marker distance2D _x < 100}) then {_units pushBack _x};} forEach allUnits; _cnt = count _units; sleep 0.5; _globalFood = GLOBALFOOD; //checks to see if the area around the base is clear if(_cnt > 0) then { hint "Clear the area to claim this base!" } //if the area is clear, this allows the player to claim the base else{ if(_globalFood > _foodCost) then { _markPos = getMarkerPos "base_4"; //calculates the amount of food remaining in food stores _foodremaining = _globalfood - _foodCost; GLOBALFOOD = _foodremaining; publicVariable "GLOBALFOOD"; //hint format["You have %1 food remaining!",_foodremaining]; //determines the current base number to be used for other things CURRENTBASENUMBER = base_num; publicVariable "CURRENTBASENUMBER"; //creates a marker at the current base. This is used for AI targetting deleteMarker "CurrentBase"; deleteMarker "base_4"; _currentBaseMarker = createMarker["CurrentBase", _markPos]; "CurrentBase" setMarkerColor "ColorBlue"; "CurrentBase" setMarkerText "Home Base"; "CurrentBase" setMarkerType "mil_circle"; //call function to create all marker plots at the new base //0 = ["_markerLocationArray"] execVM "BaseFunctions\CreateBasePlots.sqf"; _cont = count _markerLocationArray; hint format ["Count %1",_cont]; { //gets position of current array value _position = getMarkerPos _x; //builds yellow square on current array position _veh = "VR_Area_01_4x4_yellow_F" createVehicle _position; //Adds 4 actions to each item to allow various things to be built _veh addAction ["Build a Small Farm", "Compositions\assembler.sqf",[_position, "foodS"]]; _veh addAction ["Build a Large Farm", "Compositions\assembler.sqf",[_position, "foodL"]]; _veh addAction ["Build a Small Workshop", "Compositions\assembler.sqf",[_position, "workshopS"]]; _veh addAction ["Build a Large Workshop", "Compositions\assembler.sqf",[_position, "workshopL"]]; _veh addAction ["Build a Storage Facility", "Compositions\assembler.sqf",[_position, "storage"]]; } forEach _markerLocationArray; } };
  12. Ok! So i've cleaned up that first segment of code, I think it was added in for debugging, but it works fine (at least that part of it). I've checked that all of my params are being passed correctly, and they are. The last issue I'm getting is that my array is not the correct type. Here is my code: The only issue I'm getting now is on the final portion of the script. It's not throwing any errors, and I've got it building the VR squares, the only issue I'm having now is coming up with a solution to passing the position into the assembler function, but I'm sure I can figure that out!
  13. I actually got some help with that part here on the forums (its on my last post). The _MarkerArrayList is being passed as the 4th param from the script caller, but it wasn't taking the right inputs. To be honest, I really, really struggled with this part of the script, and I don't know how to make it work properly. This is my first major project that I've undertaken. I don't have access to my .rpt at the moment, but I will post it later.
  14. anaximandross

    Local Variable in Global Space

    Houston, we have liftoff! That finally worked! Thank you so much! You've been a huge help!
  15. anaximandross

    Local Variable in Global Space

    Just fixed that and it didn't fix it.
  16. anaximandross

    Local Variable in Global Space

    It wasn't, but I fixed it and that wasn't the issue. I can't find any other instances of GLOBALFOOD being used. Would my init do anything? if (isServer) then { fn_getBuildingstospawnLoot = compile preProcessFileLineNumbers "LootSpawn\fn_LSgetBuildingstospawnLoot.sqf"; LSdeleter = compile preProcessFileLineNumbers "LootSpawn\LSdeleter.sqf"; execVM "LootSpawn\Lootspawner.sqf"; []execVM "dynamix\dynamix.sqf"; []execVM "VehicleSpawn\vehiclespawner.sqf"; GLOBALFOOD = 20; publicVariable "GLOBALFOOD"; CURRENTBASENUMBER = 0; publicVariable "CURRENTBASENUMBER"; NumLgFoodFacilities = 0; publicVariable "NumLgFoodFacilities"; NumSmFoodFacilities = 0; publicVariable "NumSmFoodFacilities"; NumLgWorkshops = 0; publicVariable "NumLgWorkshops"; NumSmWorkshops = 0; publicVariable "NumSmWorkshops"; };
  17. anaximandross

    Local Variable in Global Space

    Does publicVariable convert it to a string?
  18. anaximandross

    Local Variable in Global Space

    Oh I see. I think its because I used setVariable in the init.sqf. I need to declare them normally. EDIT: Nope, that wasn't it.
  19. anaximandross

    Local Variable in Global Space

    Ah, check and check! I accidentally left an extra set of brackets in when I took the test cases out. Ok, now it says: else{ if(_globalFood > _foodCost) then { _markPos = getMarke> 18:16:38 Error position: <> _foodCost) then { _markPos = getMarke> 18:16:38 Error >: Type Object, expected Number,Not a Number 18:16:38 File C:\Users\chase\Documents\Arma 3 - Other Profiles\Harbor\missions\State%20of%20Disorder.Malden\BaseFunctions\ClaimBase.sqf, line 34 It almost seems like GlobalFood is being read as a position? Here's the relevant code: //checks to see if the area around the base is clear if(_cnt > 0) then { hint "Clear the area to claim this base!" } //if the area is clear, this allows the player to claim the base else{ if(_globalFood > _foodCost) then { _markPos = getMarkerPos "base_4"; //calculates the amount of food remaining in food stores _foodremaining = _globalfood - _foodCost; hint format["You have %1 food remaining!",_foodremaining]; GLOBALFOOD = _foodremaining;
  20. anaximandross

    Local Variable in Global Space

    That's exactly what I did! Ok, so now its saying that _foodCost is undeclared, even though its a parameter. How fix? params [ ["_marker","_foodCost"] ]; //Counts number of enemies around the desired marker _units = []; {if (side _x == east && {_marker distance2D _x < 100}) then {_units pushBack _x};} forEach allUnits; _cnt = count _units; hint format["Count:",_cnt]; //_globalFood = missionNamespace getVariable GLOBALFOOD; _globalFood = GLOBALFOOD; base_num = _this select 2; //checks to see if the area around the base is clear if(_cnt > 0) then { hint "Clear the area to claim this base!" } //if the area is clear, this allows the player to claim the base else{ if(_globalFood > _foodCost) then { _markPos = getMarkerPos "base_4"; //calculates the amount of food remaining in food stores _foodremaining = _globalfood - _foodCost; hint format["You have %1 food remaining!",_foodremaining]; GLOBALFOOD = _foodremaining; missionNamespace setVariable ["GLOBALFOOD",_foodremaining,true]; hint "New Home Base Claimed!"; //determines the current base number to be used for other things CURRENTBASENUMBER = base_num; publicVariable "CURRENTBASENUMBER";
  21. anaximandross

    Local Variable in Global Space

    Ok I got that error fixed. Now I'm back to the original issue of this post! Global variables! I'm getting this now on the .rpt _globalFood = missionNamespace getVariable GLOBALFOOD; base_num = _thi> 17:51:26 Error position: <getVariable GLOBALFOOD; base_num = _thi> 17:51:26 Error getvariable: Type Number, expected Array,String 17:51:26 File C:\Users\chase\Documents\Arma 3 - Other Profiles\Harbor\missions\State%20of%20Disorder.Malden\BaseFunctions\ClaimBase.sqf, line 22 Oh ok, I see. That only returns array/string. What is a better alternative to getVariable?
  22. anaximandross

    Local Variable in Global Space

    Mother of god...that was a dumb mistake! Ok! Well, now that the script is actually executing, its giving me an error that its expecting a number but getting an object. It says the issue is in line8, which is the parameters And thank you so much for your time! I greatly appreciate it.
  23. anaximandross

    Local Variable in Global Space

    I added in this hint to output the number of troops in the area, but nothing happens. Does that mean that this script isn't being executed at all? if(isServer) exitWith{}; //params ["_marker", "_foodCost"]; if(!isServer) exitWith{}; //add a new parameter for array of markers being passed into createBasePlots params [ ["_marker","",[""]], ["_foodCost",99999,[0]] ]; if (_marker == "") exitWith {diag_log format ["Debug Error (BaseClaim.sqf): Invalid marker passed in params (%1)",_this];}; if (_foodCost == 99999) exitWith {diag_log format ["Debug Error (BaseClaim.sqf): Invalid food cost passed in params (%1)",_this];}; //Counts number of enemies around the desired marker //Counts number of enemies around the desired marker _units = []; {if (side _x == east && {_marker distance2D _x < 100}) then {_units pushBack _x};} forEach allUnits; _cnt = count _units; hint format["Count:",_cnt]; {rest of code}
  24. anaximandross

    Local Variable in Global Space

    Ohhhhh ok! I'll give that a shot again. Thanks for all the help. This is my first major scripting attempt, so I'm making all kinds of mistakes.
  25. anaximandross

    Local Variable in Global Space

    Ok, so this is on a post this addAction["Build a small food storage", "Compositions\assembler.sqf"]; That calls assembler.sqf: if(!isServer) exitWith {}; params ["_facilityPositon","_facilityType"] _storPosit = getMarkerPos "_facilityPositon"; if (_facilityType == "foodS") then { 0 = [_storposit, 360, call (compile (preprocessFileLineNumbers "Compositions\foodstor_s.sqf"))] call BIS_fnc_ObjectsMapper; }; if (_facilityType == "foodL") then { 0 = [_storposit, 360, call (compile (preprocessFileLineNumbers "Compositions\foodstor_s.sqf"))] call BIS_fnc_ObjectsMapper; }; if (_facilityType == "workshopS") then { 0 = [_storposit, 360, call (compile (preprocessFileLineNumbers "Compositions\foodstor_s.sqf"))] call BIS_fnc_ObjectsMapper; }; if (_facilityType == "workshopL") then { 0 = [_storposit, 360, call (compile (preprocessFileLineNumbers "Compositions\foodstor_s.sqf"))] call BIS_fnc_ObjectsMapper; }; I've made a few changes to this script but the error remains the same. This script then calls foodstor_s.sqf. Unfortunately, I again don't see any errors either.
×