RandomName Oddness
![Balanor](https://forums.beamdog.com/uploads/userpics/312/n3UE8EH29HY49.jpg)
I use the RandomName function as part of a system to randomly name commoners in my module. On a 1.69 server it works flawlessly, but on a 1.74 server it returns a null string *if* you are not logging in to the module, or NWServer running the module, from the NWClient on that same machine.
As a very basic example, all you need to to is create a test module with one area. Place a "Boy" from the standard pallette in that starting area, then put this in the x3_mod_def_enter script, compile, and save:
Any ideas on this? I did submit this as a formal bug, but since it probably won't get a response for a long time, I was hoping to see if anyone else has run into this yet and/or if there may be some ideas as a workaround for this undesired behavior in multiplayer.
As a very basic example, all you need to to is create a test module with one area. Place a "Boy" from the standard pallette in that starting area, then put this in the x3_mod_def_enter script, compile, and save:
if (GetIsPC(oPC)) { string sName = RandomName(NAME_FIRST_HUMAN_MALE)+" "+RandomName(NAME_LAST_HUMAN); SendMessageToPC(oPC, "attemting to change boy's name to: "+sName); SetName(GetObjectByTag("NW_MALEKID01"), sName); }Then, when either testing the module in single player, or if you run it in NWServer on a test machine and login with a client on that same machine, it will rename the Boy. BUT, if you run the module in NWServer and login with the NWClient from a different machine, RandomName returns nothing (null string) and the boy doesn't get renamed. This occurred from Windows 10 and Windows 2016 servers that I tested from in Azure, using the dedicated 8152 NWServer build.
Any ideas on this? I did submit this as a formal bug, but since it probably won't get a response for a long time, I was hoping to see if anyone else has run into this yet and/or if there may be some ideas as a workaround for this undesired behavior in multiplayer.
0
Comments
//:://///////////////////////////////////////////// //:: Default On Enter for Module //:: x3_mod_def_enter //:: Copyright (c) 2008 Bioware Corp. //::////////////////////////////////////////////// /* This script adds the horse menus to the PCs. */ //::////////////////////////////////////////////// //:: Created By: Deva B. Winblood //:: Created On: Dec 30th, 2007 //:: Last Update: April 21th, 2008 //::////////////////////////////////////////////// #include "x3_inc_horse" void main() { object oPC=GetEnteringObject(); string sName = RandomName(NAME_FIRST_ELF_MALE)+" "+RandomName(NAME_LAST_ELF); ExecuteScript("x3_mod_pre_enter",OBJECT_SELF); // Override for other skin systems if ((GetIsPC(oPC)||GetIsDM(oPC))&&!GetHasFeat(FEAT_HORSE_MENU,oPC)) { // add horse menu HorseAddHorseMenu(oPC); if (GetLocalInt(GetModule(),"X3_ENABLE_MOUNT_DB")) { // restore PC horse status from database DelayCommand(2.0,HorseReloadFromDatabase(oPC,X3_HORSE_DATABASE)); } // restore PC horse status from database } // add horse menu if (GetIsPC(oPC)) { // more details // restore appearance in case you export your character in mounted form, etc. if (!GetSkinInt(oPC,"bX3_IS_MOUNTED")) HorseIfNotDefaultAppearanceChange(oPC); // pre-cache horse animations for player as attaching a tail to the model HorsePreloadAnimations(oPC); DelayCommand(3.0,HorseRestoreHenchmenLocations(oPC)); } // more details if (GetIsPC(oPC)) { object oBoy =GetObjectByTag("NW_MALEKID01"); if(oBoy!=OBJECT_INVALID) { SendMessageToPC(oPC, "setting name to "+sName); SetName(oBoy, sName); } } }
Test it out
@niv Does this perhaps ring any bells with the server download packages? Could anything be missing from them that would prevent RandomName from working?
Now fixed, please try and let me know if it works!
I do understand they are kind of not-official and you had the disclaimer there to "use at our own risk". So thanks for taking a look at this and fixing it so quickly. I dunno how I/we would even be able to run an EE server on a remote machine without your efforts at this time - so thank you very much.