User Tools

Site Tools


ofp:missions:real_campaign

This is an old revision of the document!


Real Campaign

This article introduces you to a real campaign that remembers the weapon loadout, team status and captured objectives by your and enemy forces.

Commands

Primary commands used to create this campaign are

  • createUnit
  • createVehicle
  • saveStatus
  • loadStatus
  • addMagazinePool
  • addWeaponPool
  • saveVar

Missions

Missions have the objectives or “targets” set, each of them has the following

  • flag pole
  • marker
  • trigger activated by east
  • trigger activated by west
  • east and west starting location gamelogic's

Scripts

  • init.sqs - loads team status, objectives, starts other scripts (moving/war etc).
  • exit.sqs - saves team status, objectives, vehicles and adds cargo to weaponPool.
  • war.sqs - creates the fighting units and vehicles.
  • moving.sqs - picks a free group and assigns it to move.
  • sendgroup-east.sqs - manages the given group, east.
  • sendgroup-west.sqs - manages the given group, west.

init.sqs

This is there you setup the markers for occupied locations (ie targets) and load the status for your team. Actually I'm not using init.sqs by itself, but just load a “StartMission.sqs” from the script.

StartMission.sqs:

;---- weaponpool stuff
_q = 1
_n = rollCall
 
while "_q < _n" do {_xx = "JAM_GBHDSoldier" createUnit [getpos player, group player, "removeAllweapons this", 0, "Private"]; _q = _q + 1}
 
#---load group status---
_z = units group player
_r = 0
 
?(rollCall >= 0):(_z select 0) loadStatus "p0"; _r = _r + (rating (_z select 0)); (_z select 0) addrating -(rating (_z select 0))
?(rollCall >= 1):(_z select 1) loadStatus "p1"; _r = _r + (rating (_z select 1)); (_z select 1) addrating -(rating (_z select 1))
?(rollCall >= 2):(_z select 2) loadStatus "p2"; _r = _r + (rating (_z select 2)); (_z select 2) addrating -(rating (_z select 2))
?(rollCall >= 3):(_z select 3) loadStatus "p3"; _r = _r + (rating (_z select 3)); (_z select 3) addrating -(rating (_z select 3))
?(rollCall >= 4):(_z select 4) loadStatus "p4"; _r = _r + (rating (_z select 4)); (_z select 4) addrating -(rating (_z select 4))
?(rollCall >= 5):(_z select 5) loadStatus "p5"; _r = _r + (rating (_z select 5)); (_z select 5) addrating -(rating (_z select 5))
?(rollCall >= 6):(_z select 6) loadStatus "p6"; _r = _r + (rating (_z select 6)); (_z select 6) addrating -(rating (_z select 6))
?(rollCall >= 7):(_z select 7) loadStatus "p7"; _r = _r + (rating (_z select 7)); (_z select 7) addrating -(rating (_z select 7))
?(rollCall >= 8):(_z select 8) loadStatus "p8"; _r = _r + (rating (_z select 8)); (_z select 8) addrating -(rating (_z select 8))
?(rollCall >= 9):(_z select 9) loadStatus "p9"; _r = _r + (rating (_z select 9)); (_z select 9) addrating -(rating (_z select 9))
?(rollCall >= 10):(_z select 10) loadStatus "p10"; _r = _r + (rating (_z select 10)); (_z select 10) addrating -(rating (_z select 10))
?(rollCall >= 11):(_z select 11) loadStatus "p11"; _r = _r + (rating (_z select 11)); (_z select 11) addrating -(rating (_z select 11))
?(rollCall >= 12):(_z select 12) loadStatus "p12"; _r = _r + (rating (_z select 12)); (_z select 12) addrating -(rating (_z select 12))
 
player addrating (_r / 3)
 
_c = 0
#damLoop
?(_c > (rollCall)): goto "endDam"
?(damage (_z select _c) > 0.9): deletevehicle (_z select _c);
_c = _c + 1
goto damLoop
#endDam
 
#---load "garage"---
_veh0pos = [(getpos player select 0)-50+random 100,(getpos player select 1)-50+random 100];
_veh1pos = [(getpos player select 0)-50+random 100,(getpos player select 1)-50+random 100];
_veh2pos = [(getpos player select 0)-50+random 100,(getpos player select 1)-50+random 100];
_veh3pos = [(getpos player select 0)-50+random 100,(getpos player select 1)-50+random 100];
_veh4pos = [(getpos player select 0)-50+random 100,(getpos player select 1)-50+random 100];
_veh5pos = [(getpos player select 0)-50+random 100,(getpos player select 1)-50+random 100];
_veh6pos = [(getpos player select 0)-50+random 100,(getpos player select 1)-50+random 100];
_veh7pos = [(getpos player select 0)-50+random 100,(getpos player select 1)-50+random 100];
_veh8pos = [(getpos player select 0)-50+random 100,(getpos player select 1)-50+random 100];
_veh9pos = [(getpos player select 0)-50+random 100,(getpos player select 1)-50+random 100];
 
?(numvehicles >= 1): _x = veh0 createVehicle _veh0pos; clearWeaponCargo _x; clearMagazineCargo  _x;
?(numvehicles >= 2): _x = veh1 createVehicle _veh1pos; clearWeaponCargo _x; clearMagazineCargo  _x;
?(numvehicles >= 3): _x = veh2 createVehicle _veh2pos; clearWeaponCargo _x; clearMagazineCargo  _x;
?(numvehicles >= 4): _x = veh3 createVehicle _veh3pos; clearWeaponCargo _x; clearMagazineCargo  _x;
?(numvehicles >= 5): _x = veh4 createVehicle _veh4pos; clearWeaponCargo _x; clearMagazineCargo  _x;
?(numvehicles >= 6): _x = veh5 createVehicle _veh5pos; clearWeaponCargo _x; clearMagazineCargo  _x;
?(numvehicles >= 7): _x = veh6 createVehicle _veh6pos; clearWeaponCargo _x; clearMagazineCargo  _x;
?(numvehicles >= 8): _x = veh7 createVehicle _veh7pos; clearWeaponCargo _x; clearMagazineCargo  _x;
?(numvehicles >= 9): _x = veh8 createVehicle _veh8pos; clearWeaponCargo _x; clearMagazineCargo  _x;
?(numvehicles >= 10): _x = veh9 createVehicle _veh9pos; clearWeaponCargo _x; clearMagazineCargo  _x;
;---- end of weaponpool stuff
 
; new city occupation colors
"pmc1" setMarkerColor PMC_City01; ["pmc1"] exec "add-defenses.sqs";
"pmc2" setMarkerColor PMC_City02; ["pmc2"] exec "add-defenses.sqs";
"pmc3" setMarkerColor PMC_City03; ["pmc3"] exec "add-defenses.sqs";
"pmc4" setMarkerColor PMC_City04; ["pmc4"] exec "add-defenses.sqs";
"pmc5" setMarkerColor PMC_City05; ["pmc5"] exec "add-defenses.sqs";
"pmc6" setMarkerColor PMC_City06; ["pmc6"] exec "add-defenses.sqs";
"pmc7" setMarkerColor PMC_City07; ["pmc7"] exec "add-defenses.sqs";
"pmc8" setMarkerColor PMC_City08; ["pmc8"] exec "add-defenses.sqs";
"pmc9" setMarkerColor PMC_City09; ["pmc9"] exec "add-defenses.sqs";
"pmc10" setMarkerColor PMC_City10; ["pmc10"] exec "add-defenses.sqs";

exit.sqs

This script saves the occupation status by looking the marker colors and the team weaponpool and savestatus.

;
; this is for the captured towns stuff.
;
PMC_City01=getMarkerColor "pmc1"
PMC_City02=getMarkerColor "pmc2"
PMC_City03=getMarkerColor "pmc3"
PMC_City04=getMarkerColor "pmc4"
PMC_City05=getMarkerColor "pmc5"
PMC_City06=getMarkerColor "pmc6"
PMC_City07=getMarkerColor "pmc7"
PMC_City08=getMarkerColor "pmc8"
PMC_City09=getMarkerColor "pmc9"
PMC_City10=getMarkerColor "pmc10"
PMC_City11=getMarkerColor "pmc11"
PMC_City12=getMarkerColor "pmc12"
PMC_City13=getMarkerColor "pmc13"
PMC_City14=getMarkerColor "pmc14"
PMC_City15=getMarkerColor "pmc15"
PMC_City16=getMarkerColor "pmc16"
PMC_City17=getMarkerColor "pmc17"
PMC_City18=getMarkerColor "pmc18"
PMC_City19=getMarkerColor "pmc19"
PMC_City20=getMarkerColor "pmc20"
PMC_City21=getMarkerColor "pmc21"
PMC_City22=getMarkerColor "pmc22"
PMC_City23=getMarkerColor "pmc23"
PMC_City24=getMarkerColor "pmc24"
PMC_City25=getMarkerColor "pmc25"
PMC_City26=getMarkerColor "pmc26"
PMC_City27=getMarkerColor "pmc27"
PMC_City28=getMarkerColor "pmc28"
PMC_City29=getMarkerColor "pmc29"
PMC_City30=getMarkerColor "pmc30"
 
saveVar "PMC_City01"
saveVar "PMC_City02"
saveVar "PMC_City03"
saveVar "PMC_City04"
saveVar "PMC_City05"
saveVar "PMC_City06"
saveVar "PMC_City07"
saveVar "PMC_City08"
saveVar "PMC_City09"
saveVar "PMC_City10"
saveVar "PMC_City11"
saveVar "PMC_City12"
saveVar "PMC_City13"
saveVar "PMC_City14"
saveVar "PMC_City15"
saveVar "PMC_City16"
saveVar "PMC_City17"
saveVar "PMC_City18"
saveVar "PMC_City19"
saveVar "PMC_City20"
saveVar "PMC_City21"
saveVar "PMC_City22"
saveVar "PMC_City23"
saveVar "PMC_City24"
saveVar "PMC_City25"
saveVar "PMC_City26"
saveVar "PMC_City27"
saveVar "PMC_City28"
saveVar "PMC_City29"
saveVar "PMC_City30"
 
#---save status---
_z = units group player
rollCall = count _z
 
deleteStatus "p1"
deleteStatus "p2"
deleteStatus "p3"
deleteStatus "p4"
deleteStatus "p5"
deleteStatus "p6"
deleteStatus "p7"
deleteStatus "p8"
deleteStatus "p9"
deleteStatus "p10"
deleteStatus "p11"
deleteStatus "p12"
 
_z = units group player
rollCall = count _z
 
?(rollCall >= 1): if (damage (_z select 1) > 0.9) then {deletevehicle (_Z select 1)};
?(rollCall >= 2): if (damage (_z select 2) > 0.9) then {deletevehicle (_z select 2)};
?(rollCall >= 3): if (damage (_z select 3) > 0.9) then {deletevehicle (_Z select 3)};
?(rollCall >= 4): if (damage (_z select 4) > 0.9) then {deletevehicle (_z select 4)};
?(rollCall >= 5): if (damage (_z select 5) > 0.9) then {deletevehicle (_z select 5)};
?(rollCall >= 6): if (damage (_z select 6) > 0.9) then {deletevehicle (_Z select 1)};
?(rollCall >= 7): if (damage (_z select 7) > 0.9) then {deletevehicle (_z select 2)};
?(rollCall >= 8): if (damage (_z select 8) > 0.9) then {deletevehicle (_Z select 3)};
?(rollCall >= 9): if (damage (_z select 9) > 0.9) then {deletevehicle (_z select 4)};
?(rollCall >= 10): if (damage (_z select 10) > 0.9) then {deletevehicle (_z select 5)};
?(rollCall >= 11): if (damage (_z select 11) > 0.9) then {deletevehicle (_z select 4)};
?(rollCall >= 12): if (damage (_z select 12) > 0.9) then {deletevehicle (_z select 5)};
 
_z = units group player
rollCall = count _z
 
?(rollCall >= 0): _sk = (skill (_z select 0)); (_z select 0) setSkill _sk + (0.1 + random 0.1); (_z select 0) saveStatus "p0"
?(rollCall >= 1): _sk = (skill (_z select 1)); (_z select 1) setSkill _sk + (0.1 + random 0.1); (_z select 1) saveStatus "p1"
?(rollCall >= 2): _sk = (skill (_z select 2)); (_z select 2) setSkill _sk + (0.1 + random 0.1); (_z select 2) saveStatus "p2"
?(rollCall >= 3): _sk = (skill (_z select 3)); (_z select 3) setSkill _sk + (0.1 + random 0.1); (_z select 3) saveStatus "p3"
?(rollCall >= 4): _sk = (skill (_z select 4)); (_z select 4) setSkill _sk + (0.1 + random 0.1); (_z select 4) saveStatus "p4"
?(rollCall >= 5): _sk = (skill (_z select 5)); (_z select 5) setSkill _sk + (0.1 + random 0.1); (_z select 5) saveStatus "p5"
?(rollCall >= 6): _sk = (skill (_z select 6)); (_z select 6) setSkill _sk + (0.1 + random 0.1); (_z select 6) saveStatus "p6"
?(rollCall >= 7): _sk = (skill (_z select 7)); (_z select 7) setSkill _sk + (0.1 + random 0.1); (_z select 7) saveStatus "p7"
?(rollCall >= 8): _sk = (skill (_z select 8)); (_z select 8) setSkill _sk + (0.1 + random 0.1); (_z select 8) saveStatus "p8"
?(rollCall >= 9): _sk = (skill (_z select 9)); (_z select 9) setSkill _sk + (0.1 + random 0.1); (_z select 9) saveStatus "p9"
?(rollCall >= 10) _sk = (skill (_z select 10)); (_z select 10) setSkill _sk + (0.1 + random 0.25); (_z select 10) saveStatus "p10"
?(rollCall >= 11): _sk = (skill (_z select 11)); (_z select 11) setSkill _sk + (0.1 + random 0.25); (_z select 11) saveStatus "p11"
?(rollCall >= 12): _sk = (skill (_z select 12)); (_z select 12) setSkill _sk + (0.1 + random 0.25); (_z select 12) saveStatus "p12"
 
saveVar "rollCall"

moving.sqs

This script checks if we have any free groups in the PMC_groups array. If there is, the group will be selected, its leader and side passed into the sendgroup-<side>.sqs script.

if (!local Server) then { exit; };
 
_A=0;
 
#Loop
; give some delay if that helps the dupe sendgroups?
~.1
if (count PMC_groups == 0) then { goto "Waiting"; };
 
 
if (!alive leader (PMC_groups select _A)) then { PMC_groups = PMC_groups - [(PMC_groups select _A)]; _A=0; goto "Loop"; };
 
if (pmcdb==1) then { player sidechat format["PMC_groups %1: %2. ldr Ready: %3, units: %4. side: %5",_A,(PMC_groups select _A),(unitready leader (PMC_groups select _A)),(count units (PMC_groups select _A)),side (PMC_groups select _A)]; };
;if (pmcdb==1) then { hint format["%1\n\nnum of groups: %2\n\n_A: %3",PMC_groups,count PMC_groups,_A]; };
 
_dude1 = PMC_groups select _A
 
; this should work :)
if (unitready leader _dude1 && side leader _dude1 == west) then { [_dude1] exec "sendgroup-west.sqs"; _A=0; goto "Loop"; };
if (unitready leader _dude1 && side leader _dude1 == east) then { [_dude1] exec "sendgroup-east.sqs"; _A=0; goto "Loop"; };
 
_A=_A+1;
if (_A >= count PMC_groups) then { goto "Waiting"; };
 
goto "Loop";
 
 
#Waiting
_tmpt=PMC_MLP + random 5
if (pmcdb==1) then { player sidechat format["waiting for %1 secs as we have 0 PMC_groups available",_tmpt]; };
_A=0;
~_tmpt
goto "Loop";

sendgroup-<side>.sqs

Here is the scripts that choose the target for this given group, selects the group behaviour and sends them on their way, managing them during the waypoints and while on the target area. If all goes well, group reaches target and patrols it, group is put back on the rotation to the moving.sqs script.

PMC_sdg=PMC_sdg+1;
 
_group = _this select 0;
_ua=0;
 
; small wait in the patrol zone
_SWait=240;
_SWaitRnd=120;
 
PMC_groups = PMC_groups - [_group];
 
if (!alive leader _group) then { player globalchat format["%1 group=dead. exiting swestsqs. count: %2. alive: %3",_group,count units _group, alive leader (_group)]; exit; };
 
; runloop is how far the guys need to be from the target before they "are there".
; for example helos it need to be like way over 100, but infantry 10 is better.
_RunLoop=10;
 
; _RanP is the random patrol distance, again 100 meters is ok for infantry, but 
; for helos it need much wider area to patrol to make it anything useful.
_RanP=100;
;_tmp = Vehicle (leader _group);
_tmp = [Vehicle (leader _group)];
 
if ("Air" countType _tmp == 1) then { _RunLoop=200; _RanP=300; };
if (pmcdb==1 && "Air" countType _tmp == 1) then { player globalchat format["WE HAVE AIR UNIT: %1 - %2",_tmp,typeOf vehicle leader _group]; };
 
; if car then safe + full speed. if tank or helo, then aware + full speed.
if ("Car" countType _tmp == 1) then { _group setbehaviour "safe"; _group setspeedmode "full"; goto "RDone"; };
if ("Tank" countType _tmp == 1 || "Air" countType _tmp == 1) then { _group setbehaviour "aware"; _group setspeedmode "full"; goto "RDone"; };
 
_behav = ["safe","aware","stealth","combat"];
_speed = ["limited","normal","full"];
_comba = ["GREEN","WHITE","YELLOW","RED"];
_fomat = ["COLUMN","STAG COLUMN","WEDGE","ECH LEFT","ECH RIGHT","VEE","LINE"];
 
_r1= random (count _behav);
_r1=_r1 - (_r1 mod 1);
_group setbehaviour (_behav select _r1)
 
_r1= random (count _speed);
_r1=_r1 - (_r1 mod 1);
_group setspeedmode (_behav select _r1)
 
_r1= random (count _comba);
_r1=_r1 - (_r1 mod 1);
_group setcombatmode (_comba select _r1)
 
_r1= random (count _fomat);
_r1=_r1 - (_r1 mod 1);
_group setformation (_fomat select _r1)
 
#RDone
 
;
; this is where we find a city which is not "targeted" or occupied by the side
;
_A=0;
#TargetLoop
_target = PMC_targets select _A;
if (East_ControList select _A == 0 && East_AssignList select _A == 0) then { goto "StartMoving"; };
 
_A=_A+1;
if (_A < (count PMC_targets)) then { goto "TargetLoop"; };
 
; we did not find a match, so we just send them to last _target location, what the hell :)
_ran = random (count PMC_targets);
_ran = _ran - (_ran mod 1);
_A=_ran;
_target = PMC_targets select _A;
 
;
; we have found city and are ready to move out
;
#StartMoving
 
East_AssignList set [_A,1];
if (leader _group distance _target > 6400) then { goto "BigMotherFuckerMovingShit"; };
 
if (pmcdb==1) then { leader _group sidechat format["ready, _A: %1, moving to: %2",_A, getpos _target]; };
 
#RunLoop
if ("alive _x" foreach units _group == 0) then { goto "EndDead"; };
if (unitready leader _group && leader _group distance _target > _RunLoop) then { leader _group move getpos _target; };
if (unitready leader _group && leader _group distance _target < _RunLoop) then { goto "EndAlive"; };
 
if (pmcdb==1) then { leader _group sidechat format["my distance to target is: %1m",leader _group distance _target]; };
 
~60 + random 5
goto "RunLoop";
 
#EndAlive
leader _group sidechat format["Starting our patrol of the target area in %1",getpos leader _group];
 
;
; okay this is tricky, if we are in SOFT vehicle we disembark.
;
_veh = [vehicle (leader _group)];_myVehicle=vehicle (leader _group);
 
;if (typeOf _veh == "HMMWV") then { {unassignVehicle _x} foreach units _group; _ua=1;};
;if (typeOf _veh == "Jeep") then { {unassignVehicle _x} foreach units _group; _ua=1; };
;if (typeOf _veh == "JeepMG") then { {unassignVehicle _x} foreach units _group; _ua=1; };
;if (typeOf _veh == "Truck5T") then { {unassignVehicle _x} foreach units _group; _ua=1; };
;if (typeOf _veh == "Truck5TOpen") then { {unassignVehicle _x} foreach units _group; _ua=1; };
;if (typeOf _veh == "UAZ") then { {unassignVehicle _x} foreach units _group; _ua=1; };
;if (typeOf _veh == "Ural") then { {unassignVehicle _x} foreach units _group; _ua=1; };
; hmm maybe this works, if we have a car type?
if ("Car" countType _veh == 1) then { {unassignVehicle _x} foreach units _group; _ua=1;};
 
_group setbehaviour "aware";
_group setformation "wedge";
_group setspeedmode "limited";
_group setcombatmode "red";
 
_WP=0;
 
#WayPointGo
;leader _group move [(getpos _target select 0)-100+random 200,(getpos _target select 1)-100+random 200,0];
leader _group move [(getpos _target select 0) - _RanP + random _RanP * 2,(getpos _target select 1) - _RanP + random _RanP * 2,0];
 
#IdleW
~10 + random 5
 
; if the fuckers are dead, then we end the script.
if ("alive _x" foreach units _group == 0) then { goto "EndDead"; };
 
; if they are NOT READY we return to waiting mode
if (!unitready leader _group) then { goto "IdleW"; };
 
; if unit is ready, we return to waypoint looping.
if (_WP < 5) then { _WP=_WP+1; goto "WayPointGo"; };
 
_group setbehaviour "safe";
_group setspeedmode "limited";
_group setcombatmode "yellow";
leader _group sidechat "Patrol Complete. Over.";
 
leader _group move getpos _target;
 
;
; small wait in the target area
;
if ("Air" countType _veh == 1) then { _SWait=10;_SWaitRnd=10; };
~_SWait + random _SWaitRnd
if ("alive _x" foreach units _group == 0) then { goto "EndDead"; };
 
;
; this is to board the earlier disembarked vehicle, if any.
;
 
; but first, if we dont have a vehice, lets just skip this crap.
if (_ua==0 || (!canMove _myVehicle)) then { goto "SkipVehicle"; };
 
; leader drives.
leader _group assignasdriver vehicle (_veh select 0);
if (pmcdb==1) then { player globalchat format["Just assigned cargo to: %1",typeOf (_veh select 0)]; };
 
; rest are put in cargo
{ if (_x != leader _group) then {_x assignAsCargo vehicle (_veh select 0)} } forEach units _group;
units _group ordergetin true;
 
; we have skipped the vehicle boarding.
#SkipVehicle
East_AssignList set [_A,0];
 
if (alive leader _group) then { PMC_groups = PMC_groups + [_group]; };
 
if (pmcdb==1) then { player globalchat format["send..sqs exit for %1, leader alive: %2. units: %3.",_group,alive leader _group, count units _group]; };
 
PMC_sdg=PMC_sdg-1;
exit
 
#EndDead
East_AssignList set [_A,0];
 
PMC_sdg=PMC_sdg-1;
exit
 
;
; plot waypoints by Snake Man & Zeneth
;
; give this script a 
; [groupname,destination object] exec "patrol.sqs";
 
#BigMotherFuckerMovingShit
 
_targetP = _target
 
_Xend = getpos _targetP select 0
_Yend = getpos _targetP select 1
_Xstart = getpos leader _group select 0
_Ystart = getpos leader _group select 1
 
_dX = _Xend - _Xstart
_dY = _Yend - _Ystart
_SubSteps = 10;
_ActStep = 1;
_posX=0;
_posY=0;
 
#WPLoop
_posX = _Xstart + (_dX * _ActStep / _SubSteps);
_posY = _Ystart + (_dY * _ActStep / _SubSteps);
goto "MoveTheGroup";
#ReturnFromMove
_ActStep=_ActStep+1;
?(_ActStep < _SubSteps): goto "WPLoop";
 
leader _group move getpos _targetP;
#WaitMyDamnGuys
~3
if (!unitready leader _group) then { goto "WaitMyDamnGuys"; };
if (pmcdb==1) then { leader _group sidechat format["patrol.sqs script ended, target reached. thank you. _ActStep: %1, leader _group dist _targetP: %2",_ActStep, leader _group distance _targetP]; };
 
; plotting has completely ended, return our command to the fight part of this script
goto "EndAlive";
 
#MoveTheGroup
leader _group move [_posX,_posY];
if (pmcdb==1) then { leader _group sidechat format["Moving out... _ActStep: %1. Posit: %2",_ActStep,getpos leader _group]; };
#MoveLoop
~2
if (!unitready leader _group) then { goto "MoveLoop"; };
goto "ReturnFromMove";

war.sqs

This script that creates the units and vehicles which are fighting, it loops to keep the fight going for a long time.

At start we define the local variables for the unit classnames. I wanted to have this script easily changed for other addons.

_WB="JAM_WBHDSoldier";
_WAT="JAM_CAVS_WBHDLAWALLSoldier";
_WLAW="JAM_CAVS_WBHDLAWALLSoldier";
_WAA="JAM_WBSoldierAAHD";
_WOff="JAM_WOfficerHD";
_WG="JAM_WBGLVestHDSoldier";
_WMG="JAM_WBMGFSHDSoldier";
_WMed="JAM_WMedicHD";
_WCre="JAM_SoldierWHDCrew";
_WPil="JAM_SoldierWHDPilot";
_WSni="JAM_WSniper";
_WSpe="JAM_WSaboteurHD";
 
_EB="JAM_EBHDSoldier";
_ELAW="JAM_CAVS_EBSoldierHDRPG";
_EAA="JAM_EBSoldierAAHD";
_EOff="JAM_EBHDOfficer";
_EG="JAM_EBGLVestHDSoldier";
_EMG="JAM_EBMGFSHD";
_EMed="JAM_EMedicHD";
_ECre="JAM_SoldierEHDCrew";
_EPil="JAM_SoldierEHDPilot";
_ESni="JAM_EBSniper";
_ESpe="JAM_EBSpetznatzHD";

There there is check for players benchmark which is used to decide how many units we place on the mission at one given time. This is sort of fishy as user with great computer gets much more intense fights than guy with poor computer, on the other hand you could say that nowadays everyone has benchmark for the highest score set here, which is the mission playability optimum/max.

; unit maxes regarding CPU powah!
if (benchmark < 3000) then { MaxEast=50/2; MaxWest=MaxEast; };
if (benchmark > 3000) then { MaxEast=80/2; MaxWest=MaxEast; };
if (benchmark > 4000) then { MaxEast=100/2; MaxWest=MaxEast; };
if (benchmark > 5000) then { MaxEast=150/2; MaxWest=MaxEast; };
if (benchmark > 7000) then { MaxEast=200/2; MaxWest=MaxEast; };

Then there is the looping part which checkes periodically if there is room to place new units. PMC_WLoopDelay is the delay how long time we wait until next check. CreateEast and CreateWest are the goto labels for the unit/vehicle creation parts.

#Loopah
;
; wait for stuff...
;
~PMC_WLoopDelay
 
; if east kills more than _WinKills
if (eastguys - count aieast > _WinKills) then { eastdead1=true; publicvariable "eastdead1"; exit; };
 
; if west kills more than _WinKills
if (westguys - count aiwest > _WinKills) then { westdead1=true; publicvariable "westdead1"; exit; };
 
; for return from the specific vehicle creates
#ReadyToCreate
 
if (count aieast + count aiwest > MaxUnits) then { goto "Loopah"; };
 
_groups = [];
{if (!(group _x in _groups)) then {_groups = _groups + [group _x]}} ForEach aieast;
_groupcount = count _groups;
if (count aieast < MaxEast && _groupcount < 60) then { goto "CreateEast"; };
 
_groups = [];
{if (!(group _x in _groups)) then {_groups = _groups + [group _x]}} ForEach aiwest;
_groupcount = count _groups;
if (count aiwest < MaxWest && _groupcount < 60) then { goto "CreateWest"; };
goto "Loopah";

Then the CreateWest label part where we create the west soldiers and vehicles, this varies a bit but in this example we list just the first squad done. Additionally this loads up the ai.sqs improved AI by Bremmer, as well as killed.sqs and smoke/special effects scripts.

;
; create US JAM Anti Armor soldier squad
;
 
; this so there is no m113 with mg or refuel truck with 2 cargo slots
_lpwsv = ["JAM_HMMWVHD","JAM_JeepHD","JAM_Truck5THD","JAM_Truck5tOpenHD"];
 
_r1= random (count _lpwsv);
_r1=_r1 - (_r1 mod 1);
_rtmptnk = _lpwsv select _r1;
 
_hvw1 = _rtmptnk createvehicle getpos west_start;
_hvw1 addEventHandler ["killed",{_this exec "killed.sqs";_this exec "fx\Lsmoke.sqs"}]
 
e1=objnull;e2=objnull;e3=objnull;
_UStempgrparmor = [];
 
_ran = random(1);
_WB createunit [getpos west_start, usinf1, "e1 = this", _ran, "SERGEANT"]
[e1] join grpnull
_UStempgrparmor = group e1;
 
_ran = random(1);
_WAT createunit [getpos west_start, _UStempgrparmor, "e2=this", _ran, "CORPORAL"]
 
_ran = random(1);
_WLAW createunit [getpos west_start, _UStempgrparmor, "e3=this", _ran, "CORPORAL"]
 
_ran = random(1);
_WAA createunit [getpos west_start, _UStempgrparmor, "e4=this", _ran, "CORPORAL"]
 
{[_x] exec "init_addTracers.sqs"} foreach units _UStempgrparmor;
{_x addEventHandler [{killed}, {_this exec "killed.sqs"}]} forEach units _UStempgrparmor;
 
e1 moveindriver _hvw1;
e2 moveincargo _hvw1;
e3 moveincargo _hvw1;
e4 moveincargo _hvw1;
 
PMC_groups = PMC_groups + [_UStempgrparmor];
 
[_UStempgrparmor,[],[],[usinf1],[],1,1] exec "ai.sqs"
westguys=westguys+4;
 
leader _UStempgrparmor sidechat "ANTI ARMOR TEAM REPORTING. READY TO ENGAGE. OVER.";
~CreateDelay

Notes

PMC Dynamic CE official topic here.

PMC Tank Hunter official topic here.

Download campaigns PMC Tactical OFP Downloads.

(This page is under work, but its pretty complete already).

ofp/missions/real_campaign.1478848592.txt.gz · Last modified: 2016-11-11 07:16 by snakeman