Jump to content

Can you help me add specific spells on an actor?


Oblis

Recommended Posts

Hello,

I want to make a short script that will add spells from a a certain spell school to an actor.

For example:

 

I would like to add all the spells from the school "Restoration" to an actor with class Healer.

Using sctipt of course...

How can this be done?

Link to comment
Share on other sites

That's a LOT of spells. Have you even considered this? The restoration school spells range not only on spell type/effect, but also each type ranges from novice to master. :ohmy:
Link to comment
Share on other sites

Hello,

I want to make a short script that will add spells from a a certain spell school to an actor.

For example:

 

I would like to add all the spells from the school "Restoration" to an actor with class Healer.

Using sctipt of course...

How can this be done?

 

As Hickory said, that is a LOT of spells, and that's without including any custom ones you might make and add. The script itself is easy but it won't be short by any means (at least, none I understand). I assume you want to add them to an NPC and not the player, so I whipped this up (forgive me if you already know this):

 

 

 

scn HealerAddSpells

 

ref actor

 

Begin GameMode

 

if (actor.GetisClass "Healer"==1)

actor.AddSpell StandardRestoreHealth1Novice

actor.AddSpell StandardRestoreFatigue1Novice

else

return

endif

StopQuest AAAStartScript

end

 

 

 

Basically you just keep adding the spells from the Restoration school to the script, attach it to a Quest form in the CS, and go (there are probably more elegant ways, to write it, but it works). If you don't want to see "Spell Added" spam and are running OBSE, add NS to the end of AddSpell.

 

Hope that helps.

Link to comment
Share on other sites

The script itself is easy but it won't be short by any means (at least, none I understand). I assume you want to add them to an NPC and not the player, so I whipped this up (forgive me if you already know this):

 

 

 

scn HealerAddSpells

 

ref actor

 

Begin GameMode

 

if (actor.GetisClass "Healer"==1)

actor.AddSpell StandardRestoreHealth1Novice

actor.AddSpell StandardRestoreFatigue1Novice

else

return

endif

StopQuest AAAStartScript

end

 

 

 

Basically you just keep adding the spells from the Restoration school to the script, attach it to a Quest form in the CS, and go (there are probably more elegant ways, to write it, but it works). If you don't want to see "Spell Added" spam and are running OBSE, add NS to the end of AddSpell.

 

Hope that helps.

 

Since you brought up the 'elegant' subject... if I may?

 

There is no point using a 'Return' statement at the end of a function -- it's already too late. It's good optimisation practice to catch things early, so that the script doesn't evaluate unnecessary code. In this case, your example would (could) become:

 

 

ScriptName HealerAddSpells

Ref actor

Begin GameMode

If ( actor.GetIsClass "Healer" != 1 )
	Return
Else
	actor.AddSpell StandardRestoreHealth1Novice
	actor.AddSpell StandardRestoreFatigue1Novice
	; and the spells go on and on...
Endif

StopQuest AAAStartScript

End

 

Link to comment
Share on other sites

Thanks for the reply guys

The script you give me is "handmade" job.

I was thinking for something more automatic...

 

like using a leveledlist for example...

 

Thanks

 

Automatic in what sense? Also, you have not even said what actor/s -- is it player, one actor, many actors? People are not psychic, you know. You want help... supply details.

Link to comment
Share on other sites

Ok! Grab the spells from the list (or from a leveledspell list), check their school and add them to the actor (if restoration).

So I will not be forced to type a thousand lines for each class or spell school.

Link to comment
Share on other sites

Since you brought up the 'elegant' subject... if I may?

 

There is no point using a 'Return' statement at the end of a function -- it's already too late. It's good optimisation practice to catch things early, so that the script doesn't evaluate unnecessary code. In this case, your example would (could) become:

 

 

ScriptName HealerAddSpells

Ref actor

Begin GameMode

If ( actor.GetIsClass "Healer" != 1 )
	Return
Else
	actor.AddSpell StandardRestoreHealth1Novice
	actor.AddSpell StandardRestoreFatigue1Novice
	; and the spells go on and on...
Endif

StopQuest AAAStartScript

End

 

 

Hickory--thanks for that fix. :smile: I'm still kind of ham-handed with my scripts so it's nice to be shown ways to do things more cleanly and tightly--the CS WIki hasn't exactly been chock full of such tips, so it's pretty much a "Oh, I hope this works" followed by "Okay, it worked, now how can I make it more efficient? I have NO clue" kind of thing for me, where what should be obvious, ain't.. :laugh:

 

Oblis:

 

You might not be totally out of luck:

 

http://cs.elderscrolls.com/index.php/GetSpellSchool

 

Though how to write up the script for it, that's a bit beyond me at the moment (I'm still about 50% utter noob). Sorry I can't be of more help there.

Link to comment
Share on other sites

You simply run through (while loop) whatever leveled list you want to use and add the spells from it to your (n)pc. Just use functions like GetNumLevItems, GetNthLevItem and of course AddSpellNS. If the objects themselves are also leveled lists you could use GetObjectType to figure that out and go through those list(s) also. Edited by Maskar
Link to comment
Share on other sites

  • Recently Browsing   0 members

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