PDA

View Full Version : Need help with the skeet-machine



dreamweaver
Jun 7 2009, 20:49
Anyone know how to get the skeet-machine to work?
I think I've found the corresponding scripts. But I cant get the machine to shoot the skeets.

The scripts can be found here:
Arma2/Addons/missions.pbo/armory/Data/Scripts/Tryout/prichals/skeetShooting

launch_skeet.sqf

/*
File: launch_skeet.sqf
Author: Joris-Jan van 't Land / Pepa Zemánek

Description:
Launches a single skeet.

Parameter(s):
_this select 0: skeet machine (Object).

Returns:
Success flag (Boolean).
*/

private ["_machine"];
_machine = _this select 0;

if (!(isnil "_machine")) then
{
LIB_skeetFired = LIB_skeetFired + 1;

_machine say "LaunchSkeet";

private ["_disc", "_discPos"];
_discPos = [_machine, 0.6, 180] call BIS_fnc_relPos;
_disc = "SkeetDisk" createVehicle [(_discPos select 0), (_discPos select 1), 0.7];
_disc setPos [(_discPos select 0), (_discPos select 1), 0.7];

LIB_dynObjs = LIB_dynObjs + [_disc];
LIB_chalObjs = LIB_chalObjs + [_disc];

private ["_vel", "_ehCode"];
_vel = [[0, -1, 0], (direction _machine)] call BIS_fnc_rotateVector2D;
_disc setVelocity [(-(_vel select 0) * 9), ((_vel select 1) * 9), 10 + (random 2)];

_ehCode =
{
private ["_disc"];
_disc = _this select 0;

//Only score a hit while the skeet is airborne.
if (((position _disc) select 0) > 0.1) then
{
LIB_skeetHit = LIB_skeetHit + 1;
if ((_disc distance player) > 100) then
{
LIB_skeetScore = LIB_skeetScore + 3;
}
else
{
LIB_skeetScore = LIB_skeetScore + 2;
};
};

LIB_dynObjs = LIB_dynObjs - [_disc];
LIB_chalObjs = LIB_chalObjs - [_disc];
deleteVehicle _disc;
};

_disc addEventHandler ["killed", _ehCode];

sleep 1;

//Make sure the skeet flies a bit longer than normal physics would cause.
_vel = velocity _disc;

private ["_i"];
_i = 0;

while {(((position _disc) select 2) > 0.1) && (alive _disc)} do
{
_disc setVelocity [(_vel select 0) / (1 + (_i / 10)), (_vel select 1) / (1 + (_i / 10)), (_vel select 2) / (1 + _i)];
_i = _i + 0.1;
sleep 0.1;
};

LIB_skeetLanded = LIB_skeetLanded + 1;
};

true



skeet_program.sqf

/*
File: skeet_program.sqf
Author: Joris-Jan van 't Land

Description:
The skeet launcher program.

Parameter(s):
_this select 0: skeet machines (Array of Objects).

Returns:
Success flag (Boolean).
*/

scopeName "root";

private ["_machines"];
_machines = _this select 0;

while {(LIB_skeetFired < 20) && LIB_skeetProgram} do
{
private ["_available", "_launched"];
_available = +_machines;
_launched = 0;

for "_i" from 0 to ((count _machines) - 1) do
{
if (((_launched == 0) || ((random 1) > 0.7)) && (LIB_skeetFired < 20)) then
{
private ["_machine"];
_machine = _available call BIS_fnc_selectRandom;

private ["_handle"];
_handle = [_machine] execVM "ca\missions\armory\data\scripts\tryout\prichals\s keetShooting\launch_skeet.sqf";

_available = _available - [_machine];
_launched = _launched + 1;
};
};

[10 + (random 5), 0, true] call LIB_safeDelayFunction;
};

LIB_skeetProgram = false;

true

dreamweaver
Jun 25 2009, 08:30
Any help?