Rotating Pickups

Tutorial collection, comprehensive listings on main site.

Rotating Pickups

Postby Tutorial on Tue Jun 12, 2007 12:32 pm

category
General Half-Life 2/Entities

description
Much like the olden days of deathmatch, learn how to make weapons and items rotate.

keywords
pick, up, ups, pickups, rotating, rotate, prop_dynamic.

Ever wanted to have the weapons/items of your map float and spin around like in ID software games (Quake, Doom3 and RTCW). In HL1 it was easy but in Source it’s a bit tricky because of HavoK physics and the parent system. So we’re going to pull a trick out from under our sleeves. You know those old movies with the effect that stopped the camera and have the actor walk off and replaced by a man in a tin foil suit or an explosion and then have the camera start running again. This is the basic idea behind this tutorial.

First place a prop_dynamic and name it ‘shotgundummy’. Use the following world model ‘models/weapons/w_shotgun.mdl’. Finally change the props collisions to ‘not solid’.

Now create a small (3 x 3 x 6 units or so) brush with the texture it with the origin texture (tools/toolsorigin) and position it in the center of the prop_dynamic. Tie it to a func_rotating and give it the name ‘shotgunrot’. Make sure to also mark the ‘Start on’ and ‘not-solid’ flags. You can change the speed and etc. if you want but the default is good enough for me.

Image

Return to the prop and assign the parent your rotating brush. Add a weapon_shotgun slightly above the rest of the mess and as usual, name it ‘shotgunreal’. Put a point_template and an env_entity_maker on the gun. Open the template’s properties and change the name to ‘shotguntemplate’ and assign template 1 to ‘shotgunreal’. Open the env_entity_maker and change the 'point template to use' to our own point_template.

Image

Now we have the basic structure done, it’s time to wire the beast. Make a trigger_multiple the size of the prop’s bounding box. Add 3 ‘OnStartTouch’ outputs and make them as shown:

Code: Select all
1# Entity: shotgundummy
     Input: TurnOff

2# Entity: shotgundummy
     Input: TurnOn
     Delay: 16

3# Entity: shotguntemplate
     Input: ForceSpawn


Now go to properties and set time before reset to 16, as 16 will be the amount of time (in secs) before the weapon will be available to spawn and the process to start (make sure the time matches your TurnOn input’s delay) again. Leave the flags as they are and continue onto the final step.

For the last step, go back to the point_template entity and make an OnEntitySpawned output like this:

Code: Select all
Entity: shotgunreal
Input: kill
Delay: 0.03


This is to make sure you don’t have a shotgun lying around unnecessarily and screwing the effect if you’ve already picked up the gun.

Image

Image

Final Notes

You may want to add a respawn sound or maybe a light that toggles while the gun is there/not there; by using the output system.

In CSS you can use this method to mark bombsites with the C4 prop model

In DODS you can make demo pack markers using the method with a few alterations as well.

I recommend that you only use this for weapons, medkits and batteries, as it’s a lot of entities for ammo which in keeping to deathmatch law should be sitting next to the weapon it works with anyway.

To make an item that rotates in singleplayer, simply parent an item to an origin brush as there is no need to respawn the item.

By Ripper_hugme
- Don't send PM's to this user -
Tutorial
Not A Real User
 
Joined: Sun Mar 06, 2005 11:00 pm

Postby Grudge on Tue Jun 12, 2007 3:15 pm

That's sweet! Will definitely try and implement this, thanks Ripper.
Uhh... what cat?
Image
User avatar
Grudge
Pheropod
Pheropod
 
Joined: Sun Jun 10, 2007 8:26 pm
Location: Lincolnshire, United Kingdom

Postby Psy on Tue Jun 12, 2007 3:19 pm

Old school...I likes it!
User avatar
Psy
Veteran
Veteran
 
Joined: Sat Dec 03, 2005 5:41 pm
Location: United Kingdom

Postby Mr. Happy on Tue Jun 12, 2007 3:58 pm

Psycho wrote:Old school...I likes it!


QFT :D
Image
-You've just been happified!?
User avatar
Mr. Happy
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Sat Dec 30, 2006 9:20 am
Location: Flyin' thru "da cloud" in the MotherShip

Re: Rotating Pickups

Postby webc0der on Tue Nov 20, 2007 1:47 am

I tried this & works great, but have an interesting issue... when I initially pick up the weapon it does away & respawns good, but a few feet away, the same weapon respawns 2 or 3 times laying on the floor (see image below) Any suggestions on how to fix it?

Image

Thanks
webc0der
webc0der
Regular
Regular
 
Joined: Sat Oct 27, 2007 12:56 am
Location: Orlando FL

Re: Rotating Pickups

Postby Ripper_hugme on Sun Jan 06, 2008 12:43 am

webc0der wrote:I tried this & works great, but have an interesting issue... when I initially pick up the weapon it does away & respawns good, but a few feet away, the same weapon respawns 2 or 3 times laying on the floor (see image below) Any suggestions on how to fix it?

Thanks
webc0der


Sorry for late reply (but this is something I forgot to add) but is the point they are spawning the origin (direct center of worldspace) of the map?

If so that's a bug I can't seem to fix so I'd solve it by moving the map away from the origin and have the origin off to the side where players can't see or in a box outside.
User avatar
Ripper_hugme
Veteran
Veteran
 
Joined: Tue Apr 12, 2005 9:01 am
Location: Australia: Now a Major Motion Picture!

Return to Tutorials

Who is online

Users browsing this forum: No registered users