Divinity Banner
Page 2 of 2 < 1 2
Topic Options
#574903 - 11/09/15 07:05 AM Re: [Tutorial] Main Campaign Modding [Re: Rhidian]
Dindono Offline
stranger

Registered: 11/09/15
Posts: 3
Hello,

Thank you Rhidian for all the info. I am currently working and learning about charscripts, and I found this post to be the most useful regarding the subject.
Charscripts appears to be the most effective way to script NPC state management and routines -like habits, patrols- that can be overrided/suspended by Osiris whenever a Player interact with said NPC. I have found using Osiris alone doesn't give me enough freedom because some Osiris calls (CharacterUseItem, (Proc)CharacterMoveToTrigger...) override everything, including NPC generic behaviors like reactions to stealing and vandalizing. This is the reason why I want to experiment with charscripts.

I actually have a hard time implementing it. I have followed Rhidian's instructions: I created a Package under my Mod in the Resource Manager and imported my created charscript into it... which allows me to add the script in the SideBar properties of the NPC Character.
Unfortunately, with such a configuration, whenever I playtest the game in the editor, I receive a ton of errors non-stop: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt".

So I kind of know where this error comes from. The content of the Main infrastructure is read-only and shouldn't be messed up with... but I don't understand why it throws this error in this specific scenario...?

There are things I should add to better describe the situation:
- In the Resource Manager, I first tried to import my charscript into the Main/Assets/Scripts/Scripts package. Thus I could add the script to the Character, but it throwed the memory error.
- Then I moved the script into a newly created package under the Mod ID -as described here- so that I thought it won't mess up with the Main package. But the error was still throwned whenever I add the charscript to the Character and hit Play.
- I have tried it with and without the patched LSToolFramework.dll in order to remove the main module protection. I used the Steam Verify Cache after deleting the dll to recover the proper one, so I tried with both, to no avail.

At this point I am quite clueless about what to do. I might try to do a backup of my Mod Data and try again on a fresh install of the Divinity Engine.

I'll report my findings, meanwhile if anyone have a clue about what's happening with this error in this context, I'll be very happy :)

Good day

Top
#574994 - 11/09/15 07:18 PM Re: [Tutorial] Main Campaign Modding [Re: Rhidian]
SniperHF Offline

old hand

Registered: 06/29/13
Posts: 853
Are you trying to mod MAIN or just doing scripts in a normal standalone mod?

When you import a script it will in my experience always throw the errors you described. A restart of the editor has always fixed this for me.

Those errors can be caused by other things though, one of which is NPCs moving between instanced areas via charscript.

If you are modding MAIN I can't be of much help but if it's a standalone mod, you can upload your work and I can try and find out what's broken tomorrow.

Far as reinstalling goes, if you are going to try that I'd also reinstall D:OS as well, not just the editor. I have had my MAIN get corrupted a few times and had to do this.

Top
#575006 - 11/09/15 11:32 PM Re: [Tutorial] Main Campaign Modding [Re: Dindono]
Norbyte Offline
addict

Registered: 04/14/13
Posts: 452
Originally Posted By: Dindono
Hello,
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt".

So I kind of know where this error comes from. The content of the Main infrastructure is read-only and shouldn't be messed up with...


That is not what the error message means.
It means that the native code encountered an unhandled error that the editors .NET runtime caught and re-threw as a managed exception (and as a side effect prevented it from crashing completely).
... so it can be anything; maybe one of the materials is not assigned? the story was not compiled beforehand? you're missing one of the main characters? Literally anything. Unfortunately the error doesn't give as much insight into what exactly is the problem frown

Top
#575280 - 11/12/15 11:37 AM Re: [Tutorial] Main Campaign Modding [Re: SniperHF]
Dindono Offline
stranger

Registered: 11/09/15
Posts: 3
I am modding Main. It is a separate module but with a dependency to Main.

You are right about reinstalling the game -not just the engine-. I might do it during the night.

I haven't really tackled the problem yet again, but I will!

Thanks for telling me about the meaning of the error Norbyte.

Top
#575749 - 11/18/15 04:17 PM Re: [Tutorial] Main Campaign Modding [Re: SniperHF]
Dindono Offline
stranger

Registered: 11/09/15
Posts: 3
Hello,

Late news! Problem solved. There was no need to reinstall &all. I simply made a mistake in the charscript, which throwed the error. It is now corrected.

The catch is that
Originally Posted By: SniperHF

When you import a script it will in my experience always throw the errors you described. A restart of the editor has always fixed this for me.

Top
#576676 - 12/06/15 08:55 AM Re: [Tutorial] Main Campaign Modding [Re: Rhidian]
Ikul Offline
apprentice

Registered: 11/17/15
Posts: 32
As far as I understand from the first post, the editor (and the game) automatically collates all roottemplates in the Main Roottemplates folder and the Mod-specific Roottemplates folder. This is handy.
Does it do the same for stats? Does it just check all appropriate locations and throw everything together?
While I'm at it, do Stats contain the price at which something is sold? If so, where does one find this?

Top
#576708 - 12/07/15 12:26 AM Re: [Tutorial] Main Campaign Modding [Re: Rhidian]
SniperHF Offline

old hand

Registered: 06/29/13
Posts: 853
Stats are in Public/MODNAME/Stats

You use the excel files to generate TXT files in the generated folder. I'm not 100% sure how it all works but I've done a decent amount of stat monkeying.



Item values are mapped like just about everything else so it runs on some formula of levee and the Value field in certain stats files (like Weapon.xlsm). Durability and special properties might play a role too not sure.

You make changes to each individual XLSM file as required and then close them, and run the all.xlsm file. Some of them are linked together.

I suggest before doing anything that you back up the generated txt files and the xlsm files somewhere.


Edited by SniperHF (12/07/15 12:28 AM)

Top
Page 2 of 2 < 1 2