Jump to content
Sign in to follow this  
Johnkok

Ze_OrderSlingLoad problem

Recommended Posts

Hi Zen,

Excellent work, this pack is awesome for code noobs like myself. I have run into an issue and I would like to check if it is just me with this this problem.

I am asking a chopper to pick up a crate, sling load it to the player and then bugger off back to base. I have used this:

[Logistics1,crate,PhilMcCrackin] spawn Zen_OrderSlingLoad;[Logistics1,"logistics1_marker"] spawn Zen_OrderHelicopterLand;

When I do this on my server the chopper slides across the ground to the crate. It looks like both functions are trying to operate at the same time. Do you have any thoughts on why this may be happening?

Share this post


Link to post
Share on other sites
Hi Zen,

Excellent work, this pack is awesome for code noobs like myself. I have run into an issue and I would like to check if it is just me with this this problem.

I am asking a chopper to pick up a crate, sling load it to the player and then bugger off back to base. I have used this:

[Logistics1,crate,PhilMcCrackin] spawn Zen_OrderSlingLoad;[Logistics1,"logistics1_marker"] spawn Zen_OrderHelicopterLand;

When I do this on my server the chopper slides across the ground to the crate. It looks like both functions are trying to operate at the same time. Do you have any thoughts on why this may be happening?

The functions are running at the same time; that is what 'spawn' does. They are not designed to handle that, as they cannot know if the other is running (they are entirely separate threads). You have to handle the timing between them yourself like so:

_h_sling = [Logistics1,crate,PhilMcCrackin] spawn Zen_OrderSlingLoad;
ZEN_STD_Code_WaitScript(_h_sling)
0 = [Logistics1,"logistics1_marker"] spawn Zen_OrderHelicopterLand;

You could use 'call' to run them and wait for the function to finish, but I find that makes the code harder to read (there's no visual indicator that execution will just stop and wait).

Also, in the future, send me a PM if you make a new thread for help with the framework. I don't usually look through every thread that appears in the forums. You can also just post in the framework's thread.

Share this post


Link to post
Share on other sites
The functions are running at the same time; that is what 'spawn' does. They are not designed to handle that, as they cannot know if the other is running (they are entirely separate threads). You have to handle the timing between them yourself like so:

_h_sling = [Logistics1,crate,PhilMcCrackin] spawn Zen_OrderSlingLoad;
ZEN_STD_Code_WaitScript(_h_sling)
0 = [Logistics1,"logistics1_marker"] spawn Zen_OrderHelicopterLand;

You could use 'call' to run them and wait for the function to finish, but I find that makes the code harder to read (there's no visual indicator that execution will just stop and wait).

Also, in the future, send me a PM if you make a new thread for help with the framework. I don't usually look through every thread that appears in the forums. You can also just post in the framework's thread.

This is great man, thank you very much. Will add that later on after work. Will do on the PM. And to add again, your framework awesome. I'll get a donation sorted out for you this weekend

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  

×