Jump to content

Raider_18

Member
  • Content Count

    15
  • Joined

  • Last visited

  • Medals

Community Reputation

3 Neutral

About Raider_18

  • Rank
    Private First Class

Profile Information

  • Interests
    Arma 3 mission design
  1. Raider_18

    How to turn init code in to a script?

    Roger that, changed. Thanks!
  2. Raider_18

    How to turn init code in to a script?

    Spot on it's working good now, thank you for your help! I will post some of it below for anyone who wants to take it and run with it, or make it more efficient as I take the painstaking brute force approach lol. Right now its 3x seperate functions. I think its a very lightweight and effective way to basically make your own "faction" with what Arma 3 gives you plus working in hidden textures. I have never been fully satisfied with vanilla A3 factions especially with the FIA, who in my mind should be scaled down akin to armed civilians, and I wanted some randomness. So Arma 3 being the best platform ever and with the help of the community I have it. You guys rock! init.sqf // detect and change all editor placed units private _mapUnits = allUnits select {!isPlayer _x && _x isKindOf "CAManBase"}; {[_x] call CB_fnc_factionConfig;} forEach _mapUnits; // add MEH to catch anything spawned CB_MEH_factions = addMissionEventHandler ["EntityCreated", { params ["_entity"]; if (_entity IsKindof 'CAManBase') then {[_entity] spawn CB_fnc_factionConfig}; }]; CB_fnc_factionConfig - directs the units to their assigned loadout function with a if/then. As many or as little as you need. Next I will post my FIA example /* Name: factionConfig Author: Raider Description: Removes AI equipment when spawned/detected and assigns a pre-defined loadout function based on faction. Used pieces of code from Beerkan / Larrow / pierremgi / Bohemia fourms ------> https://forums.bohemia.net/forums/topic/180646-list-of-all-hidden-texture-inits/ ------> https://forums.bohemia.net/forums/topic/182390-how-to-turn-init-code-in-to-a-script/?tab=comments#comment-3528029 Known issues: Nothing for vehicles/aircraft. Naked units on the battlefield is your debug Factions can be one of the following West: "BLU_F" (NATO), "BLU_T_F" (NATO Pacific), "BLU_W_F" (NATO Woodland), "BLU_G_F" (FIA), "BLU_CTRG_F" (CTRG), BLU_GEN_F (BLUFOR Police) East: "OPF_F" (CSAT), "OPF_G_F" (FIA), "OPF_T_F" (CSAT Tanoa), "OPF_R_F" (Spetznaz), "OPF_GEN_F" (OPFOR Police) Guer: "IND_F" (AAF), "IND_E_F", (LDF) "IND_G_F" (FIA), "IND_C_F" (SYNDIKAT Tanoa), "IND_L_F" (Looters) Civ: "CIV_F" (Civilians), "CIV_IDAP_F" (IDAP) helpful -> if (faction _unit isEqualTo "FACTION AS A STRING" && _unit IsKindof 'CAManBase') then {YOUR SCRIPT/FUNCTION GOES HERE}; */ // handles private _unit = _this select 0; if (isPlayer _unit) exitWith {}; //ignore special units with this variable // factions to re-paint if (faction _unit isEqualTo "BLU_F" && _unit IsKindof 'CAManBase') then {[_unit] spawn CB_fnc_loadout_BLUFORnato}; // standard NATO if (faction _unit isEqualTo "BLU_CTRG_F" && _unit IsKindof 'CAManBase') then {[_unit] spawn CB_fnc_loadout_BLUFORspecops}; // CTRG if (faction _unit isEqualTo "BLU_G_F" && _unit IsKindof 'CAManBase') then {[_unit] spawn CB_fnc_loadout_BLUFORion}; // FIA as IoN security if (faction _unit isEqualTo "OPF_F" && _unit IsKindof 'CAManBase') then {[_unit] spawn CB_fnc_loadout_OPFORcsat}; // standard CSAT if (faction _unit isEqualTo "OPF_R_F" && _unit IsKindof 'CAManBase') then {[_unit] spawn CB_fnc_loadout_OPFORspecops}; // Spetznaz as Viper guys if (faction _unit isEqualTo "IND_G_F" && _unit IsKindof 'CAManBase') then {[_unit] spawn CB_fnc_loadout_INDFORfia}; // standard FIA if (faction _unit isEqualTo "IND_C_F" && _unit IsKindof 'CAManBase') then {[_unit] spawn CB_fnc_loadout_INDFORspecops}; // Syndikat as common criminals if (faction _unit isEqualTo "CIV_F" && _unit IsKindof 'CAManBase') then {[_unit] spawn CB_fnc_loadout_CIV}; // standard civ's CB_fnc_loaddout_INDFORfia - Inside one of the loadouts, defined arrays and other miscellanious commands you can tweak or change. The end is the switch/case to get detailed control over individual classnames. Its ugly and painstaking but, it works! /* Name: INDFORfia Author: Raider Description: Custom loadout function Known issues: Nothing for vehicles/aircraft Helpful code: selectRandomWeighted ["STRING", #, "STRING", #, "STRING", #] bluforUnit linkItem "NVGoggles" opforUnit linkItem "NVGoggles_OPFOR" independentUnit linkItem "NVGoggles_INDEP" addPrimaryWeaponItem "weapon attachment" addHandgunItem "weapon attachment" "acc_flashlight" "acc_pointer_IR" "acc_flashlight_pistol" */ // debug // systemChat "FIA function worked"; // handles private _unit = _this select 0; private _side = side _unit; private _unitType = typeOf _unit; /* not used for FIA // skills _unit allowfleeing 0; // 0 = will never run away _unit setskill ['aimingAccuracy',(0.3 + random 0.3)]; _unit setskill ['aimingShake',(0.3 + random 0.3)]; _unit setskill ['aimingSpeed',(0.3 + random 0.3)]; _unit setskill ['commanding',(0.3 + random 0.3)]; _unit setskill ['courage',1]; // 1 = John Wick (I was gonna say John Wayne but thats too old) _unit setskill ['general',(0.3 + random 0.4)]; _unit setskill ['reloadSpeed',(0.3 + random 0.3)]; _unit setskill ['spotDistance',(0.2 + random 0.3)]; _unit setskill ['spotTime',(0.2 + random 0.3)]; // modifiers _unit setUnitTrait ["audibleCoef", 0]; // 0 = silent ninja _unit setUnitTrait ["camouflageCoef", 0]; // 0 = ghost assassin _unit setUnitTrait ["loadCoef", 0]; // 0 = super human */ // all get naked removeAllWeapons _unit; removeAllItems _unit; removeAllAssignedItems _unit; removeUniform _unit; removeVest _unit; removeBackpack _unit; removeHeadgear _unit; removeGoggles _unit; _unit unlinkItem hmd _unit; sleep 0.1; /* if you want to change ethnicity (European CSAT or Tanoan LDF for example), or give recon units camo faces _faces = selectRandom [ "WhiteHead_01", "WhiteHead_05", "WhiteHead_04", "WhiteHead_06", "WhiteHead_07", "WhiteHead_08", "AfricanHead_02", "AsianHead_A3_02", "AfricanHead_03", "WhiteHead_09", "WhiteHead_16", "WhiteHead_11", "WhiteHead_14", "WhiteHead_15", "AfricanHead_01", "TanoanHead_A3_02", "TanoanHead_A3_01", "LivonianHead_5", "WhiteHead_27", "LivonianHead_3", "WhiteHead_32" ]; _unit setFace _faces; _reconFaces = selectRandom [ "WhiteHead_22_a", "WhiteHead_22_l", "WhiteHead_22_sa", "PersianHead_A3_04_sa", "GreekHead_A3_10_l", "GreekHead_A3_10_sa" ]; */ _uniforms = selectRandomWeighted [ "U_I_L_Uniform_01_tshirt_black_F", .5, "U_I_L_Uniform_01_tshirt_olive_F", .5, "U_I_L_Uniform_01_tshirt_skull_F", .5, "U_I_L_Uniform_01_tshirt_sport_F", .5, "U_C_Mechanic_01_F", .5, "U_C_Poor_1", .5, "U_IG_Guerilla1_1", .45, "U_IG_Guerilla1_2_F", .45, "U_C_Uniform_Farmer_01_F", .45, "U_I_C_Soldier_Bandit_2_F", .4, "U_I_C_Soldier_Bandit_5_F", .4, "U_C_Man_casual_4_F", .35, "U_C_Poloshirt_tricolour", .35, "U_C_E_LooterJacket_01_F", .35 ]; _unit forceAddUniform _uniforms; //hidden textures _fiaFatigues = selectRandom [ "\a3\characters_f_gamma\Civil\Data\c_cloth1_black.paa", "A3\Characters_F\Civil\Data\c_cloth1_kabeiroi_co.paa", "A3\Characters_F\Civil\Data\c_cloth1_bandit_co.paa", "A3\Characters_F\Civil\Data\poor_co.paa", "A3\Characters_F\Civil\Data\poor_v2_co.paa" ]; // chance to be cool _coolGuy = [1, 10] call BIS_fnc_randomInt; if ((uniform _unit) == "U_IG_Guerilla1_1" && _coolGuy > 5) then {_unit setObjectTextureGlobal [0, _fiaFatigues]; _unit setobjectTextureGlobal [1, "#(argb,8,8,3)color(0.33,0.31,0.24,0.3)"]; if (random 1 > 0.5) then { _unit setobjectTextureGlobal [1, "#(argb,8,8,3)color(0.33,0.31,0.24,0.3)"]; //Olive pants and boots }; if (random 1 < 0.5) then { _unit setobjectTextureGlobal [1, "#(argb,8,8,3)color(0.1,0.1,0.1,0.3)"]; //Black pants and boots }; }; //hidden textures _farmerSlacks = selectRandom [ "A3\Characters_F\Civil\Data\c_cloth1_bandit_co.paa", "A3\Characters_F\Civil\Data\c_cloth1_co.paa", "A3\Characters_F\Civil\Data\c_cloth1_kabeiroi_co.paa" ]; if ((uniform _unit) == "U_C_Uniform_Farmer_01_F") then {_unit setObjectTextureGlobal [0, _farmerSlacks]}; sleep 0.5; _vests = selectRandom [ "V_LegStrapBag_olive_F", "V_LegStrapBag_coyote_F", "V_LegStrapBag_black_F", "V_Pocketed_black_F", "V_Pocketed_coyote_F", "V_Pocketed_olive_F", "V_HarnessO_brn", "V_HarnessO_gry", "V_HarnessO_ghex_F" ]; _unit addVest _vests; _leaderVest = selectRandom [ "V_TacVest_camo", "V_TacVest_blk", "V_TacVest_brn" ]; _headgear = selectRandom [ "H_Beret_blk", "H_Bandanna_gry", "H_Bandanna_blu", "H_Bandanna_cbr", "H_Booniehat_taiga", "H_Booniehat_wdl", "H_Booniehat_dgtl", "H_Cap_blk", "H_Cap_blu", "H_Cap_red", "H_Cap_tan", "H_Cap_blk_Raven", "H_Bandanna_camo" ]; _unit addHeadGear _headgear; // chance for no headgear _bald = [1, 10] call BIS_fnc_randomInt; if (_bald > 5) then {removeHeadgear _unit}; //Leader gets sniper bait if ((leader group _unit) isEqualto _unit) then {_unit addHeadGear "H_Bandanna_khk_hs";}; _mask = selectRandomWeighted [ "G_Balaclava_oli",.5, "G_Bandanna_shades",.5, "G_Bandanna_blk",.5, "G_Balaclava_Flecktarn",.5, "G_Balaclava_Tropentarn",.5, "G_Bandanna_tan",.5, "G_Balaclava_BlueStrips",.45, "G_Bandanna_sport",.45, "G_Bandanna_khk",.45, "G_Balaclava_blk",.45, "G_Bandanna_beast",.45, "G_Bandanna_shades",.45, "G_Bandanna_BlueFlame1",.4, "G_Bandanna_Syndikat1",.4, "G_Bandanna_BlueFlame2",.4, "G_Bandanna_oli",.4, "G_Bandanna_OrangeFlame1",.4, "G_Bandanna_RedFlame1",.4, "G_Bandanna_Skull1",.4, "G_Bandanna_Skull2",.4 ]; _unit addGoggles _mask; // chance for no facewear _lame = [1, 10] call BIS_fnc_randomInt; if (_lame < 5) then {removeGoggles _unit}; _authorizedEyePro = selectRandom ["G_Shades_Black", "G_Shades_Red"]; _authorizedSmallBag = selectRandom ["B_AssaultPack_dgtl", "B_Messenger_Black_F", "B_Messenger_Coyote_F"]; _authorizedMediumBag = selectRandom ["B_Kitbag_sgg", "B_TacticalPack_ocamo"]; _authorizedLargeBag = selectRandom ["B_Carryall_cbr", "B_Carryall_taiga_F"]; sleep 0.5; // equipment common to all _unit linkItem "ItemWatch"; _unit addItemToUniform "FirstAidKit"; /* nvgs not used for FIA // _giveNVGs = sunOrMoon; // if (_giveNVGs < 1) then {_unit linkItem "NVGoggles_OPFOR";}; // if (_giveNVGs > 1) then {_unit addGoggles _authorizedEyePro}; // _unit assignItem 'acc_flashlight'; */ // basic weapons _Gweapon = selectRandom [ "arifle_AKM_F", "arifle_AKS_F", "arifle_AK12U_F", "arifle_CTAR_blk_F" ]; _Gbeltfed = selectRandom [ "LMG_03_F", "arifle_RPK12_F" ]; /* test with a small team first to get a feel for the vibe I_G_Soldier_F - rifle I_G_Soldier_TL_F - team lead I_G_Soldier_AR_F - auto I_G_Soldier_A_F - ammo bearer I_G_Soldier_GL_F - grenadier I_G_Soldier_SL_F - squad leader */ // second chance for clothes if ((uniform _unit) == "") then {_unit forceAddUniform _uniforms}; sleep 0.5; // class specific switch _side do { case independent: { switch _unitType do { case "I_G_Soldier_F": { [_unit, _Gweapon , 6] call BIS_fnc_addWeapon; _unit addItemToVest "HandGrenade"; }; case "I_G_Soldier_TL_F": { [_unit, _Gweapon , 4] call BIS_fnc_addWeapon; _unit linkItem "ItemRadio"; _unit addItemToVest "HandGrenade"; _unit addItemToVest "SmokeShellYellow"; }; case "I_G_Soldier_AR_F": { [_unit, _Gbeltfed, 5] call BIS_fnc_addWeapon; _unit addBackPack _authorizedSmallBag; _unit addItemToVest "HandGrenade"; }; case "I_G_Soldier_A_F": { [_unit, _Gweapon , 4] call BIS_fnc_addWeapon; _unit addBackPack _authorizedLargeBag; _unit addItemToVest "HandGrenade"; _unit addItemToBackpack "SmokeShellYellow"; for "_i" from 1 to 2 do {_unit addItemToBackpack "Chemlight_yellow";}; for "_i" from 1 to 2 do {_unit addItemToBackpack "HandGrenade";}; for "_i" from 1 to 3 do {_unit addItemToBackpack "30Rnd_762x39_Mag_F";}; for "_i" from 1 to 3 do {_unit addItemToBackpack "30Rnd_762x39_Mag_Green_F";}; for "_i" from 1 to 3 do {_unit addItemToBackpack "75Rnd_762x39_Mag_F";}; for "_i" from 1 to 3 do {_unit addItemToBackpack "75Rnd_762x39_Mag_Tracer_F";}; for "_i" from 1 to 3 do {_unit addItemToBackpack "200Rnd_556x45_Box_F";}; for "_i" from 1 to 3 do {_unit addItemToBackpack "30Rnd_580x42_Mag_Tracer_F";}; }; case "I_G_Soldier_SL_F": { _unit forceAddUniform "U_IG_leader"; _unit addVest _leaderVest; _unit addWeapon "Binocular"; _unit linkItem "ItemMap"; _unit linkItem "ItemRadio"; _unit addItemToVest "HandGrenade"; _unit addItemToVest "SmokeShellYellow"; [_unit, _Gweapon , 4] call BIS_fnc_addWeapon; }; case "I_G_Soldier_GL_F": { _40mm = selectRandom [ "V_HarnessOGL_gry", "V_HarnessOGL_brn", "V_HarnessOGL_ghex_F" ]; _unit addVest _40mm; [_unit, "arifle_CTAR_GL_blk_F", 4] call BIS_fnc_addWeapon; _unit addPrimaryWeaponItem "1Rnd_HE_Grenade_shell"; for "_i" from 1 to 6 do {_unit addItemToVest "1Rnd_HE_Grenade_shell";}; }; case "SOMECLASS": { }; case "SOMECLASS": { }; case "SOMECLASS": { }; default {}; }; }; }; /* you could add weapon lights at night _giveLights = sunOrMoon; if (_giveLights < 1) then {_unit addPrimaryWeaponItem "acc_flashlight"; removeGoggles _unit}; */
  3. Raider_18

    How to turn init code in to a script?

    Holy smokes, event handlers... of course. It was one of those situations where you stare at the same code/script for 2 days and it just melts your brain and you forget about simple things. Thanks for the wake up pierremgi! Still not working though. I have the set up like yours as I agree that an EH is better for the goal, but it still changes all units whenever an entity is created. Should I use _x setVariable on them somehow? Although I tried that many ways already with no luck init.sqf private _mapUnits = allUnits select {!isPlayer _x}; {[_x] call CB_fnc_factionConfig;} forEach _mapUnits; uiSleep 1; addMissionEventHandler ["EntityCreated", { params ["_entity"]; if (_entity isKindOf "CAManBase") then {[_entity] call CB_fnc_factionConfig;}; }]; When I spawn a unit(s) every one in the world gets the function applied again, except player and dead bodies. How would I exclude those previous units and only run it on newly spawned/created? fn_factionConfig.sqf // handles private _unit = _this select 0; if (isPlayer _unit) exitWith {}; // all get naked removeAllWeapons _unit; removeAllItems _unit; removeAllAssignedItems _unit; removeUniform _unit; removeVest _unit; removeBackpack _unit; removeHeadgear _unit; removeGoggles _unit; _unit unlinkItem hmd _unit; /* Factions can be one of the following West: "BLU_F" (NATO), "BLU_G_F" (FIA), "BLU_CTRG_F" (NATO CTRG), BLU_GEN_F (POLICE) East: "OPF_F" (CSAT), "OPF_G_F" (FIA), "OPF_T_F" (CSAT Tanoa) Guer: "IND_F" (AAF), "IND_G_F" (FIA), "IND_C_F" (SYNDIKAT Tanoa) Civ: "CIV_F" (Civilians) */ { if (faction _x isEqualTo 'BLU_F' && _x IsKindof 'Man') then {[_x] execVM 'scripts\loadouts\BLUFOR\NATO.sqf';} else {if (faction _x isEqualTo 'BLU_F') then {{[_x] execVM 'scripts\loadouts\BLUFOR\NATO.sqf'} forEach crew _x};}; } forEach allUnits; Im thinking I need to add these into some exclusion array that I could use instead of allUnits at the end but I am not sure of how. For some clarity, the function should essentially re-dress any spawned unit via my function CB_fnc_factionConfig. In there it takes side and faction into account and executes a loadout from other scripts that have switch/case/do for assigned classnames.
  4. Raider_18

    How to turn init code in to a script?

    Hey guys, trying to use parts of this for a function that changes the loadout of AI when they are spawned in, problem is I cant get the units that have already been changed to be excluded. Im trying to append and use the set/get variable but its changing all the units everytime. I think it's a scope issue? What do you guys think? my init.sqf: // detect and change all units on map private _units = allUnits select {!isPlayer _x && { alive _x } && !(_x getVariable ["CB_VAR_PAINTED",false])}; { [_x] spawn CB_fnc_factionConfig; _x setVariable ["CB_VAR_PAINTED",true,true]; } forEach _units; uiSleep 1; CB_CHECK_UNITS = true; private _checkedUnits = allUnits; while {CB_CHECK_UNITS} do { // this variable will contain any new units that were not included on a previous loop _NewUnits = []; // Remove checked Units from the updated Unit array to create a list of new Units _NewUnits = allUnits - _checkedUnits; // Now only do the following if there are new units found. if (count _NewUnits > 0) then { { if (side _x isEqualTo WEST && _x IsKindof 'Man') then {[_x] spawn CB_fnc_factionConfig} else {if (side _x isEqualTo WEST) then {{[_x] call CB_fnc_factionConfig} forEach crew _x};}; _x setVariable ["CB_VAR_PAINTED",true,true]; } forEach _NewUnits; _checkedUnits append _NewUnits; }; hint composeText [parsetext format["<t size='1.5' align='left' color='#ffffff'>There are <t color='#00ff00'>%1 <t color='#ffffff'>new units found and <t color='#ff0000'>%2 <t color='#ffffff'>Checked Units",count _NewUnits,count _checkedUnits]];// Debug sleep 30; };
  5. It seems that messing around with https://community.bistudio.com/wiki/setVariable https://community.bistudio.com/wiki/getVariable is likely the best way forward
  6. @SoldierXXX - Many Thanks!! I knew it was something simple, and thank you for throwing in the debug stuff thats really useful. 👍🏻
  7. This is going to be a stupid easy question to answer, I know this is a very simple thing to do, but, I cannot figure this out. I have a trigger placed in editor, it is a 'restricted area'. When the player enters it runs my restricted area function. It will eventually be awesome, but first I need to pass parameters from the trigger to the script to define some things, because there will be multiple areas with different owners and be different sizes etc. So, my question is, how in the heck do I return triggerArea inside of the script from the trigger that exec'd it?? On Act: [independent, false] execvm "restricted.sqf"; restricted.sqf /* bunch of debug stuff here dont worry */ // variables _faction = _this select 0; _sendQRF = _this select 1; _zone = _this; _guards = units inAreaArray _zone select {side _x == _faction}; _bodies = allDead inAreaArray _zone; /* more awesome stuff later after I figure out triggerArea */ You see _zone needs to be the triggerArea, and the _guards are the AI inside the triggerArea (of the corresponding side). Once I figure out how to define these variables all my other code will work and I can place down a bunch of restriced areas and just pass the owner params. But I cant get a return of guards or deadBodies in the dang triggerArea. This is as close as I know how to tell the script that _zone should be the triggerArea of the editor placed trigger whatever size it may be. I have also tried the following: *_zone = _thisTrigger *_zone = _thisList *[independent, thisTrigger, false] execvm "restricted.sqf"; with _zone = _this select 1; None of the above works, keep getting syntax errors about arrays and elements provided. And yes, I have read the wiki and searched the interent for a similar script/solution. Please dont reply with the wiki pages and just tell me to 'read the wiki'. If I understood how to write C code or interpret the generous documentation that is published by Bohemia I wouldnt be posting in the forums for help. I have read and tried to the best of my scripting knowledge from the following: https://community.bistudio.com/wiki/triggerArea https://community.bistudio.com/wiki/inArea https://community.bistudio.com/wiki/inAreaArray https://community.bistudio.com/wiki/Magic_Variables Thank you to anyone who can help 👍
  8. Im learning so much about FSMs, so useful! I got conversations working but how would you make the pushback comments happen one at a time in order? For example: This is how the first menu entry is created: _nul = BIS_convMenu pushBack ["Say Hello.", _topic, "intro_greeting", []]; And this needs to be a secondary response added later: _nul = BIS_convMenu pushBack ["Yes, sorry", _topic, "exit_apologize", []]; I have it inside of an IF THEN like the example you provided: if (_this kbWasSaid [_from, _topic, "first_response", 999999]) then { _nul = BIS_convMenu pushBack ["Yes, sorry", _topic, "exit_apologize", []]; }; However both options are shown in the menu from the start regardless, and the response should come after a sentence from the NPC, like a natural conversation. I have tried the BI Switch-Case-Do format as well but does not seem to work when I arrange it like such: switch (_sentenceId) do { case "first_response": { BIS_convMenu pushBack ["Yes, sorry", _topic, "exit_apologize", []]; }; }; Any reason you see why the option is not waiting for the correct response before showing up in BIS_convMenu?? Thanks alot I have learned a ton so far!
  9. Do you use the Arma tools FSM editor or is there another preference for FSM editing??
  10. You absolute madman! THANK YOU!!! Your way looks super clean and is exactly what I needed, I am about to deep dive the example and start learning, but it looks way easier than I thought so far. And as always you went above and beyond with an example mission. You da man! **Will update this thread after I get something hashed out from scratch after reverse engineering it**
  11. Dang, sorry! I use those commands exactly how you have them written above for all my scripted triggers and they work for me, hard to know what's wrong without knowing what error or what the scenario looks like. If you wanted to end the mission fromt that trigger you could also put that in the onAct statement field like such: trgName setTriggerStatements ["this", "['task5','FAILED'] call BIS_fnc_taskSetState; 'yourEnding' call BIS_fnc_endMission;", ""]; after the condition block "This", the second "" block is the onAct portion of the trigger. so here you can see it is your failed task and the end mission fnc that you have probably already defined. Works for me at least! I think the BIS_fnc's are always best because your calling or spawning them from the game config so its fast and will work every single time.
  12. Raider_18

    In game conversation question

    @Larrow Hey Larrow, long time fan first time poster lol I came across this post while scouring for help with this subject, would you mind taking a glance? Many thanks! @interectic I have also started a little project for the SP crowd, and information delivery to the player is a vital design component in SP. So if you take a look at my post that's hopefully going to be something really cool and easy to use once a script doctor helps me. And some text-to-speech software for voice acting. But personally I think the Apex subtitles (BIS_fnc_EXP_camp_playSubtitles) are the best if your going to be using them, as well as the hold actions. They also give you more editing options
  13. Hey kiba, It looks like your already using 2D pos, Cfg stuff in description, and spawning groups successfully so I would suggest you script the trigger as well if that seems scenario appropriate: private _position = [2D position where you need the trigger] private _someName = createTrigger ["EmptyDetector", _position]; _someName setTriggerArea [50, 50, 50, false]; _someName setTriggerType "NONE"; _someName setTriggerActivation ["EAST", "PRESENT", false]; _someName setTriggerStatements ["this", "['task5','FAILED'] call BIS_fnc_taskSetState;", ""]; That should work Correction: if you needed it 20x30x10 _someName setTriggerArea [20, 30, 10, false];
  14. What's up Arma community! Throwing this out there because I am terrible at this and stuck with getting a conversation scripted. Below all the posted scripts I describe how I am currently experimenting with it What I am trying to do is get an interactive conversation flow between the player and an NPC with the scroll menu and different response options, like in Arma 2. BI has a pretty decent conversations page for this exact subject, with lip synch and all, I have copied it and made only minor tweaks to make it more readable for myself, and for my sound files to play. The example mission is here if someone who knows this stuff wants to take a look or if someone wants a good starting point for conversations in their scenario ----> Google drive example mission What works - I have kbTell working fine, so I know the code and folder set ups are ok, and my sound files play just fine. What is the problem? - when using kbAddTopic nothing! No errors!, no RPT log suspects, no stuttering... but also no functionality 😔. It must be something I am doing wrong but I cannot for the life of me debug it or figure out why. So here we are. It would be super cool to have AI conversations with player choices, especially for the SP crowd My directory - kb --------------- folder with bikb and sqf sounds ----------- folder with a few test samples in .ogg that are confirmed 100% to work in game description.ext mission.sqm Scripts - Description.ext class CfgSentences { class event1 { class talk { file = "kb\talk.bikb"; #include "kb\talk.bikb" // avoids a double declaration }; }; }; kb\talk.bikb class Sentences { class sentence1 { text = ""; textPlain = "Shuuuush"; speech[] = { "\sounds\officer_intro_1.ogg" }; class Arguments {}; actor = "officer" }; class sentence2 { text = ""; textPlain = "Go Away"; speech[] = { "\sounds\officer_intro_2.ogg" }; class Arguments {}; actor = "officer" }; // these sentences are EH options for later class response{ text = "response"; speech[] = { "\sounds\squelch.ogg" }; class Arguments {}; actor = nomad; }; class option1 { text = "op1"; speech[] = { "\sounds\squelch.ogg" }; class Arguments {}; actor = nomad; }; class option2 { text = "op2"; speech[] = { "\sounds\squelch.ogg" }; class Arguments {}; actor = nomad; }; class option3 { text = "op3"; speech[] = { "\sounds\squelch.ogg" }; class Arguments {}; actor = nomad; }; // the Interrupted sentence triggered when the conversation menu is closed without answering (e.g using backspace) class Interrupted { text = "SideChat text"; speech[] = { "\sounds\officer_intro_3" }; class Arguments {}; actor = "officer"; }; }; // Needed parameters. class Arguments {}; class Special {}; startWithVocal[] = { hour }; startWithConsonant[] = { europe, university }; kb\talk.sqf I am also not entirely sure how this one works, I am somewhat scripting literate (after so many hours trial and error) but I don't know if I should replace all the private _variables with the planned interlocuters or...??? that cant be right can it?, idk!? 😟 /* -------BI notes I kept-------- here we will be storing all the sentences from which the player will choose (left side menu) if there is only one option in the array, the sentence will replace the "Talk to" action name we want the player to be able to approach his buddy and talk to him via the action menu. we need to check: if the player is pointing at his buddy if the player is not answering any of his buddy's sentences if the player has not told him hello already then we add that array to _convMenu - the parameters are mostly self-explanatory: ------BI Params--------------- (do these have to be replaced?) _this: Object - the player receiving the sentence. Must have had this particular script assigned via kbAddTopic Player, AI player talking with or both?? _from: Object - the unit that told the sentence _sentenceId: String - the sentence the player is reacting to. Defined in .bikb in class Sentences _topic: String - topic name used in kbAddTopic */ private _convMenu = []; if (_from == officer && _sentenceId == "" && !(_this kbWasSaid [_from, _topic, "sentence1", 999999])) then { _convMenu pushBack ["menu text", _topic, "sentence1", []]; }; // here we make the unit say the proper sentence based on the one he just received // switch-case-do is used here but it is only one solution to manage sentences (if-then etc could do) switch (_sentenceId) do { case "sentence1": { _this kbTell [_from, _topic, "a player response?"]; }; case "sentence2": { _this kbTell [_from, _topic, "????"]; }; case "responses": { // the player will have 3 answers to choose from: _convMenu pushBack ["op1", _topic, "option1", []]; _convMenu pushBack ["op2", _topic, "option2", []]; _convMenu pushBack ["op3", _topic, "option3", []]; }; }; // return the sentence list pool _convMenu; the above is kind of hard for me to make sense of honestly with all the scopes and the switch-case-do wizardry. I have the player named nomad and a BLUFOR AI named officer. I have two triggers one for kbTell and one for BIS_fnc_kbAddTopic When I trigger kbTell all is good, would be great if you only needed to fire off some sentences and be done. ["the topic", "Cfg of topic"] spawn BIS_fnc_kbTell - no issues all is good But with kbAddTopic no such luck here using the following on player only, officer only, both, as objects or as strings, and for any of the methods below: X kbAddTopic ["myTest", "kb\talk.bikb", "kb\talk.sqf"]; X kbAddTopic ["myTest", "kb\talk.bikb"]; X kbAddTopic ["myTest", "kb\talk.bikb", "compile preprocessFileLineNumbers "kb\talk.sqf"]; what I mean by X --> (player, nomad, officer, with and without"") from trigger, from unit init, from a script. Nothing Again no errors or anything to start chipping away at like usual. Here are the resources I have already tried and poured many hours over: Conversations official Biki, 99% of what I have is from the source already, read many times over kbAddTopic Jezuro's old posting HateDead's old posting IndeedPete's pretty cool conversation system that I may just have to adopt if I cant figure this out. Also where I got the sample sound files. Youtube, but kind of like the BI fourm threads a lot of the stuff is outdated Google of course Prayer and hope Anything you guys have would be MUCH appreciated. Thank you so much!
×