Raised This Month: $ Target: $400
 0% 

[L4D2] Getting a survivor's next pickup item


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SpaceWashingMachine
Junior Member
Join Date: Nov 2016
Old 11-01-2016 , 14:03   [L4D2] Getting a survivor's next pickup item
Reply With Quote #1

It's a bit hard to explain what I'm after in text form, thus the title isn't very specific, but what I'm looking for is the entity that will be picked up when the survivor presses +use on it (glows blue), but I don't want to use any of the use-related events (I plan on doing some stuff to the entities without the survivor using it).

At first, I thought a Trace Ray would work out, and in a simple situation, where I'm directly looking at the item, it would, but if the item is quite a bit away, then the Trace Ray would be no good, and thus I'm unsure what to do from here.
SpaceWashingMachine is offline
Marcus101RR
Veteran Member
Join Date: Aug 2009
Location: Tampa, FL
Old 11-01-2016 , 15:11   Re: [L4D2] Getting a survivor's next pickup item
Reply With Quote #2

Quote:
Originally Posted by SpaceWashingMachine View Post
It's a bit hard to explain what I'm after in text form, thus the title isn't very specific, but what I'm looking for is the entity that will be picked up when the survivor presses +use on it (glows blue), but I don't want to use any of the use-related events (I plan on doing some stuff to the entities without the survivor using it).

At first, I thought a Trace Ray would work out, and in a simple situation, where I'm directly looking at the item, it would, but if the item is quite a bit away, then the Trace Ray would be no good, and thus I'm unsure what to do from here.
This requires a bit more clarification,

If you are trying to figure out what a Survivor Bot's next Scavange Item Target is, there is no way to do that, instead, a plugin "Defibrillator Bots Use" does this by changing their move direction to the other item instead.

If you wish to find out what a person is looking at before they pick up the target, there is no event that triggers before the actual pickup. However, The Director Hints show icons when an Item is near the scavange range, perhaps this can be used instead?

If you want to know when an Item was directly picked up, the best thing to do is either use the Use event, or the Pick up event when it triggers...
__________________
Marcus101RR is offline
Send a message via AIM to Marcus101RR Send a message via Skype™ to Marcus101RR
SpaceWashingMachine
Junior Member
Join Date: Nov 2016
Old 11-01-2016 , 18:37   Re: [L4D2] Getting a survivor's next pickup item
Reply With Quote #3

Quote:
Originally Posted by Marcus101RR View Post
This requires a bit more clarification,

If you are trying to figure out what a Survivor Bot's next Scavange Item Target is, there is no way to do that, instead, a plugin "Defibrillator Bots Use" does this by changing their move direction to the other item instead.

If you wish to find out what a person is looking at before they pick up the target, there is no event that triggers before the actual pickup. However, The Director Hints show icons when an Item is near the scavange range, perhaps this can be used instead?

If you want to know when an Item was directly picked up, the best thing to do is either use the Use event, or the Pick up event when it triggers...
Yeah, the second option was the one I was going for, I wanted to know what a human's 'targetted' item was before they interacted with it, as I wanted to do something where if they had an item targetted for a period of time something would happen, but if there isn't an event for it, I guess it isn't something easily locatable.
SpaceWashingMachine is offline
Skyy
AlliedModders Donor
Join Date: Jan 2010
Location: Toronto, Canada
Old 11-01-2016 , 21:39   Re: [L4D2] Getting a survivor's next pickup item
Reply With Quote #4

Hey there, I use GetClientAimTarget ( https://sm.alliedmods.net/api/index....ad=show&id=50& ) to do what you're looking to do - I use this call in my RPG plugins, in association with custom entities i create, and other little features.
Skyy is offline
SpaceWashingMachine
Junior Member
Join Date: Nov 2016
Old 11-02-2016 , 05:44   Re: [L4D2] Getting a survivor's next pickup item
Reply With Quote #5

Quote:
Originally Posted by Skyy View Post
Hey there, I use GetClientAimTarget ( https://sm.alliedmods.net/api/index....ad=show&id=50& ) to do what you're looking to do - I use this call in my RPG plugins, in association with custom entities i create, and other little features.
This appears to have a similar effect to the Trace Ray method I did first, if I'm directly looking at the item it works, but if I'm not, like in the second screenshot in my first post, it returns -1. It also returns other player entities that may be in the way as well.
SpaceWashingMachine is offline
Skyy
AlliedModders Donor
Join Date: Jan 2010
Location: Toronto, Canada
Old 11-02-2016 , 19:49   Re: [L4D2] Getting a survivor's next pickup item
Reply With Quote #6

GetEntPropVector() to get the location in 3d space of the entity; for players, you can use GetClientAbsOrigin() but you don't have to. I would recommend restricting interactivity based on distance, using GetVectorDistance() and, if it's a concern about other entities being in the way, using a loop that ignores entities outside the distance would allow you to track every eligible entity. By setting restrictions on which entities the player can interact with, such as ignoring actual client entities (if, say, a player was standing right on top of the item you wanted to pick up) you can further narrow down the search parameters. Now that you've got a loop running that only checks the entities you actually want to consider, you'll want to use the information collected by GetClientEyeAngles() (which will store players viewing angles) to determine if the client crosshair is close enough to said entity for you to allow them to interact.

Last edited by Skyy; 11-02-2016 at 19:54.
Skyy is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 11-03-2016 , 01:08   Re: [L4D2] Getting a survivor's next pickup item
Reply With Quote #7

Quote:
Originally Posted by Skyy View Post
GetEntPropVector() to get the location in 3d space of the entity; for players, you can use GetClientAbsOrigin() but you don't have to. I would recommend restricting interactivity based on distance, using GetVectorDistance() and, if it's a concern about other entities being in the way, using a loop that ignores entities outside the distance would allow you to track every eligible entity. By setting restrictions on which entities the player can interact with, such as ignoring actual client entities (if, say, a player was standing right on top of the item you wanted to pick up) you can further narrow down the search parameters. Now that you've got a loop running that only checks the entities you actually want to consider, you'll want to use the information collected by GetClientEyeAngles() (which will store players viewing angles) to determine if the client crosshair is close enough to said entity for you to allow them to interact.
+1
cravenge is offline
Reply



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 17:52.


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