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.
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.
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.
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






