Jump to content

Forums Announcement

Read-Only Mode for Announcements & Changelogs

Dear Survivors, we'd like to inform you that this forum will transition to read-only mode. From now on, it will serve exclusively as a platform for official announcements and changelogs.

For all community discussions, debates, and engagement, we encourage you to join us on our social media platforms: Discord, Twitter/X, Facebook.

Thank you for being a valued part of our community. We look forward to connecting with you on our other channels!

Stay safe out there,
Your DayZ Team

Sign in to follow this  
takumo@gmail.com

How can I take item from the ground into inventory (on shoulders)?

Recommended Posts

Hello!


I'm spawning a rifle on the ground using player.SpawnEntityOnGroundPos , then I'm attaching a magazine and filling it with bullets and also putting one in chamber. This works, but I need this to be on the player shoulder. I also tried ServerTakeEntityToInventory but it is working weird: it actually takes the gun to player shoulder, but player still sees it on the ground. If I reconnect to the server I see it on my shoulder. 


I also tried to create the item in user inventory initially using player.GetInventory().CreateInInventory, but it has another problem: if item is created that way, chamber cannot be loaded, it shows that bullet is in the chamber, but firing is not working, trigger just clicks.


Thank you

Share this post


Link to post
Share on other sites
8 hours ago, [email protected] said:

Hello!


I'm spawning a rifle on the ground using player.SpawnEntityOnGroundPos , then I'm attaching a magazine and filling it with bullets and also putting one in chamber. This works, but I need this to be on the player shoulder. I also tried ServerTakeEntityToInventory but it is working weird: it actually takes the gun to player shoulder, but player still sees it on the ground. If I reconnect to the server I see it on my shoulder. 


I also tried to create the item in user inventory initially using player.GetInventory().CreateInInventory, but it has another problem: if item is created that way, chamber cannot be loaded, it shows that bullet is in the chamber, but firing is not working, trigger just clicks.


Thank you

In other topic I'd written for you an example for loadout with AKM and SKS, there has some code that will fix your problem at all. It might be used on almost every gun in game.

So basically use player.getinv.createininventory fnc, catch the spawned EntityAI in your inventory, casting in useful classes instances and make what you need with it.

  • Like 1

Share this post


Link to post
Share on other sites
Sign in to follow this  

×