Is it possible to change the display name of an area in game though a script? I can only find a function for changing names of creatures like SetLastName and SetFirstName…
Yes, it’s possible.
https://neverwintervault.org/forums/neverwinter-nights-2/nwn2-scripting/editing-area-props-game - post #7, post #20
https://forum.neverwintervault.org/t/still-no-set-area-name-through-scripts/276
Ok. Thanks! I’ll read those.
I tried with kevL’s sollution found in the “Still no set area name through scripts…?” thread and jestemwlodzimierz’s sollution from the old forums.
Both these worked kind of…but just as kevL’s said in the latest thread one needs to do something about
to start things off you’d need to set the local_string “AreaLabel” on each area … else the MiniMap would show a blank string.
'cause now all areas (I haven’t tested the area where I changed the name yet) have a blank string. How do you set the local string to each area? Do I have to somehow make lots of “gui_updateareaname” scripts, one for each area that I put somewhere under “scripts” in each area’s properties…or…? How exactly does this work? (To be honest I haven’t read this yet so maybe therein lies the answer: NWN2 XML & GUI Coding For Beginners | The Neverwinter Vault)
roughly, go the the Properties of your areas (in the toolset) and under Scripts section, in the Variables field, add
AreaLabel=01theforest
eg. add the varname and value in that toolset slot (ie, a local string on each area)
You don’t have to do it manually. You can loop through all areas in the module when this module loads for the first time and place the original area name in that variable on each area.
object oArea = GetFirstArea();
string sName;
while (GetIsObjectValid(oArea))
{
sName = GetLocalString(oArea, "AreaLabel");
if (sName == "")
{
sName = GetName(oArea);
SetLocalString(oArea, "AreaLabel", sName);
}
oArea = GetNextArea();
}
P.S. Note that the GetName()
function is in the Broken Functions List with the following warning: “Only returns english names”. I didn’t test it myself.
I’m struggling to get this to work. I’m not sure I’m doing it right. I have edited the minimap.xml file so it looks like this:
<?xml version="1.0" encoding="utf-8"?>
<!--
MiniMap
Adam Brennecke - 01/04/06
Obsidian Entertainment
Copyright 2006
Because the minimap DEPENDS on scale and we do not enforce aspect ratio, we do not rescale the minimap.
-->
<UIScene name="SCREEN_MINIMAP" x=ALIGN_LEFT y=ALIGN_TOP width=215 height=208 priority="SCENE_INGAME"
draggable=true dragregion_x=0 dragregion_y=0 dragregion_width=215 dragregion_height=29 scriptloadable=“true”/>
<UIText name="AREA_NAME_TEXT" x=ALIGN_CENTER y=7 height=22 width=176 align=center valign=middle fontfamily="Special_Font" style="3" multiline=false
update=true OnUpdate=‘UIObject_Misc_ExecuteServerScript(“gui_updateareaname”)’ updaterate="0.5" />
<UIText name="AREA_NAME_TEXT_LARGE" x=ALIGN_CENTER y=14 height=22 width=212 align=center valign=middle fontfamily="NWN1_Dialog" style="1" multiline=false
update=true hidden=true OnUpdate=UIText_OnUpdate_DisplayAreaName() />
<UIText name="AREA_NAME_TEXT_COLLAPSE" x=ALIGN_CENTER y=7 height=22 width=176 align=center valign=middle fontfamily="Special_Font" style="3" multiline=false
update=true hidden=true OnUpdate=UIText_OnUpdate_DisplayAreaName() />
<UIPane name="MINIMAP_HEADER" x=21 y=8 width=170 height=28 OnLeftDoubleClick=UIPane_Input_MiniMapMakeLarge() tupple=true capturemouseclicks=false > </UIPane>
<UIPane name="MINIMAP_HEADER_LARGE" x=13 y=10 width=226 height=32 OnLeftDoubleClick=UIPane_Input_MiniMapCollapse() hidden=true tupple=true capturemouseclicks=false > </UIPane>
<UIPane name="MINIMAP_HEADER_COLLAPSE" x=21 y=8 width=170 height=28 OnLeftDoubleClick=UIPane_Input_MiniMapMakeSmall() hidden=true tupple=true capturemouseclicks=false > </UIPane>
<!-- Mini Map Zoom In -->
<UIButton name="MINIMAP_ZOOM_IN" x=22 y=34 width=30 height=30 OnLeftClick=UIButton_Input_MiniMapZoomIn()>
<UIFrame state=up fill="button_rzoomin_normal.tga" />
<UIFrame state=down fill="button_rzoomin_hover_pressed.tga" />
<UIFrame state=focused fill="button_rzoomin_normal.tga" />
<UIFrame state=hilited fill="button_rzoomin_hover.tga" />
<UIFrame state=hifocus fill="button_rzoomin_hover.tga" />
<UIFrame state=disabled fill="button_rzoomin_disabled.tga" />
</UIButton>
<!-- Mini Map Zoom Out -->
<UIButton name="MINIMAP_ZOOM_OUT" x=163 y=34 width=30 height=30 OnLeftClick=UIButton_Input_MiniMapZoomOut()>
<UIFrame state=up fill="button_rzoomout_normal.tga" />
<UIFrame state=down fill="button_rzoomout_hover_pressed.tga" />
<UIFrame state=focused fill="button_rzoomout_normal.tga" />
<UIFrame state=hilited fill="button_rzoomout_hover.tga" />
<UIFrame state=hifocus fill="button_rzoomout_hover.tga" />
<UIFrame state=disabled fill="button_rzoomout_disabled.tga" />
</UIButton>
<!-- Mini Map Zoom In Large-->
<UIButton name="MINIMAP_ZOOM_IN_LARGE" hidden=true x=13 y=44 width=41 height=41 OnLeftClick=UIButton_Input_MiniMapZoomIn()>
<UIFrame state=up fill="button_rzoomin_normal.tga" />
<UIFrame state=down fill="button_rzoomin_hover_pressed.tga" />
<UIFrame state=focused fill="button_rzoomin_normal.tga" />
<UIFrame state=hilited fill="button_rzoomin_hover.tga" />
<UIFrame state=hifocus fill="button_rzoomin_hover.tga" />
<UIFrame state=disabled fill="button_rzoomin_disabled.tga" />
</UIButton>
<!-- Mini Map Zoom Out Large-->
<UIButton name="MINIMAP_ZOOM_OUT_LARGE" hidden=true x=201 y=44 width=41 height=41 OnLeftClick=UIButton_Input_MiniMapZoomOut()>
<UIFrame state=up fill="button_rzoomout_normal.tga" />
<UIFrame state=down fill="button_rzoomout_hover_pressed.tga" />
<UIFrame state=focused fill="button_rzoomout_normal.tga" />
<UIFrame state=hilited fill="button_rzoomout_hover.tga" />
<UIFrame state=hifocus fill="button_rzoomout_hover.tga" />
<UIFrame state=disabled fill="button_rzoomout_disabled.tga" />
</UIButton>
<!-- These must be above the radar frame, so that they draw over it -->
<UIPane name="PARTY_OFFSCREEN_PANE" x=36 y=45 width=150 height=150 ignoreevents=true capturmouseclicks=false capturemouseevents=false />
<UIPane name="PERCEPTION_OFFSCREEN_PANE" x=36 y=45 width=150 height=150 ignoreevents=true capturmouseclicks=false capturemouseevents=false />
<UIPane name="MAPPOINT_OFFSCREEN_PANE" x=36 y=45 width=150 height=150 ignoreevents=true capturmouseclicks=false capturemouseevents=false />
<UIPane name="TARGET_OFFSCREEN_PANE" x=36 y=45 width=150 height=150 ignoreevents=true capturmouseclicks=false capturemouseevents=false />
<UIIcon name="RADAR_FRAME" width=215 height=208 img="radar_frame.tga" ignoreevents=true />
<UIIcon name="RADAR_FRAME_LARGE" hidden=true width=253 height=275 img="radar_frame_big.tga" ignoreevents=true />
<UIIcon name="RADAR_FRAME_COLLAPSE" hidden=true width=186 height=43 img="minimap_minimized.tga" ignoreevents=true />
<UIIcon name="PLAYER_ARROW" width=18 height=22 img="radar_player_arrow.tga" color="silver" />
<UIIcon name="PLAYER_CAMERA" width=49 height=144 img="radar_camera_direction.tga" />
<UIIcon name="PARTY_MARKER" width=14 height=18 img="radar_player_arrow.tga" color="0x8BDAE9" />
<UIIcon name="PARTY_OFFSCREEN_MARKER" width=16 height=8 img="radar_marker00_offradar.tga" color="0x8BDAE9" />
<UIPane name="PARTY_PANE" x=36 y=45 width=150 height=150 ignoreevents=true capturmouseclicks=false capturemouseevents=false/>
<UIIcon name="PERCEPTION_MARKER" width=20 height=21 img="radar_p_marker01.tga" />
<UIIcon name="PERCEPTION_OFFSCREEN_MARKER" width=16 height=8 img="radar_marker00_offradar.tga" />
<UIPane name="PERCEPTION_PANE" x=36 y=45 width=150 height=150 ignoreevents=true capturmouseclicks=false capturemouseevents=false/>
<UIIcon name="MAPPOINT_MARKER" width=16 height=16 img="radar_map_marker.tga" color="0xE0C69B" />
<UIIcon name="MAPPOINT_OFFSCREEN_MARKER" width=16 height=15 img="radar_marker01_offradar.tga" color="0xE0C69B" />
<UIPane name="MAPPOINT_PANE" x=36 y=45 width=150 height=150 ignoreevents=true capturmouseclicks=false capturemouseevents=false/>
<UIIcon name="TARGET_MARKER" width=20 height=21 img="radar_p_marker02.tga" />
<UIIcon name="TARGET_OFFSCREEN_MARKER" width=16 height=16 img="radar_marker02_offradar.tga" />
<UIPane name="TARGET_PANE" x=36 y=45 width=150 height=150 ignoreevents=true capturmouseclicks=false capturemouseevents=false/>
<!-- Mini Map Special Image -->
<!-- This pane control is mandatory and it's name will be held onto by the rootscene for use in other callbacks -->
<UIPane name="MINIMAP_IMAGE_PANE" x=36 y=45 width=150 height=150 update=true OnUpdate=UIPane_OnUpdate_UpdateMiniMap() ignoreevents=true capturmouseclicks=false capturemouseevents=false></UIPane>
<UIPane name="MINIMAP_IMAGE_PANE_LARGE" x=26 y=50 width=200 height=200 update=false ignoreevents=true capturmouseclicks=false capturemouseevents=false></UIPane>
And then I made the script gui_updateareaname as per kevL_s instructions
// '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();
}
}
My question is now to you Aqvilinus: Do I implement the script you wrote into this so it should look something like this (maybe I’m getting this totally wrong)?
// 'gui_updateareaname'
void main()
{
object oArea = GetFirstArea();
string sName;
while (GetIsObjectValid(oArea))
{
sName = GetLocalString(oArea, "AreaLabel");
if (sName == "")
{
sName = GetName(oArea);
SetLocalString(oArea, "AreaLabel", sName);
}
oArea = GetNextArea();
}
object oPlayerPc = GetFirstPC();
object oArea1 = GetArea(oPlayerPc);
string sLabel = GetLocalString(oArea1, "AreaLabel");
while (GetIsObjectValid(oPlayerPc))
{
SetGUIObjectText(oPlayerPc, "SCREEN_MINIMAP", "AREA_NAME_TEXT", -1, sLabel);
oPlayerPc = GetNextPC();
}
}
And then perhaps use this script (kevL_s script) in dialog to change the name of the area that I want to change at the moment?
// 'setarealabel'
void main(string sLabel)
{
object oArea = GetArea(GetFirstPC());
SetLocalString(oArea, "AreaLabel", sLabel);
}
It’s better to place my code in the OnModuleLoad or OnPCLoaded event handler script of your module (View -> Module Properties -> ‘Scripts’ section).
//'On PC Loaded script'
//
void main()
{
int nStart = GetLocalInt(GetModule(), "nStart"); //run this only once
if (!nStart)
{
//my code here
//....
SetLocalInt(GetModule(), "nStart", TRUE);
}
}
Thanks Aqvilinus!
I’ll try it out now in game.
P.S. By the way, I tried kevL_s thing with:
roughly, go the the Properties of your areas (in the toolset) and under Scripts section, in the Variables field, add
AreaLabel=01theforest
eg. add the varname and value in that toolset slot (ie, a local string on each area)
but that didn’t work strangely enough, but I think I maybe got that wrong somehow…anyway, I’ll try your solution now and I’ll bet back to you.
This is really wierd. As soon as I run the game to test this out, like before there’s only a blank line right now above the minimap where the name of the area should go (and this area I haven’t changed name on, that comes later in another area).
I’ve placed my edited minimap.xml in the override folder in MyDocuments by the way.
And I placed your script that now looks like this in the OnPCLoaded slot on the Module Properties:
//'On PC Loaded script'
//
void main()
{
int nStart = GetLocalInt(GetModule(), "nStart"); //run this only once
if (!nStart)
{
object oArea = GetFirstArea();
string sName;
while (GetIsObjectValid(oArea))
{
sName = GetLocalString(oArea, "AreaLabel");
if (sName == "")
{
sName = GetName(oArea);
SetLocalString(oArea, "AreaLabel", sName);
}
oArea = GetNextArea();
}
SetLocalInt(GetModule(), "nStart", TRUE);
}
}
In the OnModuleLoad slot on Module properties I use the x2_mod_def_load script. Maybe that has got to do with anything?
Try what jestemwlodzimierz suggested:
-
In minimap.xml replace all "OnUpdate=UIText_OnUpdate_DisplayAreaName() with "OnUpdate=UIText_OnUpdate_DisplayLocalVar(local:1) "
-
In gui_updateareaname.nss:
// 'gui_updateareaname'
void main()
{
object oPlayerPc = GetFirstPC();
object oArea = GetArea(oPlayerPc);
string sLabel = GetLocalString(oArea, "AreaLabel");
while (GetIsObjectValid(oPlayerPc))
{
SetLocalGUIVariable(oPlayerPc, "SCREEN_MINIMAP", 1, sLabel);
oPlayerPc = GetNextPC();
}
}
- Remove
OnUpdate=‘UIObject_Misc_ExecuteServerScript(“gui_updateareaname”)’
from
<UIText name="AREA_NAME_TEXT" ... >
and edit<UIScene name="SCREEN_MINIMAP" ...>
<UIScene name="SCREEN_MINIMAP" x=ALIGN_LEFT y=ALIGN_TOP width=215 height=208 priority="SCENE_INGAME" draggable=true dragregion_x=0 dragregion_y=0 dragregion_width=215 dragregion_height=29 OnAdd=‘UIObject_Misc_ExecuteServerScript(“gui_updateareaname”)’ scriptloadable=“true”/>
Thanks for all the help!
I’m afraid I get the same result though. Just a blank line on the minimap when I load the first area. When I press M though to get a larger map the name is there.
This is how my minimap.xml file looks right now (maybe I didn’t get it right?):
<?xml version="1.0" encoding="utf-8"?>
<!--
MiniMap
Adam Brennecke - 01/04/06
Obsidian Entertainment
Copyright 2006
Because the minimap DEPENDS on scale and we do not enforce aspect ratio, we do not rescale the minimap.
-->
<UIScene name="SCREEN_MINIMAP" x=ALIGN_LEFT y=ALIGN_TOP width=215 height=208 priority="SCENE_INGAME" draggable=true dragregion_x=0 dragregion_y=0 dragregion_width=215 dragregion_height=29 OnAdd=‘UIObject_Misc_ExecuteServerScript(“gui_updateareaname”)’ scriptloadable=“true”/>
<UIText name="AREA_NAME_TEXT" x=ALIGN_CENTER y=7 height=22 width=176 align=center valign=middle fontfamily="Special_Font" style="3" multiline=false
update=true updaterate="0.5" OnUpdate=UIText_OnUpdate_DisplayLocalVar(local:1) />
<UIText name="AREA_NAME_TEXT_LARGE" x=ALIGN_CENTER y=14 height=22 width=212 align=center valign=middle fontfamily="NWN1_Dialog" style="1" multiline=false
update=true hidden=true OnUpdate=UIText_OnUpdate_DisplayLocalVar(local:1) />
<UIText name="AREA_NAME_TEXT_COLLAPSE" x=ALIGN_CENTER y=7 height=22 width=176 align=center valign=middle fontfamily="Special_Font" style="3" multiline=false
update=true hidden=true OnUpdate=UIText_OnUpdate_DisplayLocalVar(local:1) />
<UIPane name="MINIMAP_HEADER" x=21 y=8 width=170 height=28 OnLeftDoubleClick=UIPane_Input_MiniMapMakeLarge() tupple=true capturemouseclicks=false > </UIPane>
<UIPane name="MINIMAP_HEADER_LARGE" x=13 y=10 width=226 height=32 OnLeftDoubleClick=UIPane_Input_MiniMapCollapse() hidden=true tupple=true capturemouseclicks=false > </UIPane>
<UIPane name="MINIMAP_HEADER_COLLAPSE" x=21 y=8 width=170 height=28 OnLeftDoubleClick=UIPane_Input_MiniMapMakeSmall() hidden=true tupple=true capturemouseclicks=false > </UIPane>
<!-- Mini Map Zoom In -->
<UIButton name="MINIMAP_ZOOM_IN" x=22 y=34 width=30 height=30 OnLeftClick=UIButton_Input_MiniMapZoomIn()>
<UIFrame state=up fill="button_rzoomin_normal.tga" />
<UIFrame state=down fill="button_rzoomin_hover_pressed.tga" />
<UIFrame state=focused fill="button_rzoomin_normal.tga" />
<UIFrame state=hilited fill="button_rzoomin_hover.tga" />
<UIFrame state=hifocus fill="button_rzoomin_hover.tga" />
<UIFrame state=disabled fill="button_rzoomin_disabled.tga" />
</UIButton>
<!-- Mini Map Zoom Out -->
<UIButton name="MINIMAP_ZOOM_OUT" x=163 y=34 width=30 height=30 OnLeftClick=UIButton_Input_MiniMapZoomOut()>
<UIFrame state=up fill="button_rzoomout_normal.tga" />
<UIFrame state=down fill="button_rzoomout_hover_pressed.tga" />
<UIFrame state=focused fill="button_rzoomout_normal.tga" />
<UIFrame state=hilited fill="button_rzoomout_hover.tga" />
<UIFrame state=hifocus fill="button_rzoomout_hover.tga" />
<UIFrame state=disabled fill="button_rzoomout_disabled.tga" />
</UIButton>
<!-- Mini Map Zoom In Large-->
<UIButton name="MINIMAP_ZOOM_IN_LARGE" hidden=true x=13 y=44 width=41 height=41 OnLeftClick=UIButton_Input_MiniMapZoomIn()>
<UIFrame state=up fill="button_rzoomin_normal.tga" />
<UIFrame state=down fill="button_rzoomin_hover_pressed.tga" />
<UIFrame state=focused fill="button_rzoomin_normal.tga" />
<UIFrame state=hilited fill="button_rzoomin_hover.tga" />
<UIFrame state=hifocus fill="button_rzoomin_hover.tga" />
<UIFrame state=disabled fill="button_rzoomin_disabled.tga" />
</UIButton>
<!-- Mini Map Zoom Out Large-->
<UIButton name="MINIMAP_ZOOM_OUT_LARGE" hidden=true x=201 y=44 width=41 height=41 OnLeftClick=UIButton_Input_MiniMapZoomOut()>
<UIFrame state=up fill="button_rzoomout_normal.tga" />
<UIFrame state=down fill="button_rzoomout_hover_pressed.tga" />
<UIFrame state=focused fill="button_rzoomout_normal.tga" />
<UIFrame state=hilited fill="button_rzoomout_hover.tga" />
<UIFrame state=hifocus fill="button_rzoomout_hover.tga" />
<UIFrame state=disabled fill="button_rzoomout_disabled.tga" />
</UIButton>
<!-- These must be above the radar frame, so that they draw over it -->
<UIPane name="PARTY_OFFSCREEN_PANE" x=36 y=45 width=150 height=150 ignoreevents=true capturmouseclicks=false capturemouseevents=false />
<UIPane name="PERCEPTION_OFFSCREEN_PANE" x=36 y=45 width=150 height=150 ignoreevents=true capturmouseclicks=false capturemouseevents=false />
<UIPane name="MAPPOINT_OFFSCREEN_PANE" x=36 y=45 width=150 height=150 ignoreevents=true capturmouseclicks=false capturemouseevents=false />
<UIPane name="TARGET_OFFSCREEN_PANE" x=36 y=45 width=150 height=150 ignoreevents=true capturmouseclicks=false capturemouseevents=false />
<UIIcon name="RADAR_FRAME" width=215 height=208 img="radar_frame.tga" ignoreevents=true />
<UIIcon name="RADAR_FRAME_LARGE" hidden=true width=253 height=275 img="radar_frame_big.tga" ignoreevents=true />
<UIIcon name="RADAR_FRAME_COLLAPSE" hidden=true width=186 height=43 img="minimap_minimized.tga" ignoreevents=true />
<UIIcon name="PLAYER_ARROW" width=18 height=22 img="radar_player_arrow.tga" color="silver" />
<UIIcon name="PLAYER_CAMERA" width=49 height=144 img="radar_camera_direction.tga" />
<UIIcon name="PARTY_MARKER" width=14 height=18 img="radar_player_arrow.tga" color="0x8BDAE9" />
<UIIcon name="PARTY_OFFSCREEN_MARKER" width=16 height=8 img="radar_marker00_offradar.tga" color="0x8BDAE9" />
<UIPane name="PARTY_PANE" x=36 y=45 width=150 height=150 ignoreevents=true capturmouseclicks=false capturemouseevents=false/>
<UIIcon name="PERCEPTION_MARKER" width=20 height=21 img="radar_p_marker01.tga" />
<UIIcon name="PERCEPTION_OFFSCREEN_MARKER" width=16 height=8 img="radar_marker00_offradar.tga" />
<UIPane name="PERCEPTION_PANE" x=36 y=45 width=150 height=150 ignoreevents=true capturmouseclicks=false capturemouseevents=false/>
<UIIcon name="MAPPOINT_MARKER" width=16 height=16 img="radar_map_marker.tga" color="0xE0C69B" />
<UIIcon name="MAPPOINT_OFFSCREEN_MARKER" width=16 height=15 img="radar_marker01_offradar.tga" color="0xE0C69B" />
<UIPane name="MAPPOINT_PANE" x=36 y=45 width=150 height=150 ignoreevents=true capturmouseclicks=false capturemouseevents=false/>
<UIIcon name="TARGET_MARKER" width=20 height=21 img="radar_p_marker02.tga" />
<UIIcon name="TARGET_OFFSCREEN_MARKER" width=16 height=16 img="radar_marker02_offradar.tga" />
<UIPane name="TARGET_PANE" x=36 y=45 width=150 height=150 ignoreevents=true capturmouseclicks=false capturemouseevents=false/>
<!-- Mini Map Special Image -->
<!-- This pane control is mandatory and it's name will be held onto by the rootscene for use in other callbacks -->
<UIPane name="MINIMAP_IMAGE_PANE" x=36 y=45 width=150 height=150 update=true OnUpdate=UIPane_OnUpdate_UpdateMiniMap() ignoreevents=true capturmouseclicks=false capturemouseevents=false></UIPane>
<UIPane name="MINIMAP_IMAGE_PANE_LARGE" x=26 y=50 width=200 height=200 update=false ignoreevents=true capturmouseclicks=false capturemouseevents=false></UIPane>
And my gui_udateareaname looks exactly like your script (I just copied it to my script that has that same name).
For some strange reason, gui_updateareaname script isn’t executed by the minimap gui, no matter where you place it (OnAdd or OnUpdate events), and a displayed name doesn’t get updated. I checked this by adding a line “SendMessageToPC(…)” in gui_updateareaname. Honestly, I have no idea what causes this… (the ‘scriptloadable’ parameter is in place).
Hmmm. Odd.
I’m just brainstorming now but…could it have anything to do with this that jestemwlodzimierz talked about:
The next step is modifying the AreaMap, which has to be done little differently:
In areamap.xml replace the OnUpdate commands for text just like previously. Then add OnAdd=UIObject_MISC_ExecuteServerScript("gui_script") to UIScene. After that create a gui_sctipt that edits the area name with SetLocalGUIVariable(GetFirstPC(), "SCREEN_AREAMAP", 1, GetLocalString(GetFirstPC(), "your area name"));
This way anytime the big map pops up it has the appropriate name :-)
I don’t see how it could but…
@andgalf I tried, but haven’t had any success with this so far.
You can send a PM to @jestemwlodzimierz and ask him if you want.
Thanks for you trying to help me! I’ve sent him a PM.
Anybody else have a sollution?
I’ve also tried with Shallina’s suggestion from the other thread:
SetName(GetArea(objectInArea),“New Name”) on the area object should work.
But since SetName isn’t a function it doesn’t work. I tried with SetFirstName also but of course that didn’t work either.
I’m almost finished with my module so it would be so nice if I could get this to work. Otherwise I’ll have to make a duplicate of the area and do it in another way, I guess.
k, starting with a clean player-folder this is what happens
1 )
Create Area, clear “Display Name” property. (and I’ll use tag: “Area1”)
under “Scripts”, add Variable
Name: AreaLabel
ValueString: Start
2 )
Copy “minimap.xml” from <install>/UI/default to the module folder (or Campaign, etc).
add this parameter to its <UIScene name=“SCREEN_MINIMAP” … >
scriptloadable="true"
in the next three elements
<UIText name=“AREA_NAME_TEXT” … >
<UIText name=“AREA_NAME_TEXT_LARGE” … >
<UIText name=“AREA_NAME_TEXT_COLLAPSE” … >
change this parameter
OnUpdate=UIText_OnUpdate_DisplayAreaName()
to
OnUpdate='UIObject_Misc_ExecuteServerScript(“gui_updatearealabel”)'
write and compile the update-script:
// 'gui_updatearealabel'
void main()
{
object oPC = GetFirstPC();
string sLabel = GetLocalString(GetArea(oPC), "AreaLabel");
SetGUIObjectText(oPC, "SCREEN_MINIMAP", "AREA_NAME_TEXT", -1, sLabel);
SetGUIObjectText(oPC, "SCREEN_MINIMAP", "AREA_NAME_TEXT_LARGE", -1, sLabel);
SetGUIObjectText(oPC, "SCREEN_MINIMAP", "AREA_NAME_TEXT_COLLAPSE", -1, sLabel);
}
3 )
then place a lever next to startloc,
give it an OnUsed script:
// 'setarealabel'
void main()
{
string sAreaTag = "Area1"; // pass in or get the tag of the Area to change the name of
string sLabel = "Alternate"; // pass in or get a name to change the Area to
// If the module is part of a Campaign, the module with the area must be currently loaded/being played.
object oArea = GetObjectByTag(sAreaTag);
SetLocalString(oArea, "AreaLabel", sLabel);
}
When i use the lever, the current area’s name on the MiniMap changes from “Start” to “Alternate”. If it doesn’t, there’s likely some conflict, like a file taking priority that shouldn’t …
ps. The updaterate can be slowed down (it’s pretty fast…) by adding the parameter updaterate=“0.5” to the “AREA_NAME_TEXT*” xml-elements
pps. Aqvilinus’ suggestion to copy the area-names from each area-object to AreaLabel strings should work fine also, but my opinion is why run the extra code when the variable can be set in the toolset,
I tried with your suggestions kevL_s but as before nothing works. The only thing that happens is, like before, that the area I arrive in has a “blank” name. Just to show you so that I’ve done nothing wrong here are some pictures from my toolset:
The area my PC arrives in:
My module’s properties:
The scripts:
In the area my PC arrives in the minimap name is blank. I then click on a chair I’ve put there that is useable and that has the setareaname_script attached to its OnUsedScript slot. When I click on the chair with my PC nothing happens.
I guess there must be something very wrong with my module…I’m about to give up when it comes to this little thing. Maybe I’ll just duplicate the area and give it another name instead. That makes my module even larger, it is way too large at the moment, but what the heck…
I got a reply from jestemwlodzimierz and his sollution, even though I have to make a OnClientEnter script for each area, actually worked.