Using the message producer/consumer system
Most games generate events that require some form of action. For example, a player has entered an area and an alarm should sound, or a pig has run out of food and the farmer needs to refill the trough. Rather than hardcode these actions to each event, it is preferred that objects listen for the event messages they are interested in and then act accordingly. This decouples the whole process and makes it much easier to add and remove event message responders. In this recipe, we will learn how to generate an event message and have objects listen for that message.
Getting ready
We will be making TorqueScript changes and working with the World Editor in a project based on the Torque 3D FPS Tutorial
template, and try them out using the China Town Day
level. If you haven't already, use the Torque Project Manager (Project Manager.exe
) to create a new project from the FPS Tutorial
template. It will be found under the My Projects
directory. Then start our...