Jump to content
Sign in to follow this  
ArmAriffic

why won't I move in cargo?

Recommended Posts

My init works good

//Init.sqf
Player moveInCargo Plane1;

MyPath = compile preprocessFile "path1.sqf";

MyPath2 = compile preprocessFile "path2.sqf";

rec = [] spawn Mypath;

titleText ["PILOT: Hey wake up, were landing now", "BLACK OUT", 1]; 

sleep 4;

titleText ["", "BLACK IN", 0.7]; 

But this script executed 30 seconds after the mission start via a trigger does not work properly, the title text does but only last's for half a second and i do not go in car1, all names are correct

//moveincar.sqf
titleText ["", "BLACK OUT", 0.9]; 

Player moveInCargo "car1";

sleep 3;

rec2 = [] spawn Mypath2;

titleText ["", "BLACK IN", 1]; 


EDIT: I added a "Player setPos getPos moveh1;" and put the player right next to the car I wan't him in, but sleep still won't work, it's titletext thing looks like he's blinking and last's about half a second

Edited by ArmAriffic

Share this post


Link to post
Share on other sites

so is it car1 or moveh1? make up ur mind :) Also in the init you move him into Plane1. Should you not get him out first before going into Car1?

Share this post


Link to post
Share on other sites

moveincargo.sqf is initiated by a trigger 30 seconds after the mission starts, i'm creating an intro type mission

//moveincar.sqf
titleText ["", "BLACK OUT", 0.7]; 

Player setPos getPos moveh1;

Player moveInCargo "car1";

sleep 5;

titleText ["", "BLACK IN", 0.7]; 

thats the new one, it does not move me in cargo ether, i did it like that so the player is not in the plane

sleep 5; will not work

Edited by ArmAriffic

Share this post


Link to post
Share on other sites

Change this

Player moveInCargo "car1";

to this

Player moveInCargo car1;

Maltti

Share this post


Link to post
Share on other sites

it was right in front of me lol, kinda sleepy now that's why i didn't see it, thanks

any idea about sleep 5; not working

Share this post


Link to post
Share on other sites
it was right in front of me lol, kinda sleepy now that's why i didn't see it, thanks

any idea about sleep 5; not working

Sleep commands don't work on init fields/scripts. I see that the 5 second one is not in an init field or script, but I see one in the first script up there :)

Share this post


Link to post
Share on other sites
Sleep commands don't work on init fields/scripts. I see that the 5 second one is not in an init field or script, but I see one in the first script up there :)

oh ok, thanks

Share this post


Link to post
Share on other sites

you can run sleep in init fields by using spawn command, it basically creates a "script" running.

It can now take any commands used in any script.

Example in init of any unit:

_null = this spawn {sleep 5; hint "i have slept for 5 seconds"; sleep 2; hint "i slept again for 2 seconds"; waitUntil {!alive _this}; hint format["%1 is dead",_this];};

Note that spawn requires you to collect whatever outside info to it as any other script.

above i used this wich relates to _this inside the "script"

Could also have used [this] but then you would have to declare this inside the spawn with _unit = _this select 0, or simply just use (_this select 0) instead of _this in the hint format part.

Its ok for any script, but its better to use a real script if its used alot or is big, but its a matter of taste i believe.

Share this post


Link to post
Share on other sites

Put -showScriptErrors in your shortcut to get feedback on the lines you may have mistyped or in which you have used improper syntax.

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  

×