Tutorial available? Pick up, hold, carry, and drop/throw item in GoldSrc Created 1 year ago2022-05-21 12:18:39 UTC by surreal surreal

Created 1 year ago2022-05-21 12:18:39 UTC by surreal surreal

Posted 1 year ago2022-05-21 12:18:39 UTC Post #346533
Hi!

Is there a tutorial on how to "pick up, hold, carry, and let go/throw that item" in the GoldSrc engine? More directly, pick up and throw back a loose hand grenade, or roughly stimulate the HL2 physics gun.

The way I am thinking right is the following:
1. If the player can see the entity, determine if close enough to pick up.
2. Manage if the item is "pickupable."
3. Pick up that item in front of the player's view and iterative through a think-loop, updating its angles/origin to where the player is looking, server-sided.
4. Throw item back on a player key bind, borrowing from the hand grenade weapon/snark/or satchel code.

I've searched the Internet for code or a tutorial on how best to "pick up and hold" an item in GoldSrc. After some digging, I could not find anything obvious. Yeah, GoldSrc predated this game mechanic, but being such a vital game concept and seeing it is done in other GoldSrc mods, I'm not sure why it hasn't been shared openly.

I am running a mod called Cold Ice Resurrection in which I'd like to add initial "carry/throw" support. Its code and assets are fully open. I will provide attribution for those that offer help.
Posted 1 year ago2022-05-21 19:37:29 UTC Post #346534
I'm not aware of any such tutorial. Best bet would be to reach out to the author of that video. They appear to be active in the comments on their latest videos. :)
monster_urby monster_urbyGoldsourcerer
Posted 1 year ago2022-06-01 23:30:00 UTC Post #346587
I attempted to reach out some time ago to the author, but they never responded. :(

After some tinkering, I was able to achieve the initial result I was looking for. Code can be found here. My approach was to get it working ok enough as a concept.
User posted image
User posted image
Posted 1 year ago2022-06-04 11:14:42 UTC Post #346594
You should write a tutorial about it here on the TWHL Wiki!
Admer456 Admer456If it ain't broken, don't fox it!
You must be logged in to post a response.