Stamina System Error

I've been testing my game and I keep having this error pop up:


Capture.png



It's from the script  Stamina Based Battle System - by Fomar0153


Link to script: Link


I don't understand what's going on with this error. It apears sometimes after an enemy dies, but it doesn't seem to come up in certain conditions, it seems to apear randomly. I don't even know where to start looking.


There is one condition in which the error always apears, and that's when an enemy dies because of a counter attack.


I really don't know what to do now. Any help is welcomed
Do you use any scripts for Counters or are you using the default counter from the maker?
Do you use any scripts for Counters or are you using the default counter from the maker?



I'm using the default
bump
Bump


I seems the program doesn't know the value stamina_cost in this code


def stamina_loss
if self.actor?
@stamina -= input.stamina_cost
else
@stamina -= @actions[0].stamina_cost
end
BattleManager.add_action
end


More specifically it's asking for


@actions[0].stamina_cost


What is @actions[0] ?


EDIT:


So I replaced the code


This is my code now


def stamina_loss
if self.actor?
@stamina -= input.stamina_cost
else
# @stamina -= @actions[0].stamina_cost how it was before
@stamina -= 1000 # what i changed
end
BattleManager.add_action
end


It seems to work fine ... but I feel like this isn't a good solution 🙁

Original thread: https://forums.rpgmakerweb.com/threads/stamina-system-error.55450/