> second_attack has to be defined somehow... and you're using it as an
> array index, so it has to have the same value as gsn_second_attack
> would.

Hello,
You really can't base your reply or thoughts on the fact that you
think I too would be using a stock system..

What happened in my case was that I decided I wanted my mud to really
replicate the d20 rules system as provided by wizards.com. I also
wanted spells and skills, races and classes to do what they mention in
the ruleset. There are literally 50+ downloadable guides covering
every darn thing you need to build an awesome mud.. My opinion
there...

However, This isn't a mud issue in regards to Rom.. This is an issue
that pertains to every codebase that was written and was based on the
Diku codebase... Have you ever looked to see how skills and spells are
done on LPC, Discworld or others?

If I remember correctly, fight.c includes a boat load of code related
to just combat... What was it, mob hit, one hit, and then trip and
flee backstab was there or something..  Well, if you seperate the
combat system from everything else, you may be able to understand
things a bit better.. But in reply to your question.. The backend of
the mud isn't like stock rom in any sense...

In Rom. You have a combat system, that first needs to check the skill,
that then needs to check to see if the player has the skill, then
needs to check again to see if it's been practiced seems a bit
unlogical to me.. 3 different functions to do one thing.. Return a
skill or spell..

So, to be brief, Each set of what rom used to do is now in it's own
scripted sub system.. Unlike the stock rom fight.c, this is all the
code needed when initating combat..

void combat( defines go here....)
{
    init_combat();
    init_skillsys();
    init_spellsys();

        error checks and stuff here......

}

Each system is scripted... Those bits of code call each system and
initalise it. The mud itself only checks first to see if the player
has learned the skill, if no, it returns 0, if yes, it then will
return the practiced numbered value which the combat system will
recognise.. So in spells.c, then entire spell contains all of the
information that is needed.. The spell itself, the affects, damages,
what damage to produce based on the casters level and ability,
otherwise known as how much they practiced.. For the combat system to
call the spell, it just calls it by name and it's pooled..

Also note, I don't have a skill table.. spells/skills are listed just
like commands.. The level at which the command is given to the player
is last numerical spot at the end of the command table..

{ "stoneskin",   POS_STANDING,    SPMAGIC,  0,  LN, 0, 75, 10 },

Thats all.. it means: name of skill, position, spmagic means magic
sphere, 0, the first zero is there only for IMM levels as normal. LN =
log never, 0 = clan spell zero is no, number associated with any clan
means yes. 75 is the percentage it can be practiced too, and the 10 at
the end is the level the magic user can attain it.

spell.h looks like this:

    switch ( spellreturn ) {
    case STONESKIN:
        execute();
        break;

    case BLESS:
        execute();
        break;

......... and so on..

spell.c then contains as I mentioned above, every single bit of the
code that is needed and/or required for the entire thing.. It is
looked up by name only when it is needed. Without the execute being
there in that fashion, it wouldn't be possible to load or unload the
skill as needed. It's also not listed in merc.h, it's not listed in a
rom file whatsoever except for interp.c and interp.h.

I really don't know how else to explain it.. I hope this will give you
a better view of what I was talking about.. Maybe you and anyone else
interested in this should read up on using scripting systems for this
type of stuff within 3D games.. FarCry, which I played the crap out of
was the main reason I first started piddling with these systems.. If
you are into 3D games and worked on mods for Farcry, then you know
about scripting and how to write LUA scripts.. It's how Farcry runs..
AI and all. There are a gazillion sites about farcry scripting.. It's
the best way to learn how to use LUA as well as how to use a scripting
system for something other than mob/room/object progs..

Hope this helps,
Chris

Reply via email to