OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Landdon on 13 Jun 2007, 15:07:24

Title: Hunter Killer Script
Post by: Landdon on 13 Jun 2007, 15:07:24
I downloaded this script and there was no readme for it.  I would like to implement it against a specific player (named "Pilot").  My first question is how do I effectively do that, and is there a way to improve upon it.  Is it buggy or reliable for Multiplayer?  At this point and time Addon like Group Link II can't be loaded on our server.

Code: [Select]
;Modified by Dekela from General Barrons OFP HK script

_Killer =_this select 0
_KG = group _killer
_HG = _this select 1
_KL = leader _KG

_KG SetCombatmode "RED"

_KG SetSpeedMode "FULL"

#loop
_HL = leader _HG
units _KG domove getpos _HL

~30
;you can change the distance from 300, but 300 seems about right.
? (_KL distance _HL) <300 : _KG SetBehaviour "COMBAT"
? (opfor countSide units _KG) <1 : exit
? (bluefor countside units _HL) <1 : exit

goto "loop"

exit
 
Title: Re: Hunter Killer Script
Post by: Mandoble on 13 Jun 2007, 15:31:44
Code: [Select]
/*
huntunit.sqf
Parameters:
   Group of the hunters
   Victim to kill
   If group is closer than that to the victim, the script will not send move commands to the hunting group
   Minimum number of alive units in the hunting group to keep hunting the victim

Example:
[group hunter1, pilot, 200, 2]execVM"huntunit.sqf"
*/

_huntgroup   = _this select 0;
_victim         = _this select 1;
_engangedist = _this select 2;
_minunits      = _this select 3;

_huntgroup setBehaviour "AWARE";
_huntgroup SetCombatmode "RED";
_keephunting = true;
_letsflee = false;
_leaderhunters = objNull;

while {_keephunding} do
{
   _leaderhunters = leader _huntgroup;
   if ((_leaderhunters distance _victim) > _engangedist) then
   {
      _huntgroup move getPos _victim;
   };
   Sleep 10;
   if (!alive _victim) then {_keephunting = false};
   if (({alive _x} count units _huntgroup)< _minunits) then {_keephunting = false;_letsflee = true};
};

if (_letsflee) then
{
// Add code here so that hunting group flees away, the hunting group has less units than minimum to keep hunting
};

Title: Re: Hunter Killer Script
Post by: Mr.Peanut on 13 Jun 2007, 15:50:08
GroupLink II is an addon? You could still unpbo it and use the scripts inside.
Title: Re: Hunter Killer Script
Post by: Landdon on 14 Jun 2007, 03:32:19
Group Link II has scripts, the problem is it calls for a the PBO File (Which is voices) and it cannot be used without it.  I asked the person that was modding it over to ArmA.  There is a topic in BIS forums about it.  He is trying to fix it so it will not require it but has not been successful.
Title: Re: Hunter Killer Script
Post by: ViperMaul on 14 Jun 2007, 08:46:50
Landdon,

You should speak with Sickboy, he has one version of GL2 in his MOD and he disabled voices. Perhaps Sickboy knows knows how to remove that PBO file dependency you are speaking of.  Because GL2 will definitely do what your goals are with a little added work. However, you can probably learn more about scripting by understanding what Mando wrote for you if you use his work. Then you will be more able to write your own scripts in the future.

ViperMaul
Title: Re: Hunter Killer Script
Post by: Sick on 14 Jun 2007, 15:20:03
The PBO File dependency shouldnt be any problem to remove... just disable the voice systems from the script and ur done.
Altough I haven't looked at SNKMan's work, as I am 100% against any usage of SQS in ArmA, it should be easy to remove the voice addon dependency.

SNKMan could aswell build in a check in his code to see if the addon is installed with the following statement:
isClass (ConfigFile >> cfgPatches >> "AddonName")

the above will return true if the "AddonName" is present, and false if not.