(fixed) Lua error in poison_impact

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
money
On Master
Posts: 574
Joined: Tue Apr 29, 2008 4:45 pm
Location: Newcastle

(fixed) Lua error in poison_impact

Post by money »

hmm.... I got an error using latest version on level 4, against a swamp slime monster - was punching him... and when he shot some slime all closed and error presented:

Lua Function poison_slime.on_impact: base/damage.lua:377: attempt to perform arithmetic on local 'range' (a nil value)
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: (fixed) Lua error in poison_impact

Post by Sophia »

Oops. Fixed now. :)

If you want to keep playing, you can fix this yourself, too:
Around line 377 of damage.lua you'll find a function called poison_impact. However, immediately above that, you'll find another shorter function called poison_impact, taking less parameters. Two functions with the same name is what is creating the problem.
Change this line:

Code: Select all

function poison_impact(hit_ppos, poi)
to this:

Code: Select all

function player_poison_impact(hit_ppos, poi)
Then, lower down, early in the second poison_impact, look for some code that looks like:

Code: Select all

if (hit_ppos) then
   poison_impact(hit_ppos, poi)
end
and change that to:

Code: Select all

if (hit_ppos) then
   player_poison_impact(hit_ppos, poi)
end
Everything will work wonderfully, then. :mrgreen:
User avatar
money
On Master
Posts: 574
Joined: Tue Apr 29, 2008 4:45 pm
Location: Newcastle

Re: (fixed) Lua error in poison_impact

Post by money »

Thanks :)
User avatar
Gambit37
Should eat more pies
Posts: 13770
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: (fixed) Lua error in poison_impact

Post by Gambit37 »

This is so cool that simple bugs can be fixed locally by us!
Post Reply