Basics of scripting
From Djinni Wiki
[edit] Part 1
by Katarzyna Kuczyńska
As a designer I have to do lots of scripting, but as I’m not a programmer, I try to make it as simple as it gets. ‘llI try to explain some of the basics for you, so you could use some scripts in your own adventures.
To create script, choose File > New > Neverwinter Script. Every script contains this part:
void main()
{
}
Your script should be between those brackets { }. Every line should end with “;”. If you want a script to refer to a player, you have to use function GetFirstPC(). For other objects you can use GetObjectByTag(“object_tag”) or GetNearestObjectByTag(). Another useful function is GetEnteringObject(). You can use it do define that the trigger should work only when a player enters it, eg:
if(GetEnteringObject() == GetFirstPC())
{
DestroyObject(GetObjectByTag("big_stone"));
EnableTrigger(GetObjectByTag("stone_trigger"), FALSE);
}
This function will destroy a big stone, blocking the way, when Geralt enters a specific trigger with this script added in a field “On Enter”. After that the script will disable this trigger (we want this event to happen only once).
Previous tutorial: First steps with D'jinni
Next tutorial: Activating a spawnset
