This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
arma:misc [2009-02-09 00:50] snakeman tweaked aircraft scripts. |
arma:misc [2009-12-10 18:38] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Misc Stuff ====== | ||
- | Area where all misc stuff is placed, before proper place can be found them (if any). | ||
- | |||
- | ====== Default Installation Files ====== | ||
- | |||
- | * [[arma:default_files|Default files]] | ||
- | Default installation files from your DVD. | ||
- | |||
- | ====== User Interface ====== | ||
- | |||
- | When using desktop and ArmA resolution of 1024x768 and your user interface image files are 1280x1024 you'll encounter some memory errors and ArmA will crash. | ||
- | |||
- | Here is example images in question: | ||
- | <code cpp> | ||
- | class RscDisplayLoadMission : RscStandardDisplay | ||
- | { | ||
- | class controlsBackground | ||
- | { | ||
- | class LoadingPic : RscPicture | ||
- | { | ||
- | text = "\VTE_objects\UI\VTE_loading-01.pac"; | ||
- | colortext[] = {1, 1, 1, 1}; | ||
- | }; | ||
- | }; | ||
- | }; | ||
- | </code> | ||
- | To fix this problem, use image resolution 1024 x 1024 (or other power of two resolution I believe). | ||
- | |||
- | |||
- | ====== Aircraft Scripts ====== | ||
- | |||
- | This section describes some basic things about addon aircraft scripts. | ||
- | |||
- | This is practical example of setting up F4 Phantom aircraft addon from OFP conversion into ArmA compatible environment. | ||
- | |||
- | First we have exhaust smoke script in OFP like this: | ||
- | <code cpp> | ||
- | ; We know who we are | ||
- | _plane = _this select 0; | ||
- | |||
- | #SmokeLoop | ||
- | ; If we're dead, we can stop smoking | ||
- | ?(!alive _plane) : goto "Exit"; | ||
- | ~0.01; | ||
- | ?(speed _plane < 100) : goto "SmokeLoop"; | ||
- | |||
- | _alpha = 0.16 * ((speed _plane / 900)); | ||
- | ?(_alpha > .16): _alpha =.16; | ||
- | |||
- | drop ["\ca\data\cl_basic", "", "Billboard", 1, 10, [0,-5,.1], [5-random 10, 5-random 10, 5-random 10], 0, 10, 1, 1, [5,15,40], [[.2,.2,.2,_alpha/10], [.2,.2,.2,_alpha], [.2,.2,.2,0]], [0,.2,1], 5, 5, "", "", _plane] | ||
- | |||
- | goto "SmokeLoop"; | ||
- | |||
- | #Exit | ||
- | exit | ||
- | </code> | ||
- | Now we have ported the SQS script into SQF format which ArmA likes. This is how it looks when its ported: | ||
- | <code cpp> | ||
- | |||
- | private ["_plane", "_s", "_alpha"]; | ||
- | |||
- | // We know who we are | ||
- | _plane = _this select 0; | ||
- | |||
- | // Alive and with the engine on? | ||
- | while {alive _plane && isEngineOn _plane} do | ||
- | { | ||
- | sleep 0.01; | ||
- | _s = speed _plane; | ||
- | |||
- | if (_s > 100) then | ||
- | { | ||
- | _alpha = 0.16 * (_s / 900); | ||
- | if (_alpha > 0.16) then | ||
- | { | ||
- | _alpha = 0.16; | ||
- | }; | ||
- | drop["\ca\data\cl_basic", "", "Billboard", 1, 10, [0, -5, 0.1], [5 - random 10, 5 - random 10, 5 - random 10], 0, 10, 1, 1, [5, 15, 40], [[0.2, 0.2, 0.2, _alpha/10], [0.2, 0.2, 0.2, _alpha], [0.2, 0.2, 0.2, 0]], [0, 0.2, 1], 5, 5, "", "", _plane]; | ||
- | }; | ||
- | }; | ||
- | </code> | ||
- | |||
- | Next you need to run this script from your aircraft's config.cpp file. This is used with compatibility to Extended Eventhandlers (XEH) like this: | ||
- | <code cpp> | ||
- | class Extended_Init_EventHandlers | ||
- | { | ||
- | class VTE_SomeClassName | ||
- | { | ||
- | VTE_F4_engine = "if (isEngineOn (_this select 0)) then {[_this select 0,true] execVM '\path\to\script.sqf'}"; | ||
- | }; | ||
- | }; | ||
- | |||
- | class Extended_Engine_EventHandlers | ||
- | { | ||
- | class VTE_SomeClassName | ||
- | { | ||
- | vte_someclassname_smokefx = "if (_this select 1) then {_this execVM '\path\to\script.sqf'}"; | ||
- | }; | ||
- | }; | ||
- | </code> | ||
- | And your aircraft is ready to run this smoke script. Notice how the extended_**init**_eventhandlers are used to start the script even if you place the aircraft flying in mission editor. The extended_**engine**_eventhandlers alone works OK if you start the aircraft on ground, so after mission start the engine is started by AI or player. |