To be or not to be, that is the .... bug

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
ian_scho
High Lord
Posts: 2807
Joined: Fri Apr 07, 2006 8:30 am
Location: Zaragoza, Spain

To be or not to be, that is the .... bug

Post by ian_scho »

Hullo

I've been tinkering again and think I've broke it.

Basically, when a certain champion dies, I've overridden your sys_character_die function with my own. I have an additional check in there that it isn't a "npc", say, and if so I deposit their rotten corpse not only on the ground, but also remove their portrait as well. The dsb_champion_fromparty function only works on living characters, as far as I can tell, and not deceased ones... I tested it on two chars, removing the living one when the other one died and it was no problem.

Example code, pasted at the end of the function

Code: Select all

-- Remove XXXX from party
dsb_champion_fromparty(ppos)
Stack trace:
PROGRAM ERROR!
Reason: Removed nonexistent (from all)
Stack Dump:
DSBmain
DSBgameloop
run_timers
lua.dsb_champion_fromparty
remove_from_all_pos
User avatar
Sophia
Concise and Honest
Posts: 4307
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

The problem here is that you're trying to remove someone from the party who, being dead, isn't really "in" it in the first place. (They're not actually out of it, either)

Try code like this:

Code: Select all

dsb_delay_func(1, function()
dsb_set_bar(who, HEALTH, 1)
dsb_champion_fromparty(ppos) end)
It'll revive the character a tick later, and remove them then.

It's a bit hackish, but it should suffice...
User avatar
ian_scho
High Lord
Posts: 2807
Joined: Fri Apr 07, 2006 8:30 am
Location: Zaragoza, Spain

Post by ian_scho »

Fixed with a workaround, thanks Sophia:

Code: Select all

dsb_delay_func(2, function()
  dsb_set_bar(who, HEALTH, dsb_get_maxbar(who,HEALTH))
  dsb_champion_fromparty(ppos)
			end)
Set the guy back to full health and THEN remove him.
Post Reply