Open spell issue

Post here if you need help getting started with Daggerfall Unity or just want to clarify a potential bug. Questions about playing or modding classic Daggerfall should be posted to Community.
Post Reply
Ommamar
Posts: 541
Joined: Thu Jul 18, 2019 3:08 am

Open spell issue

Post by Ommamar »

So every once in awhile I will get a ready to open message on a door after I use the open spell on it but then it says this lock is to powerful for you! Not sure what is going on as the usual correct response is for the door to open if I get the ready to open message.

User avatar
Jay_H
Posts: 4061
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Open spell issue

Post by Jay_H »

The Open spell puts an enchantment on you, not the door. When you click on the door the to-succeed chance makes its roll, and the door might be too much for you.

Ommamar
Posts: 541
Joined: Thu Jul 18, 2019 3:08 am

Re: Open spell issue

Post by Ommamar »

Jay_H wrote: Sat Aug 10, 2019 4:21 am The Open spell puts an enchantment on you, not the door. When you click on the door the to-succeed chance makes its roll, and the door might be too much for you.
Woah I didn't know that! So how does the lock spell work then? Mainly use it to lock away things I don't want to deal with in the early game but I always thought I was targeting the door. So how can you fail to buff your self? I could understand the buff not being powerful enough but it is odd that a self buff would fail.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Open spell issue

Post by Interkarma »

Open spell (if successful) allows you unlock doors up to your current level in strength. Some locks may be stronger than you are.

Lock spell allows you to lock doors to your own level strength. That is to say, a wizard of lower level than yourself could not open a door locked by your spell, but a wizard of higher level would be able to.

Many spells have a Chance component that determines if it was successful or not. We just follow classic here. Classic doesn't give much feedback at all for these effects.

The way Open/Lock work caused me a lot of confusion at first as well. I added some messages to try and make it clearer what was happening, but they need more clarity.

User avatar
Jay_H
Posts: 4061
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Open spell issue

Post by Jay_H »

For reference, the code for Lock is nearly identical to that of Open:

Code: Select all

// Output "Ready to lock." if the host manager is player
            if (awakeAlert && manager.EntityBehaviour == GameManager.Instance.PlayerEntityBehaviour)
            {
                DaggerfallUI.AddHUDText(TextManager.Instance.GetText(textDatabase, "readyToLock"), 1.5f);
                awakeAlert = false;
            }
        }

        /// <summary>
        /// Called by entity holding Lock incumbent when they activate a door.
        /// For player this is called by PlayerActivate when opening/closing a door.
        /// Enemies cannot use Lock/Open effects at this time.
        /// This effect will automatically close door if open when spell triggered.
        /// </summary>
        /// <param name="actionDoor">DaggerfallActionDoor activated by entity.</param>
        public void TriggerLockEffect(DaggerfallActionDoor actionDoor)
        {
            if (forcedRoundsRemaining == 0)
                return;

            bool activatedByPlayer = (manager.EntityBehaviour == GameManager.Instance.PlayerEntityBehaviour);

            if (actionDoor.IsLocked)
            {
                // Door already locked
                if (activatedByPlayer)
                    DaggerfallUI.AddHUDText(TextManager.Instance.GetText(textDatabase, "doorAlreadyLocked"), 1.5f);
            }
            else
            {
                // Locks door to level of entity - from spell description "Locks chest or door to lock-level of caster."
                actionDoor.CurrentLockValue = manager.EntityBehaviour.Entity.Level;

                if (activatedByPlayer)
                    DaggerfallUI.AddHUDText(TextManager.Instance.GetText(textDatabase, "doorLocked"), 1.5f);
            }

            if (actionDoor.IsOpen)
            {
                // Automatically close door if open
                actionDoor.ToggleDoor(activatedByPlayer);
            }

            // Expire effect once door activated
            CancelEffect();

Code: Select all

// Output "Ready to open." if the host manager is player
            if (awakeAlert && manager.EntityBehaviour == GameManager.Instance.PlayerEntityBehaviour)
            {
                DaggerfallUI.AddHUDText(TextManager.Instance.GetText(textDatabase, "readyToOpen"), 1.5f);
                awakeAlert = false;
            }
        }

        /// <summary>
        /// Called by entity holding Open incumbent when they activate a door.
        /// For player this is called by PlayerActivate when opening/closing a door.
        /// Enemies cannot use Lock/Open effects at this time.
        /// This effect will automatically open door if closed when spell triggered.
        /// </summary>
        /// <param name="actionDoor">DaggerfallActionDoor activated by entity.</param>
        public void TriggerOpenEffect(DaggerfallActionDoor actionDoor)
        {
            if (forcedRoundsRemaining == 0)
                return;

            bool activatedByPlayer = (manager.EntityBehaviour == GameManager.Instance.PlayerEntityBehaviour);

            if (actionDoor.IsLocked)
            {
                // Unlocks door to level of entity - from spell description "Unlocks chest or door to lock-level of caster."
                if (actionDoor.CurrentLockValue <= manager.EntityBehaviour.Entity.Level)
                {
                    actionDoor.CurrentLockValue = 0;
                }
                else if (activatedByPlayer)
                {
                    DaggerfallUI.AddHUDText(TextManager.Instance.GetText(textDatabase, "openFailed"), 1.5f);
                }
            }

            if (!actionDoor.IsLocked && actionDoor.IsClosed)
            {
                // Automatically open door if closed and unlocked
                actionDoor.ToggleDoor(activatedByPlayer);
            }

            // Expire effect once door activated
            CancelEffect();

Ommamar
Posts: 541
Joined: Thu Jul 18, 2019 3:08 am

Re: Open spell issue

Post by Ommamar »

Thank you both for the clarification!

Post Reply