[Code] Grabbable objects (a la Half-Life 2)

Post your example zscripts/ACS scripts/etc here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
Post Reply
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

[Code] Grabbable objects (a la Half-Life 2)

Post by The Zombie Killer »

This is a neat little bit of code that I'm using in a (yet unannounced) project that I am working on.
I thought I'd share the code because of the possibilities it opens up.

It's based on Linguica's gravity gun, but works vastly different, and the only real similarity is the math used, and even that is slightly changed.
Also, the object held will be affected by the player's pitch too.

Summon the class "pHealthBonus" and press use on it to pick it up.

Download:
Regular version
Multiplayer-compatible version*

* Work-in-progress, this should work exactly as the regular version does, except it should work online too. Currently untested online.

Image

-TZK
User avatar
LucasGodzilla
Posts: 102
Joined: Sun May 12, 2013 11:14 am
Location: California
Contact:

Re: [Code] Grabbable objects (a la Half-Life 2)

Post by LucasGodzilla »

Huh, could be useful for picking up medkits into a demon battle.
User avatar
amv2k9
Posts: 2178
Joined: Sun Jan 10, 2010 4:05 pm
Location: Southern California

Re: [Code] Grabbable objects (a la Half-Life 2)

Post by amv2k9 »

It gets a little wonky around level geometry, but this is really cool. Certainly better than my bash at this kind of thing (think meleeattack with custom damagetype + A_Warp)
Last edited by amv2k9 on Wed Jul 10, 2013 6:33 pm, edited 1 time in total.
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

Re: [Code] Grabbable objects (a la Half-Life 2)

Post by The Zombie Killer »

@LucasGodzilla
Huh, could be useful for picking up medkits into a demon battle.
I can imagine someone making a mod that makes medkits grabbable, and then grabbing them at full health and hogging them all in a corner while they're surrounded.

@amv2k9
It gets a little wonky around level geometry, but this is really cool. Certainly better than my bash at this kind of thing (think meleeattack with custom damagetype + A_Orbit)
I guess the wonkiness around level geometry could be fixed with a few little workarounds. The method you mentioned could actually be combined with this to make it Zandronum compatible. The custom meleeattack would cause the actor to use a slightly-edited version of the script that causes the object to be held by the player.

-TZK
User avatar
cortlong50
Posts: 753
Joined: Mon Jun 24, 2013 7:12 pm
Location: UT-WA

Re: [Code] Grabbable objects (a la Half-Life 2)

Post by cortlong50 »

can i use this? because picking up grenades and tossing them away from you would be awesome.
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

Re: [Code] Grabbable objects (a la Half-Life 2)

Post by The Zombie Killer »

cortlong50 wrote:can i use this? because picking up grenades and tossing them away from you would be awesome.
Of course! Why do you think I posted this in the resources forum? :p

-TZK
User avatar
cortlong50
Posts: 753
Joined: Mon Jun 24, 2013 7:12 pm
Location: UT-WA

Re: [Code] Grabbable objects (a la Half-Life 2)

Post by cortlong50 »

Hahaha thanks dude. Ive been messing with it and its awesome.
Post Reply

Return to “Script Library”