ladlon 10 Posted September 21, 2010 Could someone outline to me how to have a random start time and date for one of my editor-made random Secop scenarios? Assume I know nothing of scripting, just to be safe! I tried doing a search, but came up with 20 pages of seemingly unrelated results. Share this post Link to post Share on other sites
shuko 59 Posted September 21, 2010 description.ext class Params { class TimeOfDay { title = "Time of Day"; values[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,99}; texts[] = {"0000","0100","0200","0300","0400","0500","0600","0700","0800","0900","1000","1100","1200","1300","1400","1500","1600","1700","1800","1900","2000","2100","2200","2300","Random"}; default = 16; }; }; init.sqf if isserver then { private "_t"; _t = paramsarray select 0; if (_t == 99) then { _t = random 24 }; skiptime ((_t - daytime + 24) % 24); }; Date can be also made random of course, but do you really need it? Share this post Link to post Share on other sites
ladlon 10 Posted September 21, 2010 Hello again, shk. Thanks for the coding... What I don't get, though, is where to put these. I'm reading on several posts (yours included) that it's for the .sqf file, but I'm not sure about which/where. I did a search of my arma2 directories, and found several of them. I'm assuming they are custom init files. But, they only appear to be in mod folders. How would I utilize a .sqf file for something like an editor mission, or something like Cipher (user made dynamic mission)? I imagine I'd make my own .sqf file, but I have no idea where that would go, since the existing mission files I have just have a single file associated with them in the mission folder. I'll do some more research (specifically on .sqf's), but any help you can throw my way is appreciated, as always. (BTW, I found a dynamic weather script, but it doesn't appear to be working as expected... When I use 'Full Random Weather', it seems to give me the same weather every time... including snow in July! I'm assuming that it overrides the standard date/season setting of the mission... Just kind of weird that it's never rain... Always snow!) Share this post Link to post Share on other sites
CaptainBravo 0 Posted September 21, 2010 first one goes in the Description file. Seond one goes in the init file. Share this post Link to post Share on other sites
kylania 568 Posted September 21, 2010 He told you the files that they go in, the first code block goes in your description.ext file and the second code block goes into your init.sqf file. This kind of goes back to what we were discussing in the other thread, it's assumed that you're familiar with those two files and how they work. It's kind of like if you were playing baseball and you asked "Where can my friends play?" If the answer was "one can cover second base and the other can be shortstop" you wouldn't expect them to point out exactly where second base and shortstop positions were on the diamond, you're just expected to know since it's an integral part of playing the game. Now where do you find the information in the first place? The wiki links I provided above would be a good spot, or reading forum threads about it here or simply examining existing missions and inspecting the structure they use. init.sqf is a plain text file that goes in your mission's folder next to the mission.sqm file the editor creates. It's executed by all clients (including the server) when the game starts. description.ext is also a plain text file that goes in your mission's folder next to the mission.sqm file the editor creates. It contains game setup information as described in the above wiki link. With both files you'd create it yourself. I suggest using a program like ArmAEdit for this process since it includes some wizards and code highlighting to help you. Share this post Link to post Share on other sites
ladlon 10 Posted September 21, 2010 Ya, I get that they are for those two files (as you pointed out), I just wasn't sure where the files themselves go. (Ya, I'm the guy who doesn't know what 'baseball bases' are...) :( I've been trying to teach myself, to a point, about scripting... but at the same time, I don't want to be getting into heavy coding and making my own missions, etc... I just want to play. But, of course, sometimes you want to add something or change something, so then you have to dabble in the code stuff... I just can't invest too much time in it, unfortunately. So, I'm just kind trying to learn/get only what I need.. which is the tricky part. Even when I did a search for .sqf, what I got was an article about the syntax of it, and examples, etc... but it didn't answer 'Where does one put the .sqf". That's the whole problem of learning this sort of thing, unfortunately... You read one article, but it contains references to things you don't know about yet, so then (if you're lucky) there's links on that, bringing you to a similar page (but now about the item that you were confused about in the previous one), and you often go around in circles. I tried to teach myself about .sqf's as well by just looking at what is in my Arma2 folders... but in my case, there were no .sqf's in my mission folder, hence the confusion about where to put them... since there are many of them (as opposed to one global one), so each one would somehow have to be linked to their repective mission somehow... usually, I'd assume, by either their file name or their location... but since the file names were all the same, and there weren't any in the mission folders (just in the various mod folders), I was really confused as to how the .sqf fiile I'd create would even get associated with the mission. I completely sympathize with the frustration you guys have of many people coming in here, not even knowing what a third base is... but, the fact is there are a lot of us, as many people are just 'gamers', and not (yet) versed in coding... and due to the fragmented and incomplete documentation of the sim, that sort of thing will probably continue, and a lot of us will come in 'not knowing how to play baseball'. I keep trying to do searches on the various subjects I'm after, but the forum search engine just gives me 20 pages of results, all seemingly unrelated to the keywords (...I mean, I typed in 'Random Weather', and was getting things about video cards, weapons, etc... often the same results I got with other keywords! Wacky... I'll take yet another stab at learning coding basics, but again, I'm kind of going in circles, as many of the articles seem to jump ahead and 'assume you know how to play baseball', so to speak.... or they just give me the bare basics, but leave out some of the 'middle parts' that are key to my understanding the utilization of the samples given in other articles. ---------- Post added at 02:26 PM ---------- Previous post was at 02:22 PM ---------- BTW, thanks for those links to the description.ext and init.sqf. The description.ext one seems good, but the init.sqf one doesn't say where to put the file... But, at least I now know from your responses that it goes in the mission folder. Share this post Link to post Share on other sites
kylania 568 Posted September 21, 2010 (edited) BIS recently released two videos about using the Editor, the second of which includes some really basic SQF stuff and how to make a file. I highly suggest looking through them, slowly (pause a lot!) to see if it doesn't answer some basic questions. ArmA 2 Editor Tutorial Videos Yeah, I wasn't happy with the init.sqf link. Couldn't quickly find one. :) Here's a picture that shows where sqf files could go: Edited September 21, 2010 by kylania Share this post Link to post Share on other sites
shuko 59 Posted September 21, 2010 I mean, I typed in 'Random Weather', and was getting things about video cards, weapons, etc... often the same results I got with other keywords! Wacky... Never use the simple search, always click on the advanced search and in there select only this (editing & scripting) forum. Share this post Link to post Share on other sites
ladlon 10 Posted September 21, 2010 Thanks, Kylania. That looks like a great start. I was looking at some other YouTube vids on editing as well, but they are often hit and miss (...or have some attrocious music blaring in the background!). I'll check those BIS ones now. @shk: Good point. I'll try that next time. ---------- Post added at 03:16 PM ---------- Previous post was at 02:51 PM ---------- Ah! There we go! One mystery solved! I was looking in the mission folder in the Arma2 game directory... and the BIS video just informed me that the .sqf is in a mission folder in the MYDOCUMENTS folder! Okay, now it makes more sense (as far as where the file is, and how it is linked to the specific mission)! Ya, it's those little details that are left out in regular posts and things that can really throw you for a loop if you don't know. Okay, cool... Now I can probably start utilizing some of these scripts and things I've been finding. Share this post Link to post Share on other sites
ladlon 10 Posted September 21, 2010 Hey, shk... Are you sure you don't have a typo on the code you gave me for the .sqf? I got an error using it. I just plus this in at the end of the existing code of the missions's .sqf, right? if isserver then { private "_t"; _t = paramsarray select 0; if (_t == 99) then { _t = random 24 }; skiptime ((_t - daytime + 24) % 24); }; Also, both files are in the mission folder in MyDocuments, not the Arma2 install's Mission folder, correct? Share this post Link to post Share on other sites
kylania 568 Posted September 21, 2010 No, that code section goes in the init.sqf file you'll create in your missions folder (In MyDocs, like my picture above). The "Missions" folder under your ArmA2 install folder is where Singleplayer Scenarios go. Share this post Link to post Share on other sites
ladlon 10 Posted September 21, 2010 Sorry, now I'm confused again... I was verifying that they are in the mission folder in MyDocuments... and you just said no, but then say they go in the mission folder in MyDocuments, which is what I said. Also, you're saying the mission folder in the Arma2 install directory is for single player? That's what I'm doing... Single player scenario, where I have random missons via the Secop, Ambient Combat, etc modules. So, now where should they go? I can't imagine they would go in the Arma2's install Mission folder, as that doesn't have separate subfolders for each mission (thus, doesn't allow you a way to isolate a specific .sqf file for each mission). Sorry, this is all why I'm confused about it, and said 'assume I know nothing of scripting', as I was sure there'd be details that would trip me up. Is there some post or video I could view that'll explain this? Everything I'm finding or am pointed to talks about the scripting itself, but not how to utilize it (where to put the files, etc). Share this post Link to post Share on other sites
twirly 11 Posted September 22, 2010 Hey, shk... Are you sure you don't have a typo on the code you gave me for the .sqf? I got an error using it.I just plus this in at the end of the existing code of the missions's .sqf, right? if isserver then { private "_t"; _t = paramsarray select 0; if (_t == 99) then { _t = random 24 }; skiptime ((_t - daytime + 24) % 24); }; Also, both files are in the mission folder in MyDocuments, not the Arma2 install's Mission folder, correct? They go into your: 1. MyDocuments\Arma 2\missions\YourMissionNameHere\init.sqf 2. MyDocuments\Arma 2\missions\YourMissionNameHere\description.ext There is no "mission.sqf".... there's a "mission.sqm". Leave that file alone. Share this post Link to post Share on other sites
kylania 568 Posted September 22, 2010 That's what I'm doing... Single player scenario, where I have random missons via the Secop, Ambient Combat, etc modules. So, now where should they go? Well, that's going to be a problem since these mission parameters are for multiplayer missions, not single player. Now, you can play a multiplayer mission yourself though, but it'll be a little different. I'll whip up a quick video for you. Share this post Link to post Share on other sites
ladlon 10 Posted September 22, 2010 No, you misread my post... I said ' I just plus this in at the end of the existing code of the missions's .sqf, right? ' not 'mission.sqf'. Ya, I was putting them in the MyDocuments one, but I was confused by when kylania said no to that, but then said it should go in the MyDocuments one, which is what I said in the first place. Then he's saying something about single player missions being in the Arma2 install mission folder (which is where I thought they went at the very beginning of all this, before discovering (via the BIS editor video) that there's mission folders in the MyDocuments folder. So, regardless of whether my missions are single player or multiplayer (...they are single player), the codes go in the description.ext and init.sqf files in specific mission folders in the MyDocuments folder, correct? This is what I did, yet I got a code syntax error when I ran it, regarding a line in the sqf file (...something like ')' expected.. as if the code lacked a closing quote or something. Sorry, this is becoming a bit of an Abbot and Costello routine here.... Again, if someone can point me to an article that explains all of this, I'd be glad to read it, and not waste your time. I just have yet to find anything that explains it all. Share this post Link to post Share on other sites
kylania 568 Posted September 22, 2010 Selectable dynamic time mission in two minutes*. :) TBN96Q7BzJ0 (Watch it in for better quality.)* Hour and a half for video production time! :eek: Share this post Link to post Share on other sites
CarlGustaffa 4 Posted September 22, 2010 (edited) Hey, maybe that's a good idea actually, to have params support also for singleplayer games? I know when I want it I setup dialogs for it, but dialogs are probably not the first thing the new guy tries out (can be very painful experience in the start). If implemented, it should kick in before the briefing, and briefing had to be operational (shift preview actually works) before it opened up. With preview (instead of shift preview), the default values kicked in. In Domination, measures are taken so that that part of the file is actually read (only the default values), but I have downloaded missions that are unplayable from the editor (MP support only). Such missions gives all sorts of error messages due to lacking parameters being read, and such missions tends to get unmodded and unplayed. It's easy to blame the mission maker, and there are naturally other things that might break due to not being MP, but better support for MP parameters during SP testing would be welcome. Worth a ticket? Hour and a half for video production time! :eek: You sure is one of a kind. Is there no limit to your helpfulness? :) Edited September 22, 2010 by CarlGustaffa Share this post Link to post Share on other sites
kylania 568 Posted September 22, 2010 You can kind of do options for like difficulty using conditions for units and possibly even base it on playername, like load the game as kylaniaNight and you'll play a nightmission and play it as kylaniaDay and it'll be daytime. But yeah, a CTI request for single player params would be nice. :) Share this post Link to post Share on other sites
ladlon 10 Posted September 22, 2010 Hello again.. Actually, I think I'm alright on this. I just downloaded and installed the GL4 mod (thinking it would be just for FX and AI), and it actually has random start time and random weather... and it actually works! So, that saves me some trouble. I actually have been playing dynamic/random missions from the very moment I got Arma2, way back when... setting up my own scenario using the Secops, Ambient Combat, Ambient Civilians, and First Aid modules... and after a bit of tinkering and help from the forums, I had also coded a support Apache (with radio commands for it to join the team, land or be dismissed), as well as the same thing for a Huey (to take us places if it was too far to walk), and an A-10 (same as Apache, except no landing). That actually worked quite well... and that was before I had any pre-made 3rd part support scripts/mods, which thankfully now exist. I even had my guys appear in a completely random spot each session, using a VERY wide placement radias (as opposed to some sort of scripting) that worked just fine. But a few months ago, I discoved things like Cipher and Guerilla War, which were like what I was trying to do, but obviously more advanced and better done. So, I've been playing those since then. Now (long after setting that original random scenario thing up last year or so), I just added the random weather, random start time, and fx from the GL4 mod, which was pretty sweet. Still some stuff I'd like to add, but I'll tinker with what I have so far. ---------- Post added at 11:34 PM ---------- Previous post was at 11:31 PM ---------- @kylania: DUDE!! Great work on the video! Much appreciated! Man, I feel like s**t that I'm using the GL4 mod for that now! Damn! After all that work you did there! Well, at least I know how to do it now from that video. Many thanks for going through all the trouble to do that! You should post that in a sticky for others! Share this post Link to post Share on other sites
callihn 10 Posted September 22, 2010 Using "{ _t = random 24 };" what is going to happen when it returns 22.3? Share this post Link to post Share on other sites
kylania 568 Posted September 22, 2010 (edited) Well, at least I know how to do it now from that video. That was the intent. :) If you have a better understanding of how the missions and their files work, that's all that matters. One thing that should be mentioned, if you've changed your ArmA2 profile name (it defaults to your Windows login name) then where editor missions are saved is slightly different: MyDocs\ArmA 2 Other Profiles\MyOtherName\missions Using "{ _t = random 24 };" what is going to happen when it returns 22.3? Seems to round to a pretty sunset: if isserver then { private "_t"; _t = 99; if (_t == 99) then { _t = random 24 }; _bob = ((_t - daytime + 24) % 24); _first = date; skiptime _bob; hint format["Result: %1\n Current Time: %2 \nPrevious Time: %3", _bob, date, _first]; }; No questions about my choice of variable names, it's late! :) Edited September 22, 2010 by kylania Share this post Link to post Share on other sites
snkman 351 Posted September 22, 2010 Guess date is better then time you also can choose the day | month | year. Wiki: date Description: Return the actual mission date and time as an array [year, month, day, hour, minute]. Month is a full number between 1 and 12, day is between 1 and 31, hour is between 0 and 23 and minute is between 0 and 59. Share this post Link to post Share on other sites
shuko 59 Posted September 22, 2010 I did say it was possible to make date random as well, but since it doesn't add snow etc, it's kind of irrelevant what the date is. Share this post Link to post Share on other sites
rübe 127 Posted September 22, 2010 Hey, maybe that's a good idea actually, to have params support also for singleplayer games? Definitely. I'm pretty sure that I've already suggested this at some point, maybe a year ago. Sure, we can use dialogs, but a generic parameters "framework" that's easy to use would be so much faster. Considering we already have exactly that, but unfortunately can only use it for mp missions, it shouldn't be too much work, to make parameters work in sp missions too. Selecting the date/time, the weather, the friendly, enemy and maybe neutral factions/sides, selecting a difficulty, selecting the soldier-class you wanna play this time or some specific group in a combined ops mission, ... Certainly sp missions would deserve some parameters too. ^^ Though I don't how sp parameters should be displayed. Just that list like in mp? Or shouldn't we be able to group parameters somehow to make them better accessible, while all parameters are directly displayed/open. Maybe each parameter should have a dialog-type attribute, so we could choose between the typical UI elements (boolean switches, radio-checkboxes, dropdown-menus, textfields, ...). Ok, I'll shut it, for at this point we're more or less back to dialogs. :D Share this post Link to post Share on other sites
ladlon 10 Posted September 22, 2010 I did say it was possible to make date random as well, but since it doesn't add snow etc, it's kind of irrelevant what the date is. I would have normally thought so too... but some of the weather mods base their random weather on the date (snowfall appearing in winter, etc). But, other than that, ya, the date is relatively irrelevant. Share this post Link to post Share on other sites