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