[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  ROM
. -> [Folder]  Running the server
. . -> [Subject]  Adding New Weapon Types
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

Adding New Weapon Types

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Posted by Intrepid   (5 posts)  [Biography] bio
Date Wed 21 Mar 2012 08:45 PM (UTC)  quote  ]
I'm running QuickMUD (ROM 2.4b6+OLC+Color, basically) and I'm having trouble adding a new type of weapon. If you don't define a weapon (in the area file) with one of the standard types (sword, dagger, etc) it is classed exotic.

So, I did a "grep -n polearm *" and added a new entry to every case and struct I could find. When i was done, "grep -n firearm *" returned identical entries except the line numbers were understandably a few different. I also incremented the MAXSKILL to 151 from 150 in merc.h.

I thought this would work, but I get:

gcc -O -g3 -Wall -DIMC -DIMCROM -c -o obj/act_comm.o act_comm.c
gcc -O -g3 -Wall -DIMC -DIMCROM -c -o obj/act_enter.o act_enter.c
gcc -O -g3 -Wall -DIMC -DIMCROM -c -o obj/act_info.o act_info.c
gcc -O -g3 -Wall -DIMC -DIMCROM -c -o obj/act_move.o act_move.c
gcc -O -g3 -Wall -DIMC -DIMCROM -c -o obj/act_obj.o act_obj.c
gcc -O -g3 -Wall -DIMC -DIMCROM -c -o obj/act_wiz.o act_wiz.c
act_wiz.c: In function âdo_ostatâ:
act_wiz.c:1377: error: âWEAPON_FIREARMâ undeclared (first use in this function)
act_wiz.c:1377: error: (Each undeclared identifier is reported only once
act_wiz.c:1377: error: for each function it appears in.)
make: *** [obj/act_wiz.o] Error 1

I don't know where I've messed the declaration. If I comment it out (which would make ostat call it unknown instead of firearms) I get:

gcc -O -g3 -Wall -DIMC -DIMCROM -c -o obj/act_wiz.o act_wiz.c
gcc -O -g3 -Wall -DIMC -DIMCROM -c -o obj/alias.o alias.c
gcc -O -g3 -Wall -DIMC -DIMCROM -c -o obj/ban.o ban.c
gcc -O -g3 -Wall -DIMC -DIMCROM -c -o obj/bit.o bit.c
gcc -O -g3 -Wall -DIMC -DIMCROM -c -o obj/board.o board.c
gcc -O -g3 -Wall -DIMC -DIMCROM -c -o obj/comm.o comm.c
gcc -O -g3 -Wall -DIMC -DIMCROM -c -o obj/const.o const.c
const.c:85: error: âWEAPON_FIREARMâ undeclared here (not in a function)
const.c:1588: warning: implicit declaration of function âslotâ
const.c:1588: error: initializer element is not constant
const.c:1588: error: (near initialization for âskill_table[103].slotâ)
const.c:1589: error: expected expression before â:â token
const.c:1589: warning: missing braces around initializer
const.c:1589: warning: (near initialization for âskill_table[104]â)
const.c:1589: error: initializer element is not constant
const.c:1589: error: (near initialization for âskill_table[104].nameâ)
make: *** [obj/const.o] Error 1

Feedback or a guide would be really appreciated.
[Go to top] top

Posted by Intrepid   (5 posts)  [Biography] bio
Date Reply #1 on Wed 21 Mar 2012 09:15 PM (UTC)  quote  ]
I found a few things I was missing due to the case sensitivity of grep, namely defining the weapon class in merc.h.

I'll continue to comment as I either figure it out, go bald from madness, or receive comments. Next one up indicates an issue with excess elements in tables.c.
[Go to top] top

Posted by Nick Gammon   Australia  (19,495 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Wed 21 Mar 2012 09:16 PM (UTC)  quote  ]
Can you paste the diffs showing what changes you made?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Intrepid   (5 posts)  [Biography] bio
Date Reply #3 on Wed 21 Mar 2012 09:18 PM (UTC)  quote  ]

Amended on Wed 21 Mar 2012 09:19 PM (UTC) by Intrepid

Used a ) instead of a }. It now compiles. I need to test it out.

Sure Nick. Let me make sure it works and then I'll be glad to post them.
[Go to top] top

Posted by Intrepid   (5 posts)  [Biography] bio
Date Reply #4 on Wed 21 Mar 2012 09:42 PM (UTC)  quote  ]
My line number is next to the .h or .c file. This will change a little from the standard if there are multiple edits, but its close enough to follow along. Including previous portion of code for searching/matching purposes.

                case (WEAPON_POLEARM):
                    send_to_char ("polearm\n\r", ch);
                case (WEAPON_FIREARM):
                    send_to_char ("firearm\n\r", ch);

    {"polearm", OBJ_VNUM_SCHOOL_POLEARM, WEAPON_POLEARM, &gsn_polearm},
    {"firearm", OBJ_VNUM_SCHOOL_FIREARM, WEAPON_FIREARM, &gsn_firearm},

You'll have to assign it to something in your const.c file or no one can actually use the skill. I put mine in warrior (which I now call soldier) basics.

     "polearm", {1, 1, 1, 1}, {6, 6, 3, 1},
     spell_null, TAR_IGNORE, POS_FIGHTING,
     &gsn_polearm, SLOT (0), 0, 0,
     "", "!Polearm!", ""},

     "firearm", {20, 20, 1, 1}, {6, 6, 2, 1},
     spell_null, TAR_IGNORE, POS_FIGHTING,
     &gsn_firearm, SLOT (0), 0, 0,
     "shot", "!Firearm!", ""},

sh_int gsn_whip;
sh_int gsn_firearm;

                 || sn == gsn_polearm
                 || sn == gsn_firearm)

            case (WEAPON_POLEARM):
                sn = gsn_polearm;
            case (WEAPON_FIREARM):
                sn = gsn_firearm;

                case (WEAPON_POLEARM):
                    send_to_char ("polearm.\n\r", ch);
                case (WEAPON_FIREARM):
                    send_to_char ("firearm.\n\r", ch);

The definition on 1176 was what I was missing. It doesn't know to look for that element in the table if you don't define it here.

#define MAX_SKILL          151 /* Unsure if needed. It should be. */



extern sh_int  gsn_whip;
extern sh_int  gsn_firearm;

    {"polearm", WEAPON_POLEARM, TRUE},
    {"firearm", WEAPON_FIREARM, TRUE},
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum

[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.


Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Web site powered by FutureQuest.Net]