OK, right now I am just messing around with SMAUG-FUSS in CYGWIN, and I decided to make a new skill, with new code and everything. Now, just so you know, I am new to coding, I have dabbled for a while, but I have never delved into something so intricate as SMAUG.
I added the following code:
(the code is supposed to stop combat(like flee) then cause the user to go into hide, but will only work if the victim is affected by blindness)
to skills.c
this to tables.c:(line 2098)
as well as this to tables.c:(line 966)
in mud.h, line 3905:
when I fight a mob, gouge them, and type retreat, a segmentation fault occurs. I was able to get this much with GDB:
Thanks to Nick Gammon's GDB tutorial, I have figured out that this has something to do with ch->trust(I hope!)... just what, I have no clue.
Could anyone help give me some idea of what is going on, and how I could fix it?
Thanks a lot,
Will Sayin
telnet://darkstone.betterbox.net:5432
I added the following code:
(the code is supposed to stop combat(like flee) then cause the user to go into hide, but will only work if the victim is affected by blindness)
void do_retreat( CHAR_DATA * ch, char *argument )
{
int percent;
CHAR_DATA *victim;
if( ch->fighting )
{
percent = number_percent( ) + ( IS_AFFECTED( victim, AFF_BLIND ) ? 10 : -50 )
- ( get_curr_lck( ch ) - 15 ) + ( get_curr_lck( victim ) - 13 );
if( !IS_AFFECTED( victim, AFF_BLIND ) || !can_use_skill( ch, percent, gsn_retreat ))
{
send_to_char( "You try to jump out of combat, but are unable to get out in time!\n\r", ch );
act(AT_ACTION, "$n tries to jump out of combat, but you catch $m!", ch, NULL, victim, TO_VICT );
act(AT_ACTION, "$n tries to jump out of combat, but $N catches $m!", ch, NULL, victim, TO_NOTVICT );
WAIT_STATE( ch, 15 );
return;
}
stop_fighting( ch, TRUE );
xSET_BIT( ch->affected_by, AFF_HIDE );
send_to_char( "You jump out of combat and seek refuge in the shadows.\n\r", ch);
WAIT_STATE( ch, 10);
}
}
to skills.c
this to tables.c:(line 2098)
if( skill == do_retran )
return "do_retran";
if( skill == do_retreat ) <------these two
return "do_retreat"; <------ lines
if( skill == do_return )
return "do_return";
as well as this to tables.c:(line 966)
if( !str_cmp( name, "do_retran" ) )
return do_retran;
if( !str_cmp( name, "do_retreat") ) <--- this line
return do_retreat; <--- and this
if( !str_cmp( name, "do_return" ) )
return do_return;
in mud.h, line 3905:
DECLARE_DO_FUN( do_retran );
DECLARE_DO_FUN( do_retreat ); <----- this line
DECLARE_DO_FUN( do_return );
when I fight a mob, gouge them, and type retreat, a segmentation fault occurs. I was able to get this much with GDB:
Program received signal SIGSEGV, Segmentation fault.
0x004c3eea in get_Trust (ch=0x440f708) at handler.c:136
136 if( ch->trust !=0 )
(gdb) list
131 short get_trust( CHAR_DATA * ch )
132{
133 if( ch->desc && ch->desc->original )
134 ch = ch->desc->original;
135
136 if( ch->trust != 0 )
137 return ch->trust;
138
139 if( IS_NPC( ch ) && ch->level >= LEVEL_AVATAR )
140 return LEVEL_AVATAR;
141
142 if( ch->level >= LEVEL_NEOPHYTE && IS_RETIRED( ch ) )
143 return LEVEL_NEOPHYTE;
144
145 return ch->level;
146 }
(gdb) print ch->trust
Cannot access memory at address 0x440f7c0
(gdb)
Thanks to Nick Gammon's GDB tutorial, I have figured out that this has something to do with ch->trust(I hope!)... just what, I have no clue.
Could anyone help give me some idea of what is going on, and how I could fix it?
Thanks a lot,
Will Sayin
telnet://darkstone.betterbox.net:5432