Help with AddFullEffectItem (OBSE)

Post » Tue May 17, 2011 6:25 am

I have a custom helm, with a custom, blank enchantment attached to it.
In my script I am trying to add an effect to the enchantment, but nothing seems to work.
The script compiles, but when I reload the esp in the CS, it reports an error saying that the reference (in the AddFullEffectItem statement) is invalid.

The code I am trying is:
AddFullEffectItem SHLD 5 0 0 0 helm

I also tried:
set enchant to GetEnchantment helm
AddFullEffectItem SHLD 5 0 0 0 enchant

When I run the mod despite the error that is reported, the script crashes.

I also tried to test from the console in game, but it doesn't seem to recognize the effect codes.

I can't seem to figure out how to use this function.
User avatar
Annick Charron
 
Posts: 3367
Joined: Fri Dec 29, 2006 3:03 pm

Post » Tue May 17, 2011 12:45 pm

Use AddFullEffectItemC. The 4-letter codes for magic effects are actually editor IDs. Annoyingly, the game assigns a formID of zero to magic effects unless they are edited by a loaded plugin, preventing them from being used reliably in scripts. This is why OBSE provides 'C' versions of all its magic effect-related commands, and why you should prefer to use them instead.
More annoyingly, we don't currently provide an easy way to get an effect code for a magic effect with a formID of zero. Next release of 0019 will include MGEFFromChars to rectify that.
User avatar
jadie kell
 
Posts: 3497
Joined: Sat Jul 29, 2006 3:54 pm

Post » Tue May 17, 2011 12:02 am

I see, thank you.

So the following should work? ...

let code := GetMagicEffectCode SHLD
AddFullEffectItemC code 5 0 0 0 helm
User avatar
Eddie Howe
 
Posts: 3448
Joined: Sat Jun 30, 2007 6:06 am

Post » Tue May 17, 2011 5:16 am

No, that's the thing about magic effects: when you pass in SHLD as an argument OBSE sees it as the number '0' representing its formID, so we have no way of identifying the effect setting.
0019 beta 4 was released about 15 minutes ago. If you are interested in testing with it you can do:
let code := MagicEffectCodeFromChars "SHLD"AddFullEffectItemC code 5 0 0 0 helm

User avatar
Sherry Speakman
 
Posts: 3487
Joined: Fri Oct 20, 2006 1:00 pm


Return to IV - Oblivion