Jump to content
Sign in to follow this  
Hit_Sqd_Ack

Spawn Script, how to edit Unit Skill

Recommended Posts

All,

I have started using Doolittle's Spawn script that basically deletes all the vehicles in the trigger and spawns them back, pretty simple huh? Well when the AI spawns back in, they are total newbs. I have looked but I can't find where to adjust the skill of the units that are spawned back in. I have contacted the author of the script but he does not respond to anyone's e-mails.

I think this might be it:

unit = objNull;

_type createUnit [_pos, _group, "unit = this", 0.35, "MAJOR"];

if (_type != "SoldierECrew") then {

unit setBehaviour "SAFE";

Is the "0.35" the skill of the unit to be created? Any help would greatly be appreciated. Thanks

- Hit Squad Ack [FHA]

Scripts listed below:

*unitcreate.sqf*

comment "By Doolittle";

private ["_type", "_pos", "_group", "_magazine", "_weapon"];

_type = _this select 0;

_pos = _this select 1;

_group = _this select 2;

unit = objNull;

_type createUnit [_pos, _group, "unit = this", 0.35, "MAJOR"];

if (_type != "SoldierECrew") then {

unit setBehaviour "SAFE";

};

unit setCombatMode "RED";

unit setSpeedMode "LIMITED";

if (random 1 < 0.3) then {

unit setFormation "COLUMN";

};

unit addEventHandler ["Killed", {_this exec "killed.sqs"}];

unit addEventHandler ["Hit", {_this select 0 exec "captive.sqs"}];

if (random 1 < 0.1) then {

unit switchMove "StandToSitDown";

};

_magazine = [];

_weapon = [];

if (_type == "OfficerE") then {

unit addEventHandler ["Fired", {_this select 0 fire ["Throw", "SmokeShell", "SmokeShell"]; _this select 0 removeAllEventHandlers "Fired"}];

_magazine = ["SteyrMag", "SteyrMag", "SteyrMag", "SteyrMag", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "SmokeShell", "SmokeShell"];

_weapon = ["Steyr", "Binocular"];

};

if (_type == "SoldierELAW") then {

_magazine = ["HKG3Mag", "HKG3Mag", "HKG3Mag", "HKG3Mag", "RPGLauncher", "RPGLauncher", "RPGLauncher"];

_weapon = ["HKG3", "RPGLauncher"];

};

if (_type == "SoldierEMedic") then {

_magazine = ["HKG3Mag", "HKG3Mag", "HKG3Mag", "HKG3Mag"];

_weapon = ["HKG3"];

};

if (_type == "SoldierESniper") then {

_magazine = ["HuntingRifleMag", "HuntingRifleMag", "HuntingRifleMag", "HuntingRifleMag"];

_weapon = ["HuntingRifle"];

};

if (_type == "SoldierESaboteurPipe") then {

_magazine = ["UZIMag", "UZIMag", "UZIMag", "UZIMag", "PipeBomb", "PipeBomb", "PipeBomb", "GlockMag", "GlockMag", "GlockMag", "GlockMag"];

_weapon = ["UZI", "NVGoggles", "Glock"];

};

if (_type == "SoldierEB") then {

_magazine = ["FALMag", "FALMag", "FALMag", "FALMag", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade", "HandGrenade"];

_weapon = ["FAL"];

};

if (random 1 < 0.5 and count _weapon > 0) then {

"unit removeMagazine _x" forEach magazines unit;

"unit removeWeapon _x" forEach weapons unit;

"unit addMagazine _x" forEach _magazine;

"unit addWeapon _x" forEach _weapon;

unit selectWeapon primaryWeapon unit;

};

*unit.sqs*

;By Doolittle

?not local Server : exit

~1

_list = _this select 0

_trigger = _this select 1

_vehicletype = []

_crewtype = []

_pos = []

_group = []

_i = 0

#load

_obj = _list select _i

_vehicletype = _vehicletype + [typeOf vehicle _obj]

_crew = []

"_crew = _crew + [typeOf _x]" forEach crew _obj

_crewtype = _crewtype + [_crew]

_pos = _pos + [[getPos _obj select 0, getPos _obj select 1, 0]]

_group = _group + [group _obj]

"_x exec ""delete.sqs""" forEach crew _obj

vehicle _obj exec "delete.sqs"

_i = _i + 1

?_i < count _list : goto "load"

_count = count list _trigger

#empty

~2

?count list _trigger == _count : goto "empty"

_i = 0

#create

_vtype = _vehicletype select _i

_ctype = _crewtype select _i

?_vtype == _ctype select 0 : [_vtype, _pos select _i, _group select _i] call unitcreate; goto "next"

_vehicle = _vtype createVehicle (_pos select _i)

_vehicle addEventHandler ["Killed", {_this exec "killed.sqs"}]

?_vtype == "ParachuteEast" : _vehicle setPos [getPos _vehicle select 0, getPos _vehicle select 1, 135]

~0.1

_j = 0

#move

_unit = [_ctype select _j, _pos select _i, _group select _i] call unitcreate

?isNull _unit : goto "next"

?_vtype == "M2StaticMG" or _vtype == "M2StaticMGE" : _vehicle exec "mg.sqs"; _unit moveInGunner _vehicle; goto "next"

?_j == 0 : _unit moveInDriver _vehicle; goto "continue"

?_j == 1 and (_ctype select _j == "SoldierECrew" or _ctype select _j == "SoldierEPilot") : _unit moveInGunner _vehicle; goto "continue"

?_j == 2 and _ctype select _j == "SoldierECrew" : _unit moveInCommander _vehicle; goto "continue"

_unit moveInCargo _vehicle

#continue

_j = _j + 1

?_j < count _ctype : goto "move"

#next

~0.1

_i = _i + 1

?_i < count _vehicletype : goto "create"

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×