Forum

> > CS2D > Scripts > No-Damage zone code in if_trigger ?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch No-Damage zone code in if_trigger ?

11 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Re: No-Damage zone code in if_trigger ?

Apache uwu
User Off Offline

Zitieren
So essentially you want a no damage tile, in that case, it would be best to have something like:

1
2
3
4
5
6
7
8
9
addhook("hit", "_hit")

function _hit(id)
	local x = player(id, "tilex")
	local y = player(id, "tiley")
	if entity(x, y, "typename") == "Trigger_If" then
		return 1
	end
end

If the player being damaged (hit) on is on the same tile as a trigger if, then ignore the hit.

alt Re: No-Damage zone code in if_trigger ?

Apache uwu
User Off Offline

Zitieren
If you want the lua to be transferred with every player that joins, simply name the lua script the same as the map (but have .lua, for example: de_dust.map -> de_dust.lua), and also have it within /maps.

Or, place the code in server.lua or autorun/. If_trigger is really not the place to be placing high amounts of code.

alt Re: No-Damage zone code in if_trigger ?

DC
Admin Off Offline

Zitieren
Trigger_If is not made for such scripts. Don't abuse it.
Instead create a script file in the maps folder which is called like your map but with .lua file extension and put your script into it.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht