Jump to content

Scripting Question


billypnats

Recommended Posts

I don't know how the "short" and "long" command on the scripts work. I analysed other mods and I still have no clue. Does it allow aliases for other commands? but how does TES know which one it corresponds to?

 

 

Second Question:

 

Im trying to make a script for a weapon that onequip, adds a spell to you that fortifies something (like str, int, etc) but drains your magicka in the process and when your magicka hits a certain percentage, the spell is removed. What are the commands that decreases your magicka? and commands that detects it (something like a GetMagicka command)

Link to comment
Share on other sites

"Short", "Long" (Rarely used), "Float", and "Ref" aren't so much traditional functions as declaring variables. So putting "Short MyVariable" (traditionally outside any begin/end) blocks would allow you to store a number with MyVariable. More on variables can be found here.

 

The script in question might have a different optimal design depending on whether it's used on the player or an NPC... If it's used on the player, it might be better to add/remove "ability" spells and maybe split the script into one on the magic effect and one on the weapon for adding it, but on NPCs, AddSpell effects all the NPC-references that use that form, which could cause trouble. Without OBSE, I can't think of a way to do it for NPCs without causing trouble. Depending on how you want adding/removing the spell to go, OnEquip might not be the ideal begin/end block, but if you want to add the spell only OnEquip, and if the player's magicka runs down it serves as a mundane weapon until unequipped and re-equipped, this should work for the player only.

 

(Object script, attached to the weapon)

scn ArcaneFuryWeaponScript
ref wielder
;"Ref" variables store a reference, like a specific Iron Shortsword.  In this case, it's being used to check if the player is the one wielding it.

Begin OnEquip
 set wielder to GetContainer
;Needless to say, GetContainer can return an NPC who has the object in its inventory, instead of just traditional "Chest" containers.

 if (wielder == player && wielder.GetActorValue Magicka >= (wielder.GetBaseActorValue Magicka / 2) )
;You can use GetAV or GetBaseAV in scripts for short.  Here I check if the player's magicka is half or more, but you can divide GetBaseAV by pretty much anything else.
	  player.AddSpell ArcaneFury
 endif
end

 

(Magic Effect script attached to the ArcaneFury "Ability" spell, that includes whatever Fortify effect you want, and Damage Magicka)

 

scn ArcaneFuryScript

Begin ScriptEffectUpdate
 if (GetAV Magicka < (GetBaseAV Magicka / 2) )
;Same check as was done on the weapon, except backwards.
	  RemoveSpell ArcaneFury
 endif
end

Link to comment
Share on other sites

I don't know how the "short" and "long" command on the scripts work. I analysed other mods and I still have no clue. Does it allow aliases for other commands? but how does TES know which one it corresponds to?

 

 

Second Question:

 

Im trying to make a script for a weapon that onequip, adds a spell to you that fortifies something (like str, int, etc) but drains your magicka in the process and when your magicka hits a certain percentage, the spell is removed. What are the commands that decreases your magicka? and commands that detects it (something like a GetMagicka command)

Beside the clues from LoginToDownload the better next thing is using "Help", yes, that CS's menu for some reason nobody uses... it will link you to the Wiki documentation where you find all you need to begin modding.

Link to comment
Share on other sites

Beside the clues from LoginToDownload the better next thing is using "Help", yes, that CS's menu for some reason nobody uses... it will link you to the Wiki documentation where you find all you need to begin modding.

 

 

Well I searched it, there isn't any thing like getmagickavalue command out there

 

Oh yea THnx LoginToDownload, I've got the script working now

Link to comment
Share on other sites

Beside the clues from LoginToDownload the better next thing is using "Help", yes, that CS's menu for some reason nobody uses... it will link you to the Wiki documentation where you find all you need to begin modding.

 

 

Well I searched it, there isn't any thing like getmagickavalue command out there

 

Oh yea THnx LoginToDownload, I've got the script working now

Most of options involving actors (NPCs,Creatures and even the player) are under the form of Get/Mod/SetActorValue, ActorBaseValue and AV2 (aways with one of those 3, Get, Mod or Set). just be aware some of then needs OBSE

 

understanding the differences between Base, current and the AV2 is fundamental to good scripting.

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...