Jump to content

[Noob Question] How to make a potion not usable during combat


Crosstieger

Recommended Posts

Yes I've read the tutorial and I tried google but I could not find an answer. :(

 

I know there is a condition "isincombat" and there is a game setting "sCombatCannotActivate" but I don't know how I apply them on a potion, so you can only use it when you are not in combat.

 

If I use the condition on the magic effect, only the effect won't "start", but it still consumes a potion.

 

I really don’t think it’s difficult.

 

Thanks :)

 

 

Link to comment
Share on other sites

I would try making a script that is runs when Items on a formlist are used. Then you could set them to not be used in combat with the code you mentioned above.

Link to comment
Share on other sites

I would try making a script that is runs when Items on a formlist are used. Then you could set them to not be used in combat with the code you mentioned above.

 

But where would I need to assign this script, that it will always run in the background to check if the player is in combat? I can not assign this script to the potion. I could only assign it to the magic effect but then you would sill consum a potion.

Link to comment
Share on other sites

You could attach it to the items themselves but this will conflict with mods that also change said items. There maybe a way to set the script to extend the ai script or combat script if there is one. You will just have to play around with the code and see what works best for you. Scripting is not my strong suit.

Link to comment
Share on other sites

Ok, I managed to do it with a script.

 

  • I added a second magic effect that has no effect
  • I added a script to that second effect that will show a message and adds an item
    Adding an item is nessecery, because even if the effect of the potion doesn't "start" it sill consumes one item.
  • The first magic effect has the condition "IsInCombat == 0", so the effect of the potion will only apply if you are not in combat
  • The second magic effect has the condition "IsInCombat == 1", so the script will only run if you are in combat
    If you are not in combat the second magic effect won't "start"

 

Here are some screenshots:

 

 

 

The item. Please ignore result 1-7.

 

http://tm-kirsche.square7.ch/Freddi/nexus/potion.jpg

 

The result (0). The "normal" effect, when you are not in combat.

 

http://tm-kirsche.square7.ch/Freddi/nexus/item-result1.jpg

 

The result (8). If you are in combat.

 

http://tm-kirsche.square7.ch/Freddi/nexus/item-result2.jpg

 

The magic effect that applys when you are not in combat.

 

http://tm-kirsche.square7.ch/Freddi/nexus/magic-effect-1.jpg

 

The magic effect that applys when you are in combat.

 

http://tm-kirsche.square7.ch/Freddi/nexus/magic-effect-2.jpg

 

The property of the script. This is important to get access to the item within the script. Otherwise you get a error while compiling.

 

http://tm-kirsche.square7.ch/Freddi/nexus/script-property.jpg

 

 

 

And here is the script itself.

 

 

Scriptname DocBagCombatState extends ActiveMagicEffect
{Checks for combat state}

Potion Property DocBag Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
    Debug.Notification("You can't use this while in combat")
    Game.GetPlayer().AddItem(DocBag, 1, true)
endEvent
Link to comment
Share on other sites

  • Recently Browsing   0 members

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