r/gamemaker • • 1d ago

Resolved Turn-Based Combat Tutorial Issue?

I'm following this tutorial on setting up a turn-based combat, but I keep getting the following error code:

___________________________________________

############################################################################################

ERROR in action number 1

of Step Event0 for object obj_battle:

Variable <unknown_object>.effectOnTaret(100084, -2147483648) not set before reading it.

at gml_Script_BattleStatePerformAction@gml_Object_obj_battle_Create_0 (line 97) - if (currentAction.effectOnTaret == MODE.ALWAYS) || ( (currentAction.effectOnTarget == MODE.VARIES) && (array_length(currentTargets) <= 1) )

############################################################################################

gml_Script_BattleStatePerformAction@gml_Object_obj_battle_Create_0 (line 97)

gml_Object_obj_battle_Step_0 (line 1) - battleState();

I'm pretty new to game maker and coding in general, but I've gone over the video multiple times trying to figure out why it's saying unknown object.

EDIT: Coding with dyslexia is horrible. I've just misspelled things everywhere lol.

1 Upvotes

16 comments sorted by

5

u/fryman22 1d ago

effectOnTaret typo

1

u/GracieGrace4092 1d ago

oh. my god.

1

u/GracieGrace4092 1d ago

welp. now the error message is

___________________________________________

############################################################################################

ERROR in action number 1

of Step Event0 for object obj_battle:

Variable <unknown_object>.effectOnTarget(100084, -2147483648) not set before reading it.

at gml_Script_BattleStatePerformAction@gml_Object_obj_battle_Create_0 (line 97) - if (currentAction.effectOnTarget == MODE.ALWAYS) || ( (currentAction.effectOnTarget == MODE.VARIES) && (array_length(currentTargets) <= 1) )

############################################################################################

gml_Script_BattleStatePerformAction@gml_Object_obj_battle_Create_0 (line 97)

gml_Object_obj_battle_Step_0 (line 1) - battleState();

so that would have been a problem next, but for some reason the currentAction is an unknown object???

2

u/germxxx 1d ago

It would help to actually see your code. Especially everything related to this error. So when you call BeginAction, the global.actionLibrary, BeginAction itself, and also BattleStatePerformAction.

The error just says that effectOnTarget isn't specified for the struct that is referred to in the currentAction variable.

1

u/GracieGrace4092 1d ago

3

u/germxxx 1d ago

In your game data, you named the variable "effectOnTargert"

3

u/germxxx 1d ago

And in func, in the same struct, you also misspelled "ceil" the function as cell

1

u/GracieGrace4092 1d ago

Where is that? I can't find it anywhere even with control f

2

u/germxxx 1d ago

Exactly where the error says that it is:
GameData (script) Line 17

var _damage = --> cell <-- (_user.strength + random_range(-_user.strength + 0.25, _user.strength * 0.25));

1

u/GracieGrace4092 1d ago

Thank you!

2

u/nainainaii 1d ago

Ctrl + shift + f to find every instance of whatever you type, everywhere; might be useful down the line

1

u/GracieGrace4092 1d ago

Now I'm getting

############################################################################################

ERROR in action number 1

of Step Event0 for object obj_battle:

Variable struct.cell(100018, -2147483648) not set before reading it.

at gml_Script_anon@314@___struct___2@___struct___1@GameData (line 17) - var _damage = cell(_user.strength + random_range(-_user.strength + 0.25, _user.strength * 0.25));

############################################################################################

gml_Script_anon@314@___struct___2@___struct___1@GameData (line 17)

gml_Script_BattleStatePerformAction@gml_Object_obj_battle_Create_0 (line 112) - currentAction.func(currentUser, currentTargets);

gml_Object_obj_battle_Step_0 (line 1) - battleState();

Is that another typo thing??? I can't for the life of me find anything spelled wrong

1

u/nainainaii 1d ago edited 1d ago

Cell should be ceil… this is a lot of typos, yeah. Maybe look through the video again if you get more errors.

(I say this gently, but I think this tutorial might be too difficult right now. Ceil is a function, do you understand what it does? Do you know why Sara is coding the tutorial the way she is? If you do, keep moving forward, and I apologise for the unsolicited advice. If not, there are simpler tutorials out there; turn based games are hard)

https://manual.gamemaker.io/lts/en/GameMaker_Language/GML_Reference/Maths_And_Numbers/Number_Functions/ceil.htm

I just saw your edit; if the issue is dyslexia, the skill you need to learn asap is figuring out how to self solve your mistakes when they pop up. In your original post, “effectontaret” was the issue and was also basically highlighted (by being the top most error message) so I hope in the future, when you see the reports, you take another glance at it and read it slowly. Similarly, another issue you had was “currentaction.effectontarget variable was not set”, which likely means that there’s a spot where it needs to be set and it wasn’t. So what I would’ve done is find the spot current action is first used / set up in, where all your variables for effect on target are mean to be - and I would find it either because I know how my system is set (I have my variables in locations very obvious to me), or with ctrl + shift + f - and look through every instance and pay lots of attention for spelling errors or logic errors. I hope that’s useful.

1

u/GracieGrace4092 1d ago

Yeah. I knew where the problem was and thought it might be a spelling mistake, but could not for the life of me find it even when looking just at the one line. I even triple checked the words by going letter by letter and still missed it lol.

1

u/fryman22 1d ago

Upload just the files so it's easier to look through.

1

u/Mr_Quackums 1d ago

I've just misspelled things everywhere lol.

thats why I have the "dummy list" that I use after I cant resolve a error message after about 1 minute.

  • is everything spelled correctly
  • are all the "({})" in the right spots
  • is the code being run from the correct object (includes any "with" or "other." shenanigans)

if the fix to the message isnt obvious then run through the dummy list. If its still not fixed THEN you have a puzzle to solve.