Help - Search - Members - Calendar
Full Version: Global variables, or local variables?
The Nexus Forums > Specific Games > Morrowind > Morrowind Plug-Ins > TES Construction Set
Abramul
I'm making a mod that will allow the player to add and remove spells covering al effects they've learned, even if they've since removed any spells with those effects from their spellbook. The question I have is this: I'm planning on having the trigger be a book. Would it cause problems if the variables are stored in the script attached to the book?

Two other questions:
Is there a better way than spamming GetSpell to check if the player has an effect available?
Is adding or removing a large number of spells in one go a bad idea?
NewtC
Storing variables in an item is okay as long as the item is unique. It will cause problems otherwise. It is probably not a good idea to remove a large amount of spells in one script. I have never actually tried using spells in morrowind scripts. There is also a scrip effect that removes all spells that have a certain effect. It's called RemoveEffects. To use it, you have to know the spell effects ID. When you know this, you just have to say something like:

begin removeshieldeffect

if ( onactivate == 1 )
~removeeffect, sEffectShield
endif

end removeshieldeffect

This would remove all spells with the Shield effect from the character when activated.
Abramul
RemoveEffects "Removes all spells currently affecting the calling actor that include the given effect". Don't see how that's useful to me.

Anyway, thanks for the help regarding local variables. I have a prototype (covers Mark, Recall, and the Interventions) of this mod ready, now to see in what way it's broken.

EDIT 1: The Morrowind script editor is too forgiving! Allowing syntax that the game can't handle is downright mean.
NewtC
Sorry, some words got flipped around when I was reading. However, if there were any of those effects on the actor at the activation, it could still remove a large number of spells.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.