kastano Posted June 16, 2014 Posted June 16, 2014 (edited) HiI need to make a script that changes the npcs name dynamicallyi have no clue about strings and the syntax of them and i need some guidance or the complete script :-)(obse documentation didnt help me much)the concept of the script is sth like that (i know that it has wrong syntax)-just to figure out the idea Reveal hidden contents ScriptName AAAchangeNamestring_var oldName ;Declaring variablestring_var titleNameRef newNpcBegin Function {}PrintToConsole "changing Name"Let newnpc := myquest.npclet oldName := newnpc.GetNamelet titleName := "Sister" If newnpc.GetInFaction BanditFaction newnpc.SetFactionRank BanditFaction -1 newnpc.SetActorFullName "bandit prisoner" elsenewnpc.SetName $titleName+$oldName;newnpc.SetActorFullName "Sister"+$oldName endifnewnpc.SetFactionRank playerFaction 0The purpose is to retrieve the name of the npc -for example Baurusand then after some contitions to give him a proper title -for example private baurus or prisoner baurus etcThanks in advance Edited June 16, 2014 by kastano
UltharSeramis Posted June 18, 2014 Posted June 18, 2014 (edited) Hi, I had this idea myself one time and tried it with "setName". But I noticed while testing that the name changed by "setName" is NOT stored in the save game. The result: After restarting the game, the npc will have its old name.Sadly, I don't know if there is a function that solves this problem (I looked for one in OBSE, but I did not find any).Maybe you can ask one of the developers of OBSE or (if you are able to write programs in C++) create a plugin for OBSE which provides such a function. Ulthar Seramis Edited May 5, 2015 by UltharSeramis
kastano Posted June 19, 2014 Author Posted June 19, 2014 No i dont know C++i found a plugin that does this(i didnt test it)http://www.nexusmods.com/oblivion/mods/11666/? (documentation link doesnt work) also thishttp://www.oblivionmodwiki.com/index.php/Tibixe%27s_String_Function_Collectionbut it says that it is obsolete and all that functions are in obse nowthat strings thing is too advanced for mei thinks it needs sv_construct in some pointi ll see it later-SetActorFullName works (in my case ,i create a duplicate with createfullactorcopy before)
QQuix Posted June 19, 2014 Posted June 19, 2014 You almost got it. You have to construct the full name in advance in a string var and pass it to SetActorFullName. For example: string_var newName . . . let newName := "Sister " + oldName newnpc.SetActorFullName $newName For other OBSE string functions, check the "String Variables" section of the OBSE documentation [download from here] and this WIKI page
kastano Posted June 19, 2014 Author Posted June 19, 2014 (edited) Thanks :-) (it worked!!!) So farFor anyone interestedyou dont have to create fullactorcopy like mentioned beforename remains permanently after the save-loadi putted sv_destruct at the end to destroy the variables so that they dont stay in the savegame(i think!) Reveal hidden contents ScriptName AAAcreateNamestring_var oldName ;Declaring variablestring_var newNameRef newNpcBegin Function {}PrintToConsole "changing Name"Let newnpc := AAARelYieldQuest.suractor ;(in my mod)let oldName := newnpc.GetNamelet newName := "Sister " + oldNameIf newnpc.GetInFaction BanditFactionnewnpc.SetFactionRank BanditFaction -1newnpc.SetActorFullName "bandit prisoner"elsenewnpc.SetActorFullName $newNameendifsv_Destruct oldName newName ;just in case for savegameend Edited June 19, 2014 by kastano
Recommended Posts