Jump to content
Sign in to follow this  
dealman

Multiplayer Scripting

Recommended Posts

I've been working on a script for a little while, and wanted to make sure that current progress was working well in multiplayer since I've been using the Editor for quick testing. I'm fairly new to programming in SQF, and C++ in general. I come from a Lua-oriented game, which was not only a easier language to understand but also the game itself was much more unforgiving for newcomers unlike ArmA :P

I can't even get a simple hint to work in Multiplayer, I make a MP Mission, throw a init.sqf in there which uses execVM to execute another script. For testing purposes I commented everything out and I'm trying to output a simple hint message, but it would seem it's not starting my script at all.

Am I missing something...?

init.sqf;

_testScript = [] execVM "Test\HelloWorld.sqf";

HelloWorld.sqf;

hint "Hello World!";

I've tried some other things as well, but I can't get it to output any message whatsoever... I'm fairly sure I've missed something obvious. So any pointers in the right direction would be welcome!

Thanks in advance for any help!

Share this post


Link to post
Share on other sites

Test\HelloWorld.sqf : do you have HelloWorld.sqf file under test folder in mission folder ?

Do you receive any sqf file missing warning when start mission?

your codes are ok.

Share this post


Link to post
Share on other sites
Test\HelloWorld.sqf : do you have HelloWorld.sqf file under test folder in mission folder ?

Do you receive any sqf file missing warning when start mission?

your codes are ok.

Aye, I've made sure several times that it's correct, and also checked for typos.

I am running ArmA 2 with the launch parameter showScriptErrors, but I'm not getting any errors whatsoever. Do you reckon the issue might be that I host it directly through the Multiplayer menu? And not actually as a dedicated server...?

Edited by Dealman

Share this post


Link to post
Share on other sites

Go to your mission folder. (example: My Documents\ArmA 2 Other Profiles\YourName\missions\Mymission.map)

Create a text file and name it "init.sqf". Then add this in the init.sqf:

[] execVM "hello.sqf";

After that, create a text file called "hello.sqf", and put this in the file:

hint "Hello All!";

And thats it, pretty much basic stuff to scripting, if there is any other probs, let me know. :cool:

If you want to know more types of scripts you can use to make your own, go here: Category:Scripting_Commands_ArmA2

Regards,

Ranwer

Share this post


Link to post
Share on other sites

That's a single player mission, though. I've already made plenty progress on my script, but I need to start to make it compatible with multiplayer. But I realized nothing was working as I started moving it over, so I made a test simply to output a basic message to make sure it's working.

The problem is, I can't seem to execute any script whatsoever when I create a multiplayer mission. If I use a single-player mission via the editor, it works fine.

Share this post


Link to post
Share on other sites

If you can execute the script from the offline editor, just copy the mission to your "mpmissions" folder.

Share this post


Link to post
Share on other sites
If you can execute the script from the offline editor, just copy the mission to your "mpmissions" folder.

I already tried moving the folder I have in my Missions folder to the MPMission folder in my documents, and it's not executing the scripts. I have a theory that it has something to do with me hosting it as a 'listen' server via the MP Menu directly, and not actually as a dedicated one.

Edit:

I have now managed to get it to work somehow, I'm not entirely sure as to what I really did. But scripts seem to be executing now, even when hosted as a listen server.

http://i.imgur.com/456VF5p.jpg (157 kB)

Edited by Dealman

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  

×