Triggers, lua, mapping.

hello forum, I’m working on a gamemode for garry’s mod and have a few questions about mapping, I would be thankful for any answers.

I’m pretty new to hammer (which is the next step to getting my gamemode working, I need a map)

I’ve been reading a lot for a few days about hammer and I’m going to attempt making a map soon
here’s the questions.

(sorry if someone ready answered any of the questions on other threads and I missed it)

1: what sort of I/O can I have between maps and lua? (can I have a in-map trigger call a function in lua?)

2: If I use displacements in a map, I’ve read that displacements won’t seal the map so I need a brush under it then use the no-draw texture on it. Is this true? and if so can I fix the problem by making the the brush hollow and putting the no-draw texture under it?

3: well, I guess its just two questions but I’m hopping to mainly get answers on the first one, I would really like to know as much as I can about lua/maps working together but can’t really find much documentaion about it… If you have any links that you think might help please post.

Thank you everyone who read this, and even more to anyone who answers. sorry about bad english.

  1. I am not a lua expert, but I think you can do something with entity names and an I/O system… Not sure though.
  2. Yes, you have to put a brush underneath a displacement to seal it. Nodraw works fine.
  3. Reference to #1

Sorry, I only know #2. But that is true.

thanks bull04.

hmm i wonder if i should have posted this in the lua section.

It might be possible to have a trigger in the map that opens a lua file. I have not done this exact thing before but I have done something similar many times. You will need a point_clientcommand or a point_servercommand and something to trigger it. In this example I will use a trigger_multiple and a point_clientcommand.

OnStartTouch | <name of point_clientcommand> | Command | lua_openscript <name of lua file>

And that should do it. Like I said, I’ve never done this exact thing before but I have triggered console commands this way such as sv_cheats 1. (lua_openscript is a console command)

Yes you can, there is a lua_run entity you can use to call lua functions. This page explains it pretty well.

Or you can make your own lua brush entity.

As for #2, yes, you will need to seal it with a nodraw brush under the displacement.

You mentioned “Hollow” in the OP, don’t hollow…it’s lazy and messy.

Wow, I am shocked that I missed this wiki page, but so glad you linked it. Thank you.

well I met a guy who maps for the Zombie Survival gamemode, he said you make an entity for info_player_human and info_player_zombie. Hammer considers these entities as “Obsolete”, but when the map is played on multiplayer with the correct gamemode, the entities are recognized and used by the Lua.