Page 1 of 1

Rune color with forbid magic

Posted: Wed Nov 13, 2013 5:39 pm
by Qwerty
I made a code that champion cannot cast spell such as silened via sys_forbid_magic. But the rune color didn't change with this function, so that I can't recognize whether he/she is silenced immediately. :?
Could you fix to change rune color when sys_forbid_magic return "true", like set g_disable_runes to "true" for DSB0.60?

Re: Rune color with forbid magic

Posted: Wed Nov 13, 2013 6:32 pm
by Qwerty
Oh...sorry, Sophia. I jumped to conclusions. :oops: This problem should be fix by myself and I rewrite a code to fix it inserting g_disable_runes = true or false.

Code: Select all

function sys_forbid_magic(ppos, who)
	local silenced = dsb_get_condition(who, C_SILENCE)
	if (silenced) then
		for i=1 ,#g_disabled_runes do
			g_disabled_runes[i] = true
		end
      return true
	end
	for i=1 ,#g_disabled_runes do
		g_disabled_runes[i] = false
	end
   return false
end
This code what I rewrite is working correctly so far so good. But if this code has some wrong or could be messy, tell me where is wrong.

Re: Rune color with forbid magic

Posted: Wed Nov 13, 2013 10:07 pm
by Sophia
That isn't the worst way to do it, though sys_forbid_magic only gets called when you try to actually use magic, so the runes might do strange things visually.

Personally, I'd change the function that drew the runes to check if the character was silenced. You can override draw_rune, found in base/render.lua.