Jump to content
mikie boy

Arma 3 Scripting Tutorial For Noobs

Recommended Posts

Thanks all for the errors etc. The plan is to release a final version error free with the assistance of those who have used the guide. Hopefully it will be consistent throughout. I used word and open office part way through, so that may have caused additional font change.

Any more suggestion for new chapters let me know

Share this post


Link to post
Share on other sites

Weren't you going to make one about multiplayer? That would be a good option for the next chapter.

Share this post


Link to post
Share on other sites

Next chapter will be slight advance one whats been done so far with smaller scripting examples to mess around with. I think MP is a bit too soon for this tutorial, maybe an introduction to it at the end. Idea was to write a whole MP tutorial once this one is complete.

Share this post


Link to post
Share on other sites

Hey MikieJ ,

All in all excellent Job in creating this guide. It really helped me out alot. Your Examples are always good and easily understandable. I love your way of first giving the finished Code and then going through step by step explaining what was done exactly. Keep Up the Good Work man!

There is just one Aspect I don't quite understand. It's some kinda Conflict in your second Part of your v2 Guide.

On page 22 it says :

“… use spawn to execute any function that has a sleep command inside of it, and if you want the function to return a value.â€

This Conclusion gets revised on page 26 when you say :

Well since we need to execute the ‘FOCK_RndCirclePos’ function and return a random position, we need to use the call command to call the function. Remember, when you want a function to return a value/position/array etc. you need to use the call command.

So do you have to use "Sleep" or "Call" if a Value should be returned ? O_o

Otherwise very very detailed and well made guide. As I already said, keep up the good work man!

Greeetings from Germany

SpeckiJ

* Edit : Sry didn't saw this Error was reported before :// Sry for repost

Edited by SpeckiJ

Share this post


Link to post
Share on other sites

Chapter 3 released...

Download from http://fockers.moonfruit.com/#/arma-23-scripting/4566406735

Part 1

Eventhandlers

adding

removing

use of scope and exitwith command

example usage and creation of eject and mine functions

Part 2

Get and set Variable

handle variables

Create a driving licence system using eventhandlers and get/set variables to control access to vehicles

Few other commands have been thrown in.

Direct Download https://dl.dropboxusercontent.com/u/17725328/BIS_forum/Fockers%20Tutorials/Fockers%20Arma%20Scripting%20-%20Chapter%203.pdf

plan is to collect all errors and correct them for one large tutorial once this is finished.

Edited by Mikie boy

Share this post


Link to post
Share on other sites

Thanks, nice work

I have your permission to translate and use it in Spanish pages, always acknowledging the author and posting English and Spanish versions????

Edited by Thor632

Share this post


Link to post
Share on other sites
Guest

New version frontpaged on the Armaholic homepage.

** our hosted archive contains chapters 1, 2 and 3!

==========================================

You are not registered on Armaholic, or at least not that we are aware of. In the future we offer the possibility to authors to maintain their own pages.

If you wish to be able to do this as well please register on Armaholic and let me know about it.

This is not mandatory at all! Only if you wish to control your own content you are welcome to join, otherwise we will continue to follow your work like we have always done ;)

When you have any questions already feel free to PM or email me!

Edited by Guest

Share this post


Link to post
Share on other sites

Hi Mike nice write up.

There are some issues with your use of removeEventHandler. On removing an event the index of the others does not change.

It would also be nice if you were to talk about the return from addEventHandler, this give you the index the event is being added at to give you an easy way to remove events.

For example keeping to your example using GetIn:-

If you add

evhandle0 = this addEventHandler ["GetIn", {player sidechat "EH 0";}];
evhandle1 = this addEventHandler ["GetIn", {player sidechat "EH 1";}];
evhandle2 = this addEventHandler ["GetIn", {player sidechat "EH 2";}];

To your vehicle, on getting in the vehicle you will see three sidechats.

The variables evhandle0 to 2 hold the index of each added Eventhandle so 0 to 2. If you were to remove one of the events via

removeEventHandler ["GetIn",1]

same as saying

removeEventHandler ["GetIn",evhandle1]

on entering a vehicle you would now see sidechat for 0,2.

Removing the same index again will make no difference as the indexs do not readjust, EH 2 is still at index 2.

If event handles changed their position after a lower index was removed it would mess up the ability to store indexs via the return from add event.

Maybe worth covering the alternate syntax of getVariable e.g

player geVariable ["DLicence",0];

This says get the variable DLicence from the player object, if it does not exist then return a value of 0. For your example script this would eliminate having the need to initialize the varialbe in the init.sqf

player setvariable ["drivinglicence", 0];

You may also notice the small error above from your script the variable you initialise is not the same name you use later on DLicence/drivinglicence.

Edited by Larrow

Share this post


Link to post
Share on other sites

thanks, i hope you bring also some scripting for MP and the split between client and server...

Share this post


Link to post
Share on other sites

@Larrow - cheers for that dude - The wiki says otherwise and i didnt really check it - just assumed it worked. Cheers for that. Ill add the bit on the getvariables as well. suppose i was being lazy :)

as for the drivinglicence and Dlicence - Drivinglicence is just the example - Dlicence is the actual working script - but i can see the confusion.

@ghost0815 - yeah i will be getting onto MP at some point - just time consuming writing this stuff out - plus im crap i thinking of examples.

Share this post


Link to post
Share on other sites

Folks. Error that larrow pointed out is correct. I uploaded wrong version.

Player setvariable ["drivingLicence", 0 ]; should be player setvariable ["DLicence", 0 ]; in your init.sqf for the final script

Cheers larrow.

Share this post


Link to post
Share on other sites

correct version now in place - Larrow i Added the bit about the eventhandler index -cheers - ill sort the getvariable stuff out in one of the next chapters.

All previous links have been amended - and on website :)

https://dl.dropboxusercontent.com/u/17725328/BIS_forum/Fockers%20Tutorials/Fockers%20Arma%20Scripting%20-%20Chapter%203.pdf

Share this post


Link to post
Share on other sites

Nice work, thanks mate ! :)

Share this post


Link to post
Share on other sites

I am just starting out with this scripting stuff in arma i have no clue about anything so finding this is a big help,i only hope i start understanding it lol

thanks again

Share this post


Link to post
Share on other sites

Thanks Mike! haha I've known the basics of arma scripting for a little while now but this has helped me tie them all together and allowed me to make bigger and better things! I was very happy to see Chapter 3 release. I've passed them on to some of my friends who have also wanted to learn scripting and they've given great feedback so far! The guide itself is awesome but thanks for the time and effort you put in to make it, it really shows!

thanks again man!

Share this post


Link to post
Share on other sites

Hey! The six config editor class names hasn't been updated since the ALPHA. Can anyone point me the class names for editor objects like laptop, whiteboard etc? Thanks a bunch!

Also would this be createvehicle? or createunit? Im guessing createvehicle

Share this post


Link to post
Share on other sites

Just a quick note: The class-names for Editor-placed things is listed on the Top Bar

of the placement/selection box when you click on the objects.

Share this post


Link to post
Share on other sites

Awesome work Mike! Maybe this should be in instruction booklets next time Bohemia Interactive release a game ;)

Share this post


Link to post
Share on other sites

Many thanks all, much appreciated - Starting work on chapter 4 finally - taking a while though so sorry about that

Share this post


Link to post
Share on other sites

Great work mate, you saved my day. I was about to quit trying. Now it feels like it's a cakewalk.

Share this post


Link to post
Share on other sites

Thanks for these, I like to dabble in this stuff and I realize learning a bit of this would be useful in my making my missions better.

Share this post


Link to post
Share on other sites

Thanks! Have been thinking about how i ever could learn how to script, until i found your guide. Have been sitting with in some hours now reading and testing. Now i can do some easy scripts my own that i never thought i would be able to do!

Many thanks, waiting for the Multiplayer part since thats the mission im doing, trying to make a Co-op mission but don't really know what i should use instead of "Player" hehe

Keep up the good work

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

×