Jump to content
Sign in to follow this  
{USI}_Zombie

running an sqs from inside an sqf?

Recommended Posts

How do you have an old ArmA 2 mission with an init.sqs that can't be modded?

I am updating an Arma mission to Arma2, which is why I need to use init.sqs but want the briefing to show.

If you don't got too many files, you are probably just better off posting all your files here because I created the init.sqf + loadout sqf files and they worked just fine. The problem you are experiencing probably has nothing to do with whatever you are trying to do. Also, your original sqs files to change the loadout, they work fine. At least, the programming is fine. What you were calling with the _this command was probably faulty.

Thanks BlackAlpha, here is a link to the mission http://rapidshare.com/files/266854737/Random_SpecOps.Chernarus.pbo it seems to work except for the problems noted in the thread, see the bugs-to do.txt for my notes.

This is not the mission where I need to call the briefing.sqf from init.sqs, the briefing actually seems to work here. If you can find the problem I will be hugely greatful. All I want for that mission is the loadouts to start in the init and not have to be called via a trigger, and for the onloadmission to be displayed

Edited by {USI}_Zombie

Share this post


Link to post
Share on other sites

Why not upload the mission you are having trouble with, if not the ArmA1 version as well?

Share this post


Link to post
Share on other sites
I am updating an Arma mission to Arma2, which is why I need to use init.sqs but want the briefing to show.

Thanks BlackAlpha, here is a link to the mission http://rapidshare.com/files/266854737/Random_SpecOps.Chernarus.pbo it seems to work except for the problems noted in the thread, see the bugs-to do.txt for my notes.

This is not the mission where I need to call the briefing.sqf from init.sqs, the briefing actually seems to work here. If you can find the problem I will be hugely greatful. All I want for that mission is the loadouts to start in the init and not have to be called via a trigger, and for the onloadmission to be displayed

So, apparently the game doesn't like changing loadouts using scripts during the briefing phase. I found a workaround for it that still changes the loadouts during the briefing phase but I guess it's not the most efficient way to do it. Also, I merged all your loadout scripts into one and I call the script file from the units' init fields.

If you want to call the script during the mission, just use the more simple command _handle = [(object), "string"] execVM "init_loadout.sqf";

As for the briefing, you had no briefing.html, so it just went straight into the mission, which also skipped the onloadmission text. There's a briefing.html in your mission folder now. In case you didn't know, you can hold shift while clicking on the "preview" button in the editor to preview the briefing before starting the mission.

Anyway, your halo commands were no good. You are supposed to send 2 arguments to the halo init script but you sent only one. You'll see the changes in the unit init fields. I spaced the AI out a little but the AI are still retards that fly into trees and each other, so I guess there's no real way to fix that.

Here's the mission file. Put it in your editor missions folder and open it with the editor.

I'm still wondering how to change the loadout of a unit using a script during the briefing phase without putting something in the unit's init field...

Edited by BlackAlpha

Share this post


Link to post
Share on other sites
Why not upload the mission you are having trouble with, if not the ArmA1 version as well?

I will, just as soon as I am done with all the rest of the things that need tweaked ;)

---------- Post added at 05:15 PM ---------- Previous post was at 04:25 PM ----------

So, apparently the game doesn't like changing loadouts using scripts during the briefing phase. I found a workaround for it that still changes the loadouts during the briefing phase but I guess it's not the most efficient way to do it. Also, I merged all your loadout scripts into one and I call the script file from the units' init fields....

Thanks, I tried to do that but it didn't work, guess I had some syntax issues. NOW I understand how to use the call (compile (preprocessFileLineNumbers... syntax, I was absolutely doing it wrong

If you want to call the script during the mission, just use the more simple command _handle = [(object), "string"] execVM "init_loadout.sqf";

As for the briefing, you had no briefing.html, so it just went straight into the mission, which also skipped the onloadmission text. There's a briefing.html in your mission folder now. In case you didn't know, you can hold shift while clicking on the "preview" button in the editor to preview the briefing before starting the mission.

I was lead to believe in another thread that briefing.html was used only for the debriefing and not required. Guess we need BOTH, .sqf for before and during and .html for after

Anyway, your halo commands were no good. You are supposed to send 2 arguments to the halo init script but you sent only one. You'll see the changes in the unit init fields. I spaced the AI out a little but the AI are still retards that fly into trees and each other, so I guess there's no real way to fix that.

Got the syntax from another thread here. It's fantastic that setpos is no longer required to get the units airborne. Start altitude was what I was missing. I have tried different formations, different starting altitudes, different waypoints etc.....you are right, they will sometimes fly in to each other, land in the water, or in the trees ~sigh~ lol

Here's the mission file. Put it in your editor missions folder and open it with the editor.

I'm still wondering how to change the loadout of a unit using a script during the briefing phase without putting something in the unit's init field...

Thank you so much for your help, I will add your name to the credits for the help, as well as Kylania and Big Dawg KS for all the help. I learned a lot about sqf's and some of the differences between ArmA and Arma2. Collaberation like this is what has made this community great ever since OFP! Thanks again!

Edited by {USI}_Zombie

Share this post


Link to post
Share on other sites

Thanks, I tried to do that but it didn't work, guess I had some syntax issues. NOW I understand how to use the call (compile (preprocessFileLineNumbers... syntax, I was absolutely doing it wrong

Just keep in mind that the way I used compile in the units' init fields is not really the way the compile command was meant to be used.

To give you an example how it is usually used:

For example in init.sqf:

init_loadout = compile preProcessFileLineNumbers "init_loadout.sqf";

[infantry1, "grenadier"] call init_loadout;

[infantry2, "rifleman"] call init_loadout;

[infantry3, "teamleader"] call init_loadout;

It's like a shortcut and the file is compiled only once, instead of every time when you use the execVM command, which means it takes up less computer resources when you call the command. This is especially useful when you need to call the file MANY times during the mission, like in a loop. There are some other uses as well.

Reason why I used it in the units' init field was because I thought that the game didn't want to load the script file during the briefing for some reason. So I used the compile command to force the game to load it. It's more like a quick work-around then a proper way of doing things.

Alternatively, you can put the simple execVM commands in the init.sqf, like you did before but put the following above those commands: sleep 1; that means the game will wait one second. The trick here is that whenever a sleep is encountered during the briefing, it will wait until the briefing has ended before executing the rest of the code. Thus, the rest of the script will be executed when the mission is running and then everything works as it should.

Like I said before, I've still no idea why it doesn't work during the briefing.

Edited by BlackAlpha

Share this post


Link to post
Share on other sites

OK, thanks for the explanation. It makes sense, and also it made sense the way you did it in the mission. I really appreciate your help.

Share this post


Link to post
Share on other sites

Yo dawg I heard you like scripts so we put a script in your script so you can execute while you execute!

Share this post


Link to post
Share on other sites
Yo dawg I heard you like scripts so we put a script in your script so you can execute while you execute!

ummmmm......ok?

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  

×