Jump to content
Sign in to follow this  
otester

External Scripts

Recommended Posts

Yes I'm new to this, read the wiki but it doesn't say how to use external scripts.

I tried the old OFP way and it gave me an error:

Quote[/b] ][] exec “hello.sqsâ€

Share this post


Link to post
Share on other sites

It would be best, if it`s impossible to activate external scripts.

All this leads to are trojans in ArmA addons.

That is something nobody will like to have.

Share this post


Link to post
Share on other sites

How do I make mods then if no one will touch them?

How do you guys do it?

Isn't the init field a bit limited?

Share this post


Link to post
Share on other sites

I think you too are talking about too different things. There's already a few scripts with demo missions floating around here and ofpec.com otester. Take a look at how it's done in those.

Share this post


Link to post
Share on other sites
I think you too are talking about too different things. There's already a few scripts with demo missions floating around here and ofpec.com otester. Take a look at how it's done in those.

Yeah basically as you can't fit all the code in the "init" field, can I write it in an ".sqs" file and link it?

That site didn't have anything.

Share this post


Link to post
Share on other sites

You need to find your mission folder, otester.

Open the editor, add few things to your mission, save it.

Atl-tab out to windows, launch an explorer, go to "My Documents\ArmA Other Profiles\<your nickname>\Missions"

there should be there a folder named like your mission, go there.

You'll find a "mission.sqm" inside, which is the file listing what you have put in the editor.

this folder is where you need to put your script files (.sqs and .sqf) that you can call from init fields, and activation fields of triggers, with exec, execVM, preProcessFile, etc...

You cannot call scripts that are not in this folder (or in subfolders of it).

... well, that's not entirely true, as you can call scripts defined in ArmA .pbo files, but they are predefined, and generally not used.

Share this post


Link to post
Share on other sites
You cannot call scripts that are not in this folder (or in subfolders of it).

You can create a directory called 'scripts' under your arma profile dir (my documents\ArmA). At least in the mission editor preview scripts can be executed directly from there, which is useful for testing. You can also use full pathnames like 'c:\stuff\test.sqf'.

Share this post


Link to post
Share on other sites

My bad then.

Now, it won't be very usable to play it on another PC, will it? (I mean, the full pathname thing)

Share this post


Link to post
Share on other sites
My bad then.

Now, it won't be very usable to play it on another PC, will it? (I mean, the full pathname thing)

If you make an add-on with an installer, you could store your scripts in a common directory - and not in those cursed mod folders.

Share this post


Link to post
Share on other sites
Quote[/b] ]can call from init fields, and activation fields of triggers, with exec, execVM,

Yeah it's calling it thats the problem, how do I make it run my script?

Share this post


Link to post
Share on other sites

Check the wiki on scripts...

http://community.bistudio.com/wiki/ArmA:_Introduction_to_Scripting

What you are going to end up with is a text file saved as an SQF (e.g. myScript.sqf) within your mission folder and then you are going to put in the init line of a unit (or somewhere in a trigger)

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[] execVM "myScript.sqf"

Share this post


Link to post
Share on other sites
You cannot call scripts that are not in this folder (or in subfolders of it).

I don't think that statement could be any further from the truth. You can use subfolders. Try:

[] execVM "MySubFolder\MyScript.sqf"

And as previously pointed out by others, there are exceptions to the other rule as well.

Share this post


Link to post
Share on other sites
You cannot call scripts that are not in this folder (or in subfolders of it).

I don't think that statement could be any further from the truth. You can use subfolders. Try:

[] execVM "MySubFolder\MyScript.sqf"

And as previously pointed out by others, there are exceptions to the other rule as well.

errr... That's what I was saying, about subfolders wink_o.gif

Share this post


Link to post
Share on other sites

can you help me with the error? ^^

EDIT: Got it to work by using:

Quote[/b] ]var = player execVM "testscript.sqf"

Would you use?

Quote[/b] ]var = unit

for AI?

Share this post


Link to post
Share on other sites

you are passing the player into the script as a parameter. If you don't intend to do that, you can use:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">var = [] execVM "test.sqf";

or

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">var = execVM "test.sqf";

Share this post


Link to post
Share on other sites

^Thanks.

Can I change weapon sounds in scripts or is that done with config files, if so then how would one go about doing that? whistle.gif

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  

×