Jump to content
Sign in to follow this  
slimnala

Error message when importing from OFP

Recommended Posts

Ok guys, I ran into a problem importing a mission from OFP....This mission works fine in OFP.

I am tring to get my units to be created through scripts but am getting this

ERROR:

<span style='color:red'>'....Esoldierpad, group _player,"",.5,_rank] |#| call createunit2'

Error call:Type string, expected code</span>

my menu's are working fine:

this is part of menu dialog:

Soldier.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_player = _this select 0

lbClear 3200

lbClear 3213

ctrlShow[3209,false]

ctrlShow[3212,false]

?(side _player == East):goto "EastFillSoldiers"

#EastFillSoldiers

_index = lbAdd [3200, "Medic"]

lbSetData [3200, _index, "SoldierEMedic"]

lbSetValue [3200, _index, 55]

these value's are sent to this file

Purchase.SQS

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

##### File v1.53 w/ manned

_which = lbValue [3210, 0]

_index = lbCurSel 3200

_cost = lbValue [3200, _index]

_vehicledata = lbData [3200, _index]

_textname = lbText [3200, _index]

_colortype = lbColor [3200, _index]

_player = _this select 0

_manned = _this select 1

?(_which == 1):goto "Soldiers"

?(_which == 2):goto "Weapons"

?(_which == 3):goto "Vehicles"

?(_which == 4):goto "Aircraft"

?(_which == 5):goto "Boats"

closeDialog 0

exit

####################################################### SOLDIERS

#Soldiers

_unit = _vehicledata

?(side _player == West):goto "WestSoldier"

?(side _player == East):goto "EastSoldier"

#WestSoldier

? eastnobuy==1:goto "enemypresent"

_currentunits=count units group _player

? wscore<_cost:goto "nomoney"

?(_currentunits >= 1):_rank="MAJOR"

?(_currentunits >= 2):_rank="CAPTAIN"

?(_currentunits >= 3):_rank="LIEUTENANT"

?(_currentunits >= 4):_rank="SERGEANT"

?(_currentunits >= 5):_rank="CORPORAL"

?(_currentunits >= 6):_rank="PRIVATE"

?(_currentunits >= TroopMaxW):goto "toomany"

_chooseunit = [_unit, getpos WSoldierPad,group _player,"",.5,_rank] call createUnit2

wscore=wscore-_cost

PublicVariable "wscore"

[_chooseunit] exec "FUNcTIONS\EquipNVGoggles.sqs"

[_chooseunit] exec "FUNcTIONS\AddNewUnits.sqs"

_chooseunit addEventHandler ["killed",{_this exec "\EVOObjs_PS\Killing.sqs"}]

exit

#EastSoldier

? westnobuy==1:goto "enemypresent"

_currentunits=count units group _player

? escore<_cost:goto "nomoney"

?(_currentunits >= 1):_rank="MAJOR"

?(_currentunits >= 2):_rank="CAPTAIN"

?(_currentunits >= 3):_rank="LIEUTENANT"

?(_currentunits >= 4):_rank="SERGEANT"

?(_currentunits >= 5):_rank="CORPORAL"

?(_currentunits >= 6):_rank="PRIVATE"

?(_currentunits >= TroopMaxE):goto "toomany"

_chooseunit = [_unit, getpos ESoldierPad,group _player,"",.5,_rank] call CreateUnit2

escore=escore-_cost

PublicVariable "escore"

[_chooseunit] exec "FUNcTIONS\EquipNVGoggles.sqs"

[_chooseunit] exec "FUNcTIONS\AddNewUnits.sqs"

_chooseunit addEventHandler ["killed",{_this exec "\EVOObjs_PS\Killing.sqs"}]

exit

createunit2.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

//createUnit2 v 1.0

//By Backoff (michael@backoff.ch)

//This function does the same as createUnit but it will return the new object id.

//usage:

//place the sqf file in your mission folder and add this line in your init.sqs:

//'createUnit2 = preprocessfile "createUnit2.sqf"'

_private = ["_class","_pos","_group","_init","_skill","_rank","_index","_return"];

_class = _this select 0;

_pos = _this select 1;

_group = _this select 2;

_index = count units _group;

_return = false;

if(count _this > 3)then

{

_class createUnit [_pos,_group,_this select 3,_this select 4,_this select 5];

}

else

{

_class createUnit [_pos,_group,"",0.5,"PRIVATE"];

};

if(_index < 12)then

{

_return = (units _group) select ((count units _group) -1);

};

_return;

I do have the preprocessfile  command in my init

I think the error has to do with the values I am sending to createunit2.  Agian this works in ofp but not armed assault if that helps.......

Any Idea's would be appreciated.....

Thnx

Slimnala

Share this post


Link to post
Share on other sites

At the init:

PreProcessFile "Filename"

replace to:

compile preProcessFile "Filename"

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  

×