Jump to content

How can I make my spawned ped hold an object (i.e. a cigar, cellphone, etc..)?


minipunch

Recommended Posts

So I have been trying to use functions like

void GIVE_WEAPON_OBJECT_TO_PED(Object weaponObject, Ped ped)

and

void ATTACH_ENTITY_TO_ENTITY(Entity entity1, Entity entity2, int boneIndex,
  ...)

or

.AttachTo();

to try and make my spawned ped hold a cigar in his/her hand but none of them have worked.

The closest I have gotten was to just spawn the cigar in game (floating in mid-air or on the ground), without the peds holding them like they should.

Does somebody know of a good (or working) way to make a spawned ped hold a spawned object?

Thanks,

minipunch

Edited by minipunch
Link to comment
Share on other sites

I have some code for this back home but am traveling at the moment. For weapons the process is different from objects. For objects, first spawn the object, then use .AttachTo. The difficult part is getting the right bone ID. You have to use a native for it, and pass in one of the ped bone ID enum values. There's example code our there on the web, but if you havent figured it out by the time I get home I'll post some code for you. 

[REL] Coastal Callouts: An action-packed mod with new vehicles, maps, capabilities, and callouts in and around the waters of Los Santos

[REL] Police Tape: Make your scenes more realistic while stopping peds and traffic

[REL] Better EMS: Realistic and dynamic EMS response

Join the Parks Benefactor Program to support my work and get early beta access!

Link to comment
Share on other sites

12 hours ago, PNWParksFan said:

I have some code for this back home but am traveling at the moment. For weapons the process is different from objects. For objects, first spawn the object, then use .AttachTo. The difficult part is getting the right bone ID. You have to use a native for it, and pass in one of the ped bone ID enum values. There's example code our there on the web, but if you havent figured it out by the time I get home I'll post some code for you. 

You have the right idea I believe! Because the post below explains what you say to do pretty much!

3 hours ago, ainesophaur said:

Was going through the rage forums last night and came across this

http://forums.ragepluginhook.net/default.aspx?g=posts&t=543

I think that's it! I am going to try it out right now. Thanks a lot partner!!

I'll edit this post right down here to let you know if it works like I want after I try it out!

EDIT: yes, it works like a charm. Thank you @ainesophaur and @PNWParksFan!

Edited by minipunch
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...