Open keybangz opened 1 year ago
Unfortunately your interpretation is incorrect — the behavior matches that of TF2Items_OnGiveNamedItem
, which also initially assigns null
to the item
param and requires a new handle to be assigned by-ref with flags set to override specific properties.
Maybe it's worth reworking the API (that is, creating new forwards) to pass a full item definition instead, since it's a fairly common misunderstanding.
Creating an item and assigning it to the handle also breaks all weapons.
Got some sample code for that? Do note that additional validation checks are performed after OnGetLoadoutItem
returns, so items not valid for the player / slot will still be ignored without further code patches.
Unfortunately your interpretation is incorrect
Sounds about right. My apologies.
Got some sample code for that? Do note that additional validation checks are performed after OnGetLoadoutItem returns, so items not valid for the player / slot will still be ignored without further code patches.
item = TF2Items_CreateItem(OVERRIDE_ATTRIBUTES | PRESERVE_ATTRIBUTES);
Tried to grab current weapon slot classname, indexes & applying them to the newly created item but failed.
Maybe it's worth reworking the API (that is, creating new forwards) to pass a full item definition instead, since it's a fairly common misunderstanding.
Might look into that, I suppose at that point it's no different then modifying weapons in OnResupply right?
Might look into that, I suppose at that point it's no different then modifying weapons in OnResupply right?
As long as the weapon on hand is the one you want to use; TF2Items_OnGetLoadoutItem
would still be useful to change out the item definition index and class without creating an item drop.
item = TF2Items_CreateItem(OVERRIDE_ATTRIBUTES | PRESERVE_ATTRIBUTES);
Tried to grab current weapon slot classname, indexes & applying them to the newly created item but failed.
I'll have to recheck that at some point, but that forward does run before the initial weapon is granted as well.
It is of my understanding that
TF2Items_OnGetLoadoutItem
should pass through the TF2Item handle object of the already created items, however the handle passed is always invalid.Creating an item and assigning it to the handle also breaks all weapons.
Using latest release r5