Jed Where is this mod you are talking about? I wants to try it!

On Tue, Dec 11, 2012 at 9:22 AM, Jed <j...@wunderboy.org> wrote:
> Nick,
>
> You are doubtless right and there is a simpler way.
>
> The reason I did it with it's own entity just happened to be the way we
> utilize head wear in the mod. There was a lot of "fluff" I left out but we
> have additional functions and such to handle things such as pre-caching all
> the helmet models, selecting a random one for the players class and stuff to
> prevent the local player having it's head wear drawn in first person view
> and handle the helmet getting shot or blown off.
>
> //  Jed
>
>
>
>
> On 11 December 2012 16:15, Nick <xnicho...@gmail.com> wrote:
>>
>> Jed's use of the model script to determine where to put the "prop" on
>> the player is correct from what I have seen.
>>
>> His code, i don't believe is necessary. Merely attaching a prop with
>> the correct "bonemerge" should work perfectly.
>>
>> On Sat, Dec 8, 2012 at 5:57 AM, Jan Hartung <jan.hart...@gmx.de> wrote:
>> > Hi Jed,
>> >
>> >
>> >
>> > Thanks for the detailed reply, I’m sure this will help us to make items
>> > show
>> > on the player. I’ll let you know the results once I’m done implementing
>> > and
>> > the models are properly set up. May take a few days though as there’s
>> > first
>> > some work to do on my dev system.
>> >
>> >
>> >
>> > Jan
>> >
>> >
>> >
>> > Von: hlcoders-boun...@list.valvesoftware.com
>> > [mailto:hlcoders-boun...@list.valvesoftware.com] Im Auftrag von Jed
>> > Gesendet: Freitag, 7. Dezember 2012 19:08
>> >
>> >
>> > An: Discussion of Half-Life Programming
>> > Betreff: Re: [hlcoders] Show a model on the player
>> >
>> >
>> >
>> > Jan,
>> >
>> > I wrote code to attach models to the play as part of the Ham and Jam
>> > mod. We
>> > use it to put random helmet models on the players as a means of trying
>> > to
>> > not make them all look the same. I use bone merging as the general
>> > method
>> > rather than attachments but it seems to work fine for me.
>> >
>> > I'm afraid I haven't opened Visual Studio for over a year but the basics
>> > are
>> > thus.
>> >
>> > Set-up your player models and create the bones where you want your
>> > models to
>> > be attached. You need to then define them as used for bone merging with
>> > the
>> > $bonemerge directive in your QC file.
>> >
>> > In the models you want to attach to the player, you need to have a bone
>> > in
>> > the model with the same name as the bone you will attach to. The general
>> > technique I used is to place the actual prop model on the player model
>> > so
>> > it's how you want it to appear on the player model and then create a new
>> > bone in the same position and orientation and the bone I will attach
>> > too,
>> > call it something different and weight the attachment model to the new
>> > bone.
>> > I then move the new bone and the model down so that it's origin is 0,0,0
>> > and
>> > export the SMD. In the QC file I use $renamebone to rename the extra
>> > bone to
>> > the same as the bone it will attach to.
>> >
>> > So, at this point you should have a player model with named and defined
>> > attachment bones and models you will attach to it with named bones that
>> > match the attachment points.
>> >
>> > Codewise what I did was this.
>> >
>> > I created a new client and server sidee class called C_PlayerHelmet baed
>> > on
>> > on C_PhysicsProp:
>> >
>> > class C_PlayerHelmet: public C_PhysicsProp
>> > {
>> >     typedef C_PhysicsProp BaseClass;
>> > public:
>> >     DECLARE_CLIENTCLASS();
>> >
>> >     C_PlayerHelmet();
>> >     ~C_PlayerHelmet();
>> >
>> >     virtual bool    ShouldDraw( void );
>> > };
>> >
>> > It's only function, ShouldDraw, basically just does checks to see if it
>> > should draw the helmet, based on if we're the local player or not and
>> > such.
>> >
>> > bool C_PlayerHelmet::ShouldDraw( void )
>> > {
>> >     // TODO: This needs some refinement...
>> >
>> >     // if we don't have an owner entity...
>> >     if ( !GetOwnerEntity() )
>> >         return BaseClass::ShouldDraw();
>> >
>> >     if( GetOwnerEntity() == C_HajPlayer::GetLocalHajPlayer() )
>> >         return input->CAM_IsThirdPerson();
>> > }
>> >
>> > On the server side I have the same class with basically a Spawn function
>> > which calls PreCache and then BaseClass::Spawn();
>> >
>> > That's it - that just the entity to handle the helmet model for the
>> > player.
>> >
>> > As for actually getting it onto the player model. Well I have a whole
>> > bunch
>> > of player class functions to handle that but basically in my player
>> > model
>> > class I create an instance for the helmet as:
>> >
>> > CHandle<CBaseEntity>    m_hHelmetEnt
>> >
>> > When I actually want to attach a helmet to the player:
>> >
>> > // create the helmet entity
>> >     if ( !m_hHelmetEnt )
>> >     {
>> >         m_hHelmetEnt = (CBaseEntity*)CreateEntityByName( "player_helmet"
>> > );
>> >
>> >         // failure!
>> >         if ( !m_hHelmetEnt )
>> >         {
>> >             DevMsg(1, "Could not create player helmet entity!");
>> >             m_bHasHelmet = false;
>> >             return;
>> >         }
>> >
>> >         // get the helmet index
>> >         unsigned int n = ChooseHelmet();
>> >
>> >         if ( n > HELMET_NONE )
>> >         {
>> >             m_hHelmetEnt->SetOwnerEntity( this );
>> >             m_hHelmetEnt->SetModel( g_pszHelmetModels[n] );
>> >
>> >             // must spawn before attaching.
>> >             m_hHelmetEnt->Spawn();
>> >
>> >             m_hHelmetEnt->FollowEntity( this, true );
>> >             m_hHelmetEnt->AddEffects( EF_BONEMERGE_FASTCULL );
>> >             m_hHelmetEnt->AddEffects( EF_PARENT_ANIMATES );
>> >             m_hHelmetEnt->RemoveEFlags( EFL_USE_PARTITION_WHEN_NOT_SOLID
>> > );
>> >
>> >             SetHelmet( n );
>> >             m_bHasHelmet = true;
>> >         }
>> >     }
>> >
>> > To take the helmet off:
>> >
>> >     if ( m_hHelmetEnt )
>> >     {
>> >         UTIL_RemoveImmediate( m_hHelmetEnt );
>> >         m_hHelmetEnt = NULL;
>> >     }
>> >
>> > That's pretty much the basics. What it does is short is create the
>> > attachment model as it's own entity and have it bonemerge and follow the
>> > player around.
>> >
>> > I had a bunch of other stuff which handles the helmet getting shot or
>> > blown
>> > off and just spawning it into the world as a non solid gib that vanishes
>> > after a while.
>> >
>> > // Jed
>> >
>> >
>> >
>> > On 30 November 2012 18:32, Jan Hartung <jan.hart...@gmx.de> wrote:
>> >
>> > Thanks Nick, the page you linked to might help. I'll check it in detail
>> > later.
>> >
>> > Jan
>> >
>> > -----Ursprüngliche Nachricht-----
>> > Von: hlcoders-boun...@list.valvesoftware.com
>> > [mailto:hlcoders-boun...@list.valvesoftware.com] Im Auftrag von Nick
>> > Gesendet: Freitag, 30. November 2012 17:50
>> > An: Discussion of Half-Life Programming
>> > Betreff: Re: [hlcoders] Show a model on the player
>> >
>> > i am not sure... but someone did a mod where weapons were added on the
>> > player back.
>> >
>> > Also, I knew of amodeler named Flare and who was able to set the
>> > attachment point on the prop.. And that attachment point on the prop
>> > determined where the model was attached to the player.
>> >
>> > If the prop is setup correctly, it should be perfectly setup when
>> > attached to a player with HLMV, no code would be required.
>> > http://www.halfwit-2.com/?page=resources&action=view&item=14
>> >
>> > On Sat, Nov 24, 2012 at 11:19 AM, Jan Hartung <jan.hart...@gmx.de>
>> > wrote:
>> >> I’ve been trying different things now, but none of them work as they
>> >> are supposed to.
>> >>
>> >>
>> >>
>> >> A combination of LookupAttachment and GetAttachment and setting the
>> >> origin and angles of the entity I want to attach to the player to what
>> >
>> >> GetAttachment returned followed by a call to FollowEntity does not
>> >> help. The entity seems to be glued to the players feet then.
>> >>
>> >> Calling SetParent and afterwards SetParentAttachment yields better
>> > results.
>> >> The entity is shown on the attachment point and moves completely
>> >> relative to the player. The problem here is, that the weapon is no
>> >> longer in the player’s hands and the whole player model jerks around.
>> >> Additionally the console prints the error message “*** ERROR: Bone
>> >> access not allowed (entity 1:player)”. I tried to solve that by
>> >> calling PushAllowBoneAccess on the player (client side). Doesn’t help,
>> >
>> >> the error message does not disappear and the player keeps on jerking
>> > around.
>> >>
>> >>
>> >>
>> >> Any ideas?
>> >>
>> >>
>> >>
>> >> Jan
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> Von: hlcoders-boun...@list.valvesoftware.com
>> >> [mailto:hlcoders-boun...@list.valvesoftware.com] Im Auftrag von Cale
>> >> Dunlap
>> >> Gesendet: Mittwoch, 3. Oktober 2012 20:21
>> >> An: Discussion of Half-Life Programming
>> >> Betreff: Re: [hlcoders] Show a model on the player
>> >>
>> >>
>> >>
>> >> I haven't personally done what you're trying to do, but perhaps
>> >> looking at bone followers would provide some insight. I'm not sure if
>> >> they'll address what you're asking. Other members of the list can
>> > correct me if I'm wrong.
>> >> I've actually been curious about this myself.
>> >>
>> >>
>> >>
>> >> Cale
>> >>
>> >> On Thursday, September 27, 2012, Jan Hartung wrote:
>> >>
>> >> Hi,
>> >>
>> >>
>> >>
>> >> I’m trying to render different items (models) on the player model. The
>> >
>> >> player model has been set up with various attachments where I could
>> >> render the items. My problem is that I couldn’t find a way to attach
>> >> an item to any of the attachment points. The net doesn’t really help
>> >> with this and I couldn’t find the code used to show the weapons on the
>> >
>> >> player models. Any hints on how to render models on attachment points?
>> >>
>> >>
>> >>
>> >> Jan
>> >>
>> >>
>> >>
>> >>
>> >> _______________________________________________
>> >> To unsubscribe, edit your list preferences, or view the list archives,
>> >
>> >> please visit:
>> >> https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
>> >>
>> >>
>> >
>> > _______________________________________________
>> > To unsubscribe, edit your list preferences, or view the list archives,
>> > please visit:
>> > https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
>> >
>> >
>> > _______________________________________________
>> > To unsubscribe, edit your list preferences, or view the list archives,
>> > please visit:
>> > https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
>> >
>> >
>> >
>> >
>> > _______________________________________________
>> > To unsubscribe, edit your list preferences, or view the list archives,
>> > please visit:
>> > https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
>> >
>> >
>>
>> _______________________________________________
>> To unsubscribe, edit your list preferences, or view the list archives,
>> please visit:
>> https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
>>
>
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
>
>

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders

Reply via email to