Hi all,
Im working on a game with several characters. Each character has a set of variables that impact their behaviors.
To tackle this, I figured I'd use "Dynamic arrays" straight from the dynamic help section of the engine.
In a script, I define the variable array. In this case it's health.
Code: ags
then in game_start, I include the following:
Code: ags
Then to test if it works I set up the following: One action which tells me what a NPHealth variable is, and one which tells me what the same NPHealth variable is after subtracting 20.
Code: ags
Code: ags
I keep getting "Null pointer referenced" errors. I tried moving the location of where the array is defined but nothing has worked so far.
Thanks in advance.
Im working on a game with several characters. Each character has a set of variables that impact their behaviors.
To tackle this, I figured I'd use "Dynamic arrays" straight from the dynamic help section of the engine.
In a script, I define the variable array. In this case it's health.
//define health
int NPHealth[];
then in game_start, I include the following:
NPHealth = new int[Game.CharacterCount];
Then to test if it works I set up the following: One action which tells me what a NPHealth variable is, and one which tells me what the same NPHealth variable is after subtracting 20.
cCharacter.Say("health is %d",NPHealth[5]);
NPHealth[5] -= 20;
cCharacter.Say("health is %d",NPHealth[5]);
I keep getting "Null pointer referenced" errors. I tried moving the location of where the array is defined but nothing has worked so far.
Thanks in advance.