I left the divinity modding scene quite a while ago, but there's some stuff lying around on my comp that I thought is best to be shared with the community since I put some time into it and I'm sure they're useful for a lot of you, both to understand the potential of the scripting engine better as well as just to make cool mods quickly.
You can find working demos of these scrips in the latest version of the Divine Arena:
http://www.nexusmods.com/divinityoriginalsin/mods/38/? http://www.nexusmods.com/divinityoriginalsin/mods/38/? All of these scripts belong into ../Story/RawFiles/Goals in your mod folder and will show up automatically in the story editor if you put them there. Dialogs.txt and Traders.txt are ment to be used in mods that don't depend on the main campaign. The other two are useful no matter if you start from scratch or modding the campaign.
I didn't clean up the code but just pulled it out of the mod and pasted it for you. I'm sorry if it's a bit messy. There's some comments and references to the Divine Arena Mod still in there (and me trying to find a way to properly structure the code:) along with some debuging code. If you just drop it into your mod you will run into compilation errors due to missing references. It shouldn't be much of a problem to clean it up. After looking through it quickly I think it's only the DArena_... things in the INIT section of the scripts that needs to be removed. Everything was tested properly and should be bug free.
Dialogs.txtThis is a very simple script that allows you to add a conversation to a character that is set global (thus can be referenced in the story editor) on the fly. Smiply add the trader CHARACTER identifier to the DB_Dialogs database in the INIT section of the script:
Dialogs.txt:
http://pastebin.com/fHkLLt3F Example:
Add this to the INIT section
DB_Dialogs(CHARACTER_My_NPC, "My_NPC_Dialog"); to give the CHARACTER_My_NPC the global dialog My_NPC_Dialog.
Traders.txtThis is a very simple script that allows you to add traders on the fly (npcs with a shop). Smiply add the trader CHARACTER identifier to the DB_Trader database in the INIT section of the script:
Traders.txt:
http://pastebin.com/mHis12s2 Example: Add this to the INIT section
DB_Traders(CHARACTER_My_NPC); to make the CHARACTER_My_NPC have a shop.
DB_While.txt:This script adds some sort of while flow control statement to the toolkit. It's not a proper while statement tho as it's not boolean based. It allows for variable repetitive calls of a function in a very simple and elegant way and acts as a counter at the same time.
DB_While.txt:
http://pastebin.com/mBZVfW2xHere's an example hot wo use DB_While:
http://pastebin.com/3yRevh68. The function Repeat_X_Times((INTEGER) _X) will print "repetition" X times in the debug output window.
You can find real world examples in CharCreation.txt and Players.txt in the Divine Arena as well (see above for link).
DB_IntToString: This script allows you to convert ints to strings. Especially cool for debuging on the fly (see example below). Mind this is only converting to the #'s specified and will print an exception message to the debug log if you run out of range (range is currently 0-99).
DB_IntToString.txt
http://pastebin.com/ew6amJjh Here's an example how to use DB_IntToString:
http://pastebin.com/EX7p0gYj. The function DebugBreakInt((INTEGER) _i) allows you to print numbers to the debug output just like you can output text with DebugBreak((STRING) _s).
Sidenote: If you replace the last line of the DB_While example with DebugBreakInt(_X);, Repeat_X_Times((INTEGER) _X) will print the numbers from 1 to X in the debug output window.
__________________________
If you have problems to follow through, feel free to leave a reply to this thread or send me a PM. I will check once in a while.
Happy modding to you guys, I hope I helped you a bunch

Eamid
P.s. There's some more funnies in the Divine Arena like forcing PvP Combat and things. They're kind of tough to document in detail and just looking at the mod will probably get you there quickily.