Page 1 of 1
Posted: Fri Apr 06, 2007 11:30 am
by TheMormegil
Would it be (/is it currently) possible to have say, a hidden skills scroll.
When viewed by a character it's text showing that characters hidden skillz0rs.
Posted: Fri Apr 06, 2007 5:00 pm
by Adamo
you mean, when a character read a special scroll, he is able to cast a spell that was forbidden before?
Posted: Fri Apr 06, 2007 5:30 pm
by Joramun
No, reading a special scroll that displays the luck, and other hidden attributes of the character.
Posted: Fri Apr 06, 2007 8:05 pm
by Sophia
This is just a quick hack, I'm sure it could be done better.
However, as a demonstration, here's a scroll to display someone's hidden wizard skills on a scroll, using a subrenderer.
Code: Select all
obj.skillscroll = {
name="SCROLL",
type="THING",
class="SCROLL",
mass=1,
icon=gfx.icons[31],
alt_icon=gfx.icons[30],
dungeon=gfx.scroll,
to_r_hand = alticon,
from_r_hand = normicon,
fit_chest=true
}
function obj.skillscroll:subrenderer(id)
local ch, who = dsb_get_coords(id)
if (ch == MOUSE_HAND) then
who = dsb_ppos_char(dsb_get_leader())
end
local names = { "FUL", "IR", "DES", "VEN" }
local lines = { "SCROLL OF", "WIZARDRY", "" }
for i=1,4 do
local skillnum = dsb_xp_level(who, CLASS_WIZARD, i)
local s_skill
if (skillnum == 0) then
s_skill = "NO SKILL IN " .. names[i]
else
s_skill = names[i] .. " " .. xp_levelnames[skillnum]
end
lines[3+i] = s_skill
end
local num_lines = 7
local y_base = 72 - (num_lines*7) + (num_lines % 2)
local sr = dsb_subrenderer_target()
dsb_bitmap_blit(gfx.scroll_inside, sr, 0, 0, 0, 0, 246, 146)
for i=1,num_lines do
dsb_bitmap_textout(sr, gfx.scroll_font, lines[i],
124, y_base+((i-1)*14), CENTER, scroll_color)
end
end
(Note: What Adamo was talking about is also pretty easily doable, by adding an on_look event to the scroll)
Posted: Sat Apr 07, 2007 11:58 am
by Joramun
That just rocks. But I'm not too confident about how to design events attached to items, right now...