Skip to content

RandomName Oddness

BalanorBalanor Member Posts: 176
edited December 2017 in Builders - Scripting
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:
  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.

Comments

  • ShadowMShadowM Member Posts: 573
    edited December 2017
    It not a good idea to put this on module load, because it a chance that the object (the boy) has not loaded into the system it better under the spawn of the boy. I change the script around some more with a valid check. It probably a timing issue. Try and run it from a trigger from the start location.

    //:://///////////////////////////////////////////// //:: 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
  • BalanorBalanor Member Posts: 176
    Just tried it from a trigger in front of the boy and it doesn't work that way either. It's so strange this works if you test the module in single player, but not when you host the module on one machine and then login to it from a client on a different machine.
  • ShadowMShadowM Member Posts: 573
    I would do some more testing but I have issues with servers as you can see in the other forum LOL
  • BalanorBalanor Member Posts: 176
    I've continued to fight with this over the last few weeks. From all the testing I've done, it appears this is not a problem if the server is run from the complete download of EE. But if using the Server Download Packages, RandomName won't work. And since it seems impossible to use the full version of EE on a machine that can only be remote connected to, I'm unable to verify if this is the case. (Because EE can't render a 3D window via a remote desktop connection to do [whatever initial setup the full game needs done] to even get NWServer.exe to work from the full download)

    @niv Does this perhaps ring any bells with the server download packages? Could anything be missing from them that would prevent RandomName from working?
  • nivniv Member, Moderator, Developer Posts: 410
    @Balanor Both the zip and docker image were missing the .ltr files used by the name generator. Oversight when packaging them, as I did not think that the dedicated server would need the random name stuff, only the toolset and the chargen (that's why the packages are called beta and kinda-unofficial :p).

    Now fixed, please try and let me know if it works!
  • BalanorBalanor Member Posts: 176
    Awesome niv - I can confirm that RandomName works now when running NWServer from the server download packages you put together (at least the 8156 build). I'll no longer have my random commoners with a name like [Creature7237] running around in my gameworld. Yay!

    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.
Sign In or Register to comment.