Welcome to the Iron Front Fan Forums!
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
Foxsch

Avatar / Picture

Colonel
Registered:
Posts: 463
Reply with quote  #1 
Hi,

  I've added a script which effectively deletes all but the leader's of group's at mission start, then spawns them at a specified distance, as an enemy unit approaches - neat! Unfortunately, adding the call into group leaders init fields prevents the briefing and other init specifications from loading? I figured it may be this line, at the top of the script.sqf which is the problem:

if (! isServer) exitwith {};


But I do not know how to change this, or even if it IS the problem! I tried removing, and changing this to:

if(!isServer) then {waitUntil{!isNull player}};


but neither worked, and I also tried removing both:

if(!isServer) then {waitUntil{!isNull player}};

waituntil {!isnil "bis_fnc_init"};


from the init AND the exitwith from the script, still no luck - any pointers?

Here's the full script if it helps:

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: -eutf-Myke
//////////////////////////////////////////////////////////////////
if (! isServer) exitwith {};
private ["_leader", "_unitarray", "_typearray"];
_leader = _this select 0;
_cache_side = _this select 1;
_cache_dist = _this select 2;
_grp = group _leader;
_unitarray = units group _leader;
_unitarray = _unitarray - [_leader];
_typearray = [];
{
_type = typeof _x;
_weap = weapons _x;
_mags = magazines _x;
_pos = _leader worldtomodel position _x;
_typearray = _typearray + [[_type, _weap, _mags, _pos]];
}
foreach _unitarray;
if (((_cache_side countside (position _leader nearobjects ["AllVehicles", _cache_dist])) == 0)) then
{
{
deletevehicle _x;
}
foreach _unitarray;
};
while {count _unitarray >= 1} do
{
waituntil {((_cache_side countside (position _leader nearobjects ["AllVehicles", _cache_dist])) != 0)};
{
_unit_init = _x select 0;
_unit_weap = _x select 1;
_unit_mags = _x select 2;
_unit_offset = _x select 3;
_unit_pos = _leader modeltoworld _unit_offset;
_new_unit = _unit_init createunit [_unit_pos, group _leader, "myunit = this"];
removeallweapons myunit;
{
myunit addmagazine _x;
}
foreach _unit_mags;
{
myunit addweapon _x;
}
foreach _unit_weap;
}
foreach _typearray;
waituntil {((_cache_side countside (position _leader nearobjects ["AllVehicles", (_cache_dist + 15)])) == 0)};
sleep 5;
_leader = leader _grp;
_unitarray = units group _leader;
_unitarray = _unitarray - [_leader];
_typearray = [];
{
_type = typeof _x;
_weap = weapons _x;
_mags = magazines _x;
_pos = _leader worldtomodel position _x;
_typearray = _typearray + [[_type, _weap, _mags, _pos]];
}
foreach _unitarray;
{
deletevehicle _x;
}
foreach _unitarray;
};

__________________
Mission Repository - http://www.missionrepository.com

0
Gunter Severloh

Avatar / Picture

Admin
Registered:
Posts: 2,758
Reply with quote  #2 
See how this is done http://www.armaholic.com/page.php?id=10102
__________________
0
Foxsch

Avatar / Picture

Colonel
Registered:
Posts: 463
Reply with quote  #3 
That sorted it [thumb] SOLVED thx Gunter ~ This will help immensely with a lot of my Missions - sometimes I get a bit heavy-handed placing units in the Editor without worrying about the consequences and the CPU gets drained - this will fix it - more back-track editing to be done...
__________________
Mission Repository - http://www.missionrepository.com

0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.