Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: AI creator script

Hybrid View

  1. #1
    I have been working on a AI creator script for my clans training map. So far I have managed to get all the error messages that show up in game out of the script except for this last one,
    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Error in expression &#60;g&#34;&#62;
    Error position&#58; &#60;&#34;&#62;
    Error Missing&#59;[/QUOTE]

    Now I tink the error is some where in the creatunit area cause it happens multiple times.

    This is the script,
    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">//REGION RUNCODE
    ////////////////////////////////////////////////////////
    //Runcode&#58; var = &#91;Groupleader,Amountofinfantry,Amountofvehicles ,Amountofarmour,AmountofAirunits,Geartype,
    Unitside&#93; execVM &#34;AIcreator.sqf&#34;
    //Geartypes&#58; 1=West, 2=East
    //Sides&#58; 1=West, 2=East, 3=Guerilla, 4=Civilian
    ////////////////////////////////////////////////////////
    //ENDREGION
    //REGION Data gathering
    _Unit = _this select 0;
    _InfS = _this select 1;
    _VecS = _this select 2;
    _ArmS = _this select 3;
    _AirS = _this select 4;
    _Geartype = _this select 5;
    _Unittype = _this select 6;
    _Group = group _Unit;
    //ENDREGION
    //REGION Unit lists
    _InfW = &#91;&#34;SoldierWSaboteurPipe2&#34;,&#34;SoldierW AA&#34;,&#34;SoldierWAT&#34;,&#34;SoldierWAR&#34;, &#34;SoldierWCrew&#34;,&#34;SoldierWMiner&#34;,&#3 4;SoldierWG&#34;,&#34;SoldierWMG&#34;,&#34;Soldier WB&#34;,&#34;SoldierWPilot&#34;,&#34;OfficerW&#34; ,&#34;SoldierWMedic&#34;,&#34;SoldierWSaboteurAssa ult&#34;,&#34;SoldierWSaboteurMarksman&#34;,&#34;& #34;,&#34;SoldierWSaboteurRecon&#34;,&#34;SoldierW SaboteurPipe&#34;,&#34;TeamLeaderW&#34;,&#34;Squad LeaderW&#34;,&#34;SoldierWSniper&#34;&#93;;
    _VecW = &#91;&#34;Truck5tOpen&#34;,&#34;Truck5tMG&#34;,&#3 4;HMMWV&#34;,&#34;HMMWV50&#34;,&#34;HMMWVMK&#34;,& #34;Truck5t&#34;,&#34;HMMWVTOW&#34;,&#34;M1030&#34 ;,&#34;m113ambul&#34;,&#34;Truck5tRepair&#34;,&#34 ;Truck5tRefuel&#34;,&#34;Truck5tReammo&#34;&#93;;
    _ArmW = &#91;&#34;M113&#34;,&#34;Vulcan&#34;,&#34;M1Abrams &#34;,&#34;Stryker_TOW&#34;,&#34;Stryker_ICV_M2&#3 4;,&#34;Stryker_ICV_MK19&#34;&#93;;
    _AirW = &#91;&#34;UH60&#34;,&#34;Camel&#34;,&#34;MH6&#34;, &#34;UH60MG&#34;,&#34;AV8B&#34;,&#34;AV8B2&#34;,&# 34;AH6&#34;,&#34;AH1W&#34;,&#34;A10&#34;&#93;;
    _InfE = &#91;&#34;SoldierEAA&#34;,&#34;SoldierEAT&#34;,&#3 4;SoldierECrew&#34;,&#34;SoldierEMiner&#34;,&#34;S oldierEMG&#34;,&#34;SoldierEG&#34;,&#34;SoldierESn iper&#34;,&#34;SoldierEB&#34;,&#34;SoldierEPilot&# 34;,&#34;SoldierESaboteurMarksman&#34;,&#34;Office rE&#34;,&#34;SoldierESaboteurBizon&#34;,&#34;Soldi erESaboteurPipe&#34;,&#34;SoldierEMedic&#34;,&#34; SquadLeaderE&#34;,&#34;TeamLeaderE&#34;&#93;;
    _VecE = &#91;&#34;UAZ&#34;,&#34;UralReammo&#34;,&#34;UralR efuel&#34;,&#34;Ural&#34;,&#34;UAZMG&#34;,&#34;Ura lOpen&#34;,&#34;UAZ_AGS30&#34;,&#34;UralRepair&#34 ;,&#34;TT650G&#34;,&#34;bmp2ambul&#34;&#93;;
    _ArmE = &#91;&#34;T72&#34;,&#34;BMP2&#34;,&#34;BRDM2&#34;, &#34;BRDM2_ATGM&#34;,&#34;ZSU&#34;&#93;;
    _AirE = &#91;&#34;KA50&#34;,&#34;Mi17_MG&#34;,&#34;Mi17&#3 4;,&#34;Su34B&#34;,&#34;Su34&#34;,&#34;Camel2&#34; &#93;;
    _InfG = &#91;&#34;SoldierGAA&#34;,&#34;SoldierGAT&#34;,&#3 4;SoldierGCrew&#34;,&#34;SoldierGMiner&#34;,&#34;S oldierGGuard&#34;,&#34;SoldierGCommando&#34;,&#34; SquadLeaderG&#34;,&#34;TeamLeaderG&#34;,&#34;Soldi erGB&#34;,&#34;SoldierGMG&#34;,&#34;SoldierGMedic& #34;,&#34;OfficerG&#34;,&#34;SoldierGSniper&#34;,& #34;SoldierGPilot&#34;,&#34;SoldierGG&#34;,&#34;So ldierGMarksman&#34;&#93;;
    _VecG = &#91;&#34;Landrover_Closed&#34;,&#34;LandroverMG&# 34;,&#34;Landrover&#34;&#93;;
    _ArmG = &#91;&#34;Vulcan_RACS&#34;,&#34;M113_RACS&#34;,&#3 4;T72_RACS&#34;&#93;;
    _AirG = &#91;&#34;AH6_RACS&#34;,&#34;MH6_RACS&#34;&#93; ;
    _InfC = &#91;&#34;Civilian&#34;,&#34;Civilian10&#34;,&#34; Civilian11&#34;,&#34;Civilian12&#34;,&#34;Civilian 20&#34;,&#34;Civilian14&#34;,&#34;Civilian15&#34;, &#34;Civilian19&#34;,&#34;Civilian2&#34;,&#34;Civi lian13&#34;,&#34;Civilian21&#34;,&#34;Civilian9&#3 4;,&#34;Civilian8&#34;,&#34;Civilian7&#34;,&#34;Ci vilian6&#34;,&#34;Civilian5&#34;,&#34;Civilian18&# 34;,&#34;Civilian17&#34;,&#34;Civilian16&#34;,&#34 ;Civilian3&#34;,&#34;Civilian4&#34;&#93;;
    _VecC = &#91;&#34;SkodaGreen&#34;,&#34;Skoda&#34;,&#34;Ura lCivil&#34;,&#34;Bus_city&#34;,&#34;SkodaBlue&#34; ,&#34;SkodaRed&#34;,&#34;datsun1_civil_1_open&#34; ,&#34;hilux1_civil_3_open&#34;,&#34;hilux1_civil_2 _covered&#34;,&#34;hilux1_civil_1_open&#34;,&#34;c ar_hatchback&#34;,&#34;UralCivil2&#34;,&#34;TT650C &#34;,&#34;datsun1_civil_3_open&#34;,&#34;datsun1_ civil_2_covered&#34;,&#34;car_sedan&#34;,&#34;trac tor&#34;&#93;;
    _ArmC = &#91;&#93;;
    _AirC = &#91;&#93;;
    //ENDREGION
    //REGION Unit creation
    switch &#40;_Unittype&#41; do {
    //REGION West
    case 1&#58;
    {
    while {_I &#60; _InfS} do
    {
    _I=_I+1;
    _IA = count _InfW;
    _IN = random _IA;
    _IN = round _IN;
    _IUnit = _InfW select _IN;
    &#40;&#34;_IUnit&#34; createUnit &#91;position _Unit, _Group&#93;&#41;;
    };
    while {_V &#60; _VecS} do
    {
    _V=_V+1;
    _VA = count _VecW;
    _VN = random _VA;
    _VN = round _VN;
    _VUnit = _VecW select _VN;
    &#40;&#34;_VUnit&#34; createUnit &#91;position _Unit, _Group&#93;&#41;;
    };
    while {_R &#60; _ArmS} do
    {
    _R=_R+1;
    _RA = count _ArmW;
    _RN = random _RA;
    _RN = round _RN;
    _RUnit = _ArmW select _RN;
    &#40;&#34;_RUnit&#34; createUnit &#91;position _Unit, _Group&#93;&#41;;
    };
    while {_A &#60; _AirS} do
    {
    _A=_A+1;
    _AA = count _AirW;
    _AN = random _AA;
    _AN = round _AN;
    _AUnit = _AirW select _AN;
    &#40;&#34;_AUnit&#34; createUnit &#91;position _Unit, _Group&#93;&#41;;
    };
    };
    //ENDREGION
    //REGION East
    case 2&#58;
    {
    while {_I &#60; _InfS} do
    {
    _I=_I+1;
    _IA = count _InfE;
    _IN = random _IA;
    _IN = round _IN;
    _IUnit = _InfE select _IN;
    &#40;&#34;_IUnit&#34; createUnit &#91;position _Unit, _Group&#93;&#41;;
    };
    while {_V &#60; _VecS} do
    {
    _V=_V+1;
    _VA = count _VecE;
    _VN = random _VA;
    _VN = round _VN;
    _VUnit = _VecE select _VN;
    &#40;&#34;_VUnit&#34; createUnit &#91;position _Unit, _Group&#93;&#41;;
    };
    while {_R &#60; _ArmS} do
    {
    _R=_R+1;
    _RA = count _ArmE;
    _RN = random _RA;
    _RN = round _RN;
    _RUnit = _ArmE select _RN;
    &#40;&#34;_RUnit&#34; createUnit &#91;position _Unit, _Group&#93;&#41;;
    };
    while {_A &#60; _AirS} do
    {
    _A=_A+1;
    _AA = count _AirE;
    _AN = random _AA;
    _AN = round _AN;
    _AUnit = _AirE select _AN;
    &#40;&#34;_AUnit&#34; createUnit &#91;position _Unit, _Group&#93;&#41;;
    };
    };
    //ENDREGION
    //REGION Guerilla
    case 3&#58;
    {
    while {_I &#60; _InfS} do
    {
    _I=_I+1;
    _IA = count _InfG;
    _IN = random _IA;
    _IN = round _IN;
    _IUnit = _InfG select _IN;
    &#40;&#34;_IUnit&#34; createUnit &#91;position _Unit, _Group&#93;&#41;;
    };
    while {_V &#60; _VecS} do
    {
    _V=_V+1;
    _VA = count _VecG;
    _VN = random _VA;
    _VN = round _VN;
    _VUnit = _VecG select _VN;
    &#40;&#34;_VUnit&#34; createUnit &#91;position _Unit, _Group&#93;&#41;;
    };
    while {_R &#60; _ArmS} do
    {
    _R=_R+1;
    _RA = count _ArmG;
    _RN = random _RA;
    _RN = round _RN;
    _RUnit = _ArmG select _RN;
    &#40;&#34;_RUnit&#34; createUnit &#91;position _Unit, _Group&#93;&#41;;
    };
    while {_A &#60; _AirS} do
    {
    _A=_A+1;
    _AA = count _AirG;
    _AN = random _AA;
    _AN = round _AN;
    _AUnit = _AirG select _AN;
    &#40;&#34;_AUnit&#34; createUnit &#91;position _Unit, _Group&#93;&#41;;
    };
    };
    //ENDREGION
    //REGION Civilian
    case 4&#58;
    {
    while {_I &#60; _InfS} do
    {
    _I=_I+1;
    _IA = count _InfC;
    _IN = random _IA;
    _IN = round _IN;
    _IUnit = _InfC select _IN;
    &#40;&#34;_IUnit&#34; createUnit &#91;position _Unit, _Group&#93;&#41;;
    };
    while {_V &#60; _VecS} do
    {
    _V=_V+1;
    _VA = count _VecC;
    _VN = random _VA;
    _VN = round _VN;
    _VUnit = _VecC select _VN;
    &#40;&#34;_VUnit&#34; createUnit &#91;position _Unit, _Group&#93;&#41;;
    };
    while {_R &#60; _ArmS} do
    {
    _R=_R+1;
    _RA = count _ArmC;
    _RN = random _RA;
    _RN = round _RN;
    _RUnit = _ArmC select _RN;
    &#40;&#34;_RUnit&#34; createUnit &#91;position _Unit, _Group&#93;&#41;;
    };
    while {_A &#60; _AirS} do
    {
    _A=_A+1;
    _AA = count _AirC;
    _AN = random _AA;
    _AN = round _AN;
    _AUnit = _AirC select _AN;
    &#40;&#34;_AUnit&#34; createUnit &#91;position _Unit, _Group&#93;&#41;;
    };
    };
    //ENDREGION
    };
    //ENDREGION
    //REGION GEAR
    switch &#40;_Geartype&#41; do{
    case 1&#58;
    {
    &#91;_Unit,1,10&#93; execVM &#34;gear&#92;Gearsquad.sqf&#34;;
    };
    case 2&#58;
    {
    &#91;_Unit,2,10&#93; execVM &#34;gear&#92;Gearsquad.sqf&#34;;
    };
    };
    //ENDREGION
    //REGION Exit
    exitWith;
    //ENDREGION[/QUOTE]

    Does anyone have a clue what is wrong with this script?

    The Unknown
    Having problems with editing missions try the following sites:
    http://www.ofpec.com/
    http://community.bistudio.com/wiki/Main_Page

  2. #2
    god damn,..

    i wish this code box function included tabs..
    it makes long code hard to read.

    does it tell you what line the errors ocures on?

    i think this is one problem. all of the,,
    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
    _IUnit = _InfW select _IN;
    &#40;&#34;_IUnit&#34; createUnit &#91;position _Unit, _Group&#93;&#41;;
    [/QUOTE]

    try make them something like

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
    _IUnit = format&#91;&#34;%1&#34;,_InfW select _IN&#93;;
    _IUnit createUnit &#91;position _Unit, _Group&#93;;
    [/QUOTE]




    -- BEC, Battleye Extended Controls --
    -- BEC Forum Thread --

    Spoiler:

  3. #3
    Quote Originally Posted by [b
    Quote[/b] ]does it tell you what line the errors ocures on?
    Nop thats the whole problem I am haveing it doesnt tell me where the problem is.

    Ill give your code a try and see if its that.

    Edit: didnt do the trick error is still there and it created even more error&#39;s someting about a missing } tryed a couple of placements but I couldnt find it, sometimes I start to tink this sqf ting is designed to make us all go mental.




  4. #4

  5. #5
    That might help out took me a while to find out what the hell it was but here is the link,

    http://pastebin.com/m5f30e4b5

  6. #6
    Im not sure about this.. but dont you have to define _I,_V,_R,_A before you use them ?

    aslo i see exitwith ***with no ";"

    exitWith {hint "bleh" ;};

    i aslo think this is wrong. i havent tested it though,,
    but in my eyes it seams like you try to create the unit _IUnit
    littarly.. sine you use " " it is seen as a string..


    _IUnit = _InfW select _IN;


    thats why i wanted you to test with
    _IUnit = format["%1",_InfW select _IN];
    _IUnit createUnit [position _Unit, _Group];

    now _IUnit is a sting with the name "ex" SoliderW




  7. #7
    nuxil&#39;s reply was the solution: you&#39;ve got syntax errors with redundant quotes on lines: 139, 148, 157

  8. #8
    Well I got some good news and some bad news, the good news is it creats the units, the bad news is the error is still there.

    Here is a new link with the script so far,
    http://pastebin.com/d29605fd3

    I already tested if it was the gear script by commenting the lines out and that didnt fix it so its defitnally in this script.

  9. #9
    dosent exitwith need to exit with a code ?

    exitwith {};

    but i think you can remove exitwith in your script




  10. #10
    But how do you stop the script then, I am moveing from sqs to sqf resently so I dont know half these tings.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •