Ads keep us online. Without them, we wouldn't exist. We don't have
paywalls or sell mods - we never will. But every month we have large bills
and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3
Laserpoint and UFO
- A Tutorial for Spirit of Half-Life.
Two examples how to use calc- and motion-entities
An UFO flying above the players head
Make a func_wall that looks like a UFO. Give it an origin brush and a name. Place the UFO somewhere in your map. Where is not important but it should be high enough. Now use a calc_position to determine the players position. Give the calc_position a name. Now place a motion_manager in your map. Make it affect the UFO. In the "Position" field enter the name of the calc_position. Use "Set position[LP]" and in the "Axis to Modify" field use "Not Z". This is to prevent the UFO from changing its altitude. Give the motion_manager a name. Put something in your map that will turn the motion_manager on after a second(motion_managers that are on when the map starts seem to make HL crash).
Get ingame: After the motion_manager has be activated your UFO should follow you everywhere. Remember your UFO does not change its height. That means if you climb high enough you might even touch it(and probably get stuck).
If you want to learn more try:
- using offsets in the calc_position
- making the UFO more than just a func_wall. Give it a weapon or something.
A laserpointer for a human grunt
This will give a monster_human grunt a cool laserpointer for his gun. How does this work? The laserpointer will be a env_laser. It will start at the tip of the grunts gun and will point into the direction the gun is pointed.
Place a monster_human_grunt in your map and give it a name. Now we must find out where the tip of his gun is. The human_grunt model has an attachment point at the tip of the gun. Use a calc_position. The "Entity to use" is your grunt and the "Position to calculate" is "Attachment point 0". You now know where you laser has to start.
What direction does the gun point? The grunt has another attachment point at his right hand. When you think of an arrow(or a vector) that starts at his hand and goes to the tip of the gun you know that this arrow will point in the direction he is aiming. Just think how you would hold a gun and how an arrow from your hand to the tip of the gun would look like.
Make another calc_position. This time use "Attachment point 1". Thats his hand.
Now to create the "arrow" we use a calc_veloctiy_path. In the "Start position" enter the name of your "hand" calc_position and in the "Destination" field enter you "guntip" calc_position.
You now have all the information your laserpointer needs. Create a env_beam. In the "Start At(blank = here)[LP]" field enter the name of your "guntip" calc_position and in the "Fire towards" field the name of your calc_velocity_path. In "Meaning of fire towards" choose "Direction [LV]". In the "Projection mode" choose "Extend past endpoint". That means your laser keep going until it hits a wall or something. If you dont choose "Extend past endpoint" your laser will only be as long as the distance between the hand and the guntip...and that means really short and totally not-laser-like.
Youre allmost done. Get ingame and try your laser. To be save make it be off be default and turn the laser on after the map has loaded. You will notice that the laser does not aim exactly right. It will probably go a bit too far up. This is because the hand of the grunt is a little lower than the guntip. You can fix this easily. Get back into worldcraft and change your "hand" calc_positions "Offset". Play around with it until your laser aims correct.
Now comes the fun part. You can design your laser as you want it. Red yellow or green? Really thin(like a laser) or frickin thick? Change the Render Fx to make it flicker or something. You can even give it some damage. Now your grunt can kill stuff by just aiming at it!
Important note: If this grunt dies and gets gibbed(grenade explosion) HL will crash. This will hopefully be fixed in the next spirit version. Until then make sure your grunt cant be gibbed...dont ask me how...you cant really stop a grunt from blowing himself up with a grenade...they do that alot actually...