Author Topic: How to bind weapon to player?  (Read 221 times)

0 Members and 1 Guest are viewing this topic.

bitterman

  • Sr. Member
  • ****
  • Posts: 270
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
How to bind weapon to player?
« on: June 13, 2017, 11:47:00 AM »
In .def file:

Quote
"joint_attach"        "SOUL_ATTACHER"

or PISTOL_, SHOTGUN_ etc.

But "SOUL_ATTACHER" it's not bone's name or joint's name in .md5mesh.

In 'export fred' section of player.def I see:

Quote
mesh...
options ... - Rhand SOUL_ATTACHER PISTOL_ATTACHER...

I really don't understand this thing. 'Rhand' is bone's name in player.md5mesh. I don't need to create .mb (maya) and then export it to md5mesh via .def (I already have exported md5mesh).

What is "..._ATTACHER" and how to create this thing when export md5mesh from .blend file or others?

Thanks.

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 866
  • Karma: +42/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: How to bind weapon to player?
« Reply #1 on: June 13, 2017, 12:33:02 PM »
Check the weapon's md5mesh.  That could be the one used in the weapon model, not the player.

bitterman

  • Sr. Member
  • ****
  • Posts: 270
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: How to bind weapon to player?
« Reply #2 on: June 14, 2017, 11:22:08 AM »
No, it is in player.md5mesh. Sorry, my fault.

No need to deal with 'export' option.
« Last Edit: June 14, 2017, 11:25:23 AM by bitterman »

bitterman

  • Sr. Member
  • ****
  • Posts: 270
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: How to bind weapon to player?
« Reply #3 on: September 07, 2017, 11:38:07 AM »
Sorry for that, but how to bind an entity to player in editor?

I have only empty room and info_player_start. And seems like k/v "bind" "player1" is not working for me.

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 866
  • Karma: +42/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: How to bind weapon to player?
« Reply #4 on: September 07, 2017, 12:47:22 PM »
I thought I did that once but can't find my old .map file.  What I have done in the last several maps I wanted something similar was have a map script that would take the player's coordinates and move a func_mover to those coordinates.  That worked surprisingly well.

I did a test once with a helmet that was either bound to the player or used a script.  It was iffy.  I think I bound it.  I want to say that for any md5mesh that is bound to needs you to specify the entity name AND the bone you bind to.  That would mean it wouldn't be "bind" "player1".  it would be "bind" "player1:head" (if there's a head bone).  Or similar.

bitterman

  • Sr. Member
  • ****
  • Posts: 270
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: How to bind weapon to player?
« Reply #5 on: September 08, 2017, 08:58:23 AM »
In level script it can be done this way:

Code: [Select]
$entity.bind($player1);
But there is a problem - I need that binded entity to always stay in player's view but it's not happend.

When I looking around then entity losts from PVS.

Is it possible to bind entity to player's view (to moving with it)?
Perhaps some bones in player's head are tracking player's view?

Thanks.

« Last Edit: September 08, 2017, 10:15:49 AM by bitterman »

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 866
  • Karma: +42/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: How to bind weapon to player?
« Reply #6 on: September 08, 2017, 12:38:38 PM »
Anything you can do in the editor you can do in script either directly (like you said in level script) or by setting up entity spawn parameters and spawning that entity with those parameters.

You can always copy the player's location & view angles & apply those to an entity via script.

bitterman

  • Sr. Member
  • ****
  • Posts: 270
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: How to bind weapon to player?
« Reply #7 on: September 08, 2017, 11:21:16 PM »
Yes, thanks. Scripts are fine too.

Code: [Select]
$entity.bintToJoint($player1_head, "Head", true);
Entity will always stay in player's view (depends on distance between player and entity).