Book Image

Mastering CryENGINE

By : Michelle Martin
Book Image

Mastering CryENGINE

By: Michelle Martin

Overview of this book

Table of Contents (17 chapters)
Mastering CryENGINE
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a new SmartObject rule


With the SmartObject library file now writable, we can go ahead and add a new rule. For this example, we will create a new rule to use on an AI character and several environment objects. Let's build a mechanic AI using the SmartObject system.

Our goal for this example of a mechanic AI is to build a simple SmartObject behavior, which will control an AI character so that it detects broken things in its environment and automatically approaches and repairs them. This behavior can then be extended and improved with more sophisticated game logic, but for this example, we will keep things simple. We will build our mechanic AI by creating new classes, states, and a rule to trigger the according actions.

To achieve this, we need to perform the following steps:

  1. Prepare a level, character, and environment objects for our example.

  2. Create a new rule.

  3. Create new classes for the mechanic and the things he is supposed to repair.

  4. Create new states for the mechanic and the things...