Activating Scripts

From Divinity Engine Wiki
Jump to: navigation, search

Overview

Before a behaviour script is used in game, you need to tell the game when, where and how it should be used.

Script Resources

Before a behaviour script can be compiled or used, you have to create a script resource for the script. Usually, they are grouped together in a resource folder hierarchy as follows:
Script resources.png

So in the folder Assets there is a folder called Scripts. Inside the Scripts folder, there are several resource packages. Every resource package contains the script resources associated with a particular region, situation or other organisational entity.

Once you have created a script resource for your script, go back to the Script editor and resave your script. Only now the script compiler will check it for errors.

Assigning Script Resources

Now that your script is linked to a resource, you can link this resource to game entities.

Character and Item Scripts

Character and item scripts can be assigned to resp. characters and items via the Scripts property in the sidebar. You can do this both for root template and for instances/objects of root templates that you placed in a level.

After you have assigned a script this way, you can (still via the side bar) change the values of the script's parameters for that root template or local object. A script's parameters consist of all external variables.

Game Scripts

A game script is a special behaviour script that is not associated with an object in the game world, but with a mod. Game scripts only become active in a mod when explicitly specified, so that you can add multiple (inactive) game scripts to a mod and then have dependent mods choose which ones become active. Activating a game script for a mod happens in the project settings.