Jump to content
Sign in to follow this  
GunnDawg09

Question about .SQF Files

Recommended Posts

So I have a simple mission with me and 2 other russian soldiers in my group with an ACM named "BIS_ACM1" synced to me.

Now if I am not mistaken the mission file(.pbo) goes in ArmA2\Missions and the .SQF file I made goes in here(I named my mission ACM_Test2):

C:\Documents and Settings\GunnDawg\My Documents\ArmA 2\missions\ACM_Test2.utes

--

So if all of that is set up correctly so far then here is my next question. I made a .SQF file named combat.SQF but does the mission/game automatically call it when the mission loads or what?

--

Also here is what the .SQF file consists of. I think it should work fine. I want it to spawn ONLY USMC soldiers.

[1, BIS_ACM1] call BIS_ACM_setIntensityFunc;

[bIS_ACM1, 100, 300] call BIS_ACM_setSpawnDistanceFunc;

[["USMC"], BIS_ACM1] call BIS_ACM_setFactionsFunc;

["ground_patrol", 1, BIS_ACM1] call BIS_ACM_setTypeChanceFunc;

["air_patrol", 1, BIS_ACM1] call BIS_ACM_setTypeChanceFunc;

Share this post


Link to post
Share on other sites

No, you need to call the script manually somewhere.

"somewhere" being potentially :

- another sqf file which is called automatically at mission start and which is named init.sqf

- in the activation field of a trigger for which you change the "condition" field from "this" to "true"

- in the init field of a unit (to be avoided is possible, not clean)

EDIT : to be more precise on the file structure :

in the directory C:\Documents and Settings\GunnDawg\My Documents\ArmA 2\missions\ACM_Test2.utes you'll find :

* a mission.sqm file, wich is a textual representation of what you place in the editor

* nothing more if you don't put them yourself :)

You can add :

* a init.sqf file containing script commands that will be called automatically at mission startup

* a description.ext file containing ressources definitions (your own GUI if needed, mission parameters if any, spawn system used, etc...)

* a briefing.html file for briefing and debriefing, but all that has changed in A2 so I won't comment :)

* any scripts file needed, any subdirectory containing any file you feel is needed (for example .jpg images you may want to use in your GUI)

Once all done and you "save as mission" in the editor, the game will take this directory and sub-directories, and pack them into a .pbo named after the directory name. Pbo files are archive files, like .zip files, in fact.

MORE EDIT : tools to pack/unpack pbo files without the need of launching the game exists. Looks for Kegetys tools here : http://www.kegetys.net/arma/ ("ArmA tools" a bit down the page), the pbo tool is "cpbo" to pack directories into pbo and unpack .pbo files

I realise I forgot to point out HOW to launch your script manually :)

Make a init.sqf file in your directory

edit it, and launch combat.sqf by putting this into it :

_tmp = [] execVM "combat.sqf";

Edited by whisper

Share this post


Link to post
Share on other sites
No, you need to call the script manually somewhere.

"somewhere" being potentially :

- another sqf file which is called automatically at mission start and which is named init.sqf

- in the activation field of a trigger for which you change the "condition" field from "this" to "true"

- in the init field of a unit (to be avoided is possible, not clean)

Can you be more specific on how to use the first method with an init file?

Which folder do I make the init file and what do I put in the init file to execute the combat.sqf file that I made?

Share this post


Link to post
Share on other sites

you can use your combat.sqf to be init.sqf and it will be called automatically...

or

another init.sqf file and call combat.sqf from there... dont know the command line though

Share this post


Link to post
Share on other sites
No, you need to call the script manually somewhere.

"somewhere" being potentially :

- another sqf file which is called automatically at mission start and which is named init.sqf

- in the activation field of a trigger for which you change the "condition" field from "this" to "true"

- in the init field of a unit (to be avoided is possible, not clean)

EDIT : to be more precise on the file structure :

in the directory C:\Documents and Settings\GunnDawg\My Documents\ArmA 2\missions\ACM_Test2.utes you'll find :

* a mission.sqm file, wich is a textual representation of what you place in the editor

* nothing more if you don't put them yourself :)

You can add :

* a init.sqf file containing script commands that will be called automatically at mission startup

* a description.ext file containing ressources definitions (your own GUI if needed, mission parameters if any, spawn system used, etc...)

* a briefing.html file for briefing and debriefing, but all that has changed in A2 so I won't comment :)

* any scripts file needed, any subdirectory containing any file you feel is needed (for example .jpg images you may want to use in your GUI)

Once all done and you "save as mission" in the editor, the game will take this directory and sub-directories, and pack them into a .pbo named after the directory name. Pbo files are archive files, like .zip files, in fact.

Ok so I know where the init.sqf file would be placed, but what is the command line inside of init.sqf to make sure my combat.sqf file gets loaded once the mission starts?

ah so just rename combat.sqf to init.sqf and it will be loaded once the mission loads without having to call it somewhere else?

Also does it matter if I save as single mission or user mission?

---------- Post added at 02:30 AM ---------- Previous post was at 02:24 AM ----------

_tmp = [] execVM "mission.sqf"; or...

_tmp = [] execVM "combat.sqf";

Also is there any way to test whether or not the script is actually working other than waiting 20mins for some combat to start spawning?

Edited by GunnDawg09

Share this post


Link to post
Share on other sites

Edited my post while you were replying :)

That's the problem when hitting "Submit" too quick, just as you push the button, you remember everything you just forgot to write :)

Share this post


Link to post
Share on other sites

I will try that, but I just renamed combat.sqf to init sqf and launched the mission.....

Right away 2 F-35's fly over me, so I run down the road and 4 M1A2 Tanks spawn!

I think it may be working :)

Share this post


Link to post
Share on other sites

Edited again, it's "combat.sqf" that must be launched, ofc. sorry for confusion

As for debugging, it was easy before, it's a pain now in ArmA2.

All errors go to the .RPT file located here

c:\Documents and Settings\<username>\Local Settings\Application Data\ArmA2\ArmA2.RPT

the script errors are reported here (location is not the same under Vista/Win7)

Share this post


Link to post
Share on other sites

Now that I got it working (by renaming combat.sqf to init.sqf), its time to tweak, tone and start modifying this gem ;)

I think it may have been a bad idea to only spawn USMC when its only me and 2 other lonely russian soldiers, I need to spawn in some of my own reinforcements!

Share this post


Link to post
Share on other sites

I just noticed the "save" question :

"Save as user mission" will save the files (essentially, will update mission.sqm with the current status of your editor) in the directory but won't pack anything into pbo

"Save as singleplayer mission" will save the files, pack them in a .pbo and put the pbo in your game's "missions" directory

"Save as multiplayer mission" will save the files, pack them in a .pbo and put the pbo in your game's "mpmissions" directory

Share this post


Link to post
Share on other sites

I am trying to figure out the use of this .PBO tool I have. I can unpack the files that it already has packed, which is the same files that are in the .utes file....

Share this post


Link to post
Share on other sites

Yes, that's the point :)

launch cpbo once, say "Yes"

then

right-click on a directory, you should have a "make pbo" option, that's to create pbo from directory

or double click on pbo, it'll unpack the .pbo and create directory and files inside, that's for doing the opposite, ie unpack an existing pbo.

Usefull to see how missions you've played and you liked are done, how feature X or Y is done, etc...

Share this post


Link to post
Share on other sites

Ah I see, so for other missions, cause when I make my own, all of those files that you unpack are made for me in the .utes folder. makes more sense.

---------- Post added at 03:05 AM ---------- Previous post was at 02:53 AM ----------

BTW making init.sqf with:

_tmp = [] execVM "combat.sqf"

...inside of it did not seem to work as nothing spawned. Once I got rid of that init.sqf and renamed combat.sqf to init.sqf and tried it, stuff spawned right away.... so need to find a way to have 1 .sqf that can initialize multiple .sqf's as the example you gave me didnt seem to do it.

Share this post


Link to post
Share on other sites

It should have worked

don't forget the ; at each end of line

try without the "_tmp = "

Share this post


Link to post
Share on other sites

Another question.

What would the flag be for insurgents to add to the ACM script so they appear. For example you have "USMC", "RU", "CDF", "GER".... would insurgents be "INS" ?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×