Use hardcoded refs in script not explicitly

Post » Thu Apr 14, 2016 3:10 pm

I have an interesting problem with a script I am currently writing.



I need to use some of Oblivion's hardcoded references in my script. Unfortunately, I can't directly use the EditorIDs in my scripts due to this bug in Wrye Bash: https://github.com/wrye-bash/wrye-bash/issues/92. In short, when my mod is merged into the Bashed Patch, any hardcoded EditorIDs I use are assigned a FormID with the wrong ModIndex and then my script doesn't run at all because the game thinks that it is using references that don't exist.



I would greatly appreciate it if someone can think of a way for me to use hardcoded references in my scripts without explicitly referring to them.


In my case, I am trying to use the PlayerRef (00000014) reference so a method of using that specific reference would solve my problem. However, I would greatly appreciate a method that can be used to retrieve any hardcoded reference in the game. I would also appreciate a method that is compatible with total conversions (eg. Nehrim) and one that doesn't require OBSE.




Originally, I had this command in my script



If PlayerRef.GetDead

I stopped using it after I discovered the aforementioned bug in Wrye Bash. I tried changing it to



If 00000014.GetDead

But the script refuses to compile this command (CSE says that the command requires an explicit reference). I then thought of trying to use a reference variable and assign the hardcoded reference to that variable.



Set rVariable to PlayerRef
If rVariable.GetDead

This doesn't work because I'm calling a hardcoded reference directly. I then tried this:



Set rVariable to 00000014

I haven't really tested this but I'm pretty sure I remember it not working. I then tried this command



RunScriptLine "Set QuestName.rVariable to PlayerRef"

But this didn't work either. Finally, I've tried this



Set rVariable to GetFormFromMod "Oblivion.esm" 00000014

And this command does what I need. However, it requires OBSE and (this one is minor; probably 1% of my concern with this command) it is only compatible with total conversions if I explicitly reference them in my script.


I will use this method if there is no other solution but I would greatly appreciate a method that doesn't require OBSE.


User avatar
steve brewin
 
Posts: 3411
Joined: Thu Jun 21, 2007 7:17 am

Return to IV - Oblivion