Thema: Flare System?
Einzelnen Beitrag anzeigen
Alt 12.08.2009, 11:27   #41 (permalink)
Cyborg11
500 Beiträge1000 Beiträge2.500 Beiträge
 
Benutzerbild von Cyborg11
 
Registriert seit: 26.03.2008
Beiträge: 2.822
Icon14

Hab eigentlich bloß die Config umgeschrieben
Wollte die Skripte ins .sqf Format bringen, aber da hab ich irgendwie nen ganz tollen Fehler reingebracht, der es ermöglicht ArmA2 einen CTD zu verpassen, wenn eine Rakete abgefeuert wird Das passiert, wenn ich das Skript versuche im Addon einzubauen. Als Skriptversion in der Mission gibs keinen CTD.

Vllt. weiß einer, der hier reinschaut, was falsch ist. Ansonsten frag ich nochmal im Editing Forum nach bzw. im BI Forum Entdecke keinen Fehler ...
Code:
/*
// ********************************************
// Script File for ArmA2
// Made by: Cyborg11
// Version: 1.0  -  12.08.2009
// Used Elements from the Missile spoof script by Franze
// Scriptversion for Flares
// To use write in the Init from your planes or helicopters:
// this addeventhandler ["IncomingMissile",{_this execVM "flares.sqf"}];
// ********************************************
*/

private ["_plane","_missile","_planetype","_planepos","_missilepos","_oclock","_distance","_rand","_chance1","_chance2","_count"];
// Variables
_plane = _this select 0;
_planetype = typeOf _plane;
_missile = _this select 1;
_rand = 20;
_chance1 = 3;
_chance2 = 2;
_count = 0;
flarecount = 0;
If (!(alive _plane)) exitWith{};

// Flarecount
switch (_planetype) do {
    default {flarecount = 12};
    };

// Coordinates
_planepos = getpos _plane;
_missilepos = getpos _missile;
_xplane = _planepos select 0;
_yplane = _planepos select 1;
_zplane = _planepos select 2;
_xmissile = _missilepos select 0;
_ymissile = _missilepos select 1;
_zmissile = _missilepos select 2;
_dirplane = direction _plane;

_x = (_xplane - _xmissile);
_y = (_yplane - _ymissile);
_distance = _missile distance _plane;

If ((_x>0) and (_y>0)) then {_theta = atan (abs _x / abs _y) +180};
If ((_x>0) and (_y<0)) then {_theta = atan (abs _y / abs _x) +270};
If ((_x<0) and (_y<0)) then {_theta = atan (abs _x / abs _y) +0};
If ((_x<0) and (_y>0)) then {_theta = atan (abs _y / abs _x) +90};
_theta = (360 + (_dirhelo1 - _theta))Mod 360

If (_theta > 15 and _theta < 45) then {_oclock = 11};
If (_theta > 45 and _theta < 75) then {_oclock = 10};
If (_theta > 75 and _theta < 105) then {_oclock = 9};
If (_theta > 105 and _theta < 135) then {_oclock = 8};
If (_theta > 135 and _theta < 165) then {_oclock = 7};
If (_theta > 165 and _theta < 195) then {_oclock = 6};
If (_theta > 195 and _theta < 225) then {_oclock = 5};
If (_theta > 225 and _theta < 255) then {_oclock = 4};
If (_theta > 255 and _theta < 285) then {_oclock = 3};
If (_theta > 285 and _theta < 315) then {_oclock = 2};
If (_theta > 315 and _theta < 345) then {_oclock = 1};
If (_theta > 345 and _theta < 360) then {_oclock = 12};
If (_theta > 0 and _theta < 15) then {_oclock = 12};

If (_z2 > 50) then {
    _plane vehiclechat format ["%1 Missile %2 OClock High %3 Meters",_missile,_oclock,_distance];
    _plane vehicleradio "fz_plane_bp_miswarn";
    } else {
    _plane vehiclechat format ["%1 Missile %2 OClock Low %3 Meters",_weaponname,_oclock,_distance];
    _plane vehicleradio "fz_plane_bp_miswarn";
};

If (!(local _plane) AND flarecount >= 0) then {
    drop["\Ca\Data\kouleSvetlo","","Billboard",0.05,10,[-1.5,1,-1],[2-random 8,0,-10],0,2.8,1,0.1,[3],[[1,1,0.3,1]],[0,1],0.1,0,"\Flares\smokes.sqs","",_plane];
    _plane say "fzf18flarelaunch";
    sleep 0.1;
    drop["\Ca\Data\kouleSvetlo","","Billboard",0.05,10,[1.5,1,-1],[2+random 8,0,-10],0,2.8,1,0.1,[3],[[1,1,0.3,1]],[0,1],0.1,0,"\Flares\smokes.sqs","",_plane];
    _plane say "fzf18flarelaunch";
    sleep 1;
    drop["\Ca\Data\kouleSvetlo","","Billboard",0.05,10,[-1.5,1,-1],[2-random 8,0,-10],0,2.8,1,0.1,[3],[[1,1,0.3,1]],[0,1],0.1,0,"\Flares\smokes.sqs","",_plane];
    _plane say "fzf18flarelaunch";
    sleep 0.1;
    drop["\Ca\Data\kouleSvetlo","","Billboard",0.05,10,[1.5,1,-1],[2+random 8,0,-10],0,2.8,1,0.1,[3],[[1,1,0.3,1]],[0,1],0.1,0,"\Flares\smokes.sqs","",_plane];
    _plane say "fzf18flarelaunch";
    flarecount = flarecount - 4;
} else {
    _plane sidechat ["No more flares!"];
    };

WaitUntil {(_missile distance _plane) < 100};
for [{_count=0},{_count<=7},{_count=_count+1}] do {
_missile setdir (direction _missile - _chance1 - random _chance2);
};
Das spuckt übrigens die arma2.rpt aus:
Zitat:

If (_theta > 15 and _theta < 45) then {_>
Error position: <If (_theta > 15 and _theta < 45) then {_>
Error Fehlendes ;
File C:\Dokumente und Einstellungen\Matthias\Eigene Dateien\ArmA 2 Other Profiles\[EC]%20Cyborg11\missions\flaretest.utes\flares.sqf, line 51
Error in expression <planepos = getpos _plane;
_missilepos = getpos _missile;
_xplane = _planepos sel>
Error position: <getpos _missile;
_xplane = _planepos sel>
Error getpos: Typ Zeichenfolge, erwartet Objekt,Location
File C:\Dokumente und Einstellungen\Matthias\Eigene Dateien\ArmA 2 Other Profiles\[EC]%20Cyborg11\missions\flaretest.utes\flares.sqf, line 32
Error in expression < = (360 + (_dirhelo1 - _theta))Mod 360

If (_theta > 15 and _theta < 45) then {_>
Error position: <If (_theta > 15 and _theta < 45) then {_>
Error Fehlendes ;
File C:\Dokumente und Einstellungen\Matthias\Eigene Dateien\ArmA 2 Other Profiles\[EC]%20Cyborg11\missions\flaretest.utes\flares.sqf, line 51
Error in expression < = (360 + (_dirhelo1 - _theta))Mod 360

If (_theta > 15 and _theta < 45) then {_>
Error position: <If (_theta > 15 and _theta < 45) then {_>
Error Fehlendes ;
File C:\Dokumente und Einstellungen\Matthias\Eigene Dateien\ArmA 2 Other Profiles\[EC]%20Cyborg11\missions\flaretest.utes\flares.sqf, line 51

Und mal mein geändertes Addons zum Testen (Funktioniert bei allen BI Flugzeugen und Helikoptern):
RapidShare: 1-CLICK Web hosting - Easy Filehosting

EDIT: Bitte nochmal saugen. Hatte das falsche hochgeladen

Geändert von Cyborg11 (12.08.2009 um 12:18 Uhr).
Cyborg11 ist offline   Mit Zitat antworten