Jump to content
Sign in to follow this  
alexboy

(HELP) Moving a car by Scripting

Recommended Posts

So im trying to move the car by calling the script in from a Trigger

script code

_unit = _this select 0;

num = 1;

While (num <= 10) do {

num = num + 1;

_unit setPos [ (getPos _unit select 0) + num, getPos _unit select 1, getPos _unit select 2];

Sleep 3;

hint Format["Dist > %1",num];

};

when i activate the trigger it only moves it one space and stop ? i want it to look like its moving till num hits 10, like

when the trigger is activated the car moves 1, 2 ,3 ,4 ,5 .... till it hits 10 spaces away from where it is, not just jump to the 10th space.

if that makes sense

Share this post


Link to post
Share on other sites

it still doesnt work? it only moves back 2 spaces then stops ?

Thanks for quick reply

Code:

_unit = _this select 0;

If (!local _unit) exitWith{};

num = 1;

While {num <= 10} do {

_unit setPos [ (getPos _unit select 0) - num, getPos _unit select 1, getPos _unit select 2];

Sleep 2;

hint Format["Dist > %1",num];

num = num + 1;

};

Edited by alexboy

Share this post


Link to post
Share on other sites

wtf... my codes just a rebel i guess, i tried your mission out and it worked like a charm, ill see if i can take the .sqf and see what was different. thanks for your quick responses

---------- Post added at 16:18 ---------- Previous post was at 16:10 ----------

ok i found my problem, it wasnt the scripting it was the way i called it in the trigger [hmv_1_1] exec "move-vehicle.sqf"; rather then nul = [hmv_1_1] execVM 'move-vehicle.sqf';

but thanks for everything Jw Custom, and thanks for quick responses

Share this post


Link to post
Share on other sites

btw use -showScriptErrors in your game shortcut target line to catch script errors :)

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  

×