Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
Bug in do_drag( )
Oct 8, 2017, 12:40 am
By GatewaySysop
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Beastmaster 6D sound files
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl

Members: 0
Guests: 14
Stats
Files
Topics
Posts
Members
Newest Member
476
3,704
19,231
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SWFOTE FUSS » Help with fskills, I'm stumpe...
Forum Rules | Mark all | Recent Posts

Help with fskills, I'm stumped adding a new one!
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Nov 12, 2011, 10:27 pm
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

Ok, either I'm really tired or the solution is sitting right in front of me, anyhow I need a bit of help.
I'm adding in some new force skills. I've advanced the define for MAX_FORCE_SKILL up 1 in mud.h along with the do_fun statement. The command finfo shows it, I can even fstat <command> and get the properties of the command file in the /force directory from the game.

I followed interp.c if( check_force_skill( ch, command, argument ) ) to the source in force.c and it seems like everything checks out, however its not picking up on that skill.
This is the check_force_skill code from force.c:

int check_force_skill( CHAR_DATA * ch, const char *command, const char *argument )
{
        FORCE_SKILL *fskill;
        bool SKILL_FOUND = FALSE;
        DO_FUN *fun;

        for( fskill = first_force_skill; fskill; fskill = fskill->next )
        {
                if( !str_cmp( command, fskill->name ) )
                {
                        SKILL_FOUND = TRUE;
                        break;
                }
        }
        if( !SKILL_FOUND )
                return 0;
        fun = get_force_skill_function( fskill->code );
        if( fun == skill_notfound )
                return 0;
        ( *fskill->do_fun ) ( ch, argument );
        return 1;
}


This here is the code to go with the skill:
void fskill_force_push( CHAR_DATA * ch, const char *argument )
{
        FORCE_SKILL *fskill;
        CHAR_DATA *victim;
        if( argument[0] == '\0' )
                argument = str_dup( (const char*)ch->dest_buf );

        fskill = force_test_skill_use( "force_push", ch, FORCE_COMBAT );

        if( fskill == NULL )
                return;

        victim = force_get_victim( ch, argument, FORCE_INROOM );

        if( !victim )
                return;

        if( ch == victim )
        {
                send_to_char( "You cannot push yourself.\r\n", ch );
                return;
        }

        switch ( ch->substate )
        {
                default:
                        send_to_char( force_parse_string( ch, victim, fskill->ch_effect[0] ), ch );
                        send_to_char( force_parse_string( ch, victim, fskill->victim_effect[0] ), victim );
                        force_send_to_room( ch, victim, force_parse_string( ch, victim, fskill->room_effect[0] ) );
                        ch->dest_buf = str_dup( argument );
                        add_timer( ch, TIMER_DO_FUN, 2, fskill_force_push, 1 );
                        return;
                case 1:
                        if( number_range( 0, 4 ) != 0 && number_range( 0, 100 ) > ch->force_skill[FORCE_SKILL_FORCE_PUSH] )
                        {
                                send_to_char( force_parse_string( ch, victim, fskill->ch_effect[2] ), ch );
                                send_to_char( force_parse_string( ch, victim, fskill->victim_effect[2] ), victim );
                                force_send_to_room( ch, victim, force_parse_string( ch, victim, fskill->room_effect[2] ) );
                                force_learn_from_failure( ch, fskill );
                                ch->hit -=
                                        ( ( ch->force_alter * 40 / 100 ) + ( ch->force_sense * 40 / 100 ) + ( ch->force_control * 40 / 100 ) );
                                ch->substate = SUB_NONE;
                                return;
                        }
                        send_to_char( force_parse_string( ch, victim, fskill->ch_effect[1] ), ch );
                        send_to_char( force_parse_string( ch, victim, fskill->victim_effect[1] ), victim );
                        force_send_to_room( ch, victim, force_parse_string( ch, victim, fskill->room_effect[1] ) );
                        victim->hit -=
                                number_range( 50,
                                                ( ( ch->force_alter * 200 / 100 ) + ( ch->force_sense * 200 / 100 ) +
                                                  ( ch->force_control * 200 / 100 ) ) );
                        force_learn_from_success( ch, fskill );
                        if( !ch->dest_buf )
                                break;
                        DISPOSE( ch->dest_buf );
                        break;
                case SUB_TIMER_DO_ABORT:
                        send_to_char( force_parse_string( ch, victim, fskill->ch_effect[2] ), ch );
                        send_to_char( force_parse_string( ch, victim, fskill->victim_effect[2] ), victim );
                        force_send_to_room( ch, victim, force_parse_string( ch, victim, fskill->room_effect[2] ) );
                        ch->hit -= ( ( ch->force_alter * 40 / 100 ) + ( ch->force_sense * 40 / 100 ) + ( ch->force_control * 40 / 100 ) );
                        DISPOSE( ch->dest_buf );
                        break;
        }
        ch->substate = SUB_NONE;
        return;
}



Right now, its just a copy of force lightning...Which is why I'm not sure its picking it up.

It also seems that not too many people have tried to add force skills to the SWFotE side of things, or if they have the forums that hosted such knowledge is no longer running.

Here's the finfo for the test player:
(::::o::](====================================================================-
         You are a Jedi.    Mana: 0/0    Level: Jedi Master
-====================================================================)[::o::::)

                             (Apprentice skills)
  meditate        (100%)    finfo           (100%)    heal            ( 100%)
  slash           (100%)    makelightsaber  (100%)    parry           (100%)
  force_push      ( 96%)
                             (Jedi Knight skills)
  fshield         ( 100%)    whirlwind       (100%)    finish          (100%)
  reflect         (100%)    awareness       (100%)

                             (Jedi Master skills)
  sense           (100%)    protect         ( 100%)

Ok, so its there, at 96%, I set that value in my pfile to figure out if ForceSkill 24 = my new skill.

Now fstat force_push:
Skill Name: force_push
(::::o::](=====================================================================-
Level: 1         Type: Jedi       Index: 24        Cost: 0
Control: Yes     Alter: No        Sense: No        WaitState: 0
Disabled: No     Notskill: No     Mastertrain: No


So, finfo is finding the skill list, and fstat is also find it...why isn't the interpreter?
Any thoughts as to what I'm missing?

Thanks,
ayuri
       
Post is unread #2 Nov 13, 2011, 5:36 pm
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

Ok, so in trying to track down I checked that my skill is loading by modifying finfo.c bool load_forceskills by adding a bugline likes bug ("fskill name is %s" , fskill->name);
My bool load_forceskill function so it can be easily compared to the check_force_skill function in previous post:
bool load_forceskill( const char *forceskillfile )
{
   char filename[256];
   FORCE_SKILL *fskill;
   FILE *fp;
   DO_FUN *fun;
   bool found;

   CREATE( fskill, FORCE_SKILL, 1 );

   found = FALSE;
   sprintf( filename, "%s%s", FORCE_DIR, forceskillfile );

   if( ( fp = fopen( filename, "r" ) ) != NULL )
   {

      found = TRUE;
      LINK( fskill, first_force_skill, last_force_skill, next, prev );
      for( ;; )
      {
         char letter;
         char *word;

         letter = fread_letter( fp );
         if( letter == '*' )
         {
            fread_to_eol( fp );
            continue;
         }

         if( letter != '#' )
         {
            bug( "Load_forceskill: # not found.", 0 );
            break;
         }

         word = fread_word( fp );
         if( !str_cmp( word, "FORCE" ) )
         {
            fread_forceskill( fskill, fp );
            break;
         }
         else if( !str_cmp( word, "END" ) )
            break;
         else
         {
            char buf[MAX_STRING_LENGTH];

            sprintf( buf, "Load_forceskill: bad section: %s.", word );
            bug( buf, 0 );
            break;
         }
      }
      fclose( fp );
   }

   if( !( found ) )
      DISPOSE( fskill );
   fun = get_force_skill_function( fskill->code );
        bug( "fskillcodefunction is %s", fskill->code);
   fskill->do_fun = fun;
   return found;
}

The mud log now prints:
Sun Nov 13 20:29:45 2011 :: Loading force
Sun Nov 13 20:29:45 2011 :: Loading force skills...
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_refresh
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_finfo
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_student
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_master
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_identify
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_promote
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_instruct
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_heal
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_protect
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_fshield
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_whirlwind
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_slash
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_squeeze
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_force_lightning
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_fdisguise
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_makelightsaber
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_finish
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_fhelp
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_convert
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_makedualsaber
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_awareness
Sun Nov 13 20:29:45 2011 :: [*****] BUG: fskillcodefunction is fskill_force_push
Sun Nov 13 20:29:45 2011 ::  Done force skills


Note, the two blanks are parry and reflect that don't have any code checked assigned. As you can see, fskill_force_push is loading.

In force.c I've modified int check_force_skill which is called from interp.c (see previous post)
I've added a bug check in that if skill not found statement so its like this:
      fun = get_force_skill_function( fskill->code );  
     if( fun == skill_notfound )
        {
                bug("NOT FOUND");
                return 0;
        }


Sure enough, when I type my forceskill in game I get that NOT FOUND message. So, what is so diffrent about:
fun = get_force_skill_function( fskill->code );
in force.c vs
fun = get_force_skill_function( fskill->code );
in finfo.c?

*bangs head on desk*
Still stumped,
ayuri
       
Post is unread #3 Nov 13, 2011, 8:05 pm
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

Ok, so on a whim I went from gcc version 4.6.0, to gcc 4.6.1 (I'm lazy when it comes to updating my main server) and guess what? I can now use my new force skill. That's the only change I made. Well along with support lib's and all that.

After a rebuild with gcc 4.6.1 it finds it, it fires it...so....yay!

ayuri
       
Pages:<< prev 1 next >>