Thanks for all your help so far. I've added private EHANDLEs wherever I
want to record the weapon used (the RPG's missile was a little more
convoluted). It works for all weapons except the combine ball's
OnHitEntity. NPCs don't appear to take damage in the usual way from the
combine ball; it looks like it may go through dissolve instead.

Fortunately, I'm not using the energy ball, so I'm going to leave it for
now.

Thanks again for the help,

Dave

On 16 December 2014 at 14:58, Tony "omega" Sergi <omegal...@gmail.com>
wrote:

> grenades/rpg do it via RadiusDamage. and the combine ball does it from
> it's function "OnHitEntity".
> combine ball for all three of them, just add an EHANDLE to the objects and
> add a setter function.
> eg:
> //inside DelayedAttack && FireNPCSecondaryAttack
> CPropCombineBall *pBall = // Fire the combine ball
>     CreateCombineBall(    vecSrc,
>                         vecVelocity,
>                         sk_weapon_ar2_alt_fire_radius.GetFloat(),
>                         sk_weapon_ar2_alt_fire_mass.GetFloat(),
>                         sk_weapon_ar2_alt_fire_duration.GetFloat(),
>                         pOwner );
> if ( pBall != null )
>     pBall->SetWeapon(this);
>
>
> then inside CPropCombineBall::OnHitentity:
> info.SetWeapon(m_hWeapon.Get());
>
>
> On Tue, Dec 16, 2014 at 10:51 PM, David Buckley <druck...@gmail.com>
> wrote:
>>
>> Fantastic, thank you. Adding SetWeapon in FireBullets and in other places
>> such as weapon_crossbow.cpp and basebludgeonweapon.cpp works. However,
>> there are three weapons which still aren't caught properly: the SMG's
>> grenade, the AR2's energy ball and the RPG's missile. While the
>> prop_combine_ball seems to create its own CTakeDamageInfo object (which
>> isn't passed to OnTakeDamage for some reason), the other two don't. Do you
>> have any idea on how to get round this?
>>
>> Many thanks,
>>
>> Dave
>>
>> On 14 December 2014 at 08:12, Tony "omega" Sergi <omegal...@gmail.com>
>> wrote:
>>
>>> Oh, and adding to it;
>>> you can do it the same way the gamerules determines what weapon is used
>>> to cause damage for the deathnotice.
>>> the pointer doesn't need to be set for that, because it checks the
>>> player who fired it.
>>> of course.. this is assuming you're doing multiplayer and not wanting to
>>> know what weapon an NPC is firing.
>>>
>>>
>>> On Sun, Dec 14, 2014 at 5:11 PM, Tony "omega" Sergi <omegal...@gmail.com
>>> > wrote:
>>>>
>>>> the only time it's ever populated is if the weapon doing the damage
>>>> actually sets it while constructing the damage info.
>>>> default code, ie: single player, does not afaik.
>>>> (look at FireBullets)
>>>>
>>>>
>>>> On Sun, Dec 14, 2014 at 12:48 AM, David Buckley <druck...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I've been trying to record the weapon used on damage (using
>>>>> OnTakeDamage in basecombatcharacter.cpp). Unfortunately, the
>>>>> CTakeDamageInfo object doesn't seem to return a valid weapon with 
>>>>> GetWeapon
>>>>> (it's NULL). It's possible the m_hWeapon variable in CTakeDamageInfo is
>>>>> never set?
>>>>>
>>>>> Is this the case, and if so, how do I figure out which weapon was used
>>>>> to cause damage?
>>>>>
>>>>> Many thanks
>>>>>
>>>>> _______________________________________________
>>>>> To unsubscribe, edit your list preferences, or view the list archives,
>>>>> please visit:
>>>>> https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> -Tony
>>>>
>>>
>>>
>>> --
>>> -Tony
>>>
>>> _______________________________________________
>>> 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
>>
>>
>>
>
> --
> -Tony
>
> _______________________________________________
> 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