Healt system

Any aspects of level design for the Source engine.

Healt system

Postby Esbentikjoeb on Sun Mar 02, 2014 6:17 pm

Hey guys.

I'm about to make a map where i need a health system.

- When the player spawn he will lose 90hp leaving him 10hp
- There will be ports you can go through which will provide the player with 10hp per port.
- if the player falls down, hit a wall, or just fail - he will be stripped down to 10hp again and teleported to start.

First problem
The problem is that the player will be able to go through the ports as many times he want to. So i can't tie the trigger_hurt to a trigger_multiple, because then he would be able to just heal himself from one port. I can't tie it to a trigger_once since there will be more players in the game, which also needs to go through the ports and get health. And lastly, I can't make it a trigger_multiple that only "fires once", because players will retry the levl many times.

Second problem
As the player go through the map, let's say he will fail after getting to 40hp. I need him to be stripped to 10hp, but I can't only make a trigger_hurt, since players will fail at different hp-levels. Therefore, I need some kind of system that can recognize how much hp the player has and then strip it to 10hp.

I hope you guys can help. If you have the time, please send me a .bsp with the example :)
Esbentikjoeb
Dumpling
Dumpling
 
Joined: Sun Mar 02, 2014 6:06 pm

Re: Healt system

Postby greenman on Sun Mar 02, 2014 6:36 pm

For the second problem, maybe you can use Sethealth?
Not sure how it works in MP situation, but !player will accept a "SetHealth" input.
greenman
Regular
Regular
 
Joined: Thu Aug 13, 2009 8:09 pm

Re: Healt system

Postby Garrador on Sun Mar 02, 2014 6:48 pm

It has been so long since I worked with the I/O system in Hammer, so I don't know if there are any filters you could pass through a relay to check the trigger or whatnot. Can't say for sure (Ask marnamai or generalvivi).

I do know, however, how to do it by code. A custom entity for the ports that can track which players go through it every session, and when the player fails, you could simply set the HP to 10.

I'm sure it can be done with trigger_multiple and some sort of filter to make sure it only fires for a single player once.

For the second problem, there is a solution, sort of..:

command -> "buddah 1"
command -> "hurtme 100"
command -> "buddag 0"
command -> "give item_healthvial" (gives 10 hp)
command -> "hurtme 1"

Buddah command (toggle cmd) makes sure the player cannot die, so he will be left with 1 hp after hurtme 100.
Then toggle off so the player can die again, give item_healthvial which gives 10hp. Player now has 11 hp, so hurtme 1 will make it to 10.

A bit exhaustive, but it works..
You click on Build or type
make (or some equivalent), and you are astonished, then mortified, as you realize that the whole world is being
recompiled and relinked!
- Scott Meyers
User avatar
Garrador
Veteran
Veteran
 
Joined: Fri May 12, 2006 10:39 pm
Location: Norway

Re: Healt system

Postby LordDz on Sun Mar 02, 2014 8:37 pm

Make a trigger_multiple then set its outputs to:
OnStartTouch
!activator
SetHealth (It's something like that)
90

For the ports, have a trigger_hurt with a negative damage. -10 damage, etc.
User avatar
LordDz
May Contain Skills
May Contain Skills
 
Joined: Mon Sep 01, 2008 12:28 pm
Location: Hammer Crash Logs

Re: Healt system

Postby marnamai on Sun Mar 02, 2014 8:39 pm

This will only work for a singleplayer hl2 game

To set the player's health use the output "trigger / !player / sethealth / 10" (like greenman said)

if the ports are linear you could use a trigger_mulitple and name it, fire a new sethealth input (each port 10 more than the previous) and disable the trigger on starttouch with a small time delay of 0,01 sec

if they aren't linear just use garradors method with the healthvials

When the player falls and hits the teleport trigger you can send the sethealth 10 input again. make sure to enabled the trigger multiple from the ports again after the teleport reset.
User avatar
marnamai
Veteran
Veteran
 
Joined: Thu Nov 10, 2005 12:17 pm
Location: Belgium

Re: Healt system

Postby marnamai on Sun Mar 02, 2014 8:40 pm

ooh, does negative damage work? if so, then that method is by far the best
User avatar
marnamai
Veteran
Veteran
 
Joined: Thu Nov 10, 2005 12:17 pm
Location: Belgium

Re: Healt system

Postby Esbentikjoeb on Sun Mar 02, 2014 8:45 pm

^Negative damage will give the player life.

When i use the trigger_hurt i'll set Damage: -20 (This will give me 10hp (for some reason you have to double the amount))

@
LordDz wrote:
For the ports, have a trigger_hurt with a negative damage. -10 damage, etc.


Yes but since the player will be able to go through the ports multiple times, he will be able to get 100hp in just one port. I need players to get 10hp only one time from each port.
But since if they fail, they will be teleported back to start with only 10hp and must therefore be able to get the 10hp from the ports again.

Wauw this is really hard to explain lol
Esbentikjoeb
Dumpling
Dumpling
 
Joined: Sun Mar 02, 2014 6:06 pm

Re: Healt system

Postby marnamai on Sun Mar 02, 2014 8:53 pm

just disable the trigger onendtouch and enable it with once the player fails
User avatar
marnamai
Veteran
Veteran
 
Joined: Thu Nov 10, 2005 12:17 pm
Location: Belgium

Re: Healt system

Postby Esbentikjoeb on Sun Mar 02, 2014 8:56 pm

Okay here is an example of the map

It's really bad portrayed though, since my paint skills are nonexisting.

Image

from the starting point, players go to the first port to get 10hp (giving a total of 20hp)
The problem is, that if i use a trigger_hurt, they can just get all 90 hp in that port, since it wont stop giving them hp. I want the players to go through all ports which they will not do, if they can get all the hp at one port.
Esbentikjoeb
Dumpling
Dumpling
 
Joined: Sun Mar 02, 2014 6:06 pm

Re: Healt system

Postby Esbentikjoeb on Sun Mar 02, 2014 8:58 pm

@marnamai
Ohh okay, so i'll have both a trigger_teleport and a trigger_multiple. And the trigger_multiple willenable the trigger_hurt again. Ill give it a try.

But what could i do about stripping the player to 10hp everytime he restarts, regardless of how much hp he already earned?
Esbentikjoeb
Dumpling
Dumpling
 
Joined: Sun Mar 02, 2014 6:06 pm

Re: Healt system

Postby marnamai on Sun Mar 02, 2014 9:00 pm

the sethealth input to the !player?

if its mp, just kill the player when he fails and send the hurtme 90 input when he respawns
Last edited by marnamai on Sun Mar 02, 2014 9:02 pm, edited 1 time in total.
User avatar
marnamai
Veteran
Veteran
 
Joined: Thu Nov 10, 2005 12:17 pm
Location: Belgium

Re: Healt system

Postby Esbentikjoeb on Sun Mar 02, 2014 9:00 pm

marnamai wrote:just disable the trigger onendtouch and enable it with once the player fails


Arh wait. I was to quick. This will not be possible either, since there will be multiple players. so when player 1 stop touching the trigger (onendtouch) it will be disabled for all players, until player 1 fails...
Esbentikjoeb
Dumpling
Dumpling
 
Joined: Sun Mar 02, 2014 6:06 pm

Re: Healt system

Postby marnamai on Sun Mar 02, 2014 9:04 pm

yea ... might have been worth metioning it was for multiplayer ...

for what game?
User avatar
marnamai
Veteran
Veteran
 
Joined: Thu Nov 10, 2005 12:17 pm
Location: Belgium

Re: Healt system

Postby Esbentikjoeb on Sun Mar 02, 2014 9:11 pm

marnamai wrote:yea ... might have been worth metioning it was for multiplayer ...

for what game?


Haha sorry. Im new to the forum, so I thought it was all Counter-strike Source related :D

It's Counter-strike Source and it's a Multiplayer map :D
Esbentikjoeb
Dumpling
Dumpling
 
Joined: Sun Mar 02, 2014 6:06 pm

Re: Healt system

Postby LordDz on Sun Mar 02, 2014 9:21 pm

Use
Make a trigger_multiple then set its outputs to:
OnStartTouch
!activator
setHealth (It's something like that)
10

For setting the health to 10.

For the triggers that increase health by 10, is the player able to go back to them after he's passed through the next ports?
User avatar
LordDz
May Contain Skills
May Contain Skills
 
Joined: Mon Sep 01, 2008 12:28 pm
Location: Hammer Crash Logs
Next

Return to Hammer Editor Help

Who is online

Users browsing this forum: Bing [Bot]