chipper 0 Posted February 7, 2013 (edited) One of my favorite campaigns from OFP was The Partisan: Persistent Campaign by McHale. Which is basically a never ending version of the Resistance campaign that is dynamic and all your weapons and equipment carry over from one mission to the next. You start out with nothing and slowly build up to a force that can stand up to the Russians on Malden. I intend to fully port the campaign over to ArmA 2 and then build on it more from there, eventually even looking to get this campaign working in MP. I've ported it to Malden 2010 and can pull the campaign missions up in the editor and everything matches up in the right place as far as unit, marker, trigger placement goes. Getting it to run in game is another story.... I already know I have to replace all the OFP class names with their ArmA2 equivalent and have done this with no problems. The biggest problem I am facing now is that all the scripts are in .sqs format and I need convert them into a working .sqf I am starting with the init.sqs file because this one is the first culprit to crash the game according to the .rpt This post has helped me the most. I have done all of that except, and you must remove the #loop and goto "loop" and replace it with a valid looping system. Getting rid of all the "goto" and "#loop" commands in the file... I am fairly new to scripting and am having trouble wrapping my head around how to replace these with a structure that plays nice with the .sqf format. I've looked at the biki article on sqs to sqf conversion and it makes sense their but could someone give me an example of how to apply that to my script? What I have so far on my init.sqf...still have #loops and gotos in there. "1" objStatus "ACTIVE"; group player setBehaviour "AWARE"; lostStatus = 0; vehCapture setPos getMarkerPos CampMarker; skipTime passTime; cutText [startText, "BLACK IN", 6]; campPos = getMarkerPos CampMarker; campCentre setPos campPos; "campArea" setMarkerPos getPos campCentre; _pos = getPos campCentre; _q = 1; _n = rollcall; while "_q < _n" do {_xx = "GUE_Soldier_2" CreateUnit [_pos, PlayerGroup, "", (random 1), "Private"]; _q = _q + 1}; _v1 = "logic" createVehicle [(_pos select 0) + 40, (_pos select 1)]; _veh0pos = getPos _v1 ; _veh1pos = getPos _v1 ; _veh2pos = getPos _v1 ; _veh3pos = getPos _v1 ; _veh4pos = getPos _v1 ; _veh5pos = getPos _v1 ; _veh6pos = getPos _v1 ; _veh7pos = getPos _v1 ; _veh8pos = getPos _v1 ; _veh9pos = getPos _v1 ; deletevehicle _v1; #---SETUP THE CAMP---; campTruck setPos [(_pos select 0), (_pos select 1)]; campCrates setPos [(_pos select 0) + 15, (_pos select 1) - 7]; campFire setPos [(_pos select 0) + 20, (_pos select 1) + 20]; if((daytime > 18) || (daytime < 5))then {campFire inflame true}; campTent0 = "CampEast" createVehicle [(_pos select 0) + 10, (_pos select 1) + 10]; campTent1 = "MASH" createVehicle [(_pos select 0) + 10, (_pos select 1) + 3]; campTruck setVelocity [0.2, 2.0, 0.2]; playerx setPos [(_pos select 0) + 10, (_pos select 1) + 10]; #---load group status---; _z = units group player; _r = 0; if(rollcall >= 0)then{(_z select 0) loadStatus "p0"; _r = _r + (rating (_z select 0)); (_z select 0) addrating -(rating (_z select 0))}; if(rollcall >= 1)then{(_z select 1) loadStatus "p1"; _r = _r + (rating (_z select 1)); (_z select 1) addrating -(rating (_z select 1))}; if(rollcall >= 2)then{(_z select 2) loadStatus "p2"; _r = _r + (rating (_z select 2)); (_z select 2) addrating -(rating (_z select 2))}; if(rollcall >= 3)then{(_z select 3) loadStatus "p3"; _r = _r + (rating (_z select 3)); (_z select 3) addrating -(rating (_z select 3))}; if(rollcall >= 4)then{(_z select 4) loadStatus "p4"; _r = _r + (rating (_z select 4)); (_z select 4) addrating -(rating (_z select 4))}; if(rollcall >= 5)then{(_z select 5) loadStatus "p5"; _r = _r + (rating (_z select 5)); (_z select 5) addrating -(rating (_z select 5))}; if(rollcall >= 6)then{(_z select 6) loadStatus "p6"; _r = _r + (rating (_z select 6)); (_z select 6) addrating -(rating (_z select 6))}; if(rollcall >= 7)then{(_z select 7) loadStatus "p7"; _r = _r + (rating (_z select 7)); (_z select 7) addrating -(rating (_z select 7))}; if(rollcall >= 8)then{(_z select 8) loadStatus "p8"; _r = _r + (rating (_z select 8)); (_z select 8) addrating -(rating (_z select 8))}; if(rollcall >= 9)then{(_z select 9) loadStatus "p9"; _r = _r + (rating (_z select 9)); (_z select 9) addrating -(rating (_z select 9))}; if(rollcall >= 10)then{(_z select 10) loadStatus "p10"; _r = _r + (rating (_z select 10)); (_z select 10) addrating -(rating (_z select 10))}; if(rollcall >= 11)then{(_z select 11) loadStatus "p11"; _r = _r + (rating (_z select 11)); (_z select 11) addrating -(rating (_z select 11))}; if(rollcall >= 12)then{(_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; if(_c > (rollCall))then goto "endDam"; if(damage (_z select _c) > 0.9)then {deletevehicle (_z select _c)}; _c = _c + 1; goto damLoop; #endDam; #---load "garage"---; if(numvehicles >= 1)then {_x = veh0 createVehicle _veh0pos; clearWeaponCargo _x; clearMagazineCargo _x}; if(numvehicles >= 2)then {_x = veh1 createVehicle _veh1pos; clearWeaponCargo _x; clearMagazineCargo _x}; if(numvehicles >= 3)then {_x = veh2 createVehicle _veh2pos; clearWeaponCargo _x; clearMagazineCargo _x}; if(numvehicles >= 4)then {_x = veh3 createVehicle _veh3pos; clearWeaponCargo _x; clearMagazineCargo _x}; if(numvehicles >= 5)then {_x = veh4 createVehicle _veh4pos; clearWeaponCargo _x; clearMagazineCargo _x}; if(numvehicles >= 6)then {_x = veh5 createVehicle _veh5pos; clearWeaponCargo _x; clearMagazineCargo _x}; if(numvehicles >= 7)then {_x = veh6 createVehicle _veh6pos; clearWeaponCargo _x; clearMagazineCargo _x}; if(numvehicles >= 8)then {_x = veh7 createVehicle _veh7pos; clearWeaponCargo _x; clearMagazineCargo _x}; if(numvehicles >= 9)then {_x = veh8 createVehicle _veh8pos; clearWeaponCargo _x; clearMagazineCargo _x}; if(numvehicles >= 10)then {_x = veh9 createVehicle _veh9pos; clearWeaponCargo _x; clearMagazineCargo _x}; clearWeaponCargo campTruck; clearMagazineCargo campTruck; #------------- SET UP THE MISSION ------------------; #Decide mission type; missType = "tank"; _h = random 100; if(_h <= 33)then {missType = "tank"}; if(_h > 33 && _h <= 66)then {missType = "heli"}; if(_h > 66)then {missType = "fuel"}; _towns = [town1, town2, town3, town4, town5, town6, town7, town8, town9, town10, town11, town12, town13, town14]; _posMark = ["a_1","a_2","a_3","a_4","a_5","a_6","a_7","a_8","a_9","a_10","a_11","a_12","a_13","a_14","a_15","a_16","a_17","a_18","a_19","a_20"]; #******************* GET NEAREST 4 TOWNS**********************; _r = 0; _newTowns = []; #l0; _cnt = 0; if((count _newTowns) >= 4)then goto "endl"; #l1; if_cnt >= (count _towns)then goto "h"; _dist = (_towns select _cnt) distance campCentre; if_dist <= _rthen _newTowns = _newTowns + [(_towns select _cnt)]; _towns = _towns - [(_towns select _cnt)]; _cnt = _cnt + 1; goto "l1"; #h; _r = _r + 50; goto "l0"; #endl; _towns = _newTowns; #******************* GET NEAREST 4 TARGET MARKERS**********************; _r = 0; _newMark = []; _num = 4; _cursor = "logic" createvehicle getPos player; #b0; _cnt = 0; if((count _newMark) >= _num)then goto "endb"; #b1; if_cnt >= (count _posMark)then goto "x" ; _cursor setPos getMarkerPos (_posMark select _cnt); _dist = _cursor distance campCentre; if_dist <= _rthen _newMark = _newMark + [(_posMark select _cnt)]; _posMark = _posMark - [(_posMark select _cnt)]; _cnt = _cnt + 1; goto "b1"; #x; _r = _r + 50; goto "b0"; #endb; _posMark = _newMark; text1 = format["%1", _newMark]; #*******************SELECT A SINGLE MARKER*****************; #Remove the past 3 bases...; _posMark = _posMark - mk1; _posMark = _posMark - mk2; _posMark = _posMark - mk3; _array = _posMark; _temparray = _array; _newarray = []; while "count _temparray > 0" do {_acount = (count _temparray);_rand = random _acount;_rand = _rand - (_rand mod 1);_moveitem = _temparray select _rand;_newarray = _newarray + [_moveitem];_temparray = _temparray - [_moveitem]}; _posMark = _newarray; base = _posMark select 0; [(getMarkerPos base)]exec "baseGen.sqs"; #**********************************RANDOMLY SHUFFLE ARRAY********************; _array = _patrol; #shuffle; _temparray = _array; _newarray = []; while "count _temparray > 0" do {_acount = (count _temparray);_rand = random _acount;_rand = _rand - (_rand mod 1);_moveitem = _temparray select _rand; _pos = [(getpos _moveitem select 0) + - 150 + random 300, (getpos _moveitem select 1) + - 150 + random 300 , 1]; _moveitem setpos _pos; _newarray = _newarray + [_moveitem];_temparray = _temparray - [_moveitem]}; patrol = _newarray; #**************************now add traffic************************; _r = 0; [[getPos (_towns select 0), getPos (_towns select 1), getPos (_towns select 2), getPos (_towns select 3)]]exec "traffic.sqs"; #______; _n = random(4); _n = _n - (_n mod 1); _town = _towns select _n; _towns = _towns - [_towns select _n]; _n = random(3); _n = _n - (_n mod 1); _townb = _towns select _n; startTown = _town; escapeTown = _townb; #townChosen; #generalguy = "RU_Commander" CreateUnit [startTown, (_this select 0), "", (random 1), "Captain"]; #[guber, 1] setWPPos [(getpos (startTown) select 0), (getpos (startTown) select 1)]; #leader guber addweapon "AK_47_M"; #guber setbehaviour "safe"; "targ" setmarkerpos [99999,0]; "targ" setmarkerpos getMarkerpos base; "startMarker" setmarkerpos getPos player; #endz; Thanks a lot guys I really appreciate any help you guys have and I have a feeling some OFP vets would love to see this campaign in ArmA 2. And if someone knows of this same thing being done or existing in ArmA 2 already please speak up, don't want to waste my time, though this is a good learning experience. ---------- Post added at 22:03 ---------- Previous post was at 21:55 ---------- Here's the original init.sqs in case you need to see what changes I've made. "1" objStatus "ACTIVE" group player setBehaviour "AWARE" lostStatus = 0 vehCapture setPos getMarkerPos CampMarker skipTime passTime cutText [startText, "BLACK IN", 6]; campPos = getMarkerPos CampMarker campCentre setPos campPos; "campArea" setMarkerPos getPos campCentre _pos = getPos campCentre _q = 1 _n = rollcall while "_q < _n" do {_xx = "SoldierGB" CreateUnit [_pos, PlayerGroup, "", (random 1), "Private"]; _q = _q + 1} _v1 = "logic" createVehicle [(_pos select 0) + 40, (_pos select 1)]; _veh0pos = getPos _v1 _veh1pos = getPos _v1 _veh2pos = getPos _v1 _veh3pos = getPos _v1 _veh4pos = getPos _v1 _veh5pos = getPos _v1 _veh6pos = getPos _v1 _veh7pos = getPos _v1 _veh8pos = getPos _v1 _veh9pos = getPos _v1 deletevehicle _v1 #---SETUP THE CAMP--- campTruck setPos [(_pos select 0), (_pos select 1)]; campCrates setPos [(_pos select 0) + 15, (_pos select 1) - 7]; campFire setPos [(_pos select 0) + 20, (_pos select 1) + 20]; ?((daytime > 18) || (daytime < 5)): campFire inflame true campTent0 = "CampEast" createVehicle [(_pos select 0) + 10, (_pos select 1) + 10]; campTent1 = "MASH" createVehicle [(_pos select 0) + 10, (_pos select 1) + 3]; campTruck setVelocity [0.2, 2.0, 0.2] playerx setPos [(_pos select 0) + 10, (_pos select 1) + 10]; #---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"--- ?(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; clearWeaponCargo campTruck; clearMagazineCargo campTruck; #------------- SET UP THE MISSION ------------------ #Decide mission type missType = "tank" _h = random 100 ?(_h <= 33): missType = "tank" ?(_h > 33 && _h <= 66): missType = "heli" ?(_h > 66): missType = "fuel" _towns = [town1, town2, town3, town4, town5, town6, town7, town8, town9, town10, town11, town12, town13, town14] _posMark = ["a_1","a_2","a_3","a_4","a_5","a_6","a_7","a_8","a_9","a_10","a_11","a_12","a_13","a_14","a_15","a_16","a_17","a_18","a_19","a_20"] #******************* GET NEAREST 4 TOWNS********************** _r = 0 _newTowns = [] #l0 _cnt = 0 ?((count _newTowns) >= 4): goto "endl" #l1 ?_cnt >= (count _towns): goto "h"; _dist = (_towns select _cnt) distance campCentre ?_dist <= _r: _newTowns = _newTowns + [(_towns select _cnt)]; _towns = _towns - [(_towns select _cnt)] _cnt = _cnt + 1 goto "l1" #h _r = _r + 50 goto "l0" #endl _towns = _newTowns #******************* GET NEAREST 4 TARGET MARKERS********************** _r = 0 _newMark = [] _num = 4 _cursor = "logic" createvehicle getPos player #b0 _cnt = 0 ?((count _newMark) >= _num): goto "endb" #b1 ?_cnt >= (count _posMark): goto "x" _cursor setPos getMarkerPos (_posMark select _cnt) _dist = _cursor distance campCentre ?_dist <= _r: _newMark = _newMark + [(_posMark select _cnt)]; _posMark = _posMark - [(_posMark select _cnt)] _cnt = _cnt + 1 goto "b1" #x _r = _r + 50 goto "b0" #endb _posMark = _newMark text1 = format["%1", _newMark] #*******************SELECT A SINGLE MARKER***************** #Remove the past 3 bases... _posMark = _posMark - mk1 _posMark = _posMark - mk2 _posMark = _posMark - mk3 _array = _posMark _temparray = _array _newarray = [] while "count _temparray > 0" do {_acount = (count _temparray);_rand = random _acount;_rand = _rand - (_rand mod 1);_moveitem = _temparray select _rand;_newarray = _newarray + [_moveitem];_temparray = _temparray - [_moveitem]} _posMark = _newarray base = _posMark select 0 [(getMarkerPos base)]exec "baseGen.sqs" #**********************************RANDOMLY SHUFFLE ARRAY******************** _array = _patrol #shuffle _temparray = _array _newarray = [] while "count _temparray > 0" do {_acount = (count _temparray);_rand = random _acount;_rand = _rand - (_rand mod 1);_moveitem = _temparray select _rand; _pos = [(getpos _moveitem select 0) + - 150 + random 300, (getpos _moveitem select 1) + - 150 + random 300 , 1]; _moveitem setpos _pos; _newarray = _newarray + [_moveitem];_temparray = _temparray - [_moveitem]} patrol = _newarray #**************************now add traffic************************ _r = 0; [[getPos (_towns select 0), getPos (_towns select 1), getPos (_towns select 2), getPos (_towns select 3)]]exec "traffic.sqs" #______ _n = random(4); _n = _n - (_n mod 1); _town = _towns select _n; _towns = _towns - [_towns select _n]; _n = random(3); _n = _n - (_n mod 1); _townb = _towns select _n; startTown = _town escapeTown = _townb #townChosen #generalguy = "generalE" CreateUnit [startTown, (_this select 0), "", (random 1), "Captain"]; #[guber, 1] setWPPos [(getpos (startTown) select 0), (getpos (startTown) select 1)]; #leader guber addweapon "ak47" #guber setbehaviour "safe" "targ" setmarkerpos [99999,0] "targ" setmarkerpos getMarkerpos base "startMarker" setmarkerpos getPos player #endz Edited February 7, 2013 by Chipper Share this post Link to post Share on other sites