Difference between revisions of "Lua:Map Location System"
Mulchman MM (talk | contribs) |
Mulchman MM (talk | contribs) |
||
Line 8: | Line 8: | ||
==trigger_ff_script entities in the .vmf== | ==trigger_ff_script entities in the .vmf== | ||
− | In hammer create a brush and tie it to a trigger_ff_script entity. Give this new brush-entity a name like "location_my-specific-area-here". You have now created a brush based location entity that when the player touches it will tell the player what location they are in. | + | In hammer create a brush and tie it to a trigger_ff_script entity. Give this new brush-entity a name like "location_my-specific-area-here". |
+ | |||
+ | ==Example Location Entity Names== | ||
+ | <pre>location_red_ramproom | ||
+ | location_water | ||
+ | location_yellow_flagroom</pre> | ||
+ | |||
+ | You have now created a brush based location entity that when the player touches it will tell the player what location they are in. | ||
Everytime a player touches a location entity (a trigger_ff_script named location_x where as is the location name) the game code checks to see if they're already in location_x. If they are, nothing happens. If they aren't, then the HUD location display is changed to reflect the new location. The location information used for chats is also updated when touching a new location entity. | Everytime a player touches a location entity (a trigger_ff_script named location_x where as is the location name) the game code checks to see if they're already in location_x. If they are, nothing happens. If they aren't, then the HUD location display is changed to reflect the new location. The location information used for chats is also updated when touching a new location entity. |
Revision as of 08:29, 31 May 2006
Map Location System
The location system in Fortress Forever is used to show a player via the HUD what room/area they are currently in.
There are 2 parts to implementing a location system in a map:
- trigger_ff_script entities in the .vmf
- .lua file for the map
trigger_ff_script entities in the .vmf
In hammer create a brush and tie it to a trigger_ff_script entity. Give this new brush-entity a name like "location_my-specific-area-here".
Example Location Entity Names
location_red_ramproom location_water location_yellow_flagroom
You have now created a brush based location entity that when the player touches it will tell the player what location they are in.
Everytime a player touches a location entity (a trigger_ff_script named location_x where as is the location name) the game code checks to see if they're already in location_x. If they are, nothing happens. If they aren't, then the HUD location display is changed to reflect the new location. The location information used for chats is also updated when touching a new location entity.
It's important to note that location entities really only need to be placed at the entrance and exit of an area as the player does not have to constantly be touching the location entity. Once the player touches a location entity they will be marked as being in that location until they touch a location entity with a different location name.
.lua file for the map
Just like when using anything LUA related, you need a .lua file named the same as your map (ie: ff_dev_ctf.bsp has a lua file named ff_dev_ctf.lua).
In your maps lua file is where you define the actual location name you gave to the location entity in hammer. This is where you set the team who owns that area and the actual text that is displayed for this particular location.