Scripts / Need help with script error.

Author
Message
BasCelik
14
Years of Service
User Offline
Joined: 21st Jan 2012
Location: Mechanicsville, VA
Posted: 17th May 2020 07:24
Hello All, I am trying to implement "KruparGames" ai_quest_giver_1.lua" script and am getting an error when testing the level. The error is as follows:

scriptbank\ai_quest_giver_1.lua:47: attempt to compare number with nil

For the life of me I can not figure out the cause. I have also ran this through some lua code testing sites and seems not to have any errors there either. I have attached the file from KruprarGames post. This is one part of several he posted in his thread. Maybe I am missing something else.

One other thing, is this file attached to an entity or to a character I created/stock one from game guru?

Any help would be much appreciated.

AmenMoses
GameGuru Master
10
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 17th May 2020 13:06
The problem is probably in another script, something somewhere is overwriting ai_old_health.

Check other scripts for ai_old_health=<something>, i.e. without the [e].

If you can't track it down, in every script that references ai_old_health put:

local ai_old_health = {}

at the top of the script.
Been there, done that, got all the T-Shirts!
PM
BasCelik
14
Years of Service
User Offline
Joined: 21st Jan 2012
Location: Mechanicsville, VA
Posted: 22nd May 2020 04:03 Edited at: 22nd May 2020 04:04
AmenMoses, I actually went and created a new map with only that script. Still the same error appears. I also added the ai_old_health to the local variables. No change. One other issue I have noticed is when I test the game, nothing will responde until I press a mouse button...like it is waiting for an input from the mouse. Really confusing. I would like to solve this issue but, at the same time I am looking for a different quest type of script. I could use the basic one that Lee created but again, I like more flexability. if you know any that you would recommend that would be great. I wrote code many many moons ago, and I am trying to learn Lua, so eventually I'll be able to manipulate or write my own. Thanks for any help you can provide. Much appreciated.

BasCelik
AmenMoses
GameGuru Master
10
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 22nd May 2020 09:16
I've just done the same thing, empty map, add civilian and assign him that script, add player start marker. Runs fine, no error and no strange behaviour.

I suggest you verify files!
Been there, done that, got all the T-Shirts!
PM
BasCelik
14
Years of Service
User Offline
Joined: 21st Jan 2012
Location: Mechanicsville, VA
Posted: 26th May 2020 02:57
AmenMoses, very interesting, what version GG you running? I will verify files. Thanks for testing it. Atleast I now know the script is not corrupted. I'll let you know if verifying the files works.

BasCelik

Login to post a reply

Server time is: 2026-06-28 18:31:47
Your offset time is: 2026-06-28 18:31:47