Jump to content

I need help with Scripting


Print

Recommended Posts

Hey guys I just stated making my own mods for oblivion.

I decided to Make a spell and Ive been stuck ever since

Now I've used the pre made in game spell options and all I'm trying to do now it get the spell to activate in game. Now Ive tried adding the spell id in game though the Player.addspell 908098 etc option but I just got the script failed error. So I tried to make a script for the spell.

Could someone give me an example of a script that adds a spell to your spell book. Currently mine is

 

begin Gamemode

 

if (player.IsInCombat ==0) && (getStage CharacterGen >88)

message "The Power Of Arcane Is now yours..."

player.addspell ArcaneThunderBolt

message "You Feel Godly."

StopArcaneFamilyPower DCArcaneFamilyPower

return

endif

 

end

 

But I'm sure you more experienced scribes see problems. But Is this at all right?

Tnx. :wallbash:

Link to comment
Share on other sites

There are two problems, first, you are using an existng script which is based around elements within that mod, so they will of course, not work in your mod. When learning to script, you should try figuring out the main components of the script, and look at what functions that script uses. In this case, it is a condition statement, and an addspell function. Almost everything else about the spell is related to whatever mod you took that script from, to work within the purposes of that mod. So if we strip it down to just a condition to make sure that the spell only gets added once, and remove the extra stuff, you end up with something like this.

 

scn PntSpelladdingscriptofsuperwonderment

short once

begin Gamemode

if (once == 0)
player.addspell ArcaneThunderBolt
set once to 1
return
endif

end

Which, when attached to an activator or active quest script, will add the spell to the player once the script runs. You will know the spell is added by there being a message about it, removing the necessity of any flavor messages. But, this script will still probably not work right, even if it is attached to something active. This leads into the second problem.

 

The second problem is that the game will rarely accept editor IDs in functions. So you will need to use the full form ID of the spell, which is the 8 digit number next to the editor ID. 908098 did not work because the game was looking in the 00 index for the spell, usually reserved for Oblivion.esm. if 908098 is the formID, you would need to use something like 01908098 in the function to tell the mod that you are linking to a spell made within that mod, or 00908098 if the spell you want to add is a spell which is part of Oblivion.esm. However, since there is no reason why anything would have that high of a formID within a mod, I would suspect that 908098 is not an actual ID.

 

Another problem is that "StopArcaneFamilyPower DCArcaneFamilyPower" is not a normal scripting function. As this is a non-normal function, it relies on other mods and additions to be present to use it. But as your needs do not seem to require whatever this function does, you can just leave it out. Yet another reason why you should learn to script using base functions first, before even looking at anything related to OBSE.

 

Hope that helps.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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