Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.61 KB | None | 0 0
  1. /if(!isServer) then {waitUntil{!isNull player}};
  2. // **************************************************************************
  3. // BEGIN OF JBOY DOG INIT.SQF CODE
  4. // *************************************************************************// **************************************************************************
  5. // Compiles all JBOY Dog scripts and initializes some settings
  6. // **************************************************************************
  7. call compile preprocessFileLineNumbers "JBOY_Dog\JBOY_DogInit.sqf";
  8.  
  9. //if jip player and not server then exit
  10. _JIPplayer = not isServer && isNull player;
  11. if (_JIPplayer) exitwith {};
  12.  
  13. // **************************************************************************
  14. // Add dog menu to player. In this example mission, the player unit is named handler1 in the editor.
  15. // **************************************************************************
  16. _dogMenu = [handler1] spawn {params["_handler"];sleep 2; _d=[_handler] call JBOY_fnc_DogDisplayEH;};
  17. saveLoad = addMissionEventHandler ["Loaded",{
  18. [valdez] spawn {params["_handler"];sleep 2; _d=[_handler] call JBOY_fnc_DogDisplayEH;}
  19. }];
  20.  
  21. // **************************************************************************
  22. // Create a dog, assign a named handler unit to him, and place the dog next to handler.
  23. // The var _dog now references this newly created dog.
  24. // If 4th parameter=true, then voice commands will use my voice commanding Boomer.
  25. // If 4th parameter=false, then voice commnads will use generic ARMA voice commands to command dog.
  26. // **************************************************************************
  27. _dog = [handler1, "Fin_tricolour_F", (handler1 modelToWorld [2,2,0]), true] call JBOY_dog_create; // Create dog. 4th parameter true means use Johnnyboy voice for commands.
  28.  
  29. // **************************************************************************
  30. // Start command listener for the dog and handler pair.
  31. // **************************************************************************
  32. nul = [_dog, handler1, 2.5] execVM "JBOY_Dog\JBOY_dogCommand.sqf";
  33. // **************************************************************************
  34. // Set variable to allow other units to take control of dog if dog's handler is killed. Remove this line if you do not want that.
  35. // **************************************************************************
  36. sleep 1; // allow time for some dog variables to get set before doing next few calls
  37. _dog setVariable ["vOtherHandlers",(units group handler1) - [handler1],true]; // Define array of potential handlers who may take control of dog when current handler killed
  38.  
  39. //* **************************************************************************
  40. // If you want dogs to track units then do this:
  41. // =============================================
  42. // 1. In the Editor, create a unit to be tracked, and give the unit waypoints to move through.
  43. // 2. Put this line in Unit's init line in the editor (or call it from somewhere else):
  44. // _dmy = [this] spawn {params["_fugitive"]; sleep 2; _dmy=[_fugitive] call JBOY_dogPreyInit;};
  45. // Note: The tanoan thug near the flag pole in this mission has this statement in his init, and he will make a trail
  46.  
  47. // **************************************************************************
  48. // Start loop for dog to detect scent trails
  49. // **************************************************************************
  50. _dmy = [_dog] spawn {params["_dog"]; sleep 1; _d=[_dog] call JBOY_DogScentDetectionLoop;};
  51.  
  52.  
  53. /* **************************************************************************
  54. How to have a dog follow an AI handler:
  55. THIS V1.4 SAMPLE MISSION NOW HAS A SENTRY AI NAMED sentry1 DOING EXACTLY THIS, AND WALKING WAYPOINTS UNTIL DOG SENSES ENEMY.
  56. ======================================
  57. 1. Create an AI unit, name him, and give him move waypoints. Speed set to Limited works best for keeping dog close to handler.
  58. 2. Paste the code below into the unit's init field. In this case I am giving him 2 dogs. (one named Zagor, and one named GrumpyOldDog).
  59. 3. This example reduces enemy detection distance down to 40 meters instead of default of 70 meters
  60. 4. Also in code below you see I named the dog "Zagor". For non-boomer dogs, you can now name the dog to another name.
  61. 5. I also decided to make this handler french, so he commands his two dogs in French
  62.  
  63. _dmy= [this] spawn
  64. {
  65. params["_handler"];
  66. [_handler, "Male04FRE"] remoteExecCall ["setSpeaker", 0];
  67. sleep 1;
  68. _dog = [_handler, "Fin_blackwhite_F", (_handler modelToWorld [3,4,0]), false] call JBOY_dog_create;
  69. _dog setVariable ["vEnemyDetectDistance", 40, true];
  70. _dmy = [_dog, _handler, 2.5] execVM "JBOY_Dog\JBOY_dogCommand.sqf";
  71. _dog setVariable ["vDogName", "Zagor", true];
  72. sleep 1;
  73. _dog setVariable ["vCommand", 'heel', true];
  74. };
  75.  
  76. _dmy= [this] spawn
  77. {
  78. params["_handler"];
  79. [_handler, "Male04FRE"] remoteExecCall ["setSpeaker", 0];
  80. sleep 1;
  81. _dog = [_handler, "Alsatian_Sandblack_F", (_handler modelToWorld [3,4,0]), false] call JBOY_dog_create;
  82. _dog setVariable ["vEnemyDetectDistance", 40, true];
  83. _dmy = [_dog, _handler, 2.5] execVM "JBOY_Dog\JBOY_dogCommand.sqf";
  84. _dog setVariable ["vDogName", "GrumpyOldDog", true];
  85. sleep 1;
  86. _dog setVariable ["vCommand", 'heel', true];
  87. };
  88.  
  89. *****************************************************************************/
  90.  
  91. // **************************************************************************
  92. // Uncomment the following lines to create some animals for dog to attack and fetch.
  93. // **************************************************************************
  94. /*
  95. R1 = createAgent ['Rabbit_F', player modelToWorld [0,30,0], [], 0, "NONE"];
  96. R2 = createAgent ['Rabbit_F', player modelToWorld [2,30,0], [], 0, "NONE"];
  97. R3 = createAgent ['Rabbit_F', player modelToWorld [-2,30,0], [], 0, "NONE"];
  98. C1 = createAgent ['Cock_random_F', player modelToWorld [3, 20, 0], [], 0, "NONE"];
  99. C2 = createAgent ['Cock_white_F', player modelToWorld [0, 20,0], [], 0, "NONE"];
  100. {[_x] execVM "JBOY\addBirdDamageEH.sqf";} foreach [R1,R2,R3]; // add feather effect to chickens when shot
  101. {nul = [_x,true] execVM "JBOY\JBOY_animalScatter.sqf";} foreach [R1,R2,R3,C1,C2]; // rabbits will scatter when dog or man near.
  102. S1 = createAgent ['Snake_random_F', player modelToWorld [3, 10, 0], [], 0, "NONE"];
  103. S2 = createAgent ['Snake_random_F', player modelToWorld [1, 12, 0], [], 0, "NONE"];
  104. */
  105.  
  106. // **************************************************************************
  107. // To spawn a feral dog pack, place a trigger on the map, and name it dogPackTrigger1.
  108. // Then paste the code below into that trigger.
  109. // Make trigger radius 400 x 400 (or larger...you don't want player to see pack spawn)
  110. // Make trigger activated by anybody present
  111. // **************************************************************************
  112. /*
  113. _dmy=[] spawn
  114. {
  115. _pos = getpos dogPackTrigger1;
  116. _followerDogTypes = ["Fin_blackwhite_F","Fin_ocherwhite_F","Fin_tricolour_F","Alsatian_Black_F","Alsatian_Sandblack_F"];
  117. _pack = [_pos, 7, "Alsatian_Sand_F", _followerDogTypes, 50] call JBOY_dogPackCreate;
  118. };
  119. */
  120. hint "Use T key to see dog command menu. Move towards red flag pole if you want dog to detect a scent trail. In the editor, look at the unit init of the unit by the flag pole for the code that stars dropping a scent trail.
  121. To spawn a dog pack walk on to the runway. Look at the code in trigger covering runway to see how to spawn the dog pack.";
  122. // **************************************************************************
  123. // END OF JBOY DOG INIT.SQF CODE
  124. // **************************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement