Einzelnen Beitrag anzeigen
Alt 28.06.2013, 16:28   #1 (permalink)
killshot
50 Beiträge100 Beiträge
 
Registriert seit: 03.07.2012
Beiträge: 118
Standard Ai Artillery Framework (Dedicated Server)

Hey Leute,

ich habe ein kleines (Sound-)Problem mit dem Ai Artillery Framework von Blake (http://www.armaholic.com/page.php?id=8421).

Ich habe 2 Mörser positioniert und mit dem BI-Artillery-Modul (Name:Mort) verbunden. Dann mehrere Spotter (Init: null = [this,mort,500,2] execVM "FO-ai.sqf") gesetzt.

Es funktioniert auch alles wie gewünscht, allerdings kommt es auf dem DediServer zu einem leicht störenden Problem, nämlich die Geräusche der fliegenden Mörsergeschosse werden in so einer Art Loop wiedergegeben.
Als würden anstelle von einem Geschoss quasi 100 Geschosse in geringem Abstand über meinen Kopf fliegen.

Ich habe den Mörsern einen Eventhandler zugeteilt (this addEventHandler ["FIRED", {hint "Mortar1 fired!"}]) um zu sehen, ab wann die Geräusche auftreten, sie beginnen direkt sobald die erste Granate abgefeuert wurde und enden nachdem die letzte Granate detoniert ist. Also hört man im Detonationsgebiet (hier sind es 50 Sekunden Flugzeit) 50 Sekunden lang dieses sich wiederholende Geräusch, bis zum ersten Einschlag und dann kontinuierlich noch weitere Minuten, bis das Mörserfeuer eingestellt und die letzte Granate explodiert ist.

Hier die beiden Scripts von Blake, die verwendet werden:

FO-ai.sqf
Code:
/*
Ai Artillery Framework
By [ZSU]Blake www.zspecialunit.org

Ok this is a sample script for the Ai artillery Framework. It can be used in isolation or incorporated into something more complicated without having to recreate all the important aspects from scratch.
The basic implementation requires at a minimum a target.
eg null = [FO] execVM "FO-ai.sqf" it requires you have a artillery object synced to an artillery module named Art1.
Place this in a FO units init line.

Optional arguments are

Battery - which is the name of the artillery module you are calling (Default Art1)
Range - How far around the ai FO will he prosecute targets (Default 500)
Number of rounds - How many rounds to fire assuming the artillery has the ammunition (Default 1)
Dispersion - Basically how much spread between rounds (Default 100)
Prediction Calibrator - A way to influence how far ahead in the current direction of the target to rounds land (Default 20)
Skill - A basic way to see how accurate the placement is values from 1 to 10 (Default 5)
Friendly - Checks to ensure their is not a friendly of this type within 50m of the impact location (Default "SoldierWB")


*/

if (!isserver) exitWith {};
Sleep 4;

_FO = _this select 0;
_battery = if (count _this > 1) then {_this select 1} else {Art1};
_Range = if (count _this > 2) then {_this select 2} else {500};
_NoRnds = if (count _this > 3) then {_this select 3} else {1};
_RndType = if (count _this > 4) then {_this select 4} else {"HE"};
_Dispersion = if (count _this > 5) then {_this select 5} else {100};
_adjmult = if (count _this > 6) then {_this select 6} else {20};
_skill = if (count _this > 7) then {_this select 7} else {5};
_friendlycheck = if (count _this > 8) then {_this select 8} else {"SoldierEB"};
_enemy = WEST;

if  (_friendlycheck != "SoldierEB") Then
    {
    _enemy = EAST;
    };

While {alive _FO} do {
    _TgtNow = objNull;
    _TgtList = _FO nearTargets _Range;
    
    {
        
        _Side = _x select 2;
        if (_side == _Enemy) then {
        _tgtNow = _x select 4;
        Sleep 0.01;
        };
    Sleep 0.01;    
    } forEach _TgtList;
    
    if (!isNull _TgtNow) then 
    {
        
        sleep 1;
        _null1 = [_TgtNow,_battery,_NoRnds,_RndType,_Dispersion,_adjmult,_skill,_friendlycheck] execVM "scripts\aifiremission.sqf"; 
    };

    
    
    
Sleep 5;
};
Sleep 3;
aifiremission-sqf
Code:
/*
Ai Artillery Framework
By [ZSU]Blake www.zspecialunit.org

Ok this is the core script for the Ai artillery Framework. It can be used in isolation or incorporated into something more complicated without having to recreate all the important aspects from scratch.
The basic implementation requires at a minimum a target.
eg null = [targetobject] execVM "aifiremission.sqf" it requires you have a artillery object synced to an artillery module named Art1

Optional arguments are

Battery - which is the name of the artillery module you are calling (Default Art1)
Number of rounds - How many rounds to fire assuming the artillery has the ammunition (Default 1)
Round Type - Select the type of round HE by default. The other types must be added to the artillery objects for them to fire them (Default "HE")
Dispersion - Basically how much spread between rounds (Default 100)
Prediction Calibrator - A way to influence how far ahead in the current direction of the target to rounds land (Default 20)
Skill - A basic way to see how accurate the placement is values from 1 to 10 (Default 5)
Friendly - Checks to ensure their is not a friendly of this type within 50m of the impact location (Default "SoldierEB")
*/

if (!isserver) exitWith {};

_tgt = _this select 0;
_battery = if (count _this > 1) then {_this select 1} else {Art1};
_NoRnds = if (count _this > 2) then {_this select 2} else {1};
_RndType = if (count _this > 3) then {_this select 3} else {"HE"};
_Dispersion = if (count _this > 4) then {_this select 4} else {100};
_adjmult = if (count _this > 5) then {_this select 5} else {20};
_skill = if (count _this > 6) then {_this select 6} else {5};
_friendly = if (count _this > 7) then {_this select 7} else {"SoldierEB"};

_adjmax = 300;
_adjmin = -300;
_error = (10-_skill)*10;

_Yadj = speed (_tgt) * cos (direction (_tgt)) * _adjmult;
if (_Yadj > _adjmax) then {_Yadj = _adjmax};
if (_Yadj < _adjmin) then {_Yadj = _adjmin};
_Xadj = speed (_tgt) * sin (direction (_tgt)) * _adjmult;
if (_Xadj > _adjmax) then {_Xadj = _adjmax};
if (_Xadj < _adjmin) then {_Xadj = _adjmin};

_impact = [(getpos (_tgt) select 0) + _Xadj+(random _error - _error/2), (getpos (_tgt) select 1) + _Yadj+(random _error - _error/2), getpos (_tgt) select 2];

if (isNull nearestObject [_impact,_friendly]) then    
    {
    [_battery, _Dispersion] call BIS_ARTY_F_SetDispersion;
    [_battery, _impact, ["IMMEDIATE", _RndType, 3, _NoRnds]] call BIS_ARTY_F_ExecuteTemplateMission;
    };
Hat da jemand vielleicht Erfahrung oder einen Ratschlag, woran das wohl liegen könnte?

Grüße raus!
killshot ist offline