Jackael 10 Posted September 2, 2009 (edited) Alright I've been playing around with the editor a lot and in a lot of things I want to be able to do you need outside script files. I'm trying to get a good understanding of how all this stuff works. I'm still new so its hard to understand some of the technical stuff going on. I would like to know how the outside scripts work. So far what I've gotten is that you use a trigger or initialization to cause the scripts to be active. However, "init.sqf" seems to have some significance and I'm not very sure what that does. Is there any guides or anything on all of the different script types? Also on a side note, I saw in a thread that your script files should be blank icons and not have the "hidden extensions" dealy. I did disable hidden extensions and corrected the file type, but there is still a little notepad icon on the files, and so far I have been unable to get an outside script to run correctly. I AM using notepad to edit them. Is there something else thats preventing them from working? Edit: also, how do you make intros go into the mission, and the mission go to outro? Edited September 2, 2009 by Jackael Share this post Link to post Share on other sites
IndeedPete 1038 Posted September 2, 2009 I think you should read this. It contains all the basic and advanced stuff, include scripting and making intros/outros. ;) Share this post Link to post Share on other sites
kylania 568 Posted September 3, 2009 Alright I've been playing around with the editor a lot and in a lot of things I want to be able to do you need outside script files. I'm trying to get a good understanding of how all this stuff works. I'm still new so its hard to understand some of the technical stuff going on. Welcome to the wonderful world of scripting! You should definately download the Guide that Pete linked and read it to yourself every night before you go to bed. :) I would like to know how the outside scripts work. So far what I've gotten is that you use a trigger or initialization to cause the scripts to be active. However, "init.sqf" seems to have some significance and I'm not very sure what that does. Is there any guides or anything on all of the different script types? Scripts are just text files with commands in them in the same folder as the mission that, as you understand, you can call from within the game. init.sqf is special. It's a script that's run by all clients as soon as they connect to the game, so things that run at the "start of the game" should be in there. Also on a side note, I saw in a thread that your script files should be blank icons and not have the "hidden extensions" dealy. I did disable hidden extensions and corrected the file type, but there is still a little notepad icon on the files, and so far I have been unable to get an outside script to run correctly. I AM using notepad to edit them. Is there something else thats preventing them from working? That's probably the image you're talking about. If you've turned OFF "Hide Extensions" but selected "Always use Notepad to open this file" for an *.sqf file then it's OK for it to have the Notepad icon. You should be good. Edit: also, how do you make intros go into the mission, and the mission go to outro? In the mission editor on the left side near the middle top there's a drop down that says "Mission". If you change it to Intro or Outro it'll "clear" the mission. That's a blank slate that you can use for intro or outro stuff. Usually though you'll wanna learn camera scripting first. That's in the guide Pete linked. Share this post Link to post Share on other sites
Jackael 10 Posted September 3, 2009 Okay, I'm working on getting a briefing going. However I can't get it to show up. So far the map's folder contains the mission.sqm, a init.sqs, and a briefing.sqs The init.sqs simply contains execVM "briefing.sqs"; I'm not sure this is correct for this file... do you need to add more to it? The briefing.sqs contains this coding: (I copied and pasted it from this tutorial just to try to get a briefing to show. http://www.ofpec.com/forum/index.php?topic=33468.0 ) waitUntil { !isNull player }; // all hip now ;-) waitUntil { player == player }; switch (side player) do { case WEST: // BLUFOR briefing goes here { player createDiaryRecord["Diary", ["Info", "<br/>Author - Jinef<br/>Version 1.00<br/>"]]; player createDiaryRecord["Diary", ["Enemy forces", "<br/>Enemy forces are expected to consist of lightly armed locals mixed with trained regulars of the enemy. There are regular army aviation support and defence troops stationed at the airfield however after preliminary air strikes white flags have been seen, so we expect little resistance."]]; player createDiaryRecord["Diary", ["Friendly forces", "<br/>1st Platoon will be deployed on the north flank. 2nd Platoon will capture the high ground overlooking the airfield. 3rd platoon will conduct the assault on the airfield.<br/><br/>Due to a risk of mines the first phase of the operation will be conducted dismounted only, the AAVs will hold the beach."]]; player createDiaryRecord["Diary", ["Mission", "<br/>1st Platoon is to secure the northen flank of the island. This will be achieved by Alpha squad securing the town of Kamenyy, with Bravo and Charlie squads provding flank cover. Alpha squad will not proceed further than the limits of advance marked on your maps. 81mm mortar support is on call, however collateral damage is to be avoided at all costs."]]; player createDiaryRecord["Diary", ["Situation", "<br/><img image='pic.jpg' width='200' height='200'/><br/><br/>Prior to our landing on the main island of Chernarus, our marine task force will secure the airfield on the small island of Utes. Our company will be performing the assault with support from the MEU task force units. The island is expected to be defended only very lightly by enemy forces with support from an disgruntled population. The key to our success is to quickly assert control over the island while maintaining civilian infrastructure and dignity."]]; // Secondary Objective tskObj3 = player createSimpleTask["Secondary: Avoid Civilian Casualties"]; tskObj3 setSimpleTaskDescription["The civilians here are relying on us to restore order and let them return to a peaceful life, we can't just blast our way through.", "Avoid Civilian Casualties", "Avoid Civilian Casualties"]; //>---------------------------------------------------------< // Secondary Objective tskObj2 = player createSimpleTask["Secondary: Avoid Friendly Casualties"]; tskObj2 setSimpleTaskDescription["Let's not take any risks. It's not worth going home in a box for this. Stay frosty!", "Avoid Friendly Casualties", "Avoid Friendly Casualties"]; //>---------------------------------------------------------< // Primary Objective tskObj1 = player createSimpleTask["Primary: Secure The Town"]; tskObj1 setSimpleTaskDescription["Your squad has just landed on the beach <marker name='BAlpha'>here</marker>. Your task is to secure <marker name='BObj1'>this</marker> town ahead of the main landing force to ensure safe passage for further combat echelons. Meanwhile Bravo and Charlie squads will secure the enemy compounds on the flank and endeavour to prevent enemy reinforcments reaching the town.", "Secure The Town", "Secure The Town"]; player setCurrentTask tskObj1; }; I saved the mission as a Single Player mission and when I start it no briefing appears. What am I doing wrong? Share this post Link to post Share on other sites
kylania 568 Posted September 3, 2009 Change it to briefing.sqf. SQF and SQS are similar, but different. :) You also appear to be missing a }; on your very last line. You need one to close the Case statement and one to close the Switch statement. The indentations help you see that: something { something else { }; }; Notice how each { has a matching and closing }; Share this post Link to post Share on other sites
Jackael 10 Posted September 3, 2009 Thanks, this all is really helpful. What exactly are the Case and Switch statements and how do those work? Share this post Link to post Share on other sites
kylania 568 Posted September 3, 2009 (edited) Switch is a "Control Structure" and Case is part of how it works. If and forEach are also control structures, they work kind of similar. Lets say you have a stoplight. And you wanted to know what to do based on what color it is. You know the colors are Red, Yellow and Green. You can use the switch command to decide what to do. We'll pretend that stoplight_color is a variable that contains the current color of the stoplight. switch (stoplight_color) do { case red: { hint "Stop!"; }; // this closes case red: case yellow: { hint "Slow!"; }; // this closes case yellow: case green: { hint "Go!"; }; // this closes case green: }; // this closes the switch () do You can do this same process with three if statements as well: if (stoplight_color == "red") then { hint "Stop!"; }; if (stoplight_color == "yellow") then { hint "Slow!"; }; if (stoplight_color == "green") then { hint "Go!"; }; forEach is another common structure used to "walk" through an array and do the same thing to each element of the array. For each "walkthrough" _x is the magic variable for the current element. {hint _x} forEach ["red","yellow","green"]; That would produce three hints, one for "red", one for "yellow" and one for "green". It would be so quick though that you'd only see green. :) Edited September 3, 2009 by kylania Share this post Link to post Share on other sites
Jackael 10 Posted September 3, 2009 Thanks tons kylania, this has been really helpful -J Share this post Link to post Share on other sites