Forum

> > CS2D > Maps/Editor > Health in trigger_if
ForenübersichtCS2D-Übersicht Maps/Editor-ÜbersichtEinloggen, um zu antworten

Englisch Health in trigger_if

5 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Health in trigger_if

Qater
User Off Offline

Zitieren
How I can do something with health in trigger_if ?
I want to create map, in which are have zombies 255 HP.
Thanks for advice.

alt Re: Health in trigger_if

DC
Admin Off Offline

Zitieren
trigger_if is not made for this. Create a Lua script / Lua map script instead.

Are you talking about player zombies or NPC zombies? For NPC zombies you can also simply change the health in the NPC entity.

alt Re: Health in trigger_if

DC
Admin Off Offline

Zitieren
player('1,health') is a piece of code with wrong syntax.

1
value = player(1,"health")
would set the variable "value" to the current health value of the player with id 1.

Use cs2d cmd sethealth and/or cs2d cmd setmaxhealth to change the heath (in this example for player with id 1):
1
parse("setmaxhealth 1 255")

alt Re: Health in trigger_if

Accurator
User Off Offline

Zitieren
I made a little piece of code:

1
2
3
4
5
6
7
8
9
10
11
addhook("usebutton","This_happens_if_a_button_is_pressed")

function This_happens_if_a_button_is_pressed(id,x,y)
	local your button x position= --Put it here!
	local your button y position= --Put it here!
	if button("x")=="your button x position" and button("y")=="your button y position"
		if team(id,"team")==1 then -- The player's team will be defined. If it's the terrorist (zombie) team, then...
			setmaxhealth(id,250) -- The player's health will be set to 250. It is NOT possible to go over the limit of 250 max health.
		end
	end
end

Untested, and it can be made simpler, but I made it so you could understand it more. Note: "your button x position" and "your button y position" are strings. Strings can hold a value.
1
2
local your button x position= --Put it here!
local your button y position= --Put it here!
sets your strings' values to the inserted number.
1
if button("x")=="your button x position" and button("y")=="your button y position"
checks if the button's x and y position match the strings' value.

Mehr >
2× editiert, zuletzt 17.04.14 21:28:42
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Maps/Editor-ÜbersichtCS2D-ÜbersichtForenübersicht