Jump to content

Recommended Posts

Hello, community.

I need a script in order to create and complete a single task.

Here is what I need to achieve:

1. The player must drive his truck close enough to an object, that has to be loaded on the truck. So I basically need a truck named X and and object named Y (or truck1 and object1).

2. I need a condition in the script that would check the distance between the truck and the cargo which is quite logical - if the truck is close enough, the cargo can be loaded, so I need something like this: truck1 distance object1 < X (let's say 5m).

3. I need this addAction menu with "LOAD CARGO" option (if truck1 distance object1 <X, then...) to appear when the condition from p.2 is fulfilled.

4. I need to know if any kind of cargo type objects can be visibly attached to a truck, so when the cargo is loaded on it, it should be visible.

5. I must then move to a position where to unload the cargo and then the task would be completed, so I can use the script from p.2 again or simply use a condition which would check if the cargo is no more loaded in the truck, which would then complete the task.

6. I need to use a simple Create Task Module, not a scripted task, but one with a Set Task State and a trigger with a condition to check if the condition is fulfilled.

 

Thank you very much in advance, happy editing!

Best regards and cheers!

Share this post


Link to post
Share on other sites

Hi mate, 

I don't think anyone will actually make the entire code for you, this ain't a place where you "order" your scripts. 

As for the loading action, the command addAction supports adding a condition when the action can be executed. Check the documentation for details:

https://community.bistudio.com/wiki/addAction

 

For visibly loading the cargo, your best bet would be setVehicleCargo, if the object and the truck are supported by this system.

https://community.bistudio.com/wiki/setVehicleCargo

 

If that doesn't work, you'll probably have to fiddle around with the attachTo command but that's more effort and less elegant.

Feel free to ask here if you have any specific issues that you can't get past.

 

Good luck!

  • Like 1

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

×