1.06 will have a number of new script functions that will give improved control over custom GUIs.
Two of the new script functions are:
SetGUIProgressBarPosition();
This script function will let you set the position of a progress bar (Between 0.0 for empty and 1.0 for full).
The other new function is:
SetGUITexture();
This script function will let you set the texture for a UIIcon, a UIFrame's fill texture, or a Button's Base Frame's fill texture.
Both script fun
By Rich Taylor
In 1.06, it will be possible to set up multiple GUI callbacks on a single UI event in XML. The syntax will be to use the event name and append a number to it. The engine will read in the callbacks until it fails to find the next sequential number.
For example, I could set up a UI Button to with the following callbacks:
OnUpdate=UIObject_OnUpdate_DisableIfLocalVarEquals(local:3,"true")
OnLeftClick=UIObject_Input_ScreenOpen("SCREEN_OPTIONS","false")
OnLeftClick0=U
UIObject_Tooltip_DisplayTooltipString takes up to 9 parameters, but only the first four parameters are required.
Parameter list:
Message = The literal string to display in the tooltip
XLoc = The X origin for where the tooltip should appear. This can be a pixel location, or you can use the following two strings to make it relative: MOUSE_X will place the X origin of the tooltip near where the mouse is. OBJECT_X will place the tooltip next to the UIObject that is being moused over,
The only valid parameter to this callback is a local or global GUI variable index.
localguivars are expressed as local:#, where # is the index for the variable.
globalguivars are expressed as global:#, where # is the index for the variable.
This callback takes the engine-level data in a UIObject and stores it in a global or local gui variable. The engine-level data will vary from UIObject to UIObject. It is also impossible to specify which data item you want to set the GUI variable t
This callback takes a single parameter. It's only purpose is to enable or disable a button based on whether or not the user has selected a row in a List Box.
The single parameter is:
sListBoxName = The name of the list box we want to check for selection.
If the user has a row selected in the listbox named in the parameter, then the UIButton will be set to Enabled.
If the user does not have a row selected in the listbox named in the parameter, then the UIButton will be disabled.
UIButton is the generic, clickable object one expects to find on any PC game interface. It also acts as a 'restricted' container of sorts, as it can contain specific UI objects within it.
A button is made up of several child objects contained in a single pane. These pieces can be defined explicitly or left up to the engine to define.
The child objects that a UIButton can contain are:
Up to 1 UIText field. If a UIText object is not defined as a child object in the XML, the engine will
(Rich Taylor gives us a peek into 2da caching)
Our lead scripter, Charles Mead, informed me that we did not cache 2DAs that were being queried by script. This resulted in ridiculous seek time for looping over large 2DAs.
He indicated that Bioware had fixed that in the 1.64 code, so I referenced the 1.67 code drop that we had and saw that they had implemented a system whereby the most recent 2 2DAs that were queried were cached.
I took that a bit further and made it so that the # o
UIText is the GUI object used for containing and rendering text. It is one of the more complicated UI Objects to work with.
UIText takes the following attributes:
fontfamily
This defines which font should be used via a string argument. The fonts are defined in fontfamily.xml. The 'name' attribute for the different UIFontFamily elements in fontfamily.xml is how they are identified here. If this attribute is not set, then the text field will use the 'Default' font family defined in fon
By: Rich Taylor
UI Frame is used for borders and backgrounds for other UI Objects. UIFrames are imbedded in buttons and a few of the container style UI Objects that will be discussed later.
The following attributes are handled by UIFrame:
The following is a list of the texture pieces that make up a frame. They take a texture name as an argument. The texture pieces are:
topleft, topright, top, left, right, bottom, bottomleft, bottomright, fill.
The next set of attributes are
By: Rich Taylor
In 1.05 there is a new attribute that all UI Objects handle called hideoverride. If true, this attribute sets a UI Object hidden and keeps it that way until a script says otherwise via the SetGuiObjectHidden() script function.
This can be used to keep an item hidden that the GUI may try to make visible regardless what a script tries to do, such as a row in a list box.
As a result, objects that are set hidden via SetGuiObjectHidden() will STAY hidden no matter what,
Q: Trying to modify the knockdown feat in the feats.2da and here's what I've found.
There is both a Cooldown time and also a Uses per day.
Cooldown
If I set a cooldown time it "works", in a sense you can only use the kd feat every X seconds (whatever you set it as) - but the problem with this, is that it doesn't give any graphical feed back to the users (for example, Rage shows a "greyed out" icon and how long you have to wait till you can reuse it again - if I modify the kd feat it d
Q: With 8-bit alpha, is it possible with the current NWN2 engine to use the alpha to make a surface translucent (as in 50% opacity with an alpha pixel value of 50%)?
A: There are two ways to make a surface translucent.
One way would be to make a special effect that edits the alpha. In the VFX editor this would be called a "game model effect". Then you'd have to assign the effect to the object via the toolset, or script.
The second way would be to export the model that you want the
By: Rich Taylor
Taking a break from writing about the UI Elements for a moment, though there are still some of those that I will cover in future posts.
Most XML files are loaded as default UI Scene, which implies no special behaviors. There are, however, several XML files that will get special handling in code and most conform to specific rules in order to even be loaded. All of these scenes are distinguished by their identifying name in the INI file (Or the screen tag given to them wh
UIObject is the 'base' GUI object. You can't actually define it in XML, but it contains attributes that are common to many different UI Objects, so I'm starting here.
The following are the attributes that will be loaded for every UI Object in the XML file except for the attributes.
Some attributes will be ignored or overridden depending on the situation. Note that attributes are case sensitive.
name
String value for the name of the UI Object. This is used internally and will be
UIPane is the generic 'container' for other UI Objects. Panes can't be rendered, but they can contain 'child' objects which can be renderable objects.
Every scene has a 'rootpane', which is automatically defined by the engine when a new UIScene is loaded from a XML file.
Child objects within a pane will be positioned with their x,y origin relative to the origin of the UI Pane that contains the child. UIPanes can also simulate buttons with the tupple attribute, so many of the attributes
Rich Taylor gives us a peek into what will be in the 1.05 patch:
While the 1.04 patch is about to come out for NWN2, the 1.05 patch isn't too far off either. Rather than make 1.05 a big patch like 1.04 is, we want to release a small, quick patch to try and quickly resolve some issues the custom content community for NWN2 is running into.
I recently revamped the auto-updater to allow for incremental patches. This means that if someone had 1.02, the patcher would patch them up to 1.03, t
The UIScene tag at the top of the XML files defines certain global parameters about the entire GUI window being defined in the file.
A scene doesn't have anything to render by default, but rather contains items that will get rendered. So a file that defines a UIScene and nothing else will not appear as anything in the game.
Some of the attributes for UIScene overlap with those of UIObject, even though UIScene does not inherit from UIObject, so this attributes will be repeated here.
Q: Some of the blocks in a MDB file have a 32-bit field in front of the vertex count field, which we assume is a flag bit vector. In most cases it has a value of 0, but occasionally some bits are set. What do they indicate?
A: The bitflags are as follows for skin and rigid packets:
const DWORD NWN2_ALPHA_TEST = 1 << 0;
const DWORD NWN2_ALPHA_BLEND = 1 << 1; // #### SHOULD NOT BE USED
const DWORD NWN2_ADDITIVE_BLEND = 1 << 2; // #### SHOULD NOT BE USED
const DWOR
Q: Ranges.2da has 2 columns labeled 'PrimaryRange' and 'SecondaryRange' which are apparently only used for perception ranges... Which of these columns affects the seeing range and which hearing (I assume 'Primary' is hearing based on my tests, but I'm not sure)? What values does the PercepRngDefault use? It uses the usual **** entries for default values, but where is that value defined?
A: Primary Range is the Spot range (Visual range)
Secondary Range is the Listen range (Hearing range)
Q: Currently I am working on a community download pack containg a large variety of foilage placeables (ferns, shrubs, weeds, flowers, small trees etc.). I am using alpha layers in my textures, and currently have tried dxt5 interpolated alpha (this is what format I use for my foilage in other engines such as UT2003/4) and also dxt1 with alpha, but I get no transparency in the toolset. My models and textures are showing up in the toolset just fine, but the engine seems to ignore the alpha on my d
Q: In walkmeshes, each face has a 32-bit flag. We have seen the values 0x0, 0x9, 0x11, 0x21, 0x41 and 0x101. The bottom bit seems to indicate whether the face is walkable or not, but what do the other bits mean?
A: The bit assignments for the walkmesh face flags are: bit 0: walk bit ( 1 = walk, 0 = no walk ) bit 1 - 2: reserved bit 3 - 13: material ( used for footstep sounds, etc... I dont know what will happen if more than one of these are set at the same time. I dont recommend it. )... bi
Q: Is there a way that you can filter the domains available when taking the first level of cleric, based on the deity the player chooses? Torm, for example, might only offer the Good, Sun, War and Healing domains. Is this possible?
A: It is not currently possible to restrict domains based on deity selection.
The Domain GUI code has no knowledge of your deity selection, nor is there any data loaded up on a deity-by-deity basis on what domains are in that deity's portfolio. Also, default
Q: How long can a variable name be? How long can a string be?
A: While the runtime virtual machine doesn't have any limits that we could find, the compiler will reject tokens that are longer than 512 characters. So that would probably be the de facto limits of variable or hard coded string length.
Q: What effect information do different values for the Idx parameter give back for GetEffectInteger()? There doesn't appear to be many comments on this function that I can find.
A:
Welcome to the Neverwinter Nights 2 Blog!
Here you will find answers to questions asked on the official Neverwinter Nights 2 Forums and some additional information put out by some of the developers at Obsidian.
With these Blogs we hope to give you some insight into the workings of the game and answer some of the more difficult questions