Jump to content

script help - change npc name dynamically


kastano

Recommended Posts

Hi

I need to make a script that changes the npcs name dynamically

i 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

ScriptName AAAchangeName

string_var oldName ;Declaring variable
string_var titleName
Ref newNpc

Begin Function {}

PrintToConsole "changing Name"
Let newnpc := myquest.npc
let oldName := newnpc.GetName
let titleName := "Sister"
If newnpc.GetInFaction BanditFaction
newnpc.SetFactionRank BanditFaction -1
newnpc.SetActorFullName "bandit prisoner"

else

newnpc.SetName $titleName+$oldName
;newnpc.SetActorFullName "Sister"+$oldName


endif


newnpc.SetFactionRank playerFaction 0



The purpose is to retrieve the name of the npc -for example Baurus

and then after some contitions to give him a proper title -for example private baurus or prisoner baurus etc

Thanks in advance

Edited by kastano
Link to comment
Share on other sites

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 by UltharSeramis
Link to comment
Share on other sites

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 this

http://www.oblivionmodwiki.com/index.php/Tibixe%27s_String_Function_Collection

but it says that it is obsolete and all that functions are in obse now

that strings thing is too advanced for me

i thinks it needs sv_construct in some point

i ll see it later

-SetActorFullName works (in my case ,i create a duplicate with createfullactorcopy before)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Thanks :-) (it worked!!!)

 

So far

For anyone interested

you dont have to create fullactorcopy like mentioned before

name remains permanently after the save-load

i putted sv_destruct at the end to destroy the variables so that they dont stay in the savegame(i think!)

 

 

 

 

ScriptName AAAcreateName

string_var oldName ;Declaring variable
string_var newName
Ref newNpc

Begin Function {}

PrintToConsole "changing Name"
Let newnpc := AAARelYieldQuest.suractor ;(in my mod)
let oldName := newnpc.GetName
let newName := "Sister " + oldName
If newnpc.GetInFaction BanditFaction
newnpc.SetFactionRank BanditFaction -1
newnpc.SetActorFullName "bandit prisoner"

else

newnpc.SetActorFullName $newName



endif

sv_Destruct oldName newName ;just in case for savegame
end

 

Edited by kastano
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...