/* This code was created by Phyco of Dragon Ball Series AF
* What I wanted to do was create a basic skill tree system
* for use inside of a swr mud without having to compeltley
* rewrite the entire skill system to do it. So after much
* trial and error I created this simple snippet. Please
* give credit where credit is due and hope you enjoy it.
* comments and suggestions and upgrades welcome dbdaf@cox.net
*/
In Mud.h under struct skill_type add:
char * preskill1; /* pre required skill 1*/
char * preskill2; /* pre required skill 2*/
char * preskill3; /* pre required skill 3*/
Then in Do_practice add:
at the top:
char preability[MAX_STRING_LENGTH];
int sn,preskill;
then right above
if ( (ch->pcdata->learned[sn] == 0 && can_prac == FALSE))// || ch->pcdata->learned[sn] == 0 && SPELL_FLAG(skill_table[sn], SF_SECRETSKILL))
continue;
add:
if ( skill_table[sn]->preskill1 && skill_table[sn]->preskill1[0] != '\0' )
{
one_argument( skill_table[sn]->preskill1, preability );
if ( skill_lookup(preability) != -1 )
{
preskill= skill_lookup(preability);
if (ch->pcdata->learned[preskill] < 80 )
continue;
}
}
if ( skill_table[sn]->preskill2 && skill_table[sn]->preskill2[0] != '\0' )
{
one_argument( skill_table[sn]->preskill2, preability );
if ( skill_lookup(preability) != -1 )
{
preskill= skill_lookup(preability);
if (ch->pcdata->learned[preskill] < 60 )
continue;
}
}
if ( skill_table[sn]->preskill3 && skill_table[sn]->preskill3[0] != '\0' )
{
one_argument( skill_table[sn]->preskill3, preability );
if ( skill_lookup(preability) != -1 )
{
preskill= skill_lookup(preability);
if (ch->pcdata->learned[preskill] < 40 )
continue;
}
}
Next in tables.c
under fwrite_skill add:
if ( skill->preskill1 && skill->preskill1[0] != '\0' )
fprintf( fpout, "Preskill1 %s~\n", skill->preskill1 );
if ( skill->preskill2 && skill->preskill2[0] != '\0' )
fprintf( fpout, "Preskill2 %s~\n", skill->preskill2 );
if ( skill->preskill3 && skill->preskill3[0] != '\0' )
fprintf( fpout, "Preskill3 %s~\n", skill->preskill3 );
Then in case 'p' right under participants add:
KEY( "Preskill1",skill->preskill1, fread_string_nohash( fp ) );
KEY( "Preskill2",skill->preskill2, fread_string_nohash( fp ) );
KEY( "Preskill3",skill->preskill3, fread_string_nohash( fp ) );
Now you can either create a command in do_sset to create the new field
or if your like me just go into skills.dat and type it manually
heres a example of the new code.
#SKILL
Name Kamehameha~
Type Spell
Flags 908
Target 1
Minpos 7
Slot 219
Mana 0
Guild 6
Code spell_kamehameha
Dammsg kamehameha~
Wearoff !WEAROFF!~
Teachers 655 655~
Preskill1 energy-blast~
preskill2 energy-ball~
preskill2 dual-blasts~
Minlevel 1
End
Now all you have to do is use the preskills in order to create
your skill trees by tieing the needed skills togeather. Enjoy
my first attempt at a public snippet. -phyco dbseries.cjb.net