Jump to content

Theo Thalwitzer

Member
  • Content Count

    19
  • Joined

  • Last visited

  • Medals

Everything posted by Theo Thalwitzer

  1. Hi I sure help someone can shed some light - I'm making a mission where I want several random tasks to be created at random marker positions. With this I have found a way which thus far proved very effective. I created 15 markers which I placed in appropriate positions for each task. Then an officer-unit, named S1, which I placed out of the way (simulation and damage disabled) until the script is called. The working script looks like this: // SCRIPT CODE // //Place officer (s1) at random marker ("red1"-"5") and start him patrol the area. Only markers and unit placed out of the way. Once the unit (s1) has been placed, another script (USPS.sqf) then gives the unit random waypoints to patrol. After that, another script (PWNR) spawns in a support group, also patrolling the area. Task complete when s1 is killed. _taskArray = ["red_1","red_2","red_3","red_4","red_5","red_6","red_7","red_8","red_9","red_10","red_11","red_12","red_13","red_14","red_15"]; //array with marker names _taskPos = _taskArray call BIS_fnc_SelectRandom; //select a random spawn position _officer1 = s1; s1 setPosATL getMarkerPos _taskPos, 100; [player,"Task_1",["A CSAT officer is around this area","Assassinate the officer","Kill"],_officer1,True] call BIS_fnc_taskCreate; sleep 0.5; s1 hideObject false; s1 allowDamage true; s1 setCaptive false; null = [s1, 100, 200, _taskPos, _taskPos, 200, true, "SAFE", "RED", "LIMITED", "FILE", 30, 30, 0, [true,35,25,3,1]] execVM "scripts\USPS.sqf"; sleep 0.5; nul = [_taskPos,200,"EAST GUERILLA INFANTRY UNITS",8] execVM "PWNR\Scripts\PUGS.sqf"; while {alive s1} do { waitUntil {not alive s1}; ["Task_1","Succeeded"] call BIS_fnc_taskSetState; }; As I said, this works fine as long as the unit (S1) and markers is placed in the editor. My objective: I want to create the same task WITHOUT placing the unit in the editor, but rather spawning him in with <createUnit>. In this regard I have made the following script: // Task: Kill HVT _hvtArray = ["hvt_1","hvt_2","hvt_3","hvt_4","hvt_5"];//Set location array _hvtPos = _hvtArray call BIS_fnc_SelectRandom; //Select random position from array _hvtGroup = createGroup EAST; // Create HVT group _hvt = "O_Officer_F" createUnit [position _hvtPos, _hvtGroup]; // Spawn HVT [player,"Eliminate_HVT",["We have pinpointed the position of a High Value Target in the indicated area. You are to relocate and eliminate the HVT.","High Value Target","Kill"],_hvt,True] call BIS_fnc_taskCreate; while {not isNull _hvt} do { waitUntil {not alive _hvt}; ["Eliminate_HVT","Succeeded"] call BIS_fnc_taskSetState; }; //The script exits with the following error refering, I think, to line 4 : <_hvt = "O_Officer_F" createUnit [position _hvtPos, _hvtGroup]; > and neither the unit is spawned, or the task is created. "Error position, Type String, Expected object, position" I have very little scripting experience but I'm learning fast. What am I doing wrong here?
  2. Well, apparently one has to firstly create/edit the mission's Description.ext file, adding the following line: #include "\a3\Missions_F_Oldman\Systems\commonDescription.inc" I have no idea why this works (yet) but it does. Then place an <Old Man Init> module anywhere and adjust the settings as preferred. All other modules are dependent on the <Old Man Init> module to work. I'd recommend this: https://steamcommunity.com/sharedfiles/filedetails/?id=2074224580
  3. Theo Thalwitzer

    ARMAHOLIC website not working

    I have a suspicion this site has been hacked by none other than STEAM itself. moddb.com is also offline. Steam is getting on my last nerves...
  4. Theo Thalwitzer

    Side marker visibility

    That works nice but it seems a lot of code for a simple task. This might also work: - Place your (empty) markers where you want them to be in the editor. - Change their color and text to what you would like them to be inside the marker edit-boxes. Now put the following into your script or trigger: if (side player==WEST) then { myMarkers=["mkrExt1","mkrExt2","mkrExt3"]; {_x setMarkerTypeLocal "hd_pickup";} forEach myMarkers; }; This does exactly the same as above but with only 2 lines of code... Line 1 creates an array called myMarkers from your placed markers. Line 2 simply changes the type. Hope that helps
  5. Theo Thalwitzer

    Spawn unit at random marker and create task

    Thanks to everyone who helped with this! It is now thoroughly solved. Special thanks to wogz187 - your solution is exactly what I needed without adapting more than one line of code as simplicity and less lines of code is what I'm after. It's great to have a community as selflessly helpful as this!
  6. Theo Thalwitzer

    Spawn unit at random marker and create task

    BINGO! Thanks a bunch! And it's right there on the wiki... What a tool I am... This is working flawlessly now. And suddenly I see a load of possibilities! Just one question though: What does the "FORM" represent?
  7. This is just a little script-set I made to recruit and dismiss units at will. So far it works fine in SP (Surprisingly well, actually) but I want to make this MP compatible. The set consists of 4 small script files: 1. File: "recruiting.sqf" // Code below: /* Usage: put this in INIT of unit to be recruited; nul=[this] execVM "TRecruit\Recruiting.sqf"; // 'this' or unitname */ _guyNotRecruited = true; _fng = _this select 0; _fng setcaptive true; //use different state or condition perhaps?? _recruitGuy = _fng addAction ["Recruit","TRecruit\newguyinit.sqf"]; while {_guyNotRecruited} do { if (not(captive _fng)) then {_guyNotRecruited = false}; if (not alive _fng) exitwith {_fng removeAction _recruitGuy}; sleep 1; }; _fng removeAction _recruitGuy; [_fng] join (group player); _fng enableAI "MOVE"; sleep 1; nul = [[["New Team Member recruited.","<t align='center' shadow='2' size='0.7'>%1</t><br/>"],["","<t align='center' shadow='2' size='0.7'>%1</t><br/>"],["","<t align='center' shadow='2' size='0.7'>%1</t>"]]] spawn BIS_fnc_typeText; sleep 5; nul=[_fng] execVM "TRecruit\dismissing.sqf"; 2. File: "dismissing.sqf" //Code below: _guyRecruited = true; _fng = _this select 0; _dropGuy = _fng addAction ["Dismiss","TRecruit\dropguyinit.sqf"]; while {_guyRecruited} do { if (captive _fng) then {_guyRecruited = false}; if (not alive _fng) exitwith {_fng removeAction _dropGuy}; sleep 1; }; _fng removeAction _dropGuy; [_fng] join grpNull; _fng setCaptive true; sleep 1; if (not alive _fng) then { hint "Team member deceased"; } else { nul = [[["Team Member dismissed.","<t align='center' shadow='2' size='0.7'>%1</t><br/>"],["","<t align='center' shadow='2' size='0.7'>%1</t><br/>"],["","<t align='center' shadow='2' size='0.7'>%1</t>"]]] spawn BIS_fnc_typeText; nul=[_fng] execVM "TRecruit\recruiting.sqf"; }; sleep 5; 3. File: "newGuyInit.sqf" //Code below: // set unit not captive _unit=_this select 0; _unit setcaptive false; 4. File: "dropGuyInit.sqf" //Code below: // set unit not captive _unit=_this select 0; _unit setcaptive true; //// I hope someone will find this useful, but as I said it will have issues in MP. Works great in SP though.
  8. Theo Thalwitzer

    Unit recruitment and dismissal

    Super! I'll give it a go!
  9. Theo Thalwitzer

    Unit recruitment and dismissal

    Awesome thanks! I have Bon's so I'll go through it. My only problem is that I have no programming background, so I have to learn this on the fly. Bon's scripts is a little advanced for my current understanding but I'm getting there... Currently I regularly use a mod called Spyder Addons for recruitment and vehicle spawning but it doesn't allow me to dismiss team members, which is why I came up with this.
  10. Theo Thalwitzer

    Spawn unit at random marker and create task

    I also have another problem which has been stumping me for a while. Its a simple syntax issue I think: While this line works fine: _taskArray = ["red_1","red_2","red_3","red_4","red_5","red_6","red_7","red_8","red_9","red_10","red_11","red_12","red_13","red_14","red_15"]; I know its also possible to shorten that 15-name list by using; "red_%1" , which would then select all markers starting with "red_". I tried: _taskArray = ["red_%1"]; but I know its not correct and I also know it should be pretty simple. I'm still learning ...
  11. Theo Thalwitzer

    Spawn unit at random marker and create task

    I'm taking a guess here but I suspect the "undefined variable"-error may be eliminate by giving the spawned unit a new name perhaps? As I mentioned, as long as the officer is named the script works fine via the unit's name. I know its possible to name a spawned unit with setVehicleVarName. I have made another script: (Where 'tareaGrn' is a placed helipad. The full script looks like this: //Start of script if (!alive tareaGrn) then { hint "The distribution point has been destroyed"; } else { _defenceGrpG = createGroup Independent; testGroupB = _defenceGrpG; //hint "Spawning New Assault Team..."; _newSoldier1 = "PMC_SecurityCon_MXGL" createUnit [position tareaGrn,testGroupB]; sleep 1; _newSoldier2 = "PMC_FieldSpecialist_M249" createUnit [position tareaGrn,testGroupB]; sleep 1; _newSoldier3 = "PMC_Marksman_M14" createUnit [position tareaGrn,testGroupB]; sleep 1; _newSoldier4 = "PMC_SecurityCon_MX" createUnit [position tareaGrn,testGroupB]; sleep 1; _newSoldier5 = "PMC_Medic" createUnit [position tareaGrn,testGroupB]; sleep 1; _newSoldier6 = "PMC_TL_M4" createUnit [position tareaGrn,testGroupB]; sleep 1; _newSoldier7 = "PMC_Engineer" createUnit [position tareaGrn,testGroupB]; sleep 2; _newSoldier8 = "PMC_SecurityCon_MX" createUnit [position tareaGrn,testGroupB]; sleep 1; // hint "TeamSpawn Complete!"; testGroupB = group pmcl; }; sleep 2; _newSoldier1 setVehicleVarName "pmc1"; _newSoldier2 setVehicleVarName "pmc2"; _newSoldier3 setVehicleVarName "pmc3"; _newSoldier4 setVehicleVarName "pmc4"; _newSoldier5 setVehicleVarName "pmc5"; _newSoldier6 setVehicleVarName "pmc6"; _newSoldier7 setVehicleVarName "pmc7"; _newSoldier8 setVehicleVarName "pmc8"; hint "Renamed them"; testGroupB setBehaviour "SAFE"; nul=[] execVM "randomMoveS3.sqf"; //Activates waypoint task on units //End of script As you can see I kept this as simple as possible and yes it works fine - so I'm guessing adding: _hvt setVehicleVarName "hvt_1"; This should rename the variable <_hvt> to <hvt_1> , which seems easier to define when the unit gets killed and completes the task. Not sure if it will work in MP though
  12. Theo Thalwitzer

    Spawn unit at random marker and create task

    Wow! This is a lot to understand but I'll work though it. Thanks I tried this and it works nicely with one error: Undefined variable in expression _unit. Also the task doesn't end when the officer gets killed... Sorry I'm a little lost here.
  13. Theo Thalwitzer

    Spawn unit at random marker and create task

    That is correct, they are markers. But I still get an error saying: Error Undefined variable in expression: _hvt This suggests that the variable name "_hvt" has not been assigned to the unit? Like I said I'm only slightly literate in .sqf coding and have much to learn
  14. I found this topic on a search and would like to know where and how to use the line. In the editor? The config viewer? A trigger? I have no idea how to apply that
  15. Theo Thalwitzer

    User Mission Request Thread

    Variable should immediately seek single player campaigns and dismount his high horse. If a long-span mission offers no respawn, what's the point? Really? If some 15 y/o Rambo team-killls me in a moment of pimple-madness, I'm to accept fate? And you talk about reality... mmmm....
  16. I've been working on a little lightweight recruitment and dismissing script for editor placed AI units. So far it works well in single player games, as you can recruit and dismiss AI units repeatedly and at will. In my noobiness, I decided to achieve this via 4 small .sqf files inside a folder called wRecruit: recruiting.sqf - file content below: /* Usage: put this in INIT of the unit to be recruited; nul=[this] execVM "wRecruit\recruiting.sqf"; */ _guyNotRecruited = true; _fng = _this select 0; _fng setcaptive true; _recruitGuy = _fng addAction ["Recruit","wRecruit\newguyinit.sqf"]; while {_guyNotRecruited} do { if (not(captive _fng)) then {_guyNotRecruited = false}; if (not alive _fng) exitwith {_fng removeAction _recruitGuy}; sleep 1; }; _fng removeAction _recruitGuy; [_fng] join (group player); _fng enableAI "MOVE"; sleep 1; nul = [[["New Team Member recruited.","<t align='center' shadow='2' size='0.7'>%1</t><br/>"],["","<t align='center' shadow='2' size='0.7'>%1</t><br/>"],["","<t align='center' shadow='2' size='0.7'>%1</t>"]]] spawn BIS_fnc_typeText; sleep 5; nul=[_fng] execVM "wRecruit\dismissing.sqf"; __________________________________________________________ newguyinit.sqf - file content below: // set unit not captive _unit=_this select 0; _unit setCaptive false; __________________________________________________________ dismissing.sqf - file content below: _guyRecruited = true; _fng = _this select 0; _dropGuy = _fng addAction ["Dismiss","wRecruit\dropguyinit.sqf"]; while {_guyRecruited} do { if (captive _fng) then {_guyRecruited = false}; if (not alive _fng) exitwith {_fng removeAction _dropGuy}; sleep 1; }; _fng removeAction _dropGuy; [_fng] join grpNull; _fng setCaptive true; sleep 1; if (not alive _fng) then { hint "Team member deceased"; } else { nul = [[["Team Member dismissed.","<t align='center' shadow='2' size='0.7'>%1</t><br/>"],["","<t align='center' shadow='2' size='0.7'>%1</t><br/>"],["","<t align='center' shadow='2' size='0.7'>%1</t>"]]] spawn BIS_fnc_typeText; nul=[_fng] execVM "wRecruit\recruiting.sqf"; }; sleep 5; ____________________________________________________ dropguyinit.sqf - file content below: // set unit captive _unit=_this select 0; _unit setCaptive true; _____________________________________________________ This works well in single player but I would love to know how to make this multiplayer-compatible without making the script too big or cumbersome. ?? Also, how would I be able to implement this on units spawned in-game by other scripts? I used setCaptive as the condition needed to achieve the effect I wanted but I'm sure there are different ways or conditions that could be used similarly?
  17. Hi all! I have a simple problem. That's to say, for someone not as nOObish as me in scripting... In my mission (APEX), I need all units of a specific faction (all PMC units from the PG Services mod), to be automatically recruit-able via a little script I slapped together. At the moment I call the script via the unit's INIT field: e.g.; " nul=[] execVM "recruiting.sqf"; ". This, however, does not allow for AI-spawned units to be recruit-able. My goal: Run a script to check and find any AI-spawned units of the specified faction (PG_Services) within a certain radius, or ideally, the entire map, and run my recruitment script on each. The method I use for recruiting is pretty basic but seems to work exactly as I want it to, so I'd prefer not to change that. My only problem is how to identify and run the script on all faction-spawned units on the map. My method for recruiting & dismissing - After !MANY! experiments, I decided on a system of 4 tiny scripts. So far I cannot seem to find much problems with it. There may be some in MP... 1. recruiting.sqf - is run 1st - currently in unit's INIT but could be trigger / script based _guyNotRecruited = true; _man = _this select 0; _man setCaptive true; // OPTIONAL _recruitGuy = _man addAction ["Recruit","TRecruit\newguyinit.sqf"]; while {_guyNotRecruited} do { if (not(captive _man)) then {_guyNotRecruited = false}; if (not alive _man) exitWith {_man removeAction _recruitGuy}; sleep 1; }; _man removeAction _recruitGuy; [_man] join (group player); _man enableAI "MOVE"; // OPTIONAL sleep 1; nul = [[["New Team Member recruited.","<t align='center' shadow='2' size='0.7'>%1</t><br/>"],["","<t align='center' shadow='2' size='0.7'>%1</t><br/>"],["","<t align='center' shadow='2' size='0.7'>%1</t>"]]] spawn BIS_fnc_typeText; nul=[_man] execVM "TRecruit\dismissing.sqf"; Obviously the script still needs polishing... setCaptive & enableAI "MOVE"; only used for testing & debug 2. newguyinit.sqf - called by recruiting.sqf - line 4 _unit=_this select 0; _unit setCaptive false; The script 'dismissing.sqf' is now running on the unit 3. dismissing.sqf - also called by recruitment.sqf - line 17 _guyRecruited = true; _man = _this select 0; _dropGuy = _man addAction ["Dismiss","TRecruit\dropguyinit.sqf"]; while {_guyRecruited} do { if (captive _man) then {_guyRecruited = false}; if (not alive _man) exitWith {_man removeAction _dropGuy}; sleep 1; }; _man removeAction _dropGuy; _man disableAI "MOVE"; //Optional but nice for leaving someone as guard on a specific spot [_man] join grpNull; sleep 1; nul = [[["Team Member dismissed.","<t align='center' shadow='2' size='0.7'>%1</t><br/>"],["","<t align='center' shadow='2' size='0.7'>%1</t><br/>"],["","<t align='center' shadow='2' size='0.7'>%1</t>"]]] spawn BIS_fnc_typeText; nul=[_man] execVM "TRecruit\recruiting.sqf"; Last but not least 4. dropguyinit.sqf - called by dismissing.sqf _unit=_this select 0; _unit setCaptive true; The original recruitment.sqf is called back onto the unit when dismissed. So I have a nice method of recruiting, dismissing and re-recruiting units without hassle. I'd prefer to hang on to that. I foresee one problem with the dismissing.sqf script - any other player will be able to run the "Dismiss" action on the unit. Working on that... But HOW do I get to run this script automatically on all PMC units spawned on the map?? Any tip would be welcome
×