Morrowind Mod talk:AddItem

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search

A little change[edit]

That's how it started. I must be crasy. But there was a lot missing or even wrong. And then there was no structure. Every piece of information has been tested by me and should be correct - unless newer program versions changed things.

If you strongly dislike my work - now is the time for a public outcry. Otherwise I will continue, as time permits (and my mental state). Karl1965 04:57, 23 September 2011 (UTC)

I have done more testing, and I think I now understand the intricacies of the addItem problem better than before. Frankly, it's apalling. I can't remember anything that badly implemented, and I work with computers for about 30 years now. That requires new changes, hopefully the last for now. Karl1965 19:12, 27 September 2011 (UTC)
OK, I AM crazy. I added all the stuff about what addItem does in different situations, now I will run one last test: What happens, if the container is organic and respawns?... Karl1965 15:39, 28 September 2011 (UTC)

correct input of additem command[edit]

Looking through the CS I noticed that all of the additem instance are written without the commas. I.e., Player->AddItem P_Invisibility_E 1 (in the theives guild, diamond quest)and not Player->AddItem, P_Invisibility_E, 1 Do both versions work, or is there a difference between using this command in the CS and the game (console)? -Meisterdieb 16:03, 29 January 2010 (UTC)

Both is correct. Look at this Karl1965 04:57, 23 September 2011 (UTC)

Example: Workaround for Anarenen[edit]

Maybe someone has fun with this. It is an example how to deal with the addItem bug.

begin anarenenChestScript
; (C) 2011 by Karl1965
; fixes the missing tanto bug. If the player has looted the chest before, the tanto will not be added,
; so find a workaround
; script should be attached to chest_small_02_anarenen

short state
short level
short text
short val

if ( CellChanged == 1 )
        if ( state == -1 )
                return
        endif

        if ( GetJournalIndex TG_LootAldruhnMG > 0 )
                if ( state == 0 )
                        ; didn't do it! So just go on normally
                        set state to -1
                        return
                elseif ( state == 1 )
                        ; have been opened before
                        set state to 2
                endif

                ; have some fun, get some nice message. what is our best ability?
                set text to 0
                set val to ( player->getSecurity )
                if ( val >= 50 )
                        set text to 1
                        set level to val
                endif
                set val to ( player->getIllusion )
                if ( val > level )
                        set text to 2
                        set level to val
                endif
                set val to ( player->getMysticism )
                if ( val > level )
                        set text to 3
                        set level to val
                endif
                set val to ( player->getEnchant )
                if ( val > level )
                        set text to 4
                        set level to val
                endif
                set val to ( player->getLuck )
                if ( val > level )
                        set text to 5
                endif
        endif
        return
endif

if ( OnActivate == 1 )
        if ( state == -1 )
                ; all done
                Activate
                return

        elseif ( state < 2 )
                ; not accessed so far, before quest
                if ( getLocked == 1 )
                        ; can not access
                        activate                                                ; maybe needed for rattling sound?
                        return
                endif
                ; not locked, will open, we assume, player emptied chest
                set state to 1
                activate                                                        ; open it
                return
        endif

        ; state is 2, we are on the quest and the chest had been opened. Assume it is empty. Just in case remove item
        player->addItem devil_tanto_tgamg 1
        removeItem devil_tanto_tgamg 1
        set state to -1
        activate
        if ( text == 1 )
                MessageBox "Your great skills as a thief let you find the Devil's Tanto immediately." "OK"
        elseif ( text == 2 )
                MessageBox "Your expertise as illusionist leads you to the hidden Devil's Tanto in no time." "OK"
        elseif ( text == 3 )
                MessageBox "Your mystic powers reveal everything. The Devil's Tanto is in a hidden compartment of this chest." "OK"
        elseif ( text == 4 )
                MessageBox "As the great enchanter you are, you feel the hidden magic of the Devil's Tanto." "OK"
        elseif ( text == 5 )
                MessageBox "You are lucky! As you handle the chest, a hidden compartment opens and reveals the Devil's Tanto." "OK"
        else
                MessageBox "You examine the chest from every side, muttering every incantation you can remember. No success. Just as you decide to give up, you find a hidden compartment in the chest. Finally, there is the Devil's Tanto!" "OK"
        endif
endif
end

Karl1965 04:36, 26 September 2011 (UTC)