Jump to content

addform syntax


tnu

Recommended Posts

I'm trying to make my first mod and i'm ripping my hair out here trying to figure out how this works. I've never done anything with code before and so far I have no idea what's relevent and what isn't. I'm trying to use addform to add some spells from dragonborn such as Bound Dagger and Frenzy Rune to their relevent vender and loot lists (bound dagger in all lists where novice spelltomes can be found and Frenzy Rune where all expert tomes can be found.) I have no idea what goes where or how to make it work. I tried examining a simmilar script from Convenient Crossbows but I honeslty but I have no idea apart from the addform stuff what is relevent and what needs to be changed.

Link to comment
Share on other sites

I'm trying to make my first mod and i'm ripping my hair out here trying to figure out how this works. I've never done anything with code before and so far I have no idea what's relevent and what isn't. I'm trying to use addform to add some spells from dragonborn such as Bound Dagger and Frenzy Rune to their relevent vender and loot lists (bound dagger in all lists where novice spelltomes can be found and Frenzy Rune where all expert tomes can be found.) I have no idea what goes where or how to make it work. I tried examining a simmilar script from Convenient Crossbows but I honeslty but I have no idea apart from the addform stuff what is relevent and what needs to be changed.

; This script will put certain items in Magar's shop leveled list depending upon mods loaded.

 

Scriptname THEFINNMagarActivator extends Quest

 

LeveledItem Property MagarList Auto ; Point this at Magar's Leveled List in CK

 

;Supported Mods

bool isSkyrimThere ;I wonder if skyrim is there ?

bool isOpOutfitsLoaded ;Opulent Outfits - Mages of Winterhold - Replacer Version.

int i ;This is i, i is a counter, say hello i

int[] Robes ;Integer Array holding the item id's.

 

event OnInit() ;Run once On New Game Start

debug.Trace("========== Magar Initializing.")

StartShop()

endEvent

 

Function StartShop() ; This is also run once by player reference alias script on savegame LOAD.

isSkyrimThere = Game.GetFormFromFile(0x06B46C, "Skyrim.esm") ; check for skyrim.

isOPOutfitsLoaded = Game.GetFormFromFile(0x008A2F, "OmageReplacerPack.esp") ; check for opulent outfits.

if isOpOutfitsLoaded

OpulentOutfits()

endIf

if isSkyrimThere

VanillaMageRobes()

endif

endFunction

 

Function OpulentOutfits()

debug.Trace("========== Adding Opulent Robes, Hoods and Boots to Inventory.")

Robes = new int[10] ; Reset Array for new Items.

Robes[0] = 0x0028A6 ; Novice Hood of Alteration

Robes[1] = 0x002E35 ; Novice Hood of Conjuration

Robes[2] = 0x002E39 ; Novice Hood of Destruction

Robes[3] = 0x002E3D ; Novice Hood of Illusion

Robes[4] = 0x002E41 ; Novice Hood of Restoration

Robes[5] = 0x0028A7 ; Apprentice Boots of Alteration

Robes[6] = 0x002E33 ; Apprentice Boots of Conjuration

Robes[7] = 0x002E37 ; Apprentice Boots of Destruction

Robes[8] = 0x002E3B ; Apprentice Boots of Illusion

Robes[9] = 0x002E3F ; Apprentice Boots of Restoration

i = 0 ; set i back to zero to begin.

while i < Robes.Length

AddSomeItems("OmageReplacerPack.esp", Robes) ; Step through the Array.

i += 1

endwhile

 

endFunction

 

Function VanillaMageRobes()

debug.Trace("========== Adding Vanilla Skyrim Mage Robes to Inventory.")

Robes = new int[8] ; Reset Array for new items.

Robes[0] = 0x06B46C ; Novice Boots

Robes[1] = 0x10DD3A ; Novice Hood

Robes[2] = 0x10D667 ; Novice Robes

Robes[3] = 0x10D669 ; Novice Robes of Alteration

Robes[4] = 0x10D66A ; Novice Robes of Conjuration

Robes[5] = 0x10D668 ; Novice Robes of Destruction

Robes[6] = 0x10D671 ; Novice Robes of Illusion

Robes[7] = 0x10D66B ; Novice Robes of Restoration

i = 0 ; set i back to zero to begin.

while i < Robes.Length

AddSomeItems("Skyrim.esm", Robes) ; Step through the array adding each item.

i += 1

endWhile

endFunction

 

Function AddSomeItems(string Filetocall, int arg)

MagarList.AddForm(Game.GetFormFromFile(arg, Filetocall),1,1) ; Get the read item ID from the parent esm/esp and add it to the leveled list.

endFunction

 

Link to comment
Share on other sites

Well... you don't know the item id's of some mods until they are loaded up because of the first two digits, so I take those id's and make an array. detect the mod file -> add the items to the leveled list from the real id which we get from Game.GetFormFromFile.

 

Basically AddForm goes like this.

 

YourLeveledList.AddForm(ITEMID,LEVEL IN THE LIST,NUMBER OF ITEMS)

 

Level in the list is like the character level it should start to appear.

 

I just make an array out of the items and step through it with AddSomeItems Function which does all the work for me - so I'm not doing a lot of typing for no reason :wink:

Link to comment
Share on other sites

As long as you have it loaded as a master, but I would do it my way and just detect the file and get the real id as it runs. It's very simple.

 

You can see by example up there, those vanilla robes all point to vanilla items. They are the same refid with just 0x as the first 2 digits.

 

Then check it like this.

 

bool isSkyrimThere = Game.GetFormFromFile(0x06B46C, "Skyrim.esm") ; check for skyrim.

 

That's checking if there's a novice hood in skyrim.esm - if so, then skyrim.esm must exist and we can continue loading items from it.

 

This way you don't need to modify the script dependant upon what's being loaded and your mod won't need master - which can be an issue if your CK decides to start crashing because of memory issues (mine does that).

Link to comment
Share on other sites

Yep.

 

Then just import the items into the leveled list and away you go.

 

you could do an array like mine, or simpler might be just to do them one line each and cut-paste the command a lot (chesko does :wink:).

 

The script in frostfall that does it I think is DE_Compatibility - if you wanted another example, but he's just detecting the file and moving the items id's into an array, he's not putting them in leveled lists.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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