BASIC SCRIPTING

By RED

Main Menu

 

 

This tutorial is aimed at getting you started at basic scripting.

Ok where to begin !
Well first you need to know what u are aiming to do, in this tutorial we are going to make a Artillery Script which will fire Artillery rounds at a Area of the map (Targeted with a marker and activated with a trigger radio Alpha)

The first thing i am going to do is show you the script and how to use it, then give you the explination. this may sound irregualr but i find i learn better this way.

this is the script :


_Centre = _this select 0
_area = _this select 1
_shells _this select 2

_CentrePos = GetMarkerPos _Centre
_xco = _CentrePos select 0
_yco = _CentrePos select 1
_zco = _CentrePos select 2

_areaX2 = _area * 2

~2
titletext ["\n\n\n\n\n\n\nTake cover !","plain", 2]

~2

_a = _shells

#start

_bomb1 = "grenade" camCreate [_xco + Random(_areaX2) - _area,_yco + Random(_areaX2) - _area,_zco + 150]

~1

_bomb2 = "grenade" camCreate [_xco + Random(_areaX2) - _area,_yco + Random(_areaX2) - _area,_zco + 150]

_a= _shells - 1

?(_a > 0) : goto "start"

Exit


You put this script into a .SQS file you make this kind of file in notepad.

When in notepad just copy and paste the script above in. Then click save as, name it "art.sqs" then change the box below from text file, to all files (*.*).

You now have the script in the sqs file but you need to make the game activate that script for it to work.

So first make a new mission in the editor (desert island). now save it as "artytest", now go into the directory you saved the sqs file and copy it into the missions folder, (default dir should be : C:\Program Files\Codemasters\OperationFlashpoint\
Users\username\missions\artytest.Intro) then just paste the sqs file into that directory.