For-loop - not declared [SOLVED] - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: For-loop - not declared [SOLVED] (/thread-25937.html) |
For-loop - not declared [SOLVED] - FlawlessHappiness - 08-22-2014 Hey guys. Take a look at this: PHP Code: void CheckBattle() I hope this lines up correctly. It says EnemyMonsterHealth is not declared. When I am clearly declaring it here: PHP Code: void BattlePreparation() What I'm trying to do is make a for loop check how much health the monster has by grabbing the actual health as the lowest and the max health (+1) as the highest. Am I doing something wrong? RE: For-loop - not declared - Neelke - 08-22-2014 I don't think the script can find the int variable there, considering it's not a global int either. I would put the int variable in the CheckBattle script as well. Code: void CheckBattle() RE: For-loop - not declared - Wapez - 08-22-2014 An int dies after it's functions is done. You need to use SetLocalVarInt("EnemyMonsterHealth); RE: For-loop - not declared - FlawlessHappiness - 08-22-2014 Putting it there isn't gonna help much, since CheckBattle is actually checking the value of that int and if CheckBattle sets it to 10 all the time, there's no reason to check it.. I'm gonna try to fix this with a timer. Got other solutions? They'll be accepted with smiles ^^ (08-22-2014, 06:45 PM)Wapez Wrote: An int dies after it's functions is done. You need to use SetLocalVarInt("EnemyMonsterHealth); Woop woop thanks! I'll see how it works! EDIT: Oh god... It was too simple... Thanks Wapez you solved one part. The other part was... I need to remember to use GetLocalVarInt and not just use the name of the variable. |