Spell window

Everything about development and the OpenMW source code.
Post Reply
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Spell window

Post by scrawl »

How should I set the selected enchanted item? For spells / powers I can do:

Code: Select all

        spells.setSelectedSpell(_sender->getUserString("Spell"));
However, enchanted items don't have a spell, only an ESM::Enchantment.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Spell window

Post by Zini »

There is a selected item? Please refresh my memory, because I honestly don't remember such a thing (you can bind items to hotkeys, but I assume that is not what you meant).
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Spell window

Post by Zini »

Just found the MW manual on steam (lost my own physical copy of it years back). I can't find any indication of a selected item either, so it seems my memory is correct.

There are items bound to keyboard shortcuts, but these are not implemented yet.

There is also the weapon in the players main (right) hand, that will cause a magic effect when attacking, if there is an on hit enchantment.

And finally there are also equipped items, that when enchanted with a constant magic effect will affect the player. These effects are tracked by the InventoryStore.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Spell window

Post by scrawl »

The spell window list 3 types of things: Powers, spells, and enchanted items with enchantment of type "Cast Once" or "Cast when used". Each of these can be selected, and will then be displayed on the "Selected spell" icon on the HUD. (And pressing R to ready magic and then casting with left click will either cast the spell, or use the enchanted item)

This is the only possible way to use enchanted items of type "cast once" or "cast when used".
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Spell window

Post by Zini »

Right. Not supported yet.

You could add it to the InventoryStore. Just a ContainerStore iterator with get and set functions. If it is an end-iterator, the selected spell is used. If no spell is selected, the selected item is used.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Spell window

Post by scrawl »

Ok, will do.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Spell window

Post by scrawl »

Any suggestions where I should put the method that calculates spell success chance? Something like

Code: Select all

getSuccessChance(const std::string& spellId, MWWorld::Ptr actor)
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Spell window

Post by Zini »

Just make it a free function in a new file in mwmechanics. We don't have any other obvious place it could go to.
Post Reply