spelmo3
Member-
Content Count
16 -
Joined
-
Last visited
-
Medals
Community Reputation
4 NeutralAbout spelmo3
-
Rank
Private First Class
-
spelmo3 started following Spawning AI in my Randomly selected AO
-
Spawning AI in my Randomly selected AO
spelmo3 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
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!- 1 reply
-
- 1
-
Populating my AO / sector
spelmo3 replied to spelmo3's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Good morning! This looks exactly like what i need! Will give this a go. -
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
-
check if any vehicle is in an area.
spelmo3 replied to spelmo3's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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! -
check if any vehicle is in an area.
spelmo3 replied to spelmo3's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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. -
check if any vehicle is in an area.
spelmo3 replied to spelmo3's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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! -
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!
-
addaction expecting boolean value
spelmo3 replied to spelmo3's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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. -
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
-
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!
-
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.
-
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 "";
-
sector control Sector Control and AI Spawn modules after save/load?
spelmo3 replied to viel.kuul.10's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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 -
Adding VA to a Spawned in composition
spelmo3 replied to spelmo3's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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. -
Adding VA to a Spawned in composition
spelmo3 replied to spelmo3's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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?