Page 1 of 1

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

Posted: Thu May 01, 2008 5:07 pm
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

Posted: Thu May 01, 2008 11:38 pm
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...

Posted: Thu May 01, 2008 11:39 pm
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.