Jump to content

Justin Bowes

Member
  • Content Count

    8
  • Joined

  • Last visited

  • Medals

Community Reputation

1 Neutral

About Justin Bowes

  • Rank
    Private

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thanks... But I must ask for the sake of asking, wouldn't it just be easier to copy and paste a loadout from an existing unit? I find that the names of each loadout item can be kinda elusive sometimes and very confusing... and I'm by no means experienced in this category...
  2. My code is now: (full script) Params ["_unit"]; _unit = _this # 0; if (random 1 < 0.8) then { _unit setUnitLoadout (getUnitLoadout basic); } else { _unit setUnitLoadout (getUnitLoadout elite); };
  3. Yeah I changed my array to copy and paste loadout from another unit I placed 22 kilometers across the map. And yes, I do have "basic" and "elite" units in-game. Also, I only used ChatGPT for the original code because it was a much more rapid way to get an original feal for what I was working with. (responding to Maff)
  4. I tried your code, and it gave me several undefined errors. My code editor doesn't like it, and neither does Arma. "Value of private variable '_unit' is never used." also, my code editor recommends I remove the parenthesis around the "getunitloadout" commands saying that "parenthesis can be safely removed (altho i'm not sure if this is just a fluke so ill take your word for it)" Also, "global variable 'basic' is never assigned in this file." Also, "global variable 'elite' is never assigned in this file." Those are just the errors from my text editor, but arma seams to completely disregard that and give me 8109 error messages of its own. I'm sure you know what I mean. (responding to JCataclisma)
  5. My new code currently reflects this: Params ["_unit"]; ["_unit"] = _this select 0; if (random 1 < 0.8) then { _unit setUnitLoadout getUnitLoadout basic; } else { _unit setUnitLoadout getUnitLoadout elite; }; I'm currently getting errors with having not defined "basic" or "elite" variables, and also I'm apparently missing a ; on line 2 which seams like a load of arma 3 bull crap to me. Nevertheless, If it won't function, it won't function, and I need to fix the code regardless. Again, I'm sure there's something like six rookie mistakes I made with formatting in this script, so point that out if you see it.
  6. Good idea, JCataclisma I'm going to do that because apparently: And I do not currently want to learn the code names of every single object and how to do it right. This is a bit easier.
  7. So, I've done that in previous versions. Should I still add it, in addition to the "private _unit = _this select 0;" ABOVE it, or replace it? Or what?
  8. I'm new to Arma scripting. I've been using ChatGPT 4o to generate code (after having it research the language of Arma), then using my limited knowledge on the language of Arma to try to repair various problems. Since ChatGPT seams to have hit a wall with its ability to help me, and it keeps repeating like a skipping record that I need to double check my code is actually correct, I decided perhaps experienced (human) scripters would immediately see the issue, diagnose the solution, and then kindly and comprehensively explain what was going wrong and how to fix it. I'm eager to learn more about coding, but you may need to break things down into laymen's terms. If you respond to this, Thank you so much for trying to help me in advance. A bit of background on what I'm trying to accomplish: I have a bunch of terrorist riflemen. I want to make it to where, on mission start, there is a 80% chance that they spawn with a "basic Rifleman" loadout and a 20% chance that they spawn with a "elite rifleman" loadout. I tried getting it to work with specified variable names, but eventually figured out that I can design the code so any unit with the initiation script in its Init field can have the script applied to them. It still doesn't work, despite my code editor (Visual Studio Code) not finding any errors with the script itself. Arma 3 seams to be very stingy about "defining" variables, and I can't seam to fix it no matter what I do. PLEASE HELP ME!!! I have been frustratedly working on this for almost 2 weeks now, working on it almost 2 hours a day, and I'm not getting anywhere. The script itself: Initiated by the init field of each affected unit: [this] execVM "EliteOrNot.sqf"; private _basicLoadout = [ //Defines what should be in _basicLoadout variable ["arifle_AKM_F", "", "", ["30Rnd_762x39_Mag_F", 30], [], ""], [], [], ["Binocular", [], "", "", [], ""], ["U_I_C_Soldier_Bandit_4_F", [ "FirstAidKit", "30Rnd_762x39_Mag_F", "30Rnd_762x39_Mag_F" ]], ["V_BandollierB_blk", [ "HandGrenade", "30Rnd_762x39_Mag_F", "30Rnd_762x39_Mag_F", "30Rnd_762x39_Mag_F", "ACE_CTS9" ]], ["B_Messenger_Black_F", [ "ACE_fieldDressing", "ACE_quikclot", "ACE_quikclot", "ACE_elasticBandage", "ACE_elasticBandage", "ACE_elasticBandage", "ACE_EarPlugs", "ACE_morphine", "ACE_splint", "ACE_splint", "ACE_tourniquet", "kat_EACA", "30Rnd_762x39_Mag_F" ]], ["H_Bandanna_gry", "G_Balaclava_blk"], ["ItemMap", "ItemCompass", "ItemWatch", "ItemRadio", "ItemGPS"], [], "", ["male01per"], [], [] ]; private _eliteLoadout = [ //Defines what should be in the _eliteLoadout Variable ["arifle_AK12_F", "", "", ["30Rnd_762x39_AK12_Mag_F", 30], [], ""], ["hgun_Rook40_F", "", "", ["16Rnd_9x21_Mag", 16], [], ""], [], ["Binocular", [], "", "", [], ""], ["U_C_E_LooterJacket_01_F", [ "ACE_fieldDressing", "ACE_packingBandage", "ACE_morphine", "ACE_tourniquet", "30Rnd_762x39_AK12_Mag_F", "16Rnd_9x21_Mag" ]], ["V_PlateCarrier2_blk", [ "HandGrenade", "HandGrenade", "30Rnd_762x39_AK12_Mag_F", "30Rnd_762x39_AK12_Mag_F", "30Rnd_762x39_AK12_Mag_F", "30Rnd_762x39_AK12_Mag_F", "16Rnd_9x21_Mag", "16Rnd_9x21_Mag" ]], ["B_LegStrapBag_coyote_F", [ "ACE_fieldDressing", "ACE_fieldDressing", "ACE_quikclot", "ACE_quikclot", "ACE_elasticBandage", "ACE_elasticBandage", "kat_chestSeal", "ACE_EarPlugs", "ACE_epinephrine", "ACE_morphine", "ACE_splint", "ACE_tourniquet", "ACE_tourniquet" ]], ["H_PASGT_basic_black_F", "G_Bandanna_beast"], ["ItemMap", "ItemCompass", "ItemWatch", "ItemRadio", "ItemGPS"], [], "", ["male02per"], [], [] ]; if (random 1 < 0.8) then { //80% chance _unit setUnitLoadout _basicLoadout; //affected unit sets loadout as "basic" } else { //If this does not happen, then _unit setUnitLoadout _eliteLoadout; //affected unit sets loadout as "elite" }; //End Function I don't know how much context you need to understand any of this, but I did my best to give EVERY DETAIL I could possible give you because I'm used to working with AI, which requires as much specification as possible to function correctly. If I over-informed you, I'm sorry, and thank you for being patient with this. Again, thank you so much for your advice in advance. I know that if your responding to this forum, you either have a similar problem, or you know your way around a code and are searching forums, perhaps bored, looking for challenges to conquer. Either way, any information you want to contribute to this forum, please do, regardless of why you are viewing this thread. Thank you and thank you again!
×