Forum

> > CS2D > Scripts > No-Damage zone code in if_trigger ?
Forums overviewCS2D overview Scripts overviewLog in to reply

English No-Damage zone code in if_trigger ?

11 replies
To the start Previous 1 Next To the start

old No-Damage zone code in if_trigger ?

Qater
User Off Offline

Quote
Hello, I want code for No-Damage zone in trigger if_
And how I can use it?
I want to add if_trigger with this code to my map.
Thanks.

old Re: No-Damage zone code in if_trigger ?

nikolaXX
User Off Offline

Quote
ok well 1 the cts,ts,and vips cant be that retarted that theyll shoot them selfs right? i mean just make a path 1 for vip 1 for ct and 1 for t what else can i say?

old Re: No-Damage zone code in if_trigger ?

Apache uwu
User Off Offline

Quote
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.

old Re: No-Damage zone code in if_trigger ?

Apache uwu
User Off Offline

Quote
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.

old Re: No-Damage zone code in if_trigger ?

DC
Admin Off Offline

Quote
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.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview