Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Page 1 of 2 1 2
Joined: Nov 2016
A
stranger
OP Offline
stranger
A
Joined: Nov 2016
Hello, everyone.

I am going through the official modding documentation, namely the Dialogs.doc file, and it mentions a special dialogue option that allows the player to try and convince an NPC to do something. It also mentions a template that has it already implemented.

Long story short, there's no such template in my game folder, and the document doesn't actually have an example of how to implement this.

I did find a __Glo_IntimidateCharmLogic text file, which looks like someone's implementation, but it doesn't have any comments or examples so is of little use.

Can someone tell me how this stuff is supposed to work? I want to have a skill check in my dialogue (you know, like in Fallout New Vegas or Pillars of Eternity, where certain dialogue options appear only if player characters have sufficient points in certain skills), but I can't figure out a clean way to do it, so I'd like to use existing functionality.

Only this functionality is tucked away, as if the devs never wanted us to use it :(

Joined: Jun 2013
old hand
Offline
old hand
Joined: Jun 2013
My mod Dunamis has extensive skill checks like you describe if you wanna unpack it and work backwards.

It's pretty easy to do for abilities though.
Just toss a condition in like this in dialog:

CONDITION HasAbility(1,"Charisma",1)
CHECK c

And depending on the circumstance you'd need one for the player when he doesn't have Charisma 1, so you could put in a keyword section this one:

CONDITION HasAbility(1,"Charisma",1)
CHECK !c

So the logic goes if you "HaveAbility" Charisma 1 (or greater, which is implicit AFAIK) you'll get the first keyword node/line.

And if you don't, the node/line which has !c will show instead. You could also use this condition instead:
CONDITION HasAbility(1,"Charisma",0)
CHECK c

The !c version is probably a little safer though.

The first number in those conditions are the speaker entry, which in most two speaker dialogs using the default systems the player is going to be 1. If you are launching a 3+ speaker dialog make sure to adjust accordingly. Speaker 0,1,2,3 etc in order of how they are placed in the dialog call from Osiris. I usually try to follow the convention of the player being the last one on the list. So in a 3 speaker dialog the player would be #2.

And you can check any ability, so "Charisma", or "Barter, or "WarriorLore" and the like.


If you want to check attributes or talents that requires some script maneuvering. TheMasterRat created a fancy script back in the classic D:OS version which automatically creates globalevents for every single attribute/ability/talent the players have. It's extremely handy.
Check out this thread for more details:
http://larian.com/forums/ubbthreads.php?ubb=showflat&Number=582695

Ignore the initial topic, we went off it smile If you're interested in those files I can copy/paste them for you so you don't have to go digging through the template.



The existing functionality you were talking about isn't quite like Pillars/F:NV since it uses the rock paper scisors intimidate/charm/reason thing from the base game which I'm not too fond of. I do think I have a template for that kicking around somewhere though. I'll take a look for it.

Last edited by SniperHF; 22/11/16 02:08 AM.
Joined: Nov 2016
A
stranger
OP Offline
stranger
A
Joined: Nov 2016
Wow, thanks for a very detailed response!

If HasAbility is a built-in function, I'll probably just go with it since it's the simplest of options.

I have one question though, I've noticed that my player character has all his stats at 0 when I playtest. I load the mod directly into the level, bypassing character creation. In my char's instance properties his Stats field is set to MaleHero. Can you tell me what steps I'm missing?

Joined: Jun 2013
old hand
Offline
old hand
Joined: Jun 2013
Ah, I remembered where the templates are.

If you have the Steam version of the editor:
SteamLibrary\SteamApps\common\Divinity Original Sin Enhanced Edition\Data\Editor\Templates\Keywords\Main

IIRC the GOG version doesn't have templates since Larian forgot to include them. They uploaded them to a google drive though here:
https://drive.google.com/open?id=0BwnG474z1AoMdmZOUmEydXUxak0

The template for initiating a Charm/Intimidate/Reason template is called NPCConflict.template. Make sure when you are in the keyword editor to change the file type to template on the bottom right and then save it as a regular keyword file with another name for use.


Keep in mind that all those old docs are meant for the classic editor and not the current version. they are mostly up to date enough to be useful but you might run into random erroneous things from time to time. Feel free to ask if something isn't working.

Joined: Jun 2013
old hand
Offline
old hand
Joined: Jun 2013
Originally Posted by AbsoluteVirtue
Wow, thanks for a very detailed response!

If HasAbility is a built-in function, I'll probably just go with it since it's the simplest of options.

I have one question though, I've noticed that my player character has all his stats at 0 when I playtest. I load the mod directly into the level, bypassing character creation. In my char's instance properties his Stats field is set to MaleHero. Can you tell me what steps I'm missing?


If you feel the need to check attributes like strength let me know and I'll post the script for it.

Do you have character creation implemented yet in that they have gear/skills? When starting the game as you describe, if you have the CharacterCreation folder from main it should randomly assign your character in the editor a preset class. If it's not doing that you aren't setup right yet.

Also when you say stats at 0, do you mean attributes or abilities? cause the Attributes should either be all 5's or the defaults from the main game for each class.

Joined: Nov 2016
A
stranger
OP Offline
stranger
A
Joined: Nov 2016
Ha! Indeed they're there. My Windows search failed me, but you came to the rescue :)

It's a moot point, though, since for my purposes a CHA check is more than enough. Now if I only could figure out how to change my CHA value for testing...

Joined: Jun 2013
old hand
Offline
old hand
Joined: Jun 2013
Originally Posted by AbsoluteVirtue
Ha! Indeed they're there. My Windows search failed me, but you came to the rescue smile

It's a moot point, though, since for my purposes a CHA check is more than enough. Now if I only could figure out how to change my CHA value for testing...


CharacterAddAbility(CHARACTER_Player1,"Charisma",1);


You could also do CharacterAddAbilityPoint which will give you points just to distribute yourself but I usually do the first one since I don't want to be opening up the character sheet every time.

Also one thing that's kind of a pain in the ass for testing is once you add abilities/attributes to your character in the editor they don't go away until you actually remove them with
CharacterRemoveAbility or outright restart the editor. Or just test the 0 first.

Usually I make myself a little remote control when I use it in inventory it will grant me the ability I want for testing but if it's just a quickie I'll just stick CharacterAddAbility in the INIT section somewhere.

Last edited by SniperHF; 22/11/16 02:29 AM.
Joined: Nov 2016
A
stranger
OP Offline
stranger
A
Joined: Nov 2016
Originally Posted by SniperHF

Do you have character creation implemented yet in that they have gear/skills? When starting the game as you describe, if you have the CharacterCreation folder from main it should randomly assign your character in the editor a preset class. If it's not doing that you aren't setup right yet.

Also when you say stats at 0, do you mean attributes or abilities? cause the Attributes should either be all 5's or the defaults from the main game for each class.

Sorry for these 5-minute-long delays, can't reply faster due to spam protection.

Anyway, here's what I mean by "0"
[Linked Image]

As for proper setup, I just followed this guide: https://steamcommunity.com/sharedfiles/filedetails/?id=276641529

So if there are extra steps, I wouldn't know about them frown

Joined: Jun 2013
old hand
Offline
old hand
Joined: Jun 2013
Originally Posted by AbsoluteVirtue
[

So if there are extra steps, I wouldn't know about them frown


Hmm, that's a guide from the classic edition. Are you modding on the EE? Just to make sure we're on the same page.


I'll reply slower for the spam protection lol.

Joined: Nov 2016
A
stranger
OP Offline
stranger
A
Joined: Nov 2016
Yeah, I am working with the Enhanced Edition. Just couldn't find any guides specifically for it.

While we're at it, a few questions:
1) is there an equivalent of an if-else in Osiris? I can't find it anywhere in scripts, but I can;t believe they would leave out something so essential.
2) what's the simplest way to run a counter in Osiris? I see there are Sum functions available, but keeping track of variables in the Story Editor seems complicated.
3) how does the Random function work? Is there a way to pass to it a range inside which it should generate values? What does the Modulo argument do exactly?

Thanks for all your replies, very helpful!

A quick edit: my idea for counters consisted of making a temp DB and holding just one tuple in it with my counter's value. When I need to increment my counter, I'll just grab the current value from my DB, add 1 to it and put it back in. My initial question implied that there should be a simpler way to do it :)

Last edited by AbsoluteVirtue; 22/11/16 03:17 AM.
Joined: Jun 2013
old hand
Offline
old hand
Joined: Jun 2013
First off, try this:
Download the zip here: https://1drv.ms/u/s!AqX6ORoY5-DlgmTCOHfXUAoCT37K

Extract the folder to Divinity Original Sin Enhanced Edition\Data\Mods\YOUR MOD HERE\.

Try starting up the editor and see what the stats situation is.

Also, what is the exact name of your player character in the editor? is it Player1 ? something else?



For the questions:
1. No there is not. For CharScripts this functionality exists. Usually in Osiris I just use a lot of queries and databases in IF statements to get similar results.

2. I'm not really a script guru so much as a motivated mucker so maybe someone more familiar with the term will understand what you're asking better. But If you mean what I think you mean, you can use databases.

So say you want to count how many times a character enters a trigger:
Code
INIT SECTION:
DB_TriggerEntrances(0);
TriggerRegisterForPlayers(TRIGGER_HighwayPatrolExit1);

KB SECTION:
IF
CharacterEnteredTrigger(CHARACTER_Player1,TRIGGER_HighwayPatrolExit1)
AND
DB_TriggerEntrances(_INT)
AND
IntegerSum(_INT,1,_NewINT)
THEN
NOT DB_TriggerEntrances(_INT);
DB_TriggerEntrances(_NewINT);

IF
DB_TriggerEntrances(5)
THEN
PlayEffectAtCharacter("FX_GP_TeleportSmoke_A",CHARACTER_Player1);
TriggerUnregisterForPlayers(TRIGGER_HighwayPatrolExit1);



So here your character enters the trigger 5 times, each time that happens it takes the existing Integer (we started at 0) and adds 1. In the THEN section it removes the old number and adds the new one.

When it hits DB_TriggerEntrances(5) (you can run a statement based on a DB) the second statement goes and plays the teleport poof effect on player 1.

You could further complicate this with multiple characters (like how D:OS has two PCS) and add them to the DB as well.

I see your question #4 now that you edited though so basically you get the idea, and no there's no easier way to do it that I know of.




#3 -
Quote
3) how does the Random function work? Is there a way to pass to it a range inside which it should generate values? What does the Modulo argument do exactly?


If I understand you correctly, that's exactly what modulo does.

In my mod Dunamis I had a little control panel puzzle the player can press buttons on, but if the player didn't know how to use the panel you have the option of randomly pressing buttons. So I did that with 4 permutations like this:

Code
IF
GlobalEventSet("RandomCheck")
AND
Random(3,_RandomFlag)
THEN
NOT DB_RandomCheck(0);
NOT DB_RandomCheck(1);
NOT DB_RandomCheck(2);
NOT DB_RandomCheck(3);
GlobalClearEvent("AssemblyStop");
GlobalClearEvent("MachineOverload");
GlobalClearEvent("ConsoleNothing");
GlobalClearEvent("IdentityChange");
TimerLaunch("RandomMachineTimer",1500);
DB_RandomCheck(_RandomFlag);


So if the player activated the device with random combinations of buttons it would take the one from above once the timer was done and start the event called for:

Code

//0
IF
TimerFinished("RandomMachineTimer")
AND
DB_RandomCheck(0)
THEN
GlobalSetEvent("ConsoleNothing");

//1
IF
TimerFinished("RandomMachineTimer")
AND
DB_RandomCheck(1)
THEN
GlobalSetEvent("MachineOverload");

//2
IF
TimerFinished("RandomMachineTimer")
AND
DB_RandomCheck(2)
THEN
GlobalSetEvent("IdentityChange");

//3
IF
TimerFinished("AssemblyStop")
AND
DB_RandomCheck(3)
THEN
GlobalSetEvent("ConsoleNothing");



I can think of a cleaner way to do it I'm sure but I wrote that like a year and a half ago.


Oh another random tip while I remember, the default search of this forum is like a week long, extend it out to 3 years if you're looking for stuff. Some of the REALLY old posts will have erroneous info but there's good stuff in there as well. I wrote a few tutorials back in the day too and I think they are still usable.


Also, since you used that old guide, make sure to go into Modding>Module Settings and ensure you have both the MAIN and Shared datapacks.

Last edited by SniperHF; 22/11/16 03:37 AM.
Joined: Nov 2016
A
stranger
OP Offline
stranger
A
Joined: Nov 2016
Yep, it worked, my char now has all his main attributes at 5 :) Thanks! And yes, I have both Main and Shared in my data packs.

I did name my character Player1, because there's a text file that won't let me build my mod in Story Editor unless I have a character named Player1 somewhere in the mod, and I figured that should be my main character, just in case.

Thanks for clearing things up with Random and counters. And an extra "thank you" for providing examples :)

One last question, I notice that whenever I attack my NPCs they don't initiate combat with me, so I can kill them without any resistance. I know there's a function call CharacterAttackCharacter, but I assumed they would at least defend themselves.

I then noticed that the editor kept saying my NPCs didn't have any alignment. At first I thought it meant their spacial alignment, but now I think it talks about whether they're good or bad. Could this be the reason why they aren't attacking me? What alignment should I set for them? Will this affect being detected while picking pockets?

Joined: Jun 2013
old hand
Offline
old hand
Joined: Jun 2013
Originally Posted by AbsoluteVirtue

One last question, I notice that whenever I attack my NPCs they don't initiate combat with me, so I can kill them without any resistance. I know there's a function call CharacterAttackCharacter, but I assumed they would at least defend themselves.

I then noticed that the editor kept saying my NPCs didn't have any alignment. At first I thought it meant their spacial alignment, but now I think it talks about whether they're good or bad. Could this be the reason why they aren't attacking me? What alignment should I set for them? Will this affect being detected while picking pockets?


Yes it is. Try giving them CYS_Village as an alignment. Or Evil NPC (no underscore).

If that doesn't work you need the Alignments.lsx file from the same templates folder as before. It goes in Data\Mods\YOUR MOD/Story/Alignments

This is one of those things Larian should have made automatically copy but never did for reasons.


One other random tip about the dialog checks. If you are using level override to make your character level 5 for testing, it does all sorts of goofy stuff with skill checks. So if you're testing those make sure you're at the default level override.

Last edited by SniperHF; 22/11/16 05:05 AM.
Joined: Nov 2016
A
stranger
OP Offline
stranger
A
Joined: Nov 2016
Thanks again, I'm off to testing wink

Joined: Nov 2016
A
stranger
OP Offline
stranger
A
Joined: Nov 2016
OK, alignments work now, but they still don't attack me if I attack them laugh Could it be because they have no weapons on them?

EDIT: gave them weapons, and nothing. They won't defend themselves. I give up. I'll assume it's a pacifist village.

I tried giving them CYS_Village, Good NPC and Evil NPC. Evil NPC makes them attack me on sight, though, so I have two ends of the spectrum when I need them to meet in the middle

EDIT 2: oh, if I initiate dialogue with them while having my weapon out, I can make them attack me via the default options you get when you talk with NPCs with your weapon out. So the alignment thing does work, but for some reason they don't react to being hit with weapons outside of dialogue.

Last edited by AbsoluteVirtue; 22/11/16 07:05 PM.
Joined: Jun 2013
old hand
Offline
old hand
Joined: Jun 2013
I'm away from my editor at the moment so I'm gonna be kinda vague/going from memory.

Since Evil NPC works correctly it's not an alignments issue.

I think I know what's going on. When you hit an NPC with a weapon and they have the CYS_Village alignment, they should not just outright attack you but should start a dialog saying something like "HEY Don't do that" and you lose like 15 attitude points. Check the debug/event log and see if it's trying to call a dialog file that doesn't exist.

You should be able to get that dialog file from the templates folder.

There's a way to make them attack back in response on the first hit if that's what you want but one problem at a time horsey

Also, to be clear; the NPCs are all global correct? Basically any NPC that isn't a mindless enemy for combat should be global.


Last edited by SniperHF; 22/11/16 10:11 PM.
Joined: Nov 2016
A
stranger
OP Offline
stranger
A
Joined: Nov 2016
Yep, all global.

Unfortunately, I cannot attack them anymore because I tried assigning different gear to my player character (by changing the Equipment field to MaleHero from Imps_Spear), and now he has no weapons no matter what I try to give him (changing it back to Imps_Spear does nothing).

Joined: Jun 2013
old hand
Offline
old hand
Joined: Jun 2013
I think most root templates can attack with their fists unarmed.

Are you using the ImpPlayer root template for the PC? Or just a random Imp?

Also for stats/equipment issues usually restarting the editor after you set all the fields will do the trick. But you can also just reload the story for global characters.

Have you tried just placing a weapon on the ground to pick up and use for now?

Most of these issues are probably due to how character creation works. It's probably trying to give your imp a weapon it can't use. You can disable that by simply commenting out Player1 from being added to character creation in the story editor.

Last edited by SniperHF; 22/11/16 10:43 PM.
Joined: Nov 2016
A
stranger
OP Offline
stranger
A
Joined: Nov 2016
I'm using the Imp_Historian root template.

Got my weapon back, tried attacking them, and I don't see any messages in the logs. Maybe I should just toss all the dialogues from templates into my mod and see what happens.

EDIT:
dropped everything from templates into my
Data\Mods\MOD/Story/Keywords
folder, and nothing.

maybe it's just not meant to be smile

Last edited by AbsoluteVirtue; 22/11/16 10:57 PM.
Joined: Jun 2013
old hand
Offline
old hand
Joined: Jun 2013
Originally Posted by AbsoluteVirtue
Maybe I should just toss all the dialogues from templates into my mod and see what happens.


That's pretty much what I did. You can put them in a separate folder under the Keywords folder to keep them apart from your own files and the game will still find them.

Page 1 of 2 1 2

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5