Jump to content

How do use use "setessntial" in the CS?


Recommended Posts

(Edit: My apologies for the typos)

 

Here is the script from a mod in quotation marks:

 

"scn aaaaaDeathScript

begin ScriptEffectStart
if aaaaaCheatsEnabled == 1
kill
endif

end"

 

I am looking to add "setessential 0" to it but it gives me this:

 

"Script 'aaaaaDea'd‘nScript', line 5:

Non-persistent reference '0' cannot be used in a script."

 

then this:

 

"Scn'pt 'aaaaaDeathScript‘, line 5:

Item '0' not found for parameter Actor Base.

Compiled script not saved!"

 

I know it wants an NPC ID but it accepts the kill command without issue.

Edited by 60fpshacksrock
Link to comment
Share on other sites

Set Essential is working only with base objects, so you should fill some ref variable first or use SetRefEssential command.

scn aaaaaDeathScript
...
ref target
...
 
begin ScriptEffectStart
   set target to GetSelf
   if target != 0 && aaaaaCheatsEnabled == 1
     SetEssential target 0
     kill ;kill is working with references, so you can use it like this
   endif
end

or

scn aaaaaDeathScript
...
 
begin ScriptEffectStart
   if aaaaaCheatsEnabled == 1
      SetRefEssential 0
      Kill
   endif
end

According to wiki, SetRefEssential makes change in base object too, so if you have 10 copies of your NPC in the world, all will become essential.

Edited by RomanR
Link to comment
Share on other sites

It accepts the bottom script you posted but now it does nothing. It won't even work on non-essential npc's.

 

This is the mod here: https://www.nexusmods.com/oblivion/mods/44129

 

I do not take credit for it either. The main reason I wanted this mod was to unlock locks that require keys . But the "silent death" I would like to extend to include essential npc's as well.

Link to comment
Share on other sites

That's quite weird. As I tested the second approach with this script

scn RomRKillSpellScript
short ess

begin ScriptEffectStart
	set ess to IsEssential
	if ess != 0
		SetRefEssential 0
		Message "Some actors were robbed of essential status." ;only as a debug message
	endif
	kill
end

and I found it working without problems. But with first post I found that SetEssential command seems truly working as return after execution in this case, so the rest of script was ignored.

Edited by RomanR
Link to comment
Share on other sites

That's quite weird. As I tested the second approach with this script

scn RomRKillSpellScript
short ess

begin ScriptEffectStart
	set ess to IsEssential
	if ess != 0
		SetRefEssential 0
		Message "Some actors were robbed of essential status." ;only as a debug message
	endif
	kill
end

and I found it working without problems. But with first post I found that SetEssential command seems truly working as return after execution in this case, so the rest of script was ignored.

 

It gives me this when I tried the new one you posted:

 

Script 'RomRiGllSpellScript‘, line 7:

Script command 'SetRefEssential' not found.

Edited by 60fpshacksrock
Link to comment
Share on other sites

SetRefEssential is an OBSE command. I completely forgot about this, I'm sorry. Unfortunately without OBSE you will be stuck here, as wiki mentions that using SetEssential command with ref variable will act as return and so it makes my first posted script meaningless. Maybe someone more experienced using this command can give some insight, how to solve this without OBSE.

 

Edit: But didn't you wrote that the bottom script of my first post was accepted, which contains SetRefEssential too?

Edited by RomanR
Link to comment
Share on other sites

SetRefEssential is an OBSE command. I completely forgot about this, I'm sorry. Unfortunately without OBSE you will be stuck here, as wiki mentions that using SetEssential command with ref variable will act as return and so it makes my first posted script meaningless. Maybe someone more experienced using this command can give some insight, how to solve this without OBSE.

 

Edit: But didn't you wrote that the bottom script of my first post was accepted, which contains SetRefEssential too?

 

It does. But it has no effect.

 

I do in fact use OBSE, but I am trying to make it work without it.

Link to comment
Share on other sites

Vanilla Oblivion to my knowledge doesn't have function to get base object from reference, so OBSE is only solution. In the meantime I made change to RomRKillSpellScript and now it looks like this:

scn RomRKillSpellScript2
short ess
ref actor

begin ScriptEffectStart
	set actor to GetBaseObject
	set ess to IsEssential
	if ess != 0 && actor != 0
		SetEssential actor 0
		print "Actor:"+$actor+" Essential status:"+$ess ;debug message printed to console
		Message "Some actors were robbed of essential status."
	endif
	kill
end

Now it uses OBSE function GetBaseObject to get base object form target and so SetEssential command now works. As GetBaseObject is basic OBSE function, failing to compile this script could mean that OBSE isn't working in your editor. Print is OBSE command too.

Link to comment
Share on other sites

For standard Construction Set execute obse_loader.exe with parameter -editor. Best is to make a shortcut.

125215763-1680425581.jpg

 

Sorry for a quality, I wanted to be a file size of picture as small as possible. My Win is in Czech, but I hope it will still help you. If you use some Constructon Set replacement (CS Extender etc.), consult its documentation how to start it with OBSE.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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