Raised This Month: $115 Target: $400
 28% 

Missing weapons when overwriting in OGNI


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nosoop
Veteran Member
Join Date: Aug 2014
Old 03-22-2019 , 05:58   Missing weapons when overwriting in OGNI
Reply With Quote #1

Been having trouble for the longest time trying to replace weapons in the TF2Items_OnGiveNamedItem forward. I want to believe it's user error, but nothing obvious stands out to me.

Tested the attached plugin against the following on a fresh Linux server (requires Econ Data):
  • MM:S 1.11.0-git1125
  • SM 1.9.0-git6275
  • TF2Items 1.6.4-hg279

The expected outcome is that the bots (and player) spawn with replacement items, but the bots usually end up equipped with either one stock item or no items at all, though the debugging messages indicate that the item selection process was successful.
Attached Files
File Type: sp Get Plugin or Get Source (bot_randomizer_minimal.sp - 41 views - 1.6 KB)
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH)

Last edited by nosoop; 03-22-2019 at 22:58.
nosoop is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 04-06-2019 , 03:43   Re: Missing weapons when overwriting in OGNI
Reply With Quote #2

I can make some guesses:

You can't change the item class of a weapon in a TF2Items_OnGiveNamedItem callback. If you try, the game will reject your change and end up giving them nothing in that slot.

What you can do is block the item, then give them a different weapon a frame later.
__________________
Am I back? Well, we'll see.

Last edited by Powerlord; 04-06-2019 at 03:47.
Powerlord is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 04-07-2019 , 14:26   Re: Missing weapons when overwriting in OGNI
Reply With Quote #3

Quote:
Originally Posted by Powerlord View Post
What you can do is block the item, [...].
Thanks; might just have to do that. The guess is reasonable enough.

At the very least, that solution avoids having the unnecessary stock weapon spawn since it'll be replaced 100% of the time.

The other issue which I neglected to mention was that I was also looking to bypass spawning the dropped item altogether and recreating the weapon every time a bot touches the resupply cabinet (which, as it currently works, I have to additionally manage things like copying back the Ubercharge meter and killing said dropped weapons).

I'm looking into solutions for that (I believe it's somewhere within CTFPlayer::ManageRegularWeapons(), could also refer to STT's implementation, worst case I can call CTFPlayer::PickupWeaponFromOther() after I figure out what weapons were just dropped).

That's another discussion altogether though -- this one is specifically to verify whether I'm hitting a (TF2Items / PEBKAC / non-) issue in TF2Items' OGNI forward.

----

New info before I hit the bed: I've narrowed it down even further by making it only affect Soldier primaries (turning them all into copies of the Black Box). While it spawns correctly on my client, it doesn't seem to work with bot players at all. Bots only have their secondary and melee weapons available, but only the melee can be seen in the inspect panel.

New, even shorter test case attached.
Attached Files
File Type: sp Get Plugin or Get Source (oops_all_black_box.sp - 17 views - 629 Bytes)
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH)

Last edited by nosoop; 04-10-2019 at 10:23.
nosoop is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:52.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode