Jump to content
Sign in to follow this  
Skelt

Random Marker / Ambush /IED / Camp Script

Recommended Posts

[[on going development - see last page]][Ok, now we're incorporating a DAC 3.0c zone, and one DAC camp zone to supply respawns to the active zone. We are also using jsp_garrison spawn_group_v5.sqf to populate some of the houses which are soon going to be turned into various objectives, maybe a weapons cache, some intel ie: computers / maps ect. The IED placed uses MCC's IED scripts, so the IED's are jammable, as well as provides the player the ability to disarm the IED -- Still some issues with the sound there but hopefully they will be fixed. One quick note, if you do not use MCC's IED script, you will need to replace that line in the script to some other IED script, because if you don't you'll just have a useless IED laying there.

Script is written for Yak Ghar City; Tora Bora Island but can be modified for any island.

Most up to date code:

//////////////////////////////////////////////////////////////////
// create_mission.sqf
// Created by: Bones
//////////////////////////////////////////////////////////////////

/* 
Markers Postitions:: The postions were obtained by going into the editor and adding:
-->copyToClipboard str (getPos player);<-- 
     to the player's init field.
*/

//if (!isServer) exitwith {};

//-->create_markers.sqf<--
//hint "markers are being generated";
//sleep 5;
_mrker = createMarker["ambush1",[5666.8,6500.26,0]]; 				//the second part of this array is the position that will need to be changed.
_mrker setMarkerShape "ICON";								//Marker Shape ICON, should not be visable to the players
ambush1 setMarkerType "EMPTY";							//Marker Type, must be defined in order for a marker to be created.
//hint "Marker 1 created";
//sleep 5;

_mrker1 = createMarker["ambush2",[5543.12,6346.91,0]]; 			
_mrker1 setMarkerShape "ICON";							
ambush2 setMarkerType "EMPTY";								
//hint "Marker 2 created";
//sleep 5;

_mrker2 = createMarker["ambush3",[5467.18,6583.72,0]]; 			
_mrker2 setMarkerShape "ICON";							
ambush3 setMarkerType "EMPTY";								
//hint "Marker 3 created";
//sleep 5;

_mrker3 = createMarker["ambush4",[5176.45,6521,0]]; 			
_mrker3 setMarkerShape "ICON";							
ambush4 setMarkerType "EMPTY";								
//hint "Marker 4 created";
//sleep 5;

_mrker4 = createMarker["ambush5",[4568.82,6361.96,0]]; 			
_mrker4 setMarkerShape "ICON";							
ambush5 setMarkerType "EMPTY";								
//hint "Marker 5 created";
//sleep 5;

_mrker5 = createMarker["ambush6",[4425.85,6233.33,0]]; 			
_mrker5 setMarkerShape "ICON";							
ambush6 setMarkerType "EMPTY";								
//hint "Marker 6 created";
//sleep 5;

_mrker6 = createMarker["ambush7",[5666.8,6500.26,0]]; 			
_mrker6 setMarkerShape "ICON";							
ambush7 setMarkerType "EMPTY";								
//hint "Marker 7 created";
//sleep 5;

_mrker7 = createMarker["ambush8",[5457.8,6476.49,0]]; 			
_mrker7 setMarkerShape "ICON";							
ambush8 setMarkerType "EMPTY";								
//hint "Marker 8 created";
//sleep 5;

_mrker8 = createMarker["ambush9",[4832.29,6493.27,2.12529]]; 			
_mrker8 setMarkerShape "ICON";							
ambush9 setMarkerType "DEMPTY";								
//hint "Marker 9 created";
//sleep 5;

_mrker9 = createMarker["ambush10",[4983.17,6609.53,0]]; 			
_mrker9 setMarkerShape "ICON";							
ambush10 setMarkerType "EMPTY";	
//hint "All Markers generated";
//sleep 5;

//-->execVM "scripts\spawn_ai\ambush\create_units.sqf";<--				

//createCenter
_center = createCenter east;

//createGroup
_group = createGroup east;
_group1 = createGroup east;

//createUnit array ((_unit = group player createUnit ["SoldierWB", Position player, [], 0, "FORM"])) 
//group1
_unit1 = _group createUnit ["TK_INS_Soldier_EP1",[0,0,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,"NONE"];
_unit2 = _group createUnit ["TK_INS_Soldier_AT_EP1",[0,0,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,"NONE"];
_unit3 = _group createUnit ["TK_INS_Soldier_MG_EP1",[0,0,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,"NONE"];
_Unit4 = _group createUnit ["TK_INS_Soldier_EP1",[0,0,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,"NONE"];
_unit5 = _group createUnit ["TK_INS_Soldier_EP1",[0,0,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,"NONE"];
_unit6 = _group createUnit ["TK_INS_Soldier_AT_EP1",[0,0,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,"NONE"];

//group2
_unit5 = _group1 createUnit ["TK_INS_Soldier_EP1",[0,0,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,"NONE"];
_unit6 = _group1 createUnit ["TK_INS_Soldier_AT_EP1",[0,0,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,"NONE"];
_unit7 = _group1 createUnit ["TK_INS_Soldier_MG_EP1",[0,0,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,"NONE"];
_unit8 = _group1 createUnit ["TK_INS_Soldier_EP1",[0,0,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,"NONE"];
_unit9 = _group1 createUnit ["TK_INS_Soldier_EP1",[0,0,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,"NONE"];
_unit10 = _group1 createUnit ["TK_INS_Soldier_MG_EP1",[0,0,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,"NONE"];
//createVehicle array
_veh1 =  createVehicle  ["LandRover_MG_TK_INS_EP1",[0,0,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,"NONE"];
_veh2 =  createVehicle ["LandRover_SPG9_TK_INS_EP1",[0,0,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,"NONE"];

//assignAsDriver
_unit1 assignAsDriver _veh1;
_unit5 assignAsDriver _veh2;

//moveInDriver
_unit1 moveInDriver _veh1;
_unit5 moveInDriver _veh2;

//assignAsGunner
_unit3 assignAsGunner _veh1;
_unit7 assignAsGunner _veh2;

//moveIngunner
_unit3 moveInGunner _veh1;
_unit7 moveInGunner _veh2;

//assignAsCargo
_unit2 assignAsCargo _veh1;
_unit4 assignAsCargo _veh1;
_unit6 assignAsCargo _veh2;

//moveInCargo
_unit2 moveInCargo _veh1;
_unit6 moveInCargo _veh2;							

//IED Markers
//hint "starting IED markers";
//sleep 5;
_iedmrker1 = createMarker["ied1",[5676.66,6337.84,0]];					//Same as above, the second part of this array controls the possible position  			
_iedmrker1 setMarkerShape "ICON";									//of your IED. "ICON", mrkerType "EMPTY" cannot be seen by players, however I haven't seen			
"ied1" setMarkerType "EMPTY";										//any of these red EMPTYs yet.
//hint "IED Mrker 1 created";
//sleep 5;

_iedmrker2 = createMarker ["ied2",[5625.53,6443.69,0]];
_iedmrker2 setMarkerShape "ICON";
"ied2" setMarkerType "EMPTY";
//hint "IED Mrker 2 created";
//sleep 5;

_iedmrker3 = createMarker["ied3",[5531.25,6381.06,0]];
_iedmrker3 setMarkerShape "ICON";
"ied3" setMarkerType "EMPTY";
//hint "IED Mrker 3 created";
//sleep 5;

_iedmrker4 = createMarker["ied4",[5468.98,6520.94,0]];
_iedmrker4 setMarkerShape "ICON";
"ied4" setMarkerType "EMPTY";
//hint "IED Mrker 4 created";
//sleep 5;

_iedmrker5 = createMarker ["ied5",[5248.76,6568.59,0]];
_iedmrker5 setMarkerShape "ICON";
"ied5" setMarkerType "EMPTY";
//hint "IED Mrker 5 created";
//sleep 5;

_iedmrker6 = createMarker ["ied6",[5135.13,6552.93,0]];
_iedmrker6 setMarkerShape "ICON";
"ied6" setMarkerType "EMPTY";
//hint "IED Mrker 6 created";
//sleep 5;

_iedmrker7 = createMarker ["ied7",[4958.28,6569.61,0]];
_iedmrker7 setMarkerShape "ICON";
"ied7" setMarkerType "EMPTY";
//hint "IED Mrker 7 created";
//sleep 5;

_iedmrker8 = createMarker ["ied8",[4486.28,6370.78,0]];
_iedmrker8 setMarkerShape "ICON";
"ied8" setMarkerType "EMPTY";
//hint "IED Mrker 8 created";
//sleep 5;

_iedmrker9 = createmarker ["ied9",[4298.58,6185.81,0]];
_iedmrker9 setMarkerShape "ICON";
"ied9" setMarkerType "EMPTY";
//hint "IED Mrker 9 created";
//sleep 5;

_iedmrker10 = createMarker ["ied10",[4135.28,6225.42,0]];
_iedmrker10 setMarkerShape "ICON";
"ied10" setMarkerType "EMPTY"; 
//hint "IED Mrkers Complete";
//sleep 5;

//createIED array
_iedobj = createVehicle ["HeliHEmpty",[0,0,0],["ied1","ied2","ied3","ied4","ied5","ied6","ied7","ied8","ied9","ied10"],0,"NONE"];				//change "HeliHEmpty" out for your IED Item if NOT using MCC.
_iedobj setVehicleInit "null = [getpos this,'Land_IED_v4_PMC','large',1,2,0,0,30, west, 'IED'] execVM 'mcc\general_scripts\traps\put_trap.sqf'";	//this is the script call to MCC IED comment this out
//hint "IED in Place";																						//if not in use, however your IED will not do anything
sleep 5;																								//if it is not linked to another script. 

//createDynamic Zone
//zone_1
z1 = createTrigger ["EmptyDetector",[4134.51,6117.37,0]];																//Create Trigger
z1 setTriggerArea [150,150, 0,true];																			//Set Trigger size and Shape
z1 setTriggerActivation ["NONE", "PRESENT", false];																	//Set Trigger activation
z1 setTriggerStatements ["time > 1", "zone = [""z1"",[1,0,0],[4,3,50,10],[2,2,25,10],[],[],[0,10,0,0,0]] spawn DAC_Zone", ""];				//DAC 3.0c script Call refer to DAC manual to change.

//zone_2: Supporting Camp
z2 = createTrigger ["EmptyDetector",[3489.98,6022.34,0]];
z2 setTriggerArea [150,150, 0,true];
z2 setTriggerActivation ["NONE", "PRESENT", false];																	//This next zone provides way points as well as a 
z2 setTriggerStatements ["time > 1", "zone = [""z2"",[1,0,0],[2,3,50,10],[],[],[1,2,50,0,100,10,[z1]],[0,10,0,3,0]] spawn DAC_Zone", ""];			//camp to supply respawns to z1.

/*Parameter Set-Up jsp_garrison spawn_group_v5.sqf
This area sets up the parameters.
//Perams
markername-------------------------(where the troops will garrison)
percent_of_buildings_populated-----(.1 =10% of buildings will be populated
percent_of_positions---------------(.1 =10%)
min_Skill--------------------------(.1 through 1)
max_Skill--------------------------(.1 through 1)
enemy_faction----------------------(Listed Below)
initial_spawn_marker---------------(where the units will start on the map)
PosWindow_OnOff--------------------(1-on 0-off: Window Positions)
PosDoor_OnOff----------------------(1-on 0-off: Door Positions)
PosRoof_OnOff----------------------(1-on 0-off: Roof Positions)
PosBalcony_OnOff-------------------(1-on 0-off: Balcony Positions)

factions>----[0] - Takistan Militia,[1] - Takistan Army,[2] - Takistan Militia and Takistan Army,3 - Takistan Locals,
factions>----[4] - Takistan Miltia and Takistan Locals (Allied),[5] - US Army,[6] - UK Army,[7] - CDF,[8] - Chedaki (Insurgents),
factions>----[9] - NAPA (Guerillas),[10] - Russian Army,[11] - US Marines,[12] - Czech Army,[13] - United Nations (UNO),[14] - PMC.
*/

//populate task houses with enemies using jsp_garrison script.
_garrison = createMarker ["garrison_E", [4125.58,6074.36,0]];
_garrison setMarkerShape "ICON";
"garrison_E" setMarkerType "EMPTY";

//create spawn marker (they teleport from here to the buildings)
_garrison_spwn = createMarker ["garrison_spwn", [0,0,0]];
_garrison_spwn setMarkerShape "ICON";
"garrison_spwn" setMarkerType "EMPTY";
sleep .5;
//scriptCall
["garrison_E",100,1,.3,.7,.1,0,"garrison_spwn",1,1,1,1] execVM "scripts\spawn_ai\spawn_group_v5.sqf";

//>-----------------------------------------------------------------------Create Objectives Linked to the briefing.sqf---------------------------------------------------------------------<

//createMarker:::
//createMarker for Camo Netting
_vhammo = createMarker ["vhammo", [4136.17,6094.95,0]];
_vhammo setMarkerShape "ICON";
"vhammo" setMarkerType "EMPTY";

_vhammo1 = createMarker ["vhammo1", [4059.93,5999.04,0]];
_vhammo1 setMarkerShape "ICON";
"vhammo1" setMarkerType "EMPTY";

_vhammo2 = createMarker ["vhammo2", [4024.69,6172.72,0]];
_vhammo2 setMarkerShape "ICON";
"vhammo2" setMarkerType "EMPTY";

//createMarker for Land_radar
_radiotwr = createMarker ["tower",[4123.65,6097.16,0]];
_radiotwr setMarkerShape "ICON";
"tower" setMarkerType "EMPTY";

_radiotwr1 = createMarker ["tower1",[4064.68,5989.88,0]];
_radiotwr1 setMarkerShape "ICON";
"tower1" setMarkerType "EMPTY";

_radiotwr2 = createMarker ["tower2",[4037.17,6170.31,0]];
_radiotwr2 setMarkerShape "ICON";
"tower2" setMarkerType "EMPTY";

_radiotwr3 = createMarker ["tower3",[4202.99,6149.63,0]];
_radiotwr3 setMarkerShape "ICON";
"tower3" setMarkerType "EMPTY";

_radiotwr4 = createmarker ["tower4",[4193.42,6085.45,0]];
_radiotwr4 setMarkerShape "ICON";
"tower4" setMarkerType "EMPTY";

/*createMarker for ammo_cache (Unused Markers)
_cache = createmarker ["ammo_cache",[4135.99,6094.03,0]];
_cache setMarkerShape "ICON";
"ammo_cache" setMarkerType "EMPTY";

_cache1 = createMarker ["ammo_cache1",[4060.00,5999.04,0]];
_cache1 setMarkerShape "ICON";
"ammo_cache1" setMarkerType "EMPTY";

_cache2 = createMarker ["ammo_cache2",[4027.31,6170.39,0]];
_cache2 setMarkerShape "ICON";
"ammo_cache2" setMarkerType "EMPTY";
*/

//createMarker for ammo_cache1 -- added a few more to add to replayabilty
_cache3 = createMarker ["ammo_cache3",[4136.99,6094.03,0]];
_cache3 setMarkerShape "ICON"; 
"ammo_cache3" setMarkerType "EMPTY";

_cache4 = createMarker ["ammo_cache4",[4061.00,5999.04,0]];
_cache4 setMarkerShape "ICON";
"ammo_cache4" setMarkerType "EMPTY";

_cache5 = createMarker ["ammo_cache5",[4026.31,6172.72,0]];
_cache5 setMarkerShape "ICON";
"ammo_cache5" setMarkerType "EMPTY";

_cache6 = createMarker ["ammo_cache6",[4016.17,6142.86,0]];
_cache6 setMarkerShape "ICON";
"ammo_cache6" setMarkerType "EMPTY";

_cache7 = createMarker ["ammo_cache7",[4176.16,6147.76,0]];
_cache7 setMarkerShape "ICON";
"ammo_cache7" setMarkerType "EMPTY";

//createVehicle:::

//createVehicle GuerillaCacheBox_EP1
_cacheBox = createVehicle ["GuerillaCacheBox_EP1",[0,0,0],["ammo_cache3","ammo_cache4","ammo_cache5","ammo_cache6","ammo_cache7"],0,"NONE"];
_cacheBox setVehicleInit "cacheBox = this";

//createVehicle Land_camonet_east
_vhammoBx = createVehicle ["TKVehicleBox_EP1",[0,0,0],["vhammo","vhammo1","vhammo2"],0,"NONE"];
_vhammoBx setVehicleInit "cacheBox1 = this";

//createVehicle Land_Ind_illuminanttower
_radio = createVehicle ["Land_radar",[0,0,0],["tower","tower1","tower2","tower3","tower4"],0,"NONE"];
_radio setVehicleInit "radio_tower = this";

//Place Holder for future Task linked for markers above.
//_cacheBox1 = createVehicle ["class name",[0,0,0],["marker1","marker2","marker3","marker4","marker5"],0,"NONE"];
//_cacheBox1 setVehicleInit "cacheBox1 = this";

sleep 5;

//create a trigger to tell when convoy has reached the city
convoytrg = createTrigger ["EmptyDetector",[4227.84,6225.94,0]];
convoytrg setTriggerArea [100,100,0,true];
convoytrg setTriggerActivation ["WEST","PRESENT",false];
convoytrg setTriggerStatements ["this","null = execVM 'scripts\missions\convoy_complete.sqf'; hint 'fired'",""];

//create a trigger to tell when cacheBox is destroyed
cacheTrg = createTrigger ["EmptyDetector",[0,0,0]];
cacheTrg setTriggerArea [0,0,0,false];
cacheTrg setTriggerActivation ["ANY","PRESENT",false];
cacheTrg setTriggerStatements ["!alive cacheBox1 && (taskCompleted tskObj0)","null= execVM 'scripts\missions\objective_1.sqf'; hint 'fired'",""];					//Change this to the directory your briefing tasks are linked to.

//create a trigger to tell when cachebox1 is destroyed
cacheTrg1 = createTrigger ["EmptyDetector",[0,0,0]];
cacheTrg1 setTriggerArea [0,0,0,false];
cacheTrg1 setTriggerActivation ["ANY","PRESENT",false];
cacheTrg1 setTriggerStatements ["!alive cacheBox && (taskCompleted tskObj1)","null = execVM 'scripts\misisons\objective_2.sqf'; hint 'fired'",""];					 //Change this to the directory your briefing tasks are linked to.

//create a trigger to tell when the radio_tower is destroyed
radioTrg = createTrigger ["EmptyDetector",[0,0,0]];
radioTrg setTriggerArea [0,0,0,false];
radioTrg setTriggerActivation ["ANY","PRESENT",false];
radioTrg setTriggerStatements ["!alive radio_tower","null = execVM 'scripts\missions\objectiv_3.sqf'; hint 'fired'",""];					 //Change this to the directory your briefing tasks are linked to.






Again, simple stuff for you pros out there, but I feel it's a great starting script. The reason there are sleeps throughout the script commented out, was for trouble shooting.. I could see exactly where it breaks.

Edited by Skelt

Share this post


Link to post
Share on other sites

If you feed this script an array of positions it will plot the points. At present it works with positions, a markertype and color. You should be able to get the gist of it and change it to suit yourself.

plot_points.sqf:-

private ["_ptarray","_mkrtyp","_mkrclr","_i","_pos","_mkr","_m"];

_ptarray = _this select 0;
_mkrtyp = _this select 1;
_mkrclr = _this select 2;

for "_i" from 0 to (count _ptarray)-1 do {
_pos = _ptarray select _i;
_mkr = format ["mkr_%1", _i];
_m = createMarkerLocal [_mkr, _pos];
_m setMarkerTypeLocal _mkrtyp;
_m setMarkerColorLocal _mkrclr;
_m setMarkerSizeLocal [0.5, 0.5];
sleep 0.01;
};

Execute like this:-

nul = [[[2345.67,3456.67,0],[6578.98,7648.66,0]],"mil_dot","colorRED"] execVM "plot_points.sqf";

This only plots the two points supplied... but it could have been a hundred points with no problems.

Edited by twirly
Clarity

Share this post


Link to post
Share on other sites

Awesome, I will implement that. The long way seems to be working for testing right now.

Having a little bit of problems with the creation of units. I've defined a center, but since there are no groups available for it to join, it's giving me problems. I'm attempting createUnit right now, because it seemed the easiest in the wiki to define a units name.

Ed: Ok Units are spawning now, how about I createGroup for those units eh? haha

but im trying to use:: [bIS_TK_INS, 5] call BIS_fnc_spawnGroup; and it doesn't recognize BIS_TK_INS .... it would be easy if i could just say East =/ but i need taki insurgents.

Edited by Skelt

Share this post


Link to post
Share on other sites

Create a group before you create the unit(s).... then use the created group... wgroup1... to create the unit(s).

[b]wgroup1[/b] = creategroup west;

Edited by twirly
Clarity

Share this post


Link to post
Share on other sites

This is what I have for unit creation, I just need the two pillar pieces, because the other units should appear at which ever marker is chosen for them. Problem I'm getting, is that the random_ambush.sqf is not picking up the unit names of atk1 & atk2.

//////////////////////////////////////////////////////////////////
// create_units.sqf
// Created by: Bones
//////////////////////////////////////////////////////////////////

hint "Unit Creation Started";
sleep 5;
//Create the Center for the Side.
_center = createCenter east;
_group = createGroup east;
_group1 = createGroup east;
//createVehicle
"LandRover_MG_TK_INS_EP1" createUnit [[0,0,0],_group,"atk1 = this",0.5,"corporal"];
//hint "unit 1 created";
//sleep 5;

"LandRover_MG_TK_INS_EP1" createUnit [[1,0,0],_group1,"atk2 = this",0.5,"corporal"];
//hint "unit 2 created";
//sleep 5;
hint "Units Creation Finished";
sleep 5;

execVM "scripts\spawn_ai\ambush\random_ambush.sqf";

I also had it like this:

this = atk1

this = atk2

---------- Post added at 02:10 AM ---------- Previous post was at 01:53 AM ----------

tried setIdentity... not sure if it's working yet, im going to test the above script.. I want to visually see the units this time rather then just see the hints and no errors.

---------- Post added at 02:28 AM ---------- Previous post was at 02:10 AM ----------

the above code doesn't work. I replaced out [0,0,0] with my positions cords, and nothing appears, and I don't get any script errors...

Share this post


Link to post
Share on other sites

well, it's a manned vehicle. createVehicle would create it empty, and I'm looking for a manned version. I got the class name directly from the unit. i'll check createunit array. Sounds better already haha.

---------- Post added at 02:36 AM ---------- Previous post was at 02:33 AM ----------

well createUnit array does have some great functionality, but it's more than what I need for this. I will have some future needs for createunit array tho :)

---------- Post added at 02:40 AM ---------- Previous post was at 02:36 AM ----------

well crap, now that I think about it, I could generate markers, and feed them to a createUnit array and solve this right there...hmmph

ed: then again... I'm still having problems getting guys to appear.

Share this post


Link to post
Share on other sites

This is probably what you need...

createGroup

createUnit Array

creatVehicle Array

assignAsDriver

moveInDriver

assignAsGunner

moveInGunner

Share this post


Link to post
Share on other sites

Cool.... see if you can sort that out and come back. There's a little problem with how you execute "random_ambush.sqf"

Share this post


Link to post
Share on other sites

since I'm passing an array of markers to createUnit array am I still in need of the other script? Seems it would do exactly what my other script was going to do. Should be done in a lil bit. I have to go over my reference a few times for each to make sure everything is right.

Share this post


Link to post
Share on other sites

Ok, this is what I came up with::

//////////////////////////////////////////////////////////////////
// create_units.sqf
// Created by: Bones
//////////////////////////////////////////////////////////////////

//createCenter
_center = createCenter east;

//createGroup
_group = createGroup east;
_group1 = createGroup east;

//createUnit array ((_unit = group player createUnit ["SoldierWB", Position player, [], 0, "FORM"])) 
//group1
_unit1 = _group createUnit ["TK_INS_Soldier_EP1",[5919.17,6089.42,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,""];
_unit2 = _group createUnit ["TK_INS_Soldier_AT_EP1",[5925.17,6089.42,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,""];
_unit3 = _group createUnit ["TK_INS_Soldier_AAT_EP1",[5927.17,6089.42,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,""];
_unit4 = _group createUnit ["TK_INS_Soldier_MG_EP1",[5929.17,6089.42,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,""];
//group2
_unit5 = _group1 createUnit ["TK_INS_Soldier_EP1",[5919.17,6089.42,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,""];
_unit6 = _group1 createUnit ["TK_INS_Soldier_AT_EP1",[5925.17,6089.42,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,""];
_unit7 = _group1 createUnit ["TK_INS_Soldier_AAT_EP1",[5927.17,6089.42,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,""];
_unit8 = _group1 createUnit ["TK_INS_Soldier_MG_EP1",[5929.17,6089.42,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,""];

//createVehicle array
_veh1 = _group createVehicle ["LandRover_MG_TK_INS_EP1",[5930.17,6089.42,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,""];
_veh2 = _group1 createVehicle ["LandRover_SPG9_TK_INS_EP1",[5940.17,6089.42,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,""];

//assignAsDriver
_unit1 assignAsDriver _veh1;
_unit5 assignAsDriver _veh2;

//moveInDriver
_unit1 moveInDriver _veh1;
_unit5 moveInDriver _veh2;

//assignAsGunner
_unit4 assignAsGunner _veh1;
_unit8 assignAsGunner _veh2;

//moveIngunner
_unit4 moveInGunner _veh1;
_unit8 moveInGunner _veh2;

//assignAsCargo
_unit2 assignAsCargo _veh1;
_unit3 assignAsCargo _veh1;
_unit6 assignAsCargo _veh2;
_unit7 assignAsCargo _veh2;

//moveInCargo
_unit2 moveInCargo _veh1;
_unit3 moveInCargo _veh1;
_unit6 moveInCargo _veh6;
_unit7 moveInCargo _veh7;

I placed them kinda near the player so I can see if they actually appear...

---------- Post added at 03:20 AM ---------- Previous post was at 03:19 AM ----------

suppose I wont be able to see them tho cuz it's going to look for those markers right off the bat eh? haha

---------- Post added at 03:25 AM ---------- Previous post was at 03:20 AM ----------

It's looking like all I would need to do is link my createMarker script to this one (running it first) and the createUnit array should do the rest.

Share this post


Link to post
Share on other sites

That was quick!

Cool....OK... I haven't run it to know if it works...but it looks good. Create your markers and run it and see if everyhting is created as you expect. Putting the markers closeby is a good idea.

Share this post


Link to post
Share on other sites

will do. I'm going to place them in the editor for now..

---------- Post added at 03:34 AM ---------- Previous post was at 03:28 AM ----------

hmmm it says it doesn't like my vehicle class names... says it's expecting a string at line 27

//createVehicle array
_veh1 = _group createVehicle ["LandRover_MG_TK_INS_EP1",[5930.17,6089.42,0],["ambush1","ambush2","ambush3","ambush4","ambush5","ambush6","ambush7","ambush8","ambush9","ambush10"],0,""];

Im using this:

myclass=typeOf this;hint format["The class name is:%1",myclass];copyToClipboard myclass;

to grab the class names

---------- Post added at 03:37 AM ---------- Previous post was at 03:34 AM ----------

error: type group, expected string..

Share this post


Link to post
Share on other sites

See what you get with this....

myclass=typeOf ([b]vehicle[/b] this);hint format["The class name is:%1",myclass];copyToClipboard myclass;

EDIT: Place the vehicle (Land Rover?) in the editor and save the mission..... then open the mission.sqm file and look for the vehicles classname. It'll be in there.

Edited by twirly

Share this post


Link to post
Share on other sites

something different on first truck... weirddd

---------- Post added at 03:42 AM ---------- Previous post was at 03:41 AM ----------

second was the same.

---------- Post added at 03:44 AM ---------- Previous post was at 03:42 AM ----------

ah i placed the reg taki truck in der no insurgent

---------- Post added at 03:45 AM ---------- Previous post was at 03:44 AM ----------

Still have the same error at line 26/27 error: type group, expected string

---------- Post added at 03:55 AM ---------- Previous post was at 03:45 AM ----------

They arnt showing under EAST in mission.sqm

---------- Post added at 03:57 AM ---------- Previous post was at 03:55 AM ----------

found it by right some stuff in the init...

LandRover_MG_TK_INS_EP is one of them

---------- Post added at 03:58 AM ---------- Previous post was at 03:57 AM ----------

LandRover_SPG9_TK_INS_EP1 for the other

Share this post


Link to post
Share on other sites

I just did a test by putting this in my players init with two markers on the map... ambush1 and ambush2.

The Land Rover is created fine at one of the markers.

veh = createvehicle ["LandRover_MG_TK_INS_EP1",getpos player,["ambush1","ambush2"],0,"NONE"];

Share this post


Link to post
Share on other sites

and it still wont accept that.. hmph.

---------- Post added at 04:02 AM ---------- Previous post was at 04:01 AM ----------

I didnt have "NONE" i just left my empty "" I'll change and see what happens. If I remove the createVehicle arrays everything works as its suppose to.

Share this post


Link to post
Share on other sites

Well...then you've got some tiny little gremlin left to sort out (the worst kind! LoL).....but you're nearly there.

EDIT: I ran the code.... and there's no group needed for the createVehicle syntax... it's an empty vehicle so that follows!

//createVehicle array
_veh1 = [s]_group[/s] createVehicle ["LandRover_MG_TK_INS_EP1",[0,0,30],["ambush1","ambush2","ambush3","ambush4","ambush5"],0,""];
_veh2 = [s]_group[/s] createVehicle ["LandRover_SPG9_TK_INS_EP1",[0,0,30],["ambush1","ambush2","ambush3","ambush4","ambush5"],0,""];

Edited by twirly

Share this post


Link to post
Share on other sites

you also defined yours differently, you did veh vs. _veh but that shouldn't matter because I'm not calling it else where correct?

---------- Post added at 04:09 AM ---------- Previous post was at 04:07 AM ----------

Yeah I'll get it worked out, them I'm going to change my create marker script over to your version, and everything should be good to go on it. Then next it's on to IED's and Camps** haha

---------- Post added at 04:12 AM ---------- Previous post was at 04:09 AM ----------

oh and one last thing before you go, how do I correctly call a script from a script? I thought it was ok to just

exceVM "script.sqf";

---------- Post added at 04:21 AM ---------- Previous post was at 04:12 AM ----------

ahh no group

---------- Post added at 04:23 AM ---------- Previous post was at 04:21 AM ----------

well....it's working now...

---------- Post added at 04:26 AM ---------- Previous post was at 04:23 AM ----------

Thanks for all your help** Was fun.

Share this post


Link to post
Share on other sites

I edited my post above....check it out.... I found one of your problems.

With the execVM... I think it should be like this to give the process a handle:-

nul = [] execVM "script.sqf";

or

_scr = [1thing, 2thing] execVM "do_something.sqf";

Then you can do :-

waituntil {scriptdone _scr};

That's the only use I know for the handle. Every script I run is just nul = blah...blah...blah.

I believe it's just proper protocol. I saw a discussion on it just a few days ago...might be right here in this forum... and I beleive what you did will work.... but you won't see it around much.

Share this post


Link to post
Share on other sites

I'll be here for another couple hours so feel free to drop back by, and check out what i'm pulling my hair out about then...

---------- Post added at 04:28 AM ---------- Previous post was at 04:26 AM ----------

ah yeah, I started that post haha. yeah that was the main arguments for having the handle was waituntil {scriptdone _scr};

---------- Post added at 04:29 AM ---------- Previous post was at 04:28 AM ----------

other then that, the handle is only used and needed for calling the scripts from within the editor, outside makes no real differrence besides for above.

Share this post


Link to post
Share on other sites

I'm always browsing....so we'll catch up soon then I'm sure!

EDIt: ...Hahah... just saw tt was you that started that discussion about execVM... Lol!

Share this post


Link to post
Share on other sites

Sounds good, Thanks for all your help**

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  

×