Rune color with forbid magic

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.
Post Reply
User avatar
Qwerty
Apprentice
Posts: 55
Joined: Sun Aug 30, 2009 6:21 am

Rune color with forbid magic

Post 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?
User avatar
Qwerty
Apprentice
Posts: 55
Joined: Sun Aug 30, 2009 6:21 am

Re: Rune color with forbid magic

Post 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.
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Rune color with forbid magic

Post 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.
Post Reply