Code: Select all
elif pick == "hurt": #<----- The button sends us here, a function has loaded all the special damage and regular damage, now we pick a target
$ pick = ui.interact()
$ enemies[pick]["crnt_hp"] -= LoadDam #<-------- From the list of active enemies, the pick now suffers effects, both regular and special.
$ enemies[pick]["grit"] -= LoadGritDam
if LoadGritDam >= 0: #Nested to 9 #<----- Here we load up special attribute damage that will be returned after a clock runs out
if FloatingGrit1 == 0:
$ FloatingGrit1 += LoadGritDam
$ FloatingTarget1 = pick
elif FloatingGrit2 == 0: #<--- this goes on 9 times
$ Grit_Check() #<--Here, the numbers are assigned to their clocks. [pick == "hurt"] has no issues here. This block is the last shown in the post. Code: Select all
elif pick == "blanket": # <------- Returns "blanket" from ui.interact() so we know it applies to all enemies
if enemies[0] == True enemies[0].crnt_hp >= 0:
$ current_blanket_enemy1 = enemies[0]
if current_blanket_enemy1["crnt_hp"] > 0:
$ current_blanket_enemy1["crnt_hp"] -= LoadDam
$ current_blanket_enemy1["grit"] -= LoadGritDam
$ AmbGrt.amount -= LoadGritDam
if LoadGritDam >= 0: #Nested to 9
if FloatingGrit1 == 0:
$ FloatingGrit1 += LoadGritDam
$ FloatingTarget1 = current_blanket_enemy1
elif FloatingGrit2 == 0: #<----------this goes on for 9 cycles, but assigns a quantity of grit to be returned after a clock runs out.
if enemies[1] == True and enemies[1].crnt_hp >= o: #<--- It goes on for as many enemies as can be in a battle.
Then after all
$ Grit_Check() #<---- after "blanket" Grit_Check() throws the title error "list indices must be integers not NPC. Where is shown below.
Code: Select all
def Grit_Check():
global GritTimer1
global FloatingGrit1
global FloatingTarget1
if GritTimer1 == 0 and FloatingGrit1 >= 0:
enemies[FloatingTarget1]["grit"] += FloatingGrit1 <---#As I've said, "hurt" can fill this whole block to the 9s, literally, with no issue. Even "blanket"
AmbGrt.amount += FloatingGrit1 #can assign its first GritTimer with no problem. If I've assigned GritTimer1 with "hurt" then
FloatingGrit1 = 0 #"blanket" will assign its first target to GritTimer2 and fall over on GritTimer 3
FloatingTarget1 = 0
if GritTimer1 <= 0:
GritTimer1 = 0
global GritTimer2
global FloatingGrit2
global FloatingTarget2
if GritTimer2 == 0 and FloatingGrit2 >= 0:
enemies[FloatingTarget2]["grit"] += FloatingGrit2 # <-------Here is where we see the error, if i run a blanket with not GritTimer1 active
AmbGrt.amount += FloatingGrit2 # "list indices must be integers not NPC"
FloatingGrit2 = 0
FloatingTarget2 = 0
if GritTimer2 <= 0:
GritTimer2 = 0
global GritTimer3 ....... #<---------- This also goes on 9 timesBonus question, why isn't [if enemies[0] == True] working? The only reason I'm not doing an index and [len(enemies)] is to see if that was my problem, but now I'm curious.
Any help appreciated.
I'm an ignorant fool. Thanks for reading