(fixed) Ai bugs

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting. You may Image to help finance the hosting costs of this forum.
Post Reply
User avatar
Joramun
Mon Master
Posts: 927
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

(fixed) Ai bugs

Post by Joramun »

Code: Select all

FATAL LUA ERROR: Lua Function sys_ai_near: base/monster_ai.lua:2640: attempt to perform arithmetic on a nil value
@@@ LUA STACK @@@
[S:base/monster_ai.lua:2640: attempt to perform arithmetic on a nil value]
@@@@@@
I also had the same kind of problems with :

Code: Select all

local delay_len = dsb_ai(boss_id, AI_DELAY_ACTION, QUERY)
returning nil. (With a Deth Armor)
What Is Your Quest ?
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Ai bugs

Post by Sophia »

I'll change those functions to return the actual integer 0 instead of nil when the value is 0.

Sometimes I kind of dislike that Lua makes a distinction. :)
Anyway, fixed!

The one consequence of this fix is that a line like

Code: Select all

if (dsb_ai(id, AI_DELAY_ACTION, QUERY))
will now always be true. It'd need to be rewritten as "if (whatever > 0)" to work right.
Post Reply