Jump to content
Sign in to follow this  
stilton

automatic placement init script thingy..

Recommended Posts

Hi, i've made several posts and perhaps i should have just made this in my carrier topic.. but it's directly related to scripting and i'm a complete dunce at it...

Mandoble wrote me out a little script, and whilst its very complete.. i'm still unable to get it to work, he's currently offline.. and i've taken a fair bit of his time anyway, personally i'd just love to drop this and carry on modelling because i really dont know what to do.. so i think i will, in the hope someone spots this and see's what error i've made

- Oh yeh, i should explain what the script does, i have 4 parts of my carrier in seperate Pbo's/folders..

and i've written into themy carrier's middle piece config..

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

class CfgVehicles

{

class All {};

class AllVehicles: All {};

class Land: AllVehicles {};

class Static : Land {};

class Building : Static {};

class NonStrategic : Building {};

class Fence : NonStrategic {};

class WireFence: Fence {};

class House: NonStrategic {};

class ViewTower2: House{};

class TcCarrierMid: ViewTower2

{

model="\TcCarrierMid\TcCarrierMid.p3d";

armor=2000;

scope=2;

vehicleClass="Objects";

displayName="TC01 Carrier Mid";

class EventHandlers

{

init = "[_this select 0] exec {\TcCarrierMid\grouptogether.sqf}";

};

};

};

Phew.. and the 'grouptogether.sqf' consists of:

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

// your init EH cv script

private["_center", "_types", "_offsets", "_rest", "_cvpart", "_i"];

if (!local (_this select 0)) exitWith {};

_center = _this;

_types = ["TcCarrierFront","TcCarrierTower","TcCarrierRear"];

_offsets = [50, 20, -50];

_rest = [];

{

_cvpart = _x createVehicle [0,0,0];

_cvpart setDir getDir _center;

_rest = _rest + [_cvpart];

} forEach _types;

while {alive _center} do

{

_i = 0;

{

_x setVectorUp vectorUp _center;

_x setVectorDir vectorDir _center;

_x setPos (_center modelToWorld [0,_offsets select _i, 0]);

_i = _i + 1;

} forEach _rest;

Sleep 0.002;

};

I understand some of this.. But not enough to be able to know what's going on.. once i get ingame in the top right it says something about a missing { i think..

then lots of |#| and i say the 'Sleep 0.002' in the top left corner in white.. and then.. Generic error in expression?

Sorry if i'm not giving much to work on, but that's all i know.. And as i say, i'm a complete dunce when it comes to scripting, i keep having to relook up how to set an objects height ingame everytime i want to use it biggrin_o.gif

Thanks in advance of anyone who skims across this and see's where i've gone wrong.. cheers wink_o.gif

Share this post


Link to post
Share on other sites

i thought exec is a pure sqs script call. maybe try execvm instead. only a guess.

Share this post


Link to post
Share on other sites

hmmmmm...I'm not quite sure either.

Yes exec only starts sqs scripts. To run a sqf you need

script = [] execVM "blank.sqf";

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  

×