Adding flat agi to stamina (Stamina script done, just need the last piece)

Hello all you wondeful people!
 

I know what I need to do is make the script work alongside $game_actors[0].agi somehow but I get various errors mostly telling me ether that .nil can't be coerced into fixnum or undefined method 'agi' for nil:NilClass

Here's the script:
http://pastebin.com/MkDpnxYA

And the method that does the setup for how much Stamina the player has is called (this to me seems like the likely place to add the relevant code:
 def setup_initial_ct(actor_id)


Cheers!
And thanks in advance <3

 
There isn't an actor with ID 0.


Or, there shouldn't.


Replace 0 with actor_id and see if that works.
Actually solved it just moments later but from a whole 'nother perspective. I was just being really silly. There's a command inside of the XAS script to change max stamina. Just using that and events works for me ^-^ Now I feel bad for posting here and getting people worked up! 😳

Consider this solved and closed, if anyone is curious to how it was solved PM me ^-^

Original thread: https://forums.rpgmakerweb.com/threads/adding-flat-agi-to-stamina-stamina-script-done-just-need-the-last-piece.44424/