PITN Posted July 30, 2014 at 07:56 AM Report Share Posted July 30, 2014 at 07:56 AM Okay. I need to remove the processInit cmds from inurgency and I'm trying to wrap my head around BIS_fnc_MP. I'll post a section of code and if someone can explain to me how _process is a switch that would be a start. Ignore my crappy attempts. ATM the AI spawn repeatedly and are not being counted properly and could be a naming issue as well.This portion spawns the enemy AI, sets enemy count, adds IEDS/NVGs (not needed atm), and sets the Intel briefcase on death. I need to remove the process init section and use MP_fnc_mp or similar. fillHouseEast = { <br /> private ["_x","_process","_arr","_inc","_pID","_pos","_bool","_unit","_name","_class","_ai","_nPos","_house","_cCount","_hID","_wCount","_i","_group","_skill"];<br /> scopeName "fillHouseEastMain";<br /> <br /> _house = _this select 0;<br /> _wCount = _this select 1;<br /> _inc = _this select 2;<br /> <br /> // when this is true, setVehicleInit is processed (i.e. AI is created)<br /> _process = false;<br /> // number of spawn positions in a house<br /> _nPos = nPos(_house);<br /> // 0 based count of OPFOR infantry class members<br /> _cCount = count eastInfClasses - 1;<br /> // random spawn position<br /> _x = round random (_nPos-1); <br /> // checks if the house is a valid house for AI spawns (if not it's -1)<br /> _hID = CACHEHOUSEPOSITIONS find (typeOf _house);<br /> _arr = [];<br /> if (_hID != -1 && _wCount > 0) then {<br /> _arr = CACHEHOUSEPOSITIONS select (_hID + 1); <br /> };<br /> <br /> for [{ _i=_x},{ _i<((_nPos-1)+_x)},{ _i=_i+_inc}] do { <br /> if (count _arr == 0 && _wCount > 0 && _hID != -1) exitWith {}; <br /> _pos = _house buildingPos (_i % _nPos); <br /> if (count _arr > 0) then {<br /> _pID = (_arr select 0);<br /> _pos = _house buildingPos _pID;<br /> _arr = _arr - [(_arr select 1)] - [_pID];<br /> };<br /> // create an AI at _pos if no other "Man" in radus of 3 meters of _pos<br /> if (count nearestObjects[_pos, ["Man"], 3] == 0) then {<br /> _name = findSquadAIName(player);<br /> if (_name == "") exitWith { breakTo "fillHouseEastMain"; };<br /> _bool = !isNil _name;<br /> if _bool then { _bool = alive (call compile _name); };<br /> // when the AI unit (found by name) is alive, make sure it's healthy and, make it <br /> // "look-alive" by issuing a move command<br /> if _bool exitWith {<br /> _unit = call compile _name;<br /> _unit setPosATL _pos; <br /> _unit setDamage 0;<br /> [_unit,{<br /> _this doMove getPosATL _this;<br /> sleep 1;<br /> doStop _this;<br /> },server,true] spawn BIS_fnc_MP;<br /> if DEBUG then { server globalChat format["moving %1", _name]; };<br /> };<br /> // if there are no appropriate AI units around, prepare for spawning them<br /> if DEBUG then { server globalChat format["spawning %1", _name]; };<br /> _class = eastInfClasses select (random _cCount);<br /> _group = [player, "EastAIGrp", "", "east"] call getGroup; // create an AI group<br /> _ai = _group createUnit [_class, spawnPos, [], 0, "NONE"];<br /> _ai setPosATL _pos;<br /> _skill = aiSkill / 10;<br />// SPAWN AI, SET VEHICLE INIT, NEEDS REWRITE --------------------------------------------------- <br />/* fnc_SpawnInsAI = //my crappy attempt<br /> {<br /> %1 = _ai;<br /> this setVehicleVarName ''''%1'''';<br /> %1 = this;<br /> doStop this;<br /> };<br /> [(_process, true, "fnc_SpawnInsAI"],_process,false] spawn BIS_fnc_MP;<br />*/ <br /> call compile format[' ///original<br /> %1 = _ai; <br /> _ai setVehicleInit ''<br /> this setVehicleVarName ''''%1'''';<br /> %1 = this;<br /> doStop this;<br /> this addMagazine (%2 select (random (count %2 - 1)));<br /> this addMagazine (%2 select (random (count %2 - 1)));<br /> // Chance AI will have a nightvision device - Disabled in coop only!!!<br /> if (random 100 > 75 && eastRatio > 0) then {<br /> if !(this hasWeapon ''''NVGoggles'''') then { this addWeapon ''''NVGoggles''''; if DEBUG then { diag_log format [''''Adding NVG to %1'''', this]; }; };<br /> };<br /> this setSkill %3;<br /> this addEventHandler [''''killed'''', { <br /> missionNamespace setVariable [''''%1var'''', time];<br /> if (random 100 > 90 || DEBUG) then {<br /> _case = createVehicle [''''Land_Suitcase_F'''', %4, [], 0, ''''None'''']; <br /> _case setPosATL getPosATL (_this select 0);<br /> };<br /> }];<br /> '';<br /> ', _name, IEDList, _skill, spawnPos];<br /> _process = true; // switch to spawn ai<br /><br /> };<br /> sleep 0.1;<br /> };<br /> // spawns the AI prepared with 'setVehicleInit'<br /> if _process then { processInitCommands; }; //PROB DONT NEED THIS ANYMORE---CALL COMPLILE INSTEAD? NEED _PROCESS TRUE TO SPAWN AI<br /> <br />}; How the hell does if _process then { processInitCommands; }; become a trigger? and why are they using ' so much instead of " . Quote Link to comment Share on other sites More sharing options...
=VG= SemlerPDX Posted August 1, 2014 at 05:56 PM Report Share Posted August 1, 2014 at 05:56 PM Obviously, this entire page is a function call for spawning, and it evaluates conditions.that line you ask about "_process" becomes a trigger near the bottom of that script page...it is a boolean == true or false.Also, the reason for the ' instead of " is because that section is inside a "compile" format,therefore, any " would be incorrect useage that would indicate the end of the compileformat block, so one must use ' instead. I've used compile format a lot, this was my bible: ofpec.com/COMREF/Those "percent 1" calls always annoyed Poff I remember... They are wildcards that pull the first variable at the end into the compile format at thebeginning - so, "percent 2" would be the 2nd listed variable at the end of the code block,in this script, that would be the variable IEDList.(also, the script block for this forum is kinda fubar - page is too wide now...)Best of luck to you! !cheers Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.