<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2716.2200" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>I was checking out the code that returns messages
for rods and wands and horns (in player.c) because I wanted to make an item that
recharged like a rod. Looking at the code the messages for ranged attacks
are hard coded and there are case statements to spit them out depending on the
item type. </FONT></DIV>
<DIV><FONT face=Arial size=2>looks like this:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>case range_wand:<BR>
for(weap=op->inv;weap!=NULL;weap=weap->below)<BR>
if(weap->type==WAND&&QUERY_FLAG(weap,
FLAG_APPLIED))<BR> break;<BR> if(weap==NULL)
{<BR> new_draw_info(NDI_UNIQUE, 0,op,"You have no
wand readied.");<BR>
op->contr->count_left=0;<BR>
return;<BR> }<BR>
if(weap->stats.food<=0) {<BR>
play_sound_player_only(op->contr,
SOUND_WAND_POOF,0,0);<BR>
new_draw_info(NDI_UNIQUE, 0,op,"The wand says
poof.");<BR> return;<BR>
}<BR>
if(cast_spell(op,weap,dir,op->contr->chosen_item_spell,0,spellWand,NULL))
{<BR> SET_FLAG(op, FLAG_BEEN_APPLIED); /* You now
know something about it */<BR> if
(!(--weap->stats.food))<BR> {<BR> object
*tmp;<BR> if (weap->arch) {<BR> CLEAR_FLAG(weap,
FLAG_ANIMATE);<BR> weap->face =
weap->arch->clone.face;<BR> weap->speed =
0;<BR> update_ob_speed(weap);<BR> }<BR> if
((tmp=is_player_inv(weap)))<BR>
esrv_update_item(UPD_ANIM, tmp, weap);<BR>
}<BR> }</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> case range_rod:<BR> case
range_horn:<BR>
for(weap=op->inv;weap!=NULL;weap=weap->below)<BR>
if(QUERY_FLAG(weap, FLAG_APPLIED)&&<BR>
weap->type==(op->contr->shoottype==range_rod?ROD:HORN))<BR> break;<BR>
if(weap==NULL) {<BR> char
buf[MAX_BUF];<BR> sprintf(buf, "You have no %s
readied.",<BR> op->contr->shoottype == range_rod ? "rod" :
"horn");<BR> new_draw_info(NDI_UNIQUE, 0,op,
buf);<BR>
op->contr->count_left=0;<BR>
return;<BR> }<BR>
if(weap->stats.hp<spells[weap->stats.sp].sp) {<BR>#if
0<BR> LOG(llevDebug,"Horn/rod: %d < %d (%d)\n",
weap->stats.hp, spells[weap->stats.sp].sp,
weap->stats.sp);<BR>#endif<BR>
play_sound_player_only(op->contr,
SOUND_WAND_POOF,0,0);<BR> if
(op->contr->shoottype == range_rod)<BR> new_draw_info(NDI_UNIQUE,
0,op,"The rod whines for a while, but nothing
happens.");<BR>
else<BR> new_draw_info(NDI_UNIQUE,
0,op,<BR> "No matter
how hard you try you can't get another note
out.");<BR> return;<BR>
}<BR>
if(cast_spell(op,weap,dir,op->contr->chosen_item_spell,0,<BR>
op->contr->shoottype == range_rod ? spellRod : spellHorn,NULL))
{<BR> SET_FLAG(op, FLAG_BEEN_APPLIED); /* You now
know something about it */<BR>
drain_rod_charge(weap);<BR> }<BR>
return;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> I propose a small change here which I am not
yet competent to execute.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>1. Like to see two new item types - rodlike (for
recharging items) and wandlike (for rechargable items). not sure what the
best actual names should be... 'misc_rodlike' and 'misc_wandlike' ?</FONT></DIV>
<DIV><FONT face=Arial size=2>2. the player.c range code changed adding in a
second case called 'range_misc_wandlike' to the wand portion and a third case
called 'range_misc_rodlike' to the rod/horn portion which works off the else
statement which will spit out generic messages like </FONT></DIV>
<DIV><FONT face=Arial size=2>' the %s seems to be out of juice'
rather than the specific ones. </FONT></DIV>
<DIV><FONT face=Arial size=2>In the wand section there would be an 'if - else'
similar to the way the rod/horn section works, and for the rod/horn
section there would be an 'if - if - else' if you get my drift
here.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>something like this for wands</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>case range_wand</FONT></DIV>
<DIV><FONT face=Arial size=2>case range_misc_wandlike</FONT></DIV>
<DIV><FONT face=Arial size=2> do this:</FONT></DIV>
<DIV><FONT face=Arial size=2> if
(op->contr->shoottype == range_wand)</FONT></DIV>
<DIV><FONT face=Arial size=2>
do this:<BR> else</FONT></DIV>
<DIV><FONT face=Arial size=2>
do this:</FONT></DIV>
<DIV><FONT face=Arial size=2> do this:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>and this for rods/horns</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>case range_rod</FONT></DIV>
<DIV>case range_horn</DIV>
<DIV><FONT face=Arial size=2>case range_misc_wandlike</FONT></DIV>
<DIV><FONT face=Arial size=2> do this:</FONT></DIV>
<DIV><FONT face=Arial size=2> if
(op->contr->shoottype == range_rod)</FONT></DIV>
<DIV><FONT face=Arial size=2>
do this:<BR> if
(op->contr->shoottype == range_horn)</FONT></DIV>
<DIV> do this:</DIV>
<DIV><FONT face=Arial
size=2> else</FONT></DIV>
<DIV><FONT face=Arial size=2>
do this:</FONT></DIV>
<DIV> do this:</DIV>
<DIV> </DIV>
<DIV>This I think would be pretty simple to change but then again there
could be more to it than that since I am still puzzling my way along
here. Any thoughts?</DIV>
<DIV>It would allow for a whole bunch of new special items to be made which
would be fun if not functionally too different.How about a magic stone of
summoning or a teakettle of steambolt, or what I was trying to make 'Lythander's
pipe of wonder' and 'Lythander's pipe of mass confusion'</DIV>
<DIV> </DIV>
<DIV>Just a suggestion.</DIV>
<DIV>-tm</DIV></FONT></DIV></BODY></HTML>