Search the Community
Showing results for tags 'help!'.
Found 3 results
-
scripting Help! My script should be working! Various errors with "variable undefined"
Justin Bowes posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
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!- 15 replies
-
- errors
- new to scripting
-
(and 1 more)
Tagged with:
-
Is it possible to process a file that is outside the pbo of a mission and instead is located on a server? maybe something like this?????? initServer.sqf if (! isServer ) exitWith { Myprocess = call compile preprocessFileLineNumbers "Server\File.sqf"; };
-
3rd Person Script, Kick player if they press numpad enter more than 3 times?
Sokoloft posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello, I found this script at armahaulic = www.armaholic.com/page.php?id=26369 With a minute amount of editing, I made it do what I want, which is just force first person on the player. // Author - Sokoloft & Rodeostar42 @ www.armaholic.com/page.php?id=26369 //3rdPersonView.sqf if (!isDedicated) then { waitUntil {!isNull (findDisplay 46)}; if( (difficultyOption "thirdPersonView")isEqualTo 0) then { while {true} do {}; }; if( (difficultyOption "thirdPersonView")isEqualTo 1) then { while {true} do { waitUntil {cameraView == "EXTERNAL" || cameraView == "GROUP"}; if (((vehicle player) == player) && (speed ( player)) >= 0) then { player switchCamera "INTERNAL"; }; sleep 0.1; }; }; }; How would I go about making it to were the player is kicked after numpad enter is hit more than 3 times. As well as in between, is given a warning via side chat, so people in server can shame the person, as well as it should have the persons name. So: %PlayerName% has tried to enter third person, stop now or you will be kicked! %PlayerName% has tried to enter third person, last chance, stop now! %PlayerName% has tried to enter third person, for the last time, and will now be kicked! As well as the only reason why I want to do this is because if you run, and spam enter, you can slightly get into third person for a second. This is really not a problem, since my mission is vs AI, however if a player decided to spam it, they can slow down the server quite a bit since the script is being done every time they hit numpad enter. As well as there needs to be a grace for players in vehicles, so that they can still go into third person and not be kicked. But not spam it at the same time! Any info would be helpful as I don't know what I'm doing xD- 13 replies