• 0
TheFarFlash

Spawning a function the right way.....

Question

Hi Folks,

I'm trying to modify the _ambient Overfly script to use "GOM Carpet Bombing" script/function to attack an player randomly.

GOMs Carpet bombing on Armaholic

As GOM said I can call the function on the Server with following line over infistar (F3):
 

_bomb = ["",[0.5,0.5],270,20,100] spawn GOM_fnc_carpetbombing;

//first parameter gives the bomb type, empty string will make the script use a random bomb, mod bombs will also be used
//second parameter holds the position that should be bombed
//third parameter holds the direction
//fourth parameter defines the amount of bombs to be dropped
//fifth parameter defines the average distance for the bombs to spread

 

the given one in theScript:

_bomb = ["",screenToWorld [0.5,0.5],270,20,100] spawn GOM_fnc_carpetbombing;

doesnt work for me.

 

Now I'm trying to call this in the 

ExileServer_system_event_ambientFlyOver_start.sqf

at the following position with this altered line (_bomb is a private variable):

...
//_waypoint setWaypointStatements ["true", "'Ambient Fly Over - Reached player...' call ExileServer_util_log;"];

_waypoint setWaypointStatements ["true", '_bomb = ["",[(_targetPosition select 0),(_targetPosition select 1)],270,48,250] spawn GOM_fnc_carpetbombing;'];
...

I tried a lot of kombinations of () {} [] '' "" ... but I'm not able to get a call that is functioning.

The script throws errors os doesnt start when called.

when it starts and calls the function I got an error:

Spoiler

19:31:22 Error in expression <alse;

_firstImpactPos = (_bomblocation getPos [(_distance / 2),_direction + 180>
19:31:22   Error position: <getPos [(_distance / 2),_direction + 180>
19:31:22   Error Type Any, expected Number
19:31:22 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 51
19:31:22 Error in expression <on"];

_airraidsirens = nearestobjects [_bomblocation,["Land_BellTower_01_V1_F",>
19:31:22   Error position: <_bomblocation,["Land_BellTower_01_V1_F",>
19:31:22   Error Undefined variable in expression: _bomblocation
19:31:22 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 24
19:31:34 Error in expression <yers = allPlayers select {_x distance2D _firstImpactPos < 1500};
[_randomsound] >
19:31:34   Error position: <_firstImpactPos < 1500};
[_randomsound] >
19:31:34   Error Undefined variable in expression: _firstimpactpos
19:31:34 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 58
19:31:34 Trying to call RemoteExec(Call) with 0 targets for func 'playsound'. Maximum is 1000
19:31:54 Error in expression <",_closePlayers];

sleep 20;

_relpos = _firstImpactPos;
_bomb = objNull;
for "_>
19:31:54   Error position: <_firstImpactPos;
_bomb = objNull;
for "_>
19:31:54   Error Undefined variable in expression: _firstimpactpos
19:31:54 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 63
19:31:54 Error in expression < to _amount do {

sleep 0.1;
_tempPos = _relpos vectorAdd [random [-20,0,20],ran>
19:31:54   Error position: <_relpos vectorAdd [random [-20,0,20],ran>
19:31:54   Error Undefined variable in expression: _relpos
19:31:54 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 68
19:31:54 Error in expression <
params ["_bomb"];
waituntil {getposATL _bomb select 2 <= 700};
_soundarray = [">
19:31:54   Error position: <_bomb select 2 <= 700};
_soundarray = [">
19:31:54   Error Undefined variable in expression: _bomb
19:31:54 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 88
19:31:54 Error in expression <
params ["_bomb"];
waituntil {getposATL _bomb select 2 <= 700};
_soundarray = [">
19:31:54   Error position: <_bomb select 2 <= 700};
_soundarray = [">
19:31:54   Error Undefined variable in expression: _bomb
19:31:54 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 88
19:31:54 Error in expression <
params ["_bomb"];
waituntil {getposATL _bomb select 2 <= 700};
_soundarray = [">
19:31:54   Error position: <_bomb select 2 <= 700};
_soundarray = [">
19:31:54   Error Undefined variable in expression: _bomb
19:31:54 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 88
19:31:54 Error in expression <
params ["_bomb"];
waituntil {getposATL _bomb select 2 <= 700};
_soundarray = [">
19:31:54   Error position: <_bomb select 2 <= 700};
_soundarray = [">

from here the error in line 88 is repeating constantly...

It would be nice, if anyone can help me get this thing running.

TheFarFlash

PS: spent two days for this little line, trying to get it running :-(

Edited by TheFarFlash

Share this post


Link to post
Share on other sites

5 answers to this question

  • 0
12 hours ago, Haywood Voltiac said:

@TheFarFlash You have the files download from armaholic correct? I see that it's calling for a custom function (GOM_fnc_carpetbombing). If you could show some of the errors as well.

Hi,

the files are downloaded and "installed" correct.

When I call the function over the console in Infistar, and use manually given coordinates like

_bomb = ["",[26415.2,6314.5],270,20,100] spawn GOM_fnc_carpetbombing;

the call is functioning without any errors.

The thing is, that I dont know how to alter the line / part ini the 

ExileServer_system_event_ambientFlyOver_start.sqf

...
//_waypoint setWaypointStatements ["true", "'Ambient Fly Over - Reached player...' call ExileServer_util_log;"];

_waypoint setWaypointStatements ["true", '_bomb = ["",[(_targetPosition select 0),(_targetPosition select 1)],270,48,250] spawn GOM_fnc_carpetbombing;'];
...

so the script calls the function, when the jet arrives the given waypoint.

;-)

Share this post


Link to post
Share on other sites
Advertisement
  • 0

Okay a little more Info.

This is my altered "ExileServer_system_event_ambientFlyOver_start":

Spoiler

/**
 * ExileServer_system_event_ambientFlyOver_start
 *
 * Exile Mod
 * exile.majormittens.co.uk
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private['_targetPlayer', '_flyHeight', '_speed', '_direction', '_targetPosition', '_distance', '_endPosition', '_planeClass', '_i', '_startPosition', '_pilot', '_plane', '_waypoint', '_bombRadius', '_bomb'];
_group = createGroup independent;
_targetPlayer = selectRandom allPlayers;
format ["Ambient Fly Over - Heading to %1...", _targetPlayer] call ExileServer_util_log;
_flyHeight = 800;
_speed = 250;
_direction = random 360;
_bombRadius = 250;
_targetPosition = 
[
	(getPos _targetPlayer) select 0, 
	(getPos _targetPlayer) select 1, 
	_flyHeight
];
_distance = worldSize * 0.75;
_endPosition = 
[
	(_targetPosition select 0) - (sin _direction) * _distance,
	(_targetPosition select 1) - (cos _direction) * _distance,
	_flyHeight
];
_planeClass = selectRandom 
[
	"rhsgref_cdf_mig29s"
];
for "_i" from 1 to (3 + (floor (random 3))) do 
{
	_distance = 3000 + (_i * 400);
	_startPosition = 
	[
		(_targetPosition select 0) + (sin _direction) * _distance,
		(_targetPosition select 1) + (cos _direction) * _distance,
		800 
	];
	_pilot = _group createUnit ["I_helicrew_F", _startPosition, [], 100, "NONE"];
	_pilot setSkill 1;
	[_pilot] joinSilent _group;
	_plane = createVehicle [_planeClass, _startPosition, [], 100, "FLY"];
	clearBackpackCargoGlobal _plane;
	clearWeaponCargoGlobal _plane;
	clearMagazineCargoGlobal _plane;
	clearItemCargoGlobal _plane;
	_plane setVehicleAmmo 1;
	_plane setFuel 1.0;
	_pilot assignAsDriver _plane;
	_pilot moveInDriver _plane;
	_pilot allowDamage true;
	_plane allowDamage true;
	_plane flyInHeight _flyHeight;
	_plane disableAI "AUTOTARGET";
	_plane disableAI "FSM";
	_plane disableAI "AUTOCOMBAT";
	_plane disableAI "SUPPRESSION";
	_plane setDir _direction;
	_plane setVelocity [(sin _direction) * _speed, (cos _direction) * _speed, 0];
};
_group allowFleeing 0;
_group setBehaviour "CARELESS";
_group setSpeedMode "NORMAL";
_group setFormation "WEDGE";
//_group setCombatMode "BLUE";
_group setCombatMode "YELLOW";
_waypoint = _group addWaypoint [getPos _targetPlayer, 0];
_waypoint setWaypointType "MOVE";
_waypoint setWaypointCompletionRadius 800;

//hier klappt der Aufruf und die Uebergabe der Koordinaten noch nicht ! Das Carpetbombing selbst funktioniert 
_waypoint setWaypointStatements ["true", '_bomb = ["",[(_targetPosition select 0),(_targetPosition select 1)],_direction,48,_bombRadius] spawn GOM_fnc_carpetbombing;'];


_waypoint = _group addWaypoint [_endPosition, 0];
_waypoint setWaypointType "MOVE";
_waypoint setWaypointCompletionRadius 800;
_waypoint setWaypointStatements ["true", "'Ambient Fly Over - Reached end...' call ExileServer_util_log; { deleteVehicle (vehicle _x); deleteVehicle _x; } forEach thisList;"];
if(!isNull _plane) then {
	deleteVehicle _plane;
	// diag_log format['[ZCP-Debug]: Deleted plane'];
};

if(!isNull _Pilot) then {
	deleteVehicle _Pilot;
	// diag_log format['[ZCP-Debug]: Deleted pilot'];
};

 

And this is the Error it produces:

Spoiler

.........

14:08:50 "ExileServer - Ambient Fly Over - Heading to R Alpha 1-2:1 (Kjell Ragnarson) REMOTE..."
14:08:50 a3\weapons_f\binocular\nvg_proxy_indep.p3d: No geometry and no visual shape
14:08:50 a3\weapons_f\binocular\nvg_proxy_indep.p3d: No geometry and no visual shape
14:08:50 a3\weapons_f\binocular\nvg_proxy_off_indep.p3d: No geometry and no visual shape
14:08:50 rhsafrf\addons\rhs_mig29\rhs_mig29s_ladder.p3d: No geometry and no visual shape
14:08:50 R Alpha 1-3:4: Getting out while IsMoveOutInProgress
14:09:48 Error in expression <alse;

_firstImpactPos = (_bomblocation getPos [(_distance / 2),_direction + 180>
14:09:48   Error position: <getPos [(_distance / 2),_direction + 180>
14:09:48   Error Type Any, expected Number
14:09:48 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 51
14:09:48 Error in expression <on"];

_airraidsirens = nearestobjects [_bomblocation,["Land_BellTower_01_V1_F",>
14:09:48   Error position: <_bomblocation,["Land_BellTower_01_V1_F",>
14:09:48   Error Undefined variable in expression: _bomblocation
14:09:48 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 24
14:09:59 Error in expression <yers = allPlayers select {_x distance2D _firstImpactPos < 1500};
[_randomsound] >
14:09:59   Error position: <_firstImpactPos < 1500};
[_randomsound] >
14:09:59   Error Undefined variable in expression: _firstimpactpos
14:09:59 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 58
14:09:59 Trying to call RemoteExec(Call) with 0 targets for func 'playsound'. Maximum is 1000
14:10:19 Error in expression <",_closePlayers];

sleep 20;

_relpos = _firstImpactPos;
_bomb = objNull;
for "_>
14:10:19   Error position: <_firstImpactPos;
_bomb = objNull;
for "_>
14:10:19   Error Undefined variable in expression: _firstimpactpos
14:10:19 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 63
14:10:19 Error in expression < to _amount do {

sleep 0.1;
_tempPos = _relpos vectorAdd [random [-20,0,20],ran>
14:10:19   Error position: <_relpos vectorAdd [random [-20,0,20],ran>
14:10:19   Error Undefined variable in expression: _relpos
14:10:19 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 68
14:10:19 Error in expression <
params ["_bomb"];
waituntil {getposATL _bomb select 2 <= 700};
_soundarray = [">
14:10:19   Error position: <_bomb select 2 <= 700};
_soundarray = [">
14:10:19   Error Undefined variable in expression: _bomb
14:10:19 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 88
14:10:19 Error in expression <
params ["_bomb"];
waituntil {getposATL _bomb select 2 <= 700};
_soundarray = [">
14:10:19   Error position: <_bomb select 2 <= 700};
_soundarray = [">
14:10:19   Error Undefined variable in expression: _bomb
14:10:19 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 88
14:10:19 Error in expression <
params ["_bomb"];
waituntil {getposATL _bomb select 2 <= 700};
_soundarray = [">
14:10:19   Error position: <_bomb select 2 <= 700};
_soundarray = [">
14:10:19   Error Undefined variable in expression: _bomb
14:10:19 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 88
14:10:19 Error in expression <
params ["_bomb"];
waituntil {getposATL _bomb select 2 <= 700};
_soundarray = [">
14:10:19   Error position: <_bomb select 2 <= 700};
_soundarray = [">
14:10:19   Error Undefined variable in expression: _bomb
14:10:19 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 88
14:10:19 Error in expression < to _amount do {

sleep 0.1;
_tempPos = _relpos vectorAdd [random [-20,0,20],ran>
14:10:19   Error position: <_relpos vectorAdd [random [-20,0,20],ran>
14:10:19   Error Undefined variable in expression: _relpos
14:10:19 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 68
14:10:19 Error in expression <
params ["_bomb"];
waituntil {getposATL _bomb select 2 <= 700};
_soundarray = [">
14:10:19   Error position: <_bomb select 2 <= 700};
_soundarray = [">
14:10:19   Error Undefined variable in expression: _bomb
14:10:19 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 88
14:10:19 Error in expression <
params ["_bomb"];
waituntil {getposATL _bomb select 2 <= 700};
_soundarray = [">
14:10:19   Error position: <_bomb select 2 <= 700};
_soundarray = [">
14:10:19   Error Undefined variable in expression: _bomb
14:10:19 File mpmissions\__cur_mp.Altis\Custom\GOM\GOM_fnc_carpetBombing.sqf, line 88
14:10:19 Error in expression <
params ["_bomb"];
waituntil {getposATL _bomb select 2 <= 700};
_soundarray = [">
14:10:19   Error position: <_bomb select 2 <= 700};
_soundarray = [">

  ........

 

Can anyone help me to correct this so that the script will spawn the carpetbombing ?

Thx

Edited by TheFarFlash

Share this post


Link to post
Share on other sites
  • 0

Hello @TheFarFlash,

You might be better off asking 'Grumpy Old Man' aka GOM about this script.  Also, there are at least 2 versions of this script, BOTH from him.

You never stated which version you have as well.

 

I would also set a trigger point on  the GROUND and when you walk in this area, have it 'fire off' this script.  You MUST NOT BE AN ADMIN when testing this!  Something tells me it works when you run it via IS console as you're an admin and no where else.

 

LOGGING OUT and trying via the ground trigger will tell you if this an IS problem or a scripting problem.

I do KNOW that some types of bombs/stuff (by default) are 'blacklisted' for regular players and some scripts also block bombs as well.

 

Try it as a 'regular player' and I think you will see that it does NOT work, thus indicating you need to adjust your IS settings.  If it does work, then it is a scripting issue.

 

:)

 

Edited by Z80CPU

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.