Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
#531106 28/07/14 08:27 PM
Joined: Jul 2014
P
stranger
OP Offline
stranger
P
Joined: Jul 2014
Couple questions.

I was wondering how do you make NPC walk around a set area. I noticed one of the kickstarter characters will walk around by without anyhelp, but regular NPCs do not.

I also wondered on top of that how would one make them sit, I've made a bar and i want my NPCs sitting at a table playing cards.

Any help would be awesome

Joined: Jul 2014
R
addict
Offline
addict
R
Joined: Jul 2014
NPC behaviors like walking or sitting are defined in a .charScript file, which is then attached to the RootTemplate of the character using that script.

Aureus' script might be a good example to look at- he does a variety of different actions.

Rhidian #531156 28/07/14 10:31 PM
Joined: Jul 2014
P
stranger
OP Offline
stranger
P
Joined: Jul 2014
Sorry for being a noob. 1st time modding. but how would i find this .charScript file. And how would i attach it. I tried just putting Aureus Script in the script under the side bar. Didnt change anything unless im just missing something... Prolly am... Thanks for any potential help =D

Joined: Jul 2014
R
addict
Offline
addict
R
Joined: Jul 2014
Aureus' script is pretty specific for his situation/room, so plugging it in on a random character will likely not work.

Unfortunately, at this time I don't think anyone can really tell you how to get a character to sit via scripting, since most of our attention has been on figuring out how the basic functions in the Editor work (Character Creation, etc). Research into how CharScripts truly work hasn't been done yet to my knowledge, and the lack of official documentation doesn't help.

I can, however, tell you how you can get your own script into the game. CharScript files are basically txt files, but with a .charScript extension. When you write your own, you can save it anywhere you like (though I suggest saving it in the Data/Public/(Your Mod folder)/Scripts/

Then in the Editor, at the top is a button that allows you to view Resources. In the box that pops up, click your mods folder at the left, and then press the button near the top left that says "New Package". Name the package whatever you want and save that.

Then click the button near the top left that says "New Resource" (or import resource; I can't recall at the moment). You can then navigate to your Script file and add it to the Package you just created.

After that is done, you can finally attach your script to the Character RootTemplate of your choice via the Sidebar.

----

While I can't tell you how your script file should be structured, it might be useful to look at the other charScripts that the game uses. You would have to Unpack the Main.pak file using a third party tool to do so though (search for Norbyte on this forum; his tool is the one that does it).

For your reference though, here is the Chicken.charScript file- The wandering part might prove useful

Code
INIT
CHARACTER:__Me

BEHAVIOUR

REACTION Wander,1
USAGE ALL
ACTIONS
	CharacterWander(FLOAT:5,5)
	Sleep(1)
	CharacterWander(FLOAT:3,3)
	Sleep(0.5)
	Goto(Start)

REACTION FleeFromNeutral,3
USAGE ALL
VARS
	CHARACTER:_char
	FLOAT:_dist
CHECK "c1"
	CharacterGet(_char,__Me,4,Lowest,Distance,Neutral,null,null)
ACTIONS
	CharacterFleeFrom(Neutral,8)

REACTION FleeFromEnemy,5
USAGE ALL
VARS
	CHARACTER:_char
	FLOAT:_dist
CHECK "c1"
	CharacterGet(_char,__Me,4,Lowest,Distance,Enemy,null,null)
ACTIONS
	CharacterFleeFrom(Enemy,8)


Rhidian #531203 28/07/14 11:20 PM
Joined: Jun 2014
apprentice
Offline
apprentice
Joined: Jun 2014
Originally Posted by Rhidian


Unfortunately, at this time I don't think anyone can really tell you how to get a character to sit via scripting,


You add the Sit script to the character and copy the UID of the object you want them to sit on.

[Linked Image]

dsvw56 #531857 30/07/14 01:46 AM
Joined: Jul 2014
P
stranger
OP Offline
stranger
P
Joined: Jul 2014
Originally Posted by dsvw56
Originally Posted by Rhidian


Unfortunately, at this time I don't think anyone can really tell you how to get a character to sit via scripting,


You add the Sit script to the character and copy the UID of the object you want them to sit on.

[Linked Image]


Where do you put the UID?

Joined: Jul 2014
P
stranger
OP Offline
stranger
P
Joined: Jul 2014
Nevermind i found it! THANKS A BILLION GOOD SIR!
\

Joined: Jun 2014
apprentice
Offline
apprentice
Joined: Jun 2014
Originally Posted by Pinkpandasays
Nevermind i found it! THANKS A BILLION GOOD SIR!
\


For anyone else wondering, after you add a script to a character, if you highlight it some options will show up for it. This is where you put the UID.


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