I've played Arma 3 for years and I've never been able to get scripting to work for me. I understand the coding language and what everything means but I've never been able to get scripts to work and every time someone tried to explain it or I looked up a tutorial, I'd get totally lost. Then it FINALLY dawned on me that I had to change the file extension itself to a SQF file to have the game even read the script. So, here I am years later dumbfounded that one tiny oversight could cause so much headache
I agree, the learning curve can seem a bit too steep and it takes a while to get some decent results. I'd like to see some statistics on how many people write their own scripts for their missions - I'd guess it's a tiny fraction of the player base.
I need some help with this; I've downloaded the mod "Civilian Occupation System", after following the installation-instructions, i still got a message saying "Script cos\cosinit.sqf not found". What can i do to fix this ? struggling for hours ! :/
just create a Mission in 3d editor,put a Unit Player name it and save the mission. then put all the files from the COS folder into your Mission Folder, Put a Logic game, somwhere in the map, and in the init paste null = [] execVM "cos \ cosInit.sqf"; and play!!
I have no idea what im doing script wise i just wish i could actually create a campaign/scenario missions etc... without having to be excluded from being able to create hostage rescues and so many other kinds also
Are all those files in that folder scripts? All I have in my downloaded mission folders are .PBO files. I don't have any .SQM file in any of my mission folders.
A pbo file is an archive containing the entire mission, something like a zip file. These are the downloaded missions or the ones you are subsribed to in steam workshop. If you make your own missions in the editor and save as "user mission", these will be created as folders with sqm file, and will allow you to place scripts in them as well. Once the custom mission is ready, you have the option to "Export to Single Missions", or "Export to Multiplayer Missions", which packs the folder into .pbo and moves it to the corresponding folder.
Hey mate , would it be possible for you to edit my server mate with some scripts ? I have a gamingdeluxe server on altis epoch and just wanted to get the blackmarket trader and ai missions on there its been pickling my head now for 48 hours on where to put the scripts in folders or such :( if you or anyone else could help me would be awesome man i will surely repay yall :)
hey, i really love your scripting videos, great for newer ppl like me... now, i have a question.. i know how to make airdrops, but how can i make an airdrop only available after a trigger is tripped?
whatever you use to make them, just connect that action to the trigger activation. I think you could appreciate an older video where I talk about triggers, how they are activated and how to use them. ruclips.net/video/xctQHbCDtLY/видео.html There is a section where I talk about conditions and how they work, I have recently gone into further details with a new video dedicated solely to conditions. ruclips.net/video/6HSddREj3_s/видео.html These videos cover triggers and conditions, in other words activating triggers only under a condition (in your case, the trigger itself), so they should be all you need.
ohhh right on, i get what your saying, and thanks alot for the quick response, will check these out, since im here, i also wanted to know how to have one side (bluefor) respawn to base, and opfor respawn to side.. i allready know how to have base respawns as its pretty simple, but i dont know how to have both :( bluefor respawn to "base" and opfor respawn to "side")
Side-specific respawn types can be specified by simply adding "side" to the respawn template line. Using respawn templates instead of the basic 'respawn = number' is highly recommended in this case. You can have a look over here for a short example of the side related template here: community.bistudio.com/wiki/Description.ext#respawnTemplates And a more general talk about respawning mechanics, creating templates and combining them together here. community.bistudio.com/wiki/Arma_3_Respawn I don't think any of my videos talk about these details, so I have to link you to the BIS wiki. Those links contain all you need, and a lot more, if you wish to learn more about respawn mechanics.
oh ok, thx again, yeah, i read these wiki's and am still kinda unshure how to write this :/ some one else pointed me towards event handlers, but i dont know how to do it, if you have the time maby you could write this for me? if not thats ok, thanks again man grate videos m8 keep it up
+Feuerex can you think off hand how to have units respawn to side instead of base, using only the units init line or field? i thought somthing like this would work "this addEventHandler ["KILLED", "(_this select 0) respawn =side"]" but it doesnt work... would love some help
Great Videos! Unfortunately I cant seem to find the text for the scripts...After I used the camera tool, I went back to camera.sqf hit Ctrl+VThis is what I got:["Altis",[8183.14,2819.27,294.194],231.591,0.7,[-11.5152,0],0,0,720.455,0.3,0]
I'm not very sure which steps you followed (as camera creating is clearly unrelated to this video), but it seems to me that you used Splendid camera tool, available in the pause menu of the game. I personally don't use this tool, as it doesn't generate a very nice code, and prefer the function cameraold instead. Camera creating with that function is described over here: ruclips.net/p/PLnxQwP1Iit_ReeucwKV0fO4DUSyEybZi1 you are most interested in part 1 and 2 of intro creating, they are dedicated to cameras only. You might also be interested in this video: ruclips.net/video/7SI1hQPWaCk/видео.html where I explain individual camera commands in depth and create camera shots manually with scripts only - no in-game tools needed.
- make sure you have chosen the right folder for the script. The folder name is missionName.Island, and it is in Documents/arma3/missions. Careful, 3DEN can create a folder named ~missionName.Island, which you don't want to use. - make sure you are calling the script from the mission by a trigger that actually activates, with the right command. - if there's something wrong with a script, the game usually tells you. If the script can't be found, you get an error message, and if it contains any errors, the game should show them as well. These messages can tell you where to look next. - go to your PC settings and 'show known file extensions' to make sure you have an actual .sqf file, and not .sqf.txt. - try to download any simple script or a mission with scripts, and see if they work. If they do, try to change the content of such script to only display hello world. Try to figure out why the other script works and yours doesn't. - come back if you need further assistance.
I have the correct filepath, I triple checked. How do i ensure the trigger activates? And I get no erroe message. I have file extensions shown and it's a .sqf file for certain. and no other scripts seem to work for me but i may be trying to set them up wrong.
From what you described, it seems to me that the main problem is in how scripts are called. Renaming the script to init.sqf is, in some way, a solution, as that one specifically doesn't need to be called by the user. Try the following: - Make a second script .sqf file in the folder where you have your init.sqf and name it like myScript.sqf. - Your mission folder now contains mission.sqm, init.sqf and myScript.sqf. - Open myScript.sqf and put inside: hint "Hello world"; - Open init.sqf, (backup and) remove anything that's inside, and put inside: _test = [] execVM "myScript.sqf"; - Save changes in both files. - Try the mission. You _should_ get the message on your screen. If you still don't get anything, then it's an issue I've never encountered or heard about before, as calling scripts is usually a straightforward process. Unfortunately I can't do very much for you right now, but I'll be more than happy to assist you later, if you still encounter the problem. In about 30 hours from now, until the weekend, I'll be here and on steam, ready to examine any code, provide you with some example missions or scripts, and generally help you to get this working. I don't want to hear that there's someone who can't get scripts to work, they are a really amazing thing that everyone making missions should try out. We'll figure this out.
Changing the name to init.sqf also helped me. I didn't try your fix but is it ok if I just leave it init.sqf and use that file for all my scripting of the mission? Thanks for the video btw
so I go to the editor, start a random map and put a trigger and on activation just a simple script: hint "hi"; sleep 4; hint "hello"; and when I launch the scenario it says "/#/sleep 4 error generic error in expression" and obviously the sleep command didn't work because the hint is just showing hello. So this sleep command never works and i'm not even saving the scenario and putting local scripts in it. Thanks in advance
that is exactly the reason why scripts can do more than triggers. Do save the scenario, make an actual script, and it will work. putting commands in triggers isn't bad, but your options there are limited. It has to do with a thing called scheduled vs unscheduled environment, and triggers are simply one of the situations where sleep never works, similar to unit's init box. So please, take the extra 2 minutes to create an sqf script, call it with execVM, and see that making a real script will work. If you don't want to create the external file for whatever bizzare reason, you can quickly test your code in a trigger by encapsulating it, like this. 0 = [] spawn { hint "hi"; sleep 4; hint "hello"; } but since you're asking this under a video about _scripts_ , I'd guess you want to make scripts instead of using triggers.
All the code explained and provided for this video is a single command, Hint "Hello, World!"; I also explain comments, however they aren't necessary for running the script.
I've played Arma 3 for years and I've never been able to get scripting to work for me. I understand the coding language and what everything means but I've never been able to get scripts to work and every time someone tried to explain it or I looked up a tutorial, I'd get totally lost.
Then it FINALLY dawned on me that I had to change the file extension itself to a SQF file to have the game even read the script. So, here I am years later dumbfounded that one tiny oversight could cause so much headache
Thank you, Thank you, THANK YOU FOR GOING BACK TO 'HELLO WORLD!' You are amazing for just doing the base-of-basics!
+Keegan Penney Glad I could help.
yeah scripting is REALLY diffucult if u start out of the nowhere.. But i gotta say this tutorial is very helpfull for a starter!
I agree, the learning curve can seem a bit too steep and it takes a while to get some decent results. I'd like to see some statistics on how many people write their own scripts for their missions - I'd guess it's a tiny fraction of the player base.
Thanks to your videos, I have been trying to learn as much as I can about scripting!
Great introduction! Nicely clear!
Feuerex, Another great video ! Thank you.
Where in Arma do you call the script? When I try it says "Script.sqf" not found.
Do you have to use a trigger?
please see 5:50 and onwards, the video talks about this extensively.
I need some help with this; I've downloaded the mod "Civilian Occupation System", after following the installation-instructions, i still got a message saying "Script cos\cosinit.sqf not found". What can i do to fix this ? struggling for hours ! :/
just create a Mission in 3d editor,put a Unit Player name it and save the mission. then put all the files from the COS folder into your Mission Folder, Put a Logic game, somwhere in the map, and in the init paste null = [] execVM "cos \ cosInit.sqf"; and play!!
I have no idea what im doing script wise i just wish i could actually create a campaign/scenario missions etc... without having to be excluded from being able to create hostage rescues and so many other kinds also
great video!
Good intro.
Are all those files in that folder scripts? All I have in my downloaded mission folders are .PBO files. I don't have any .SQM file in any of my mission folders.
A pbo file is an archive containing the entire mission, something like a zip file. These are the downloaded missions or the ones you are subsribed to in steam workshop. If you make your own missions in the editor and save as "user mission", these will be created as folders with sqm file, and will allow you to place scripts in them as well.
Once the custom mission is ready, you have the option to "Export to Single Missions", or "Export to Multiplayer Missions", which packs the folder into .pbo and moves it to the corresponding folder.
I got it m8, cheers.
Hey mate , would it be possible for you to edit my server mate with some scripts ? I have a gamingdeluxe server on altis epoch and just wanted to get the blackmarket trader and ai missions on there its been pickling my head now for 48 hours on where to put the scripts in folders or such :( if you or anyone else could help me would be awesome man i will surely repay yall :)
hey, i really love your scripting videos, great for newer ppl like me... now, i have a question.. i know how to make airdrops, but how can i make an airdrop only available after a trigger is tripped?
whatever you use to make them, just connect that action to the trigger activation. I think you could appreciate an older video where I talk about triggers, how they are activated and how to use them.
ruclips.net/video/xctQHbCDtLY/видео.html
There is a section where I talk about conditions and how they work, I have recently gone into further details with a new video dedicated solely to conditions.
ruclips.net/video/6HSddREj3_s/видео.html
These videos cover triggers and conditions, in other words activating triggers only under a condition (in your case, the trigger itself), so they should be all you need.
ohhh right on, i get what your saying, and thanks alot for the quick response, will check these out,
since im here, i also wanted to know how to have one side (bluefor) respawn to base, and opfor respawn to side.. i allready know how to have base respawns as its pretty simple, but i dont know how to have both :( bluefor respawn to "base" and opfor respawn to "side")
Side-specific respawn types can be specified by simply adding "side" to the respawn template line. Using respawn templates instead of the basic 'respawn = number' is highly recommended in this case.
You can have a look over here for a short example of the side related template here:
community.bistudio.com/wiki/Description.ext#respawnTemplates
And a more general talk about respawning mechanics, creating templates and combining them together here.
community.bistudio.com/wiki/Arma_3_Respawn
I don't think any of my videos talk about these details, so I have to link you to the BIS wiki. Those links contain all you need, and a lot more, if you wish to learn more about respawn mechanics.
oh ok, thx again, yeah, i read these wiki's and am still kinda unshure how to write this :/ some one else pointed me towards event handlers, but i dont know how to do it, if you have the time maby you could write this for me? if not thats ok, thanks again man
grate videos m8 keep it up
+Feuerex can you think off hand how to have units respawn to side instead of base, using only the units init line or field? i thought somthing like this would work "this addEventHandler ["KILLED", "(_this select 0) respawn =side"]" but it doesnt work... would love some help
Great Videos! Unfortunately I cant seem to find the text for the scripts...After I used the camera tool, I went back to camera.sqf hit Ctrl+VThis is what I got:["Altis",[8183.14,2819.27,294.194],231.591,0.7,[-11.5152,0],0,0,720.455,0.3,0]
I'm not very sure which steps you followed (as camera creating is clearly unrelated to this video), but it seems to me that you used Splendid camera tool, available in the pause menu of the game. I personally don't use this tool, as it doesn't generate a very nice code, and prefer the function cameraold instead. Camera creating with that function is described over here:
ruclips.net/p/PLnxQwP1Iit_ReeucwKV0fO4DUSyEybZi1
you are most interested in part 1 and 2 of intro creating, they are dedicated to cameras only.
You might also be interested in this video:
ruclips.net/video/7SI1hQPWaCk/видео.html
where I explain individual camera commands in depth and create camera shots manually with scripts only - no in-game tools needed.
thank you very much for the quick response. Im trying to start my campaign with a scene inside a flying c17
Any ideas where the command special "flying" in the eden editor is?
perfect video
The 2 dislikes are people that don't have the game
Mine didn't work. I followed all step. Any tips man?
- make sure you have chosen the right folder for the script. The folder name is missionName.Island, and it is in Documents/arma3/missions.
Careful, 3DEN can create a folder named ~missionName.Island, which you don't want to use.
- make sure you are calling the script from the mission by a trigger that actually activates, with the right command.
- if there's something wrong with a script, the game usually tells you. If the script can't be found, you get an error message, and if it contains any errors, the game should show them as well. These messages can tell you where to look next.
- go to your PC settings and 'show known file extensions' to make sure you have an actual .sqf file, and not .sqf.txt.
- try to download any simple script or a mission with scripts, and see if they work. If they do, try to change the content of such script to only display hello world. Try to figure out why the other script works and yours doesn't.
- come back if you need further assistance.
I have the correct filepath, I triple checked.
How do i ensure the trigger activates?
And I get no erroe message.
I have file extensions shown and it's a .sqf file for certain.
and no other scripts seem to work for me but i may be trying to set them up wrong.
I actually got it working but had to rename the file to init.sqf
From what you described, it seems to me that the main problem is in how scripts are called. Renaming the script to init.sqf is, in some way, a solution, as that one specifically doesn't need to be called by the user.
Try the following:
- Make a second script .sqf file in the folder where you have your init.sqf and name it like myScript.sqf.
- Your mission folder now contains mission.sqm, init.sqf and myScript.sqf.
- Open myScript.sqf and put inside: hint "Hello world";
- Open init.sqf, (backup and) remove anything that's inside,
and put inside: _test = [] execVM "myScript.sqf";
- Save changes in both files.
- Try the mission. You _should_ get the message on your screen.
If you still don't get anything, then it's an issue I've never encountered or heard about before, as calling scripts is usually a straightforward process. Unfortunately I can't do very much for you right now, but I'll be more than happy to assist you later, if you still encounter the problem. In about 30 hours from now, until the weekend, I'll be here and on steam, ready to examine any code, provide you with some example missions or scripts, and generally help you to get this working.
I don't want to hear that there's someone who can't get scripts to work, they are a really amazing thing that everyone making missions should try out. We'll figure this out.
Changing the name to init.sqf also helped me. I didn't try your fix but is it ok if I just leave it init.sqf and use that file for all my scripting of the mission? Thanks for the video btw
This scriptin are very complicated, its too difficult for me, its take too much time to learn.
so i've got that stupid sleep command not working and I went to all the forums and didn't understand shit so plz help
well, why not start with describing what you're trying to do and where you're encountering your problem(s).
so I go to the editor, start a random map and put a trigger and on activation just a simple script:
hint "hi";
sleep 4;
hint "hello";
and when I launch the scenario it says "/#/sleep 4 error generic error in expression" and obviously the sleep command didn't work because the hint is just showing hello.
So this sleep command never works and i'm not even saving the scenario and putting local scripts in it.
Thanks in advance
btw i'm playing arma 3 laws of war 1.76
that is exactly the reason why scripts can do more than triggers. Do save the scenario, make an actual script, and it will work.
putting commands in triggers isn't bad, but your options there are limited. It has to do with a thing called scheduled vs unscheduled environment, and triggers are simply one of the situations where sleep never works, similar to unit's init box.
So please, take the extra 2 minutes to create an sqf script, call it with execVM, and see that making a real script will work.
If you don't want to create the external file for whatever bizzare reason, you can quickly test your code in a trigger by encapsulating it, like this.
0 = [] spawn { hint "hi";
sleep 4;
hint "hello"; }
but since you're asking this under a video about _scripts_ , I'd guess you want to make scripts instead of using triggers.
Thanks a lot, I appreciate you took the time to answer to my questions
Słovak czy Czeski?
Czeski
Bo ja Polski, i trochę rozumiem Czeski :D Pozdrawiam
Where do you get the Code?
All the code explained and provided for this video is a single command,
Hint "Hello, World!";
I also explain comments, however they aren't necessary for running the script.
scriptlaunch = [] execVM "script.sqf"
first!
cod
i just can't understand this guy lol