Jump to content

Recommended Posts

Does anyone know of a script to pickup - move - and place a crate?

 

I'm not talking about loading into a vehicle. I mean explicitly to pick up a crate from one place and set it down in another. With or without inventory items in it.

 

And I'm talking about crates that were placed in the editor.

 

Any ideas? I've looked around a bit and I can only find loading into vehicles.

 

Thanks,

Fire

Share this post


Link to post
Share on other sites

attachTo

start taking a look at that, maybe that'll get you the idea so you can write it for what you need.

detach

to detach objects.

 

object addAction["Pickup",{
_object  = (_this select 0);
_user = (_this select 1);

_object attachTo[_user,[0,0,1],"Pelivs"];

}];

quick example there. 

  • Like 1

Share this post


Link to post
Share on other sites
7 minutes ago, Midnighters said:

attachTo

start taking a look at that, maybe that'll get you the idea so you can write it for what you need.

detach

to detach objects.

 

 

Awesome, I'll dive into it tonight and see what I can put together. Thank you.

Share this post


Link to post
Share on other sites
1 minute ago, FireWalker said:

 

 

Awesome, I'll dive into it tonight and see what I can put together. Thank you.

Yep, sure thing. 

Share this post


Link to post
Share on other sites

Ok, so as a start this works good. The code can be in the objects' init or I can put it in my initServer.sqf.  Works exactly the same either way. (haven't run on server yet, just MP instance through the Eden editor)

 

but..

 

The addactions don't show if I'm inside or on the roof of a building. Stranger still, I can be inside a building, but if my player unit can "see" outside and get the addaction to show, then I can place the object. (sort of like being in a doorway or the edge of the roof) The object will land on the surface as its supposed to.

 

 

Really not sure where to go with this. I'm feeling like I need to add   "can_collide"   somewhere, but that doesn't seem right either...

 

Fire

 

Spoiler

tanoa_supplyBox_12 addAction["Pickup",{ 
_object  = (_this select 0); 
_user = (_this select 1); 
 
_object attachTo[_user,[0,1,1],"Pelivs"]; 
}]; 
 
tanoa_supplyBox_12 addAction["Place",{ 
_object  = (_this select 0); 
_user = (_this select 1); 
 
_object attachTo[_user,[0,1,0.2],""]; 
detach _object; 
}];

 

 

Should probably add that the addaction issue happens after I've picked up the object.   (I can pick it up inside fine, just can't place it back down inside a building)

 

Edited by FireWalker

Share this post


Link to post
Share on other sites
1 hour ago, FireWalker said:

Ok, so as a start this works good. The code can be in the objects' init or I can put it in my initServer.sqf.  Works exactly the same either way. (haven't run on server yet, just MP instance through the Eden editor)

 

but..

 

The addactions don't show if I'm inside or on the roof of a building. Stranger still, I can be inside a building, but if my player unit can "see" outside and get the addaction to show, then I can place the object. (sort of like being in a doorway or the edge of the roof) The object will land on the surface as its supposed to.

 

 

Really not sure where to go with this. I'm feeling like I need to add   "can_collide"   somewhere, but that doesn't seem right either...

 

Fire

 

  Hide contents

tanoa_supplyBox_12 addAction["Pickup",{ 
_object  = (_this select 0); 
_user = (_this select 1); 
 
_object attachTo[_user,[0,1,1],"Pelivs"]; 
}]; 
 
tanoa_supplyBox_12 addAction["Place",{ 
_object  = (_this select 0); 
_user = (_this select 1); 
 
_object attachTo[_user,[0,1,0.2],""]; 
detach _object; 
}];

 

 

Should probably add that the addaction issue happens after I've picked up the object.   (I can pick it up inside fine, just can't place it back down inside a building)

 

when the object is attached it has no collision, regardless of what you do you add collision. Just the nature of it.

As to when the action appears, that is super strange. 

I wouldn't run  this in the initServer.sqf, make it it's own script and just run it from there if you have to.

 

Share this post


Link to post
Share on other sites

Yep, I've never experienced it before. And if I have, I didn't realize it.  The reason I figured it out was that I could pick the object up but as soon as I did the addaction to pickup or place was gone. I initially thought the code was messed up and cancelling the "place" addaction. So I ended up running around with it and all of a sudden I got the addaction back. And a few minutes of trial and error realized it had something to do with buildings.

 

I'll keep digging around. I'm testing this right now with a couple mods running, so, I'm going to test it vanilla and see what the result is.

 

Fire

Share this post


Link to post
Share on other sites
8 minutes ago, FireWalker said:

Yep, I've never experienced it before. And if I have, I didn't realize it.  The reason I figured it out was that I could pick the object up but as soon as I did the addaction to pickup or place was gone. I initially thought the code was messed up and cancelling the "place" addaction. So I ended up running around with it and all of a sudden I got the addaction back. And a few minutes of trial and error realized it had something to do with buildings.

 

I'll keep digging around. I'm testing this right now with a couple mods running, so, I'm going to test it vanilla and see what the result is.

 

Fire

Hmmm...that is very odd. Best of luck with the testing. 

  • Like 1

Share this post


Link to post
Share on other sites

Lol, works perfect outside though.. haha

Share this post


Link to post
Share on other sites

https://drive.google.com/open?id=0B1yx41tVHd9bOVFPWV9yLURac2s

 

That should be the link to a simple mission.sqm

 

You can pick up and place the crate on the ground. You won't be able to get the addaction to place the crate if you run up the stairs onto the military outpost. Should be same result for all buildings.

 

You sort of have to look down on it to get the addactions to pop up.

 

Very strange. I wonder could this be a BIS issue?

 

Fire

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

×