Jump to content

[LE] Problem with global variables


Ryyz

Recommended Posts

So I have a script that increases a global variable every time the player drinks a potion. I want the potions effects to stop applying once it gets to 100. I added the condition on the potion effects but once it reaches 100 the effects just stop. I tried everything I can think of. Can't get it to work.

Link to comment
Share on other sites

Describe in a little bit more detail what it is you are wanting to happen and what it is that is happening. Also post a screenshot of your condition statement(s) for the effect and / or effects in question.

 

 

5LLTqc0.png

 

 

Thats the condition I have set.

 

remember the toxicity script you helped me with last year? I just got back to working on that mod. Basically what I want to happen is once the global variable reaches 100, when you drink a potion no effects apply. But the problem is that when the toxicity reaches 100, it doesn't allow more effects but it also cancels the currently applied effects. I don't want that.

 

All the effects have the same condition.

 

Edit: I messed up the image several times. Fixed now though.

Link to comment
Share on other sites

If you were using a condition I would say make it < 100, but in this case I don't think you want to use a condition on the magic effect, because once the global variable reaches 100, like you said all magic effects that are currently active with that condition will stop. Instead, you can put a script on the magic effect that dispels the effect:

 

 

 

GlobalVariable Property WA_ToxicityLevelGlobal Auto 

Event OnEffectStart(Actor akTarget, Actor akCaster)
    If WA_ToxicityLevelGlobal.GetValue() >= 100
        Self.Dispel() 
    Endif
EndEvent 

Link to comment
Share on other sites

 

If you were using a condition I would say make it < 100, but in this case I don't think you want to use a condition on the magic effect, because once the global variable reaches 100, like you said all magic effects that are currently active with that condition will stop. Instead, you can put a script on the magic effect that dispels the effect:

 

 

 

GlobalVariable Property WA_ToxicityLevelGlobal Auto 

Event OnEffectStart(Actor akTarget, Actor akCaster)
    If WA_ToxicityLevelGlobal.GetValue() >= 100
        Self.Dispel() 
    Endif
EndEvent 

 

It does the same thing. That script would check if its greater than or equal to 100.. as a result if its equal to 100 it cancels and the way I have it set up makes it impossible to go above 100. I want the effects to remain but not gain any more until the global variable goes down which it does every 60 seconds.

Link to comment
Share on other sites

Like I said, if you put that condition on a magic effect, all effects that are currently active will cancel when the global reaches 100. Using the script function Dispel() only cancels that specific active magic effect. Other active magic effects remained untouched.

Link to comment
Share on other sites

Like I said, if you put that condition on a magic effect, all effects that are currently active will cancel when the global reaches 100. Using the script function Dispel() only cancels that specific active magic effect. Other active magic effects remained untouched.

I don't want any magic effects cancelled though... I just want to prevent them from continuing to apply until the global variable goes below 100.

Link to comment
Share on other sites

Try a value of 101 instead of 100. It doesn't solve the sudden cancellation of effects once the upper limit is reached but it does allow the effects of the 100th to continue at least and until the 101st is drank.

 

Alternatively, you can create a separate effect and / or set of effects that get applied only when the variable is at 100. That way the old might get erased but you'll still have some effects in place for the 100th.

 

I don't know. Pretty much just guessing as magic effects and their conditions were not among my most practiced when it came to modding.

Link to comment
Share on other sites

One more thought, if the dispel option doesn't work. Instead of putting the actual magic effects on the potion, you could make a spell for each potion and put the effects on the spell. For the potion magic effect, make it script type, then when you drink the potion, it casts the spell on the target, but only if the global is less than 100:

 

 

 

GlobalVariable Property WA_ToxicityLevelGlobal Auto 
Spell Property SpellPotion Auto ;put the actual effects of the potion on this spell.

Event OnEffectStart(Actor akTarget, Actor akCaster)
    If WA_ToxicityLevelGlobal.GetValue() < 100
        SpellPotion.Cast(akTarget, akTarget)
    Endif
EndEvent 

Edited by dylbill
Link to comment
Share on other sites

  • Recently Browsing   0 members

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