Was thinking I’d change the name of an area through dialog (and of course script), but so far this has failed somewhat miserably.
Still not possible to set an area name through script, is that so?
am sure there was a thread on the old forum that talked about it but i can’t find it. but if I really wanted to change area-names, modify ‘minimap.xml’
and change the OnUpdate call in this element:
<UIText name="AREA_NAME_TEXT" x="ALIGN_CENTER" y="7" width="180" height="20" align="center" valign="middle"
fontfamily="Special_Font" style="3" multiline="false"
OnUpdate='UIText_OnUpdate_DisplayAreaName()' update="true" />
to a run a custom script that gets a local_string, stored on each area. As a local_string it can be changed ad hoc ofc.
/untested
That seems pretty nice, except that my brain hurts.
If you could provide an example with a little more info that would be very nice of you.
uh, you pretty much gotta learn how scripting interacts with the GUIs.
here’s the de facto tutorial : https://neverwintervault.org/project/nwn2/other/gui/nwn2-xml-gui-coding-beginners
and here’s a blog by the Obsidian guy who spent a fair bit of time developing it : http://oeiprogrammer.blogspot.ca/2007/01/something-new.html
but basically it’s gonna go something like this:
in ‘minimap.xml’
add scriptloadable=“true” to its UIScene (if it isn’t there already)
and in the AREA_NAME_TEXT element, change
OnUpdate=‘UIText_OnUpdate_DisplayAreaName()’
to
OnUpdate=‘UIObject_Misc_ExecuteServerScript(“gui_updateareaname”)’
and add updaterate=“0.5” to slow down the refresh.
Here’s what it looks like in the testing i just did:
<UIText name="AREA_NAME_TEXT" x="ALIGN_CENTER" y="7" width="180" height="20" align="center" valign="middle"
fontfamily="Special_Font" style="3" multiline="false"
OnUpdate='UIObject_Misc_ExecuteServerScript("gui_updateareaname")' update="true" updaterate="0.5" />
‘gui_updateareaname’ is a custom script:
// 'gui_updateareaname'
void main()
{
object oPlayerPc = GetFirstPC();
object oArea = GetArea(oPlayerPc);
string sLabel = GetLocalString(oArea, "AreaLabel");
while (GetIsObjectValid(oPlayerPc))
{
SetGUIObjectText(oPlayerPc, "SCREEN_MINIMAP", "AREA_NAME_TEXT", -1, sLabel);
oPlayerPc = GetNextPC();
}
}
and for convenience here’s a console-script to change the area-name:
// 'setarealabel'
void main(string sLabel)
{
object oArea = GetArea(GetFirstPC());
SetLocalString(oArea, "AreaLabel", sLabel);
}
to start things off you’d need to set the local_string “AreaLabel” on each area … else the MiniMap would show a blank string.
/tested
The file ‘minimap.xml’ is in the <install>/Neverwinter Nights 2/UI folder. That’s a low priority folder, so a copy in the module or Campaign folder ought to override it (it might even work in a .hak). And ofc the /Override is fine for testing.
The custom script is just a script. But it should start w/ “gui_” (as a safety feature for servers, i think)
all this is barring the idea that there really is a function that can change an area-name. Shallina - who knows her stuff - mentioned it but i didn’t test it at the time and can’t find the old thread …
I’ll look into it tomorrow after work, thanks.