Vlatitude: Customising the Health Packs Last edited 1 year ago2022-09-29 07:56:04 UTC

Download example

Many mappers prefer health packs to chargers in their Deathmatch maps as they can be picked up easily, and you don't have to wait while charging, creating a much quicker paced game. However, a majority of the time the old fashioned 'medikit' style just doesn't fit in with the theme of the map. The obvious answer, a brush based kit with a trigger_hurt with a minus damage. But there are many problems with that, the main one being that the player can still pick it up with full health, which is why I suspect that I haven't seen a custom health pack in a map.

However, there is a way to do it, using the very thing we are trying to get rid of; an item_healthkit! The aim of this tutorial is to explain how to create a customised health pack that can be used in the same way a normal one is.

The model way

Before I start, I should mention that if you are making a mod, or can model and don't mind including a model with your map, you can just remodel the health pack model and use that, as in the long run it is easier and more efficient.

The brush based way

Below is a screenshot of what we will eventually be making:
User posted image
User posted image
As you can see, I managed to make a nice little glowing cross that revolves. This is made up of two brushes (well 6 actually, but two that are different objects) one for the actual cross and another for the glow. This means I needed a few more entities to set it up, but the process is the same.

So first of all make your health pack out of normal brushes and textures. It can be any shape (with the usual restrictions of Half Life obviously) have any texture and be stationary, a train or revolving. For a train you need to put the health pack on a small invisible train and make the actual pack a separate train. As you can see, that gets very complicated, as if its not complicated enough and is very buggy. For a revolving one just make it a func_rotating.

Give the entity/entities you just made a name. If they all have the same rendermode and amount then you can call them the same name. If they are different, you need to call them different names so all of the entities with one render style have one name, and all the ones with another render style have another. You'll see why later. You also need to tick the ' Not Solid ' option in the flags, otherwise you won't be able to walk over them.

Next place an item_healthkit under the brush based health pack you just made, making sure it isn't inside any solid objects (the brush based health packs don't count because you should have ticked the ' Not Solid ' flag) Give this a name and then make an env_render next to it. Give the env_render a name and put the name of the item_healthkit in the Target field. Then set the Rendermode to Texture and the FX Amount to 0. Not many people know this works, but it will turn the health pack invisible. It works for almost any item, ammo, weapons, and the suit. But first it needs to be triggered so it is invisible from the start. Put a trigger_auto into your map, it is usually good to place it near the player start for ease of finding it later on. Make it target start_mm and give it a Trigger State of On. Now create a multi_manager called start_mm next to it, then add the name of the env_render and a value of ' 0 '. This will then trigger the env_render and make the item_healthkit invisible at the start. You can add anything you want to trigger at the start into the multi_manager (If you are using Spirit you can get rid of the trigger_auto and check the ' Start On ' flag in the multi_manager)

Note: If you create other customised health packs you can call all the item_healthkit's the same and it will make all of them invisible with only one env_render.

Run your map now. You can run over your new design of the health pack and it will behave like a normal health pack, only giving you health if you need it. You can leave it at that, but it doesn't disappear so you don't know when you've run over it. To do this needs a few more entities.

Make an env_render, two for each different name you have for your brush based health pack. Name them uniquely (I suggest the name of the brush with a ' _show1 ' or ' _hide2 ' etc. suffix) Set the target of each of the pairs to the corresponding brush name, and set the rendermode to texture and the renderamount to 0 for one set and the renderamount of the corresponding brush for the other.

Make another multi_manager and give it a name. In it add the names of the env_render 's, for the first set giving them a value of 0 and for the second set a value of 30.

Now make the item_healthkit target the mutli_manager and viola, it should disappear when you walk over it and respawn at the appropriate time!

A few things to mention

There are a few things I should mention before I finish. Firstly if you are not using a mod that allows you to set the amount of health the item_healthkit gives you, you can't set the amount of health you receive, apart from using multiple item_healthkits over the top of each over, which is very buggy and I would advise against it.

Also the sprite that appears on the HUD to tell alert you that have picked up an item_healthkit will remain the same unless you change the sprite manually, meaning you need to include it with your map. The same applies to the sound you get when you pick it up.

If you are putting a custom health pack into a single player map you need to get rid of the second set of env_renders so the brush based health pack doesn't reappear.
This article was originally published on 69th Vlatitude.
The original URL of the article was http://www.vlatitude.com/tutorials.php?tutID=52.
The archived page is available here.
TWHL only publishes archived articles from defunct websites, or with permission. For more information on TWHL's archiving efforts, please visit the TWHL Archiving Project page.


You must log in to post a comment. You can login or register a new account.