Jump to content

beno_83au

Member
  • Content Count

    1880
  • Joined

  • Last visited

  • Medals

Everything posted by beno_83au

  1. _handle = [] spawn { while {true} do { //code sleep 1; }; }; https://community.bistudio.com/wiki/spawn and https://community.bistudio.com/wiki/while are what you need. But you'd be better off giving the AI a waypoint (one of the types that never completes) and moving the waypoint's position every 30 seconds or so.
  2. Yes, synching the trigger with the module will control it's activation. Just make sure the trigger activates properly, e.g. Any Player Present, but you can always use more advanced conditions with it.
  3. beno_83au

    Confusion With reloadTime

    Excellent, thanks. Obviously, I was just going from the main class.
  4. I would imagine that Sarogahtyp could do the same thing and show it working as he's described, so you showing a video of working code not working for you probably won't change much. I don't think there's any doubt from anyone here that you're not getting the result you want. The issue is that you're not getting that result with code that works. Try starting a fresh scenario, no mods, and just get in and see how it runs from the debug console.
  5. beno_83au

    Help with Custom Loadout

    I generally do what @Smart Games has suggested for random loadouts. Once you get it set up it's incredibly easy to move from one mission to another, or swap classnames in and out. Plus, you can apply it to any number of units, whenever you need it. The only way I do it differently is to declare all the loadouts in a separate .sqf and save them into public variable, and sometimes use predefined loadout sets. For example, below the MIL_EasterEgg is a predefined set and the rest is just like Smart Games has done (MIL_EasterEgg uses setUnitLoadout in the spawn script). opForLoadouts.sqf MIL_EasterEgg = [ ["sgun_HunterShotgun_01_sawedoff_F","","","",["2Rnd_12Gauge_Pellets",2],[],""], [], ["hgun_Pistol_heavy_02_F","","","",["6Rnd_45ACP_Cylinder",6],[],""], ["U_C_Uniform_Scientist_02_F",[["FirstAidKit",2]]], ["rhs_vest_commander",[["2Rnd_12Gauge_Pellets",4,2],["6Rnd_45ACP_Cylinder",3,6]]], ["B_CombinationUnitRespirator_01_F",[["Chemlight_blue",2,1],["Chemlight_green",2,1],["Chemlight_red",2,1],["Chemlight_yellow",2,1]]], "H_Hat_Tinfoil_F","G_Blindfold_01_white_F", [], ["ItemMap","ItemGPS","ItemRadio","ItemCompass","ItemWatch",""] ]; MIL_EasterEggAvailable = true; MIL_Uniforms = ["U_OrestesBody","U_Marshal","U_C_Poor_1","U_I_C_Soldier_Bandit_2_F","U_I_C_Soldier_Bandit_5_F","U_I_C_Soldier_Bandit_3_F","U_I_C_Soldier_Para_5_F","U_C_Man_casual_6_F","U_C_Man_casual_4_F","U_C_Man_casual_5_F","U_C_E_LooterJacket_01_F","U_I_L_Uniform_01_tshirt_black_F","U_I_L_Uniform_01_tshirt_skull_F","U_I_L_Uniform_01_tshirt_sport_F","U_C_Uniform_Scientist_02_formal_F","U_O_R_Gorka_01_black_F","U_C_Mechanic_01_F"]; MIL_Webbing = ["V_TacVestIR_blk","V_Chestrig_rgr","V_HarnessO_brn","V_BandollierB_cbr","rhs_vydra_3m","rhsusf_iotv_ocp","rhsusf_mbav","rhsusf_plateframe_sapi","rhsusf_spcs_ucp","rhs_6b5_khaki","rhsgref_alice_webbing","V_LegStrapBag_olive_F","V_Rangemaster_belt","V_Press_F","V_SmershVest_01_F","V_CarrierRigKBT_01_EAF_F","rhs_6sh46","V_Pocketed_coyote_F"]; MIL_Packs = ["B_AssaultPack_blk","rhsusf_assault_eagleaiii_coy","B_FieldPack_ghex_F","B_Kitbag_rgr","B_Messenger_Gray_F","rhs_sidor","B_TacticalPack_mcamo"]; MIL_Primaries = [["rhs_weap_ak104_zenitco01_b33","rhs_acc_pgs64","rhs_30Rnd_762x39mm_polymer",true],["rhs_weap_ak105_zenitco01_b33","rhs_acc_pgs64","rhs_30Rnd_545x39_7N10_AK",true],["rhs_weap_ak74","rhs_acc_dtk1983","rhs_30Rnd_545x39_7N6M_AK",false],["rhs_weap_ak74n","rhs_acc_dtk1983","rhs_30Rnd_545x39_7N6M_AK",false],["rhs_weap_akm","rhs_acc_dtkakm","rhs_30Rnd_762x39mm_bakelite",false],["rhs_weap_akms","rhs_acc_dtkakm","rhs_30Rnd_762x39mm_bakelite",false],["rhs_weap_aks74","rhs_acc_dtk1983","rhs_30Rnd_545x39_7N6M_AK",false],["rhs_weap_aks74u","rhs_acc_dtk1983","rhs_30Rnd_545x39_7N6M_AK",false],["rhs_weap_m14_rail_wd","","rhsusf_20Rnd_762x51_m80_Mag",true],["rhs_weap_m16a4_carryhandle","","rhs_mag_30Rnd_556x45_M855A1_Stanag",false],["rhs_weap_m24sws_d","","rhsusf_5Rnd_762x51_m118_special_Mag",true],["rhs_weap_m4","","rhs_mag_30Rnd_556x45_M855A1_Stanag",true],["rhs_weap_m4a1_carryhandle","","rhs_mag_30Rnd_556x45_M855A1_Stanag",true],["rhs_weap_M590_8RD","","rhsusf_8Rnd_00Buck",false],["rhs_weap_M590_5RD","","rhsusf_5Rnd_00Buck",false],["rhsusf_weap_MP7A2_winter","","rhsusf_mag_40Rnd_46x30_FMJ",true],["rhs_weap_Izh18","","rhsgref_1Rnd_00Buck",false],["rhs_weap_kar98k","","rhsgref_5Rnd_792x57_kar98k",false],["rhs_weap_l1a1_wood","rhsgref_acc_falMuzzle_l1a1","rhs_mag_20Rnd_762x51_m80_fnfal",false],["rhs_weap_m1garand_sa43","","rhsgref_8Rnd_762x63_M2B_M1rifle",false],["rhs_weap_m3a1_specops","","rhsgref_30rnd_1143x23_M1911B_SMG",false],["rhs_weap_m70ab2","","rhs_75Rnd_762x39mm",false],["rhs_weap_m38","","rhsgref_5Rnd_762x54_m38",false],["rhs_weap_MP44","","rhsgref_30Rnd_792x33_SmE_StG",false],["rhs_weap_savz61","","rhsgref_20rnd_765x17_vz61",false],["rhs_weap_g36c","","rhssaf_30rnd_556x45_EPR_G36",true]]; MIL_PrimaryAttachments_Optic = ["rhsusf_acc_ACOG_USMC","rhsusf_acc_EOTECH","rhsusf_acc_eotech_552","rhsusf_acc_compm4","rhsusf_acc_RX01_NoFilter","rhsusf_acc_mrds","rhsusf_acc_mrds_c","rhsusf_acc_RM05","rhsusf_acc_T1_high","rhsusf_acc_T1_low","rhsusf_acc_eotech_xps3"]; MIL_PrimaryAttachments_Grip = ["rhsusf_acc_grip2","rhsusf_acc_grip1","rhsusf_acc_harris_bipod","rhsusf_acc_kac_grip","rhsusf_acc_rvg_blk","rhsusf_acc_rvg_de","rhsusf_acc_tacsac_blue","rhsusf_acc_tdstubby_blk","rhsusf_acc_grip3","rhsusf_acc_grip2","rhsusf_acc_grip1","rhsusf_acc_harris_bipod","rhsusf_acc_kac_grip","rhsusf_acc_rvg_blk","rhsusf_acc_rvg_de","rhsusf_acc_tdstubby_blk","rhsusf_acc_grip3"]; MIL_Secondaries = [["rhs_weap_6p53","rhs_18rnd_9x21mm_7N28"],["rhs_weap_pya","rhs_mag_9x19_17"],["rhs_weap_makarov_pm","rhs_mag_9x18_8_57N181S"],["rhsusf_weap_glock17g4","rhsusf_mag_17Rnd_9x19_JHP"],["rhsusf_weap_m1911a1","rhsusf_mag_7x45acp_MHP"],["rhsusf_weap_m9","rhsusf_mag_15Rnd_9x19_JHP"],["rhs_weap_savz61_folded","rhsgref_20rnd_765x17_vz61"],["rhs_weap_tt33","rhs_mag_762x25_8"],["rhs_weap_type94_new","rhs_mag_6x8mm_mhp"],["rhs_weap_cz99","rhssaf_mag_15Rnd_9x19_FMJ"]]; MIL_Torches = ["rhsusf_acc_M952V","rhsusf_acc_wmx","rhs_acc_2dpZenit_ris","acc_flashlight_pistol"]; MIL_Headgear = ["H_Bandanna_surfer","H_Beret_blk","H_Cap_blu","H_Hat_checker","H_Helmet_Skate","rhs_6b26_green","rhs_altyn_visordown","rhs_beanie_green","rhs_ssh68","rhsusf_opscore_bk","rhsusf_opscore_coy_cover","rhsusf_opscore_fg","rhsusf_opscore_mc","rhsusf_opscore_paint","rhsusf_protech_helmet","rhsgref_helmet_M1_des","rhsgref_helmet_m1940_camo01","rhsgref_hat_m43cap_heer","H_HeadBandage_stained_F","H_HeadBandage_bloody_F"]; MIL_Facewear = ["G_Bandanna_aviator","G_Bandanna_beast","G_Bandanna_blk","G_Bandanna_khk","G_Bandanna_oli","G_Bandanna_shades","G_Bandanna_sport","G_Bandanna_tan","G_AirPurifyingRespirator_02_black_F","G_AirPurifyingRespirator_02_olive_F","G_AirPurifyingRespirator_02_sand_F","G_AirPurifyingRespirator_01_F","G_RegulatorMask_F","rhs_scarf","rhsusf_shemagh2_gogg_grn","rhsusf_shemagh2_gogg_od","rhsusf_shemagh2_gogg_tan","rhsusf_shemagh2_gogg_white"]; { publicVariable _x; } forEach [ "MIL_EasterEgg", "MIL_EasterEggAvailable", "MIL_Uniforms", "MIL_Webbing", "MIL_Packs", "MIL_Primaries", "MIL_PrimaryAttachments_Optic", "MIL_PrimaryAttachments_Grip", "MIL_Secondaries", "MIL_Headgear", "MIL_Facewear" ]; paraFlag setVariable ["MIL_OpForLoadouts_Ready",true];
  6. beno_83au

    Issue with script

    Ok, one last shot. https://community.bistudio.com/wiki/selectRandom is how you use selectRandom, not the way you have here. So, like before, you have to check the commands to see how to use them. Otherwise you will keep making the same mistakes and keep getting nowhere: _sup = selectRandom (allUnits select {side _x == EAST}); systemChat str _sup;
  7. beno_83au

    Issue with script

    It can take a while to wrap your head around some of the different concepts. This is especially true if, like me, you were starting from scratch as someone without any experience in this. And speaking from experience, the best thing you can do is break everything down into it's individual parts and make each step work on it's own, while at the same time understating why it works, generally through relying heavily on the biki. When figuring commands out it's not a bad idea to either hint or systemChat your results: systemChat str (selectRandom (units opfor)); It's a basic one, but apply the idea to the commands you don't understand, or when you get weird results. Maybe even "opfor" turns out to be wrong? Then you check that. Moving on from that method (and only a little more advanced) is the use of the diag_log command. So at the end of the day if A, B, C and D are not working, get A working first. I swear this is only the second edit I've made to this post. But it should also be mentioned that bald people should avoid trying to script the AI, because you'll usually need that hair for pulling it out.
  8. beno_83au

    Issue with script

    Was writing, but pierre covered most of it (I was going to mention there is also selectRandomWeighted). But to reinforce the points already made, the biki should be your #1 reference point for learning how to use the commands and figuring out what is wrong. And, each time you return to the editor you can delete the rpt file to start fresh, then just search "error" and skip down until you're at the first script error.
  9. beno_83au

    Issue with script

    There's still a number of errors in that example. You should be looking at how each command and function works here: https://community.bistudio.com/wiki/Category:Arma_3:_Scripting_Commands https://community.bistudio.com/wiki/Category:Arma_3:_Functions For example, BIS_fnc_enemyTargets returns an array (of enemy units), which you have saved/declared as _targets. But then you try to use _targets with getPosATL which only takes on object, not an array (same idea as with doMove). So you need to work out what you're trying to achieve with that (e.g. are you trying to get just one unit's position?). But you also need to look at what the error is telling you, and you need to read the error report to be sure you get the right info. The on-screen error reports will overlap each other if there is more than one, and in the past I've been guilty of getting stuck on a problem when I didn't realise two errors were overlapping (it is not always obvious). So it's important that you check your error report for the details. And as is the case in your situation, you've only seen the error about the else statement, when there's still another error before that. That's why you check the .rpt and solve the first occurrence of any errors before moving on (as sometimes later errors are fixed when an earlier error is fixed). In the case of the else statement, you've basically written: }; else { Which is incorrect, as the error states, and proper examples are given in the above linked wiki. The exact error report can sometimes be a little misleading, as it is here (I assume), but it is pointing you to the correct area of that specific error and so looking at the command in the wiki will show you why it's throwing an error. Also, not an error, but you can declare EmemPos as a local variable (_EmemPos) throughout this script if it is not being used anywhere else. Not a biggie, but it will save on a small amount of resources if it is only declared locally to the script.
  10. beno_83au

    Issue with script

    The error is because of getPosATL _targets. You're not saving it as a variable or using it as a condition, so it doesn't make any sense. As for the error, I suspect there's more than one error happening here. From a quick glance it seems you haven't defined _targets anywhere, the previous line in question doesn't end with a ; and the following if......then check will fail because _targets isn't defined. You may need to look at your .rpt to see where things are going wrong in the first instance, and solve the issues one at a time.
  11. Yes. The event handler is added to the player and will activate any time they enter a vehicle. There is another event handler, https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#GetIn, that would be used if needing to add it to vehicles themselves. But your case sounds like it'll be best to use getInMan.
  12. beno_83au

    Enemy counter

    @rodrigoglowacki have you tried hintSilent?
  13. You haven't looped your script before the condition, so it'll run once when executed and that's it. But, even if it runs when the player is in the vehicle it'll loop the enableChannel command every frame, forever (while {true} do will never return false). You're better off using a GetInMan event handler though: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#GetInMan Then just run the enableChannel command and wait until the player isn't in the vehicle and disable it again.
  14. beno_83au

    PUID Spawning configuration

    It's been a good while since I've had my head in Exile scripts, but it sounds like it's forcing respawn when the player joins the server. If that's the case then maybe adding a Killed EH in onPlayerRespawn would work. So that the player joins, the get force respawned, then the EH adds itself...... onPlayerRespawn.sqf player addEventHandler ["Killed",{ waitUntil {lifeState player != "DEAD-RESPAWN"}; //code }]; You might need to mess around with the wait condition a little to get it right, but that should be a good start.
  15. Where there is a will, there is (almost) always a way 🙂
  16. https://community.bistudio.com/wiki/deleteAt is a good way to avoid getting the same element from an array. It'll return the removed element for you to use and remove it from the array.
  17. Something like this @Nemanjic?
  18. beno_83au

    [Release] MIL_CAS

    @Dyeg0 Ok, I'm back baby, not that I actually went anywhere. So as Alex Dyre posted (and I'm sure I mentally noted to edit my OP, but then forgot), the module needs to be run from the server. So I'll talk towards that to start with. One of the first lines of the module is: if (!isserver && {local _x} count (objectcurators _logic) == 0) exitwith {}; So that'll exit the module on a dedi server if run from a (non-curator) client. Easy way to get that to work on a dedi is just to do what Alex said (thanks Alex). Just remoteExec it to the server. And to keep it simple and make sure it's working for you, start simple (using a quick copy+paste from Alex's example): _id = player addAction [ "CAS", { private _target = screenToWorld [0.5,0.5]; nul = [[_target,200,"B_Plane_CAS_01_F",0],"MIL_CAS.sqf"] remoteExec ["BIS_fnc_execVM",2]; } ]; Run that from initPlayerLocal.sqf and see how it goes, then expand and see if anything @Harzach mentioned still needs to be addressed.
  19. beno_83au

    Local Variable in Global Space

    Yes, and it'll be easier to work with your script if it starts getting bigger/more complex.
  20. beno_83au

    Local Variable in Global Space

    Yes. As Harzach said, just spawn/call the code yourself from within the trigger's On Activation.
  21. beno_83au

    Banned by Game Developer

    Uhhh, Armaholic was an OFP/Arma site hosting mods/missions/scripts/forums/etc that got dropped by it's owner very recently. Not sure who you think here actually owns that address anymore..... But if another shady gambling site gets shut down then I doubt anyone here will complain. So that'd be helpful if you got that to happen.
  22. While @sarogahtyp makes a point of good practices, I happened to notice this: sage1 KbTell [off,"Balcony","SageLine_1"]; waitUntil { sage1 KbWasSaid [off,"Balcony","SageLine_1"",3]; //double "" }; There was also a "hidden" character in that code, which is sometimes an issue from the forum. So depending on where you got the code, you may want to just write it again from scratch real quick.
  23. beno_83au

    Help on Random Spawn direction

    Well, this is a hell of a necro, but at least it's relevant. So your code is wrong, some bad use of "=" where it shouldn't be. Have a look through the command reference for setDir: https://community.bistudio.com/wiki/Category:Arma_3:_Scripting_Commands
  24. beno_83au

    Local Variable in Global Space

    It's allowed from time to time 🤪 But CBA has had an error related to XEHs -
  25. There's a few ways, but probably the easiest is in the init of each group leader, as you've said. Doing it this way though, you need to define them as global variables: https://community.bistudio.com/wiki/Variables#:~:text=two main scopes%3A-,Global Scope,-A global variable. So just removing the _ from _aiGroup and _playerGroup is enough, as the _ treats them as local (explained in that link). I only used local variables to demonstrate what info needed to go where.
×