Search the Community
Showing results for tags 'new to scripting'.
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:
-
First, some info for context: 1) I'm a scripting Noob and this is being made because of the noob perspective I hope to out grow but wish to utilize. 2) This forum is filled with incredibly talented and knowledgable people. Keep in mind many people reading these have no education at all in the subject and dont understand your explanations due to a lack of vocabulary. Now that that's out of the way! I've been browsing topics here for awhile and there are many introduction and tutorial threads available. However, as many of you may remember with your first time learning, a lot of vital information falls through the cracks that later become insurmountable obstacles filled with frustration. So I thought I'd provide the mind melting eureka information I got that solved many of my problems and hope you guys will to. Comment information, hints, and links to things most noobs miss or need to know before attempting a script of any kind. Heres mine: - Theres a huge difference between how mission editing and scripting needs to be organized and utilized between SinglePlayer amd MultiPlayer. Read this if you want to know more about multiplayer scripting (https://community.bistudio.com/wiki/Multiplayer_Scripting) read this entire page start to finish and navigate hyperlinks to anything that's sus this will explain why you'll see 3 different explanations for the same problem and none of them are working for you because you dont know what a description.ext file is. - Arma3 has undergone updates to its scripting ( or it appears so) some functions you'll see being recommended to you from a youtube video from 2014 may not apply to the version you are using. This applies to the Eden editor and previous editors as well. Usually theres a link to new versions in and explanations to what changed in that functions wiki page. - You have to make your own sqf files. When you launch a mission the game will search for specific files. By naming you file that same title it will load that file in place of. Basically, its asking for butter and a song as you've labeled it butter, its gunna use it like butter. Learn all you sqf file names in the wiki. - If your using Notepad ++ there are plugins. for sqf file type that highlights relevant. variables the way you see everyone else's in videos. - half the battle is speaking the language. So click on every hyperlink presented to you and read it whether it makes sense or not. Sometimes it takes a single page to tie everything together. More experienced people please comment your own below, feel free to criticize anything I've said above, I'm also a noob. I know there is another thread for noobs (I've read it a million times believe me, I just want more posts just like it for the monkey brain level questions I have)
-
beginner [BEGINNER] Whitelist Different people to many Different Slots?
Vesturo posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello Scriptgods! I am Currently Working on a MilitaryRP server and i never scripted anything before, i always used premade scripts for missions so i am still learning it.... I have many slots that should only be aviable for special people but i can't figure out how to realise that properly... i found some solutions here but these never say how to make different slots whitelist only. it's about the following slots: Does anybody here maybe have a solution for me or a hint in what direction i need to go? struggeling with that since the beginning of my project to be honest. Cheers, Vesturo