Jump to content

spelmo3

Member
  • Content Count

    16
  • Joined

  • Last visited

  • Medals

Everything posted by spelmo3

  1. So i'm a novice scripter. I've started to create a simple randomly generated AO system, very basic. Takes an array of invisible pre-placed markers on the map. selects one and creates an AO marker around it. (right now its just moving a marker placed in the editor.) my next step is spawning a few enemy AI's around the AO area. using a mix of fnc_findsafepos & fnc_spawngroup. I'm just looking at some simple ways to populate the AO with a handful of groups by scratch. I've always used someone elses released scripts over on the bis forums to populate the AO. But i'd love to have ago at making my own simple and possibly crude script from scratch. //**AO Selection** _locations = ["mrk","mrk_1","mrk_2","mrk_3","mrk_4","mrk_5","mrk_6","mrk_7", "mrk_8","mrk_9","mrk_10","mrk_11"]; _objType = floor(random(24)); rndLoc = _locations call BIS_fnc_selectRandom; "aoArea" setMarkerPos (getMarkerPos rndloc); /*created in the map already*/ switch (_objType) do { case 0: {"aoArea" setMarkerPos (getMarkerPos rndloc); }; case 1: {"aoArea" setMarkerPos (getMarkerPos rndloc); }; case 2: {"aoArea" setMarkerPos (getMarkerPos rndloc); }; case 3: {"aoArea" setMarkerPos (getMarkerPos rndloc); }; case 4: {"aoArea" setMarkerPos (getMarkerPos rndloc); }; case 5: {"aoArea" setMarkerPos (getMarkerPos rndloc); }; case 6: {"aoArea" setMarkerPos (getMarkerPos rndloc); }; case 7: {"aoArea" setMarkerPos (getMarkerPos rndloc); }; case 8: {"aoArea" setMarkerPos (getMarkerPos rndloc); }; case 9: {"aoArea" setMarkerPos (getMarkerPos rndloc); }; case 10: {"aoArea" setMarkerPos (getMarkerPos rndloc); }; case 11: {"aoArea" setMarkerPos (getMarkerPos rndloc); }; }; //**AI Population** spawnPos = ["aoArea", 50, 100, 10, 0, 20, 0] call BIS_fnc_findSafePos; [spawnPos, east, (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad_Weapons")] call BIS_fnc_spawnGroup; Just to add.. my last two lines of code are probably completely written wrong and will probably throw and unexpected variable error.. i've tried a few things round and just left it how it is right now. Its been awhile playing in arma sqf's so bare with any sloppyness!
  2. So i'm working on a little project. similar to I&A just to learn how to spawn some "dynamic" AO areas and sectors to capture. and to learn some basics with MP scripting so i've got my random sector working.. (it uses placed markers on a map mrk mrk_1 etc) it all works flawlessly. but now im stumped onto spawning some AI around the "AO" zone. (the zone is actually a trigger) ive been checking out bis_fnc_spawngroups. but im wondering whats the best way to spawn in AI to this. I've put a snippet of what i've got so far. running in my initserver.sqf //for the time being I've limited everying to one case for testing. //_locations = ["mrk","mrk_1","mrk_2","mrk_3","mrk_4","mrk_5","mrk_6","mrk_7","mrk_8"]; _locations = ["mrk"]; _objType = floor(random(1)); _rndLoc = _locations call BIS_fnc_selectRandom; switch (_objType) do { case 0: {zone setPos (getMarkerPos _rndloc); zonetask setPos (getMarkerPos _rndloc); // code to spawn or move some opfor AI in my trigger radius to fill out the AO }; //I could spawn my AI here without calling it in every case. as _rndloc is the center point of my AO area. }; also. this is for an MP scenario please feel free to correct my syntax
  3. Good morning! This looks exactly like what i need! Will give this a go.
  4. just trying to figure out a simple check.. im a novice scripter so im probably missing a function or syntax error or something. basically i have some spawned in compositions and vehicle spawn scripts. they all work. but ideally i need to check that any vehicle isnt near before my script fires.. (i've covered objects just not vehicles) i've been playing about doing simple stuff such as using vehicles distance _myobject and looking at inarea/inarea arrays. i've tried a range of stuff but im a little lost. _isclear = code to check if a vehicle is in a 100m of an object.. store that information eg presence of a vehicle within 100m returns false. if (_isclear = true) then { //my code if the area is clear (returned true) ["TaskSucceeded",["","spawned the composition"]] call BIS_fnc_showNotification; //lazy test notification } else { //alternative code if a vehicle is present unsafe to spawn composition ["TaskFailed",["","a Vehicle is too close"]] call BIS_fnc_showNotification; //lazy test notification }; hope some one could give me a quick example. with a little explanation to learn from!
  5. Yeah since most of my compositions are quite basic. Simply _x hideobject true does the trick. Its rare that i'll use spawned compositions in populated areas As I'd hand craft it. (Hide it if required) That example is much better than what i expected! The whileloop would of been enough. Thank you for your time. Just needed something open ended as a basis to learn and work with. Will let you know how i get on!
  6. just using triggers as an example on here. Ideally i would like to do it through an If statement.. EG if i decided to use a marker/object/position instead. it's something i could use on a few things i've learnt. eg spawning vehicles or compositions. if i spawn more than one vehicle in a tight space then it can lead to some explosions. or a moderately sized composition may spawn on a vehicle and destroy it. using BIS_fnc_findSafePos helps with certain things. but having a check before spawning things would just be cleaner.
  7. Thanks for that. this is quick code i've put together. just to show where i'm a little lost!! Thanks for the futher details. so ideally i should be using if (_isClear) or if (_isClear == true). depending on the way i need to go about doing my actual check! on to running my check.. I'll be honest i have no idea what im looking for or doing.... I'm not sure if using inArea/inAreaArrays is the way to go. I've tried some research, not finding much of an example of its use for my situation. since im checking for any vehicles its more likely inAreaArrays _mytrigger = createTrigger ["EmptyDetector", getPos my_object]; //create a trigger area created at object with variable name my_object _mytrigger setTriggerArea [50, 50, 0, false]; // trigger area with a radius of 100m. // this is where im completely baffled with no knowledge.. _isClear = vehicles inAreaArrays _mytrigger; //vehicles (all vehicles) inAreaArray (Returns list of Objects or Positions that are in the area _mytrigger.) should i store this in a variable ? could i remove the _isClear variable completely in one sense if the return value of vehicles returns empty. then my IF statement can move on to " then{} " and if a vehicle is in the area then run "else{}" I literally dont know how to get that value. or put it into the right syntax to use. is it simple enough to just drop an exclamition mark in there and do something like... If !vehicles inAreaArrays _mytrigger; then{} i have issues where i make matters overly complexed than i need too!
  8. just making a simple addaction script to recruit units. its been throwing a few errors but my syntax seems correct. but im missing something. for now this is the problem line. this addAction ["<t color='#00bbdd'>Recruit Rifleman","B_RangeMaster_F" createUnit [position player, group player],"",nil,1.5,true,true,"","",5]; ^^ my script has about 8 of these lines for each unit. but im just testing it with the one line. no errors when in the init show until i start the playtest. then i get that its missing bool expression at " this |#|addAction..." any thoughts? originally i just thought the sqf was being excuted/called wrong but the in editor init has the same error
  9. your right. also noticed on the bis page you added about the alt syntax also being outdated. which is also what i'm using. going back to drawing board on this one.
  10. So im trying to make a super simple helicopter taxi script. nothing fancy.. no RTB or anything.. just go to the marker position placed on the map, land and turn off engine. I've tried creating invisible helipads, using land and landAt.. addwaypoint etc.. its called in via the players addaction with the heli using helo1 as its variable can someone help me out im probably getting the syntax all wrong. deleteMarkerLocal "LZmarker"; _marker = createMarkerLocal ["LZmarker",[0,0,0]]; _marker setMarkerColorLocal "ColorWhite"; _marker setMarkerShapeLocal "ELLIPSE"; _marker setMarkerBrushLocal "Solid"; _marker setMarkerSizeLocal [25, 25]; openMap true; mapclick = false; onMapSingleClick "'LZmarker' setMarkerPosLocal _pos; mapclick = true; true"; waitUntil{!visibleMap}; helo1 domove getMarkerPos "LZmarker"; //just to move to marker position as a filler for now. //something to land the chopper. i've tried waypoints, invisible helipads and i cant seem to get it right onMapSingleClick "";
  11. spelmo3

    Landing a Heli Help.

    works like a charm.. _posToLand = getMarkerPos "LZmarker"; // better to get position in local variable _landPad = createVehicle ["Land_HelipadEmpty_F", _posToLand]; this is where i was going wrong.. i was trying stupid complex things. i was trying to call getmarkerpos within create vehicle.. could of just done a variable hahaha thank you. it works a charm.. changed a few minor things to fit how i want it!
  12. spelmo3

    Landing a Heli Help.

    thats quite close to what i had. albeit yours is much tidier.. but i get the same error.. missing ] on line 21.. issue is with syntax using getMarkerPos.. but i cant figure it out.
  13. sorry for the necro here.. im still looking for this solution for the past 3 months.. did anyone have any luck? I'm currently looking at setting up my own sectors using triggers & markers because i cant find a way to get the sectors to reinitalize on load
  14. So im working on a FOB spawn script. upto now it all works fine. Addaction on container truck to run the SQF script. the script despawns the truck then runs the code and spawns in all my compositions. but i need to add virtual arsenal to two supply crates in the _object array.. i originally added it the supply crates init fields before i used object grabber. to grab the composition.. obviously this doesnt copy over into the array im not sure how i go about that.. btw the object im trying to add virtual Arsenal to is "B_A_supplyCrate_F" code so far is below; _markerName = createMarker ["FOB Alpha", player]; _markerName setMarkerType "hd_flag"; _markerName setMarkerText "FOB Alpha"; deleteVehicle FOBTRUCK1; sleep 3; _objectsArray = [ ["B_A_supplyCrate_F",[-7.49097,-3.54138,1.43051e-006],58.9527,1,0,[-0.0003387,3.54903e-006],"","",true,false] ["Land_Cargo_House_V1_F",[7.28906,6.12756,0],87.6723,1,0,[0,0],"","",true,false], ["Land_WaterTank_F",[-5.43066,-7.16418,2.00272e-005],358.416,1,0,[0.00140761,-0.000315334],"","",true,false], ["B_A_supplyCrate_F",[-8.54297,3.66064,0],125.868,1,0,[-4.63595e-006,-1.37018e-006],"","",true,false], ["Land_PortableLight_double_F",[-3.17969,-8.9541,0],340.729,1,0,[0,0],"","",true,false], ["CamoNet_BLUFOR_open_F",[-9.25562,0.519653,0],268.702,1,0,[0,0],"","",true,false], ["Land_ToiletBox_F",[9.88672,0.405273,6.67572e-006],88.4163,1,0,[-0.000229069,-0.000436622],"","",true,false], ["Land_GarbageBarrel_01_F",[10.1389,-1.72766,-0.00604343],307.257,1,0,[0.3308,0.935652],"","",true,false], ["Land_HBarrier_5_F",[-11.0273,3.53418,0],87.9017,1,0,[0,0],"","",true,false], ["Land_HBarrier_5_F",[-2.61914,-10.4092,0],178.557,1,0,[0,-0],"","",true,false], ["Land_HBarrier_5_F",[-10.6934,-6.56934,0],268.147,1,0,[0,0],"","",true,false], ["Land_HBarrier_5_F",[8.38672,-10.1221,0],178.557,1,0,[0,-0],"","",true,false], ["Land_HBarrier_5_F",[11.959,3.57324,0],87.7722,1,0,[0,0],"","",true,false], ["Land_PortableLight_double_F",[9.74097,-7.47314,0],143.108,1,0,[0,-0],"","",true,false], ["Land_HBarrier_5_F",[-7.38672,-10.5029,0],227.148,1,0,[0,0],"","",true,false], ["Land_HBarrier_5_F",[12.4219,-6.52246,0],267.546,1,0,[0,0],"","",true,false], ["Land_PaperBox_closed_F",[-7.3042,10.8262,0],69.6406,1,0,[0,0],"","",true,false], ["Land_HBarrier_5_F",[-11.3164,9.06934,0],87.3005,1,0,[0,0],"","",true,false], ["Land_PaperBox_closed_F",[-9.50366,9.16528,0],312.011,1,0,[0,0],"","",true,false], ["Land_HBarrier_5_F",[12.2266,-6.77246,0],135.892,1,0,[0,-0],"","",true,false], ["Land_PortableLight_double_F",[-8.74414,10.4397,0],324.693,1,0,[0,0],"","",true,false], ["Land_HBarrier_5_F",[11.7031,9.14941,0],87.9017,1,0,[0,0],"","",true,false], ["Land_HBarrier_5_F",[-7.42188,12.6924,0],356.646,1,0,[0,0],"","",true,false], ["Flag_UK_F",[4.37622,-12.7537,0],179.05,1,0,[0,-0],"","",true,false], ["Land_HBarrier_5_F",[8.13477,13.2725,0],178.557,1,0,[0,-0],"","",true,false], ["Land_HBarrier_3_F",[-10.02,10.6465,1.33939],127.492,1,0,[0,-0],"","",true,false], ["Land_HBarrier_3_F",[-7.08447,12.8091,1.3314],149.258,1,0,[0,-0],"","",true,false], ["Land_HBarrier_3_F",[-8.82275,11.9532,0],140.781,1,0,[0,-0],"","",true,false], ["Land_TTowerSmall_2_F",[8.72632,8.93225,-3.02009],180.361,1,0,[0,0],"","",true,false], ["Land_HBarrier_5_F",[8.39258,13.0693,0],46.9021,1,0,[0,0],"","",true,false], ["Land_HBarrierTower_F",[0.218262,15.7477,0],181.546,1,0,[0,0],"","",true,false], ["Land_PortableLight_double_F",[2.50903,15.2213,0.00282383],34.0734,1,0,[0,0],"","",true,false], ["B_A_Quadbike_01_F",[-5.47314,-15.9047,-0.0102015],161.695,1,0,[-0.102109,0.0473369],"","",true,false], ["Land_HBarrier_1_F",[-17.4121,-3.23926,0],355.469,1,0,[0,0],"","",true,false], ["Land_Razorwire_F",[-17.832,-0.202148,-2.38419e-006],265.407,1,0,[0,0],"","",true,false], ["Land_Razorwire_F",[-12.1367,-14.7178,-2.38419e-006],226.555,1,0,[0,0],"","",true,false], ["Land_HBarrier_1_F",[-16.4492,-9.76855,0],318.366,1,0,[0,0],"","",true,false], ["Land_Razorwire_F",[19.1328,0.254883,-2.38419e-006],265.407,1,0,[0,0],"","",true,false], ["Land_HBarrier_1_F",[-18.2891,6.18457,0],355.469,1,0,[0,0],"","",true,false], ["Land_HBarrier_1_F",[-9.68555,-17.0479,0],318.366,1,0,[0,0],"","",true,false], ["Land_PortableLight_double_F",[-1.89478,18.7633,-0.00322342],136.662,1,0,[0,-0],"","",true,false], ["Land_Razorwire_F",[13.7441,-13.9756,-2.38419e-006],314.574,1,0,[0,0],"","",true,false], ["Land_HBarrier_1_F",[19.6289,-2.94629,0],173.384,1,0,[0,-0],"","",true,false], ["Land_HBarrier_1_F",[11.5742,-16.3135,0],224.613,1,0,[0,0],"","",true,false], ["Land_HBarrier_1_F",[18.8535,6.84277,0],173.384,1,0,[0,-0],"","",true,false], ["Land_HBarrier_1_F",[18.3438,-9.4209,0],224.613,1,0,[0,0],"","",true,false] ]; [getMarkerPos "FOB Alpha", 0, _objectsArray, 0] call BIS_fnc_objectsMapper;
  15. thanks for the help. There isnt any units or waypoints. the FOB's are quite small. basically small camp like FOB's. I was also thinking of using your example then just teleporting to the player location..as you've mentioned and from teleporting stuff in the past doesnt play well with uneven terrain. going to give larrows script a good read and see how i get on over the next week.
  16. Thanks for the reply, so pretty much create it on a new layer and have it hidden? I'd have to adapt it because the FOBS are created at the players position when the script is run. il do some research into your suggestion. im still a novice with scripting. Quote: "If you save a composition in editor, with codes in init field of the objects, then add this custom composition in any of your scenario, the codes will work (so the arsenal)." i use 0 = ["AmmoboxInit", [this, true]] spawn BIS_fnc_arsenal; in the init field of my supply crates, they work on crates already in the editor but not composition thats spawned in during mission. like the init scripts are not carried? im using the same object "B_A_supplyCrate_F" in both already in the editor (they work) and in the spawned comp (broken) I was thinking is there a way to call / check multiples of a certain object is present(possiblity by using its class name). then basically apply the arsenal.. it would need to run once on mission init and run once during my spawn script to update the newly spawned in crates. again i dont know if that would be effective way or not to run it. and i dont even know if its possible?
×