Jump to content

How to block multiple instances of the same Magic Effect running


PJMail

Recommended Posts

I have a 'potion' that triggers a 'magic effect' (which just runs a script) when consumed.

If I hotkey the potion I can spam that key and get many simultaneous versions of that magic effect running.

This is annoying as its script brings up a menu....

 

Is there an easy way to block the ME starting if there is already one active?

 

The 'hasmagiceffect' condition does nothing.

 

Is it possible the ME terminates once it launches the script - that would explain the condition failing?

 

I don't want to put some sort of 'lock' in the script unless I can be sure it will be released if the script terminates unexpectedly (game script dumping etc).

 

Surely the game has a nice method of stopping 'effect spamming'?

 

Thanks

Link to comment
Share on other sites

My Magic Effect is a 'fire and forget' with 0 duration so that probably explains why it is gone when the script starts.

 

And I probably need to let each instance of the script run so it 'replaces' the consumed Ingestable.

 

Oh well, simplest way is to move the 'AddItem(ingestable)' to the end of the script and hope noone has more than one of them...

 

Unless someone has a better idea (or can configure an ingestable to replace itself without a script)...

Link to comment
Share on other sites

Duration is 0 as it is just there 'fire and forget' to launch a script. I suppose I could set it to a few seconds which would stop most spamming - thanks.

 

Still has the issue that ingestables are still consumed even if the ME fails to fire.

Edited by PJMail
Link to comment
Share on other sites

Still has the issue that ingestables are still consumed even if the ME fails to fire.

Event OnItemEquipped(Form akBaseObject, ObjectReference akReference)
    ; this event will detect potions being used
    if akBaseObject as potion
        ; add the potion back
        Game.GetPlayer().addItem(akBaseObject)
    endif
EndEvent

Make some changes so that it only cares about the specific potion. The one issue I can see with that is they will never run out of this potion even if it succeeds.

 

Edited by Rasikko
Link to comment
Share on other sites

  • Recently Browsing   0 members

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