Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.17 KB | None | 0 0
  1. //TRIGGER EXAMPLE
  2. //Spawn a tree, vanilla
  3. //Because we are calling vanilla objects, their textures
  4. //and materials are already in-game, no need to change them
  5. //define a position, close to player
  6. //trees spawn below ground, so we also move it up by 8 m after spawning it
  7.  
  8. pos = player getRelPos [15, 0];    
  9. tree = createSimpleObject ["a3\plants_f\Tree\t_PinusP3s_F.p3d", pos];
  10. tree setPos [pos select 0, pos select 1,8];
  11.    
  12.  
  13. /*
  14. ---------------------------
  15. ALL EXAMPLES BELOW THIS POINT ARE DESIGNED FOR USE IN SCRIPTS.
  16. Using them in triggers may result in errors.
  17. ---------------------------
  18. */
  19.  
  20. //Spawn a tree, vanilla
  21. //Because we are calling vanilla objects, their textures
  22. //and materials are already in-game, no need to change them
  23. _pos = player getRelPos [15, 0];    //define a position, close to player
  24. _tree = createSimpleObject ["a3\plants_f\Tree\t_PinusP3s_F.p3d", _pos];
  25. _tree setPos [_pos select 0, _pos select 1,8];  //trees spawn below ground, so we move it up by 8 m
  26.  
  27. //spawn a bush, covers up the tree base
  28. _pos = player getRelPos [13, 0.2];
  29. _bush = createSimpleObject ["a3\plants_f\Bush\b_NeriumO2d_F.p3d", _pos];
  30. _bush setPos [_pos select 0, _pos select 1,2.1];        //we move it by 2.1 m up
  31.  
  32. //Spawn a road part, vanilla
  33. _pos = player getRelPos [5, 0];
  34. _road = createSimpleObject ["a3\roads_f\Roads\city_W10_A7_639_R75.p3d", _pos];
  35. _road setPos [_pos select 0, _pos select 1,2];
  36.  
  37. //spawn a vanilla bridge, rotate it slightly
  38. _pos = player getRelPos [30, 0];
  39. _brdg = createSimpleObject ["a3\structures_f\Bridges\Bridge_Concrete_F.p3d", _pos];
  40. _brdg setPos [_pos select 0, _pos select 1,7.5];    //each model has different height
  41. _brdg setDir 35;
  42.  
  43. //spawn a non-animated head and place it on a metal shelf called "shelf"
  44. _pos = getpos shelf;
  45. _sol = createSimpleObject ["a3\characters_f\heads\m_greek_01.p3d", _pos];
  46. _sol setPos [_pos select 0, _pos select 1, 1.3];
  47. _sol setdir direction shelf;
  48.  
  49. //spawn a vehicle (not interactive, immobile)
  50. _pos = getpos player;
  51. _posX = _pos select 0;
  52. _posY = _pos select 1;
  53. _sol = createSimpleObject ["a3\armor_f_beta\apc_tracked_01\APC_Tracked_01_aa_F.p3d", _pos];
  54. _sol setPos [_posX, _posY, 5.8];
  55.  
  56.  
  57. //spawn a custom model (in this case, a vest)
  58. //you NEED description.ext for this to work. Even an empty file.
  59. _pos = shelf getRelPos [0,1];
  60. _obj = createSimpleObject      
  61.  [(str missionConfigFile select [0, count str missionConfigFile - 15])  //path to mission folder
  62.  + "A3_vest_example.p3d", _pos]; //name of the object itself, position
  63.  //set the object's texture and material, I used in-game data
  64. _obj setObjectTexture [0,"a3\characters_f\BLUFOR\data\armor1_co.paa"];
  65. _obj setObjectMaterial [0,"a3\characters_f\BLUFOR\data\armor1.rvmat"];
  66. _obj setPos _pos;   //make sure the object is in the right place
  67.  
  68.  
  69.  
  70.  
  71.  
  72. //The video also included a quick showcase of all different types of objects,
  73. //these objects were spawning in a row and each one was rotating around as it spawned to demonstrate that the objects
  74. //can be operated with commands, just like any static object. The script is down below,
  75. //but it is more like an extra fancy example, not necessarily what needs to be done each time you want to spawn something.
  76.  
  77. _array = [
  78. "a3\structures_f\households\addons\i_Garage_V1_F.p3d",
  79. "a3\structures_f\walls\Mil_WiredFenceD_F.p3d",
  80. "a3\structures_f_bootcamp\Civ\SportsGrounds\GymBench_01_F.p3d",
  81. "a3\structures_f\mil\fortification\HBarrierTower_F.p3d",
  82. "a3\armor_f_beta\apc_tracked_01\APC_Tracked_01_crv_F.p3d",
  83. "a3\rocks_f\Decal_rock_dark.p3d",
  84. "a3\rocks_f\StoneSharp_Wall.p3d",
  85. "a3\plants_f\Bush\b_Thistle_Thorn_Green.p3d",
  86. "a3\plants_f\Tree\t_poplar2f_dead_F.p3d",
  87. "a3\roads_f\Test_RoadsA\road_W10_A18_007_R35.p3d",
  88. "a3\structures_f\Bridges\Bridge_Asphalt_F.p3d",
  89. "a3\data_f\ParticleEffects\Universal\Explosion_4x4.p3d",
  90. "a3\data_f\ParticleEffects\Universal\GlassShards.p3d",
  91. "a3\boat_f_epc\Submarine_01\Submarine_01_F.p3d"
  92. ];
  93. _n = count _array;
  94. _j = 200;
  95. for "_i" from 0 to (_n - 1) step 1 do {
  96. _pos = logic getRelPos [_j, 0];
  97. _obj = createSimpleObject [_array select _i, _pos];
  98. _obj setPos [_pos select 0, _pos select 1,25];
  99. _j = _j - 15;
  100.  
  101. for "_xx" from 0 to 360 step 1 do {
  102. _obj setDir _xx;
  103. sleep 0.05;
  104. };
  105. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement