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

Gammon Forum

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

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Combat system tweaks
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

Combat system tweaks

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Posted by Valna   (15 posts)  [Biography] bio
Date Mon 05 Apr 2004 04:35 AM (UTC)

Amended on Mon 05 Apr 2004 04:36 AM (UTC) by Valna

Ok i'm working on a little bit of code here to set an "offensive strength" relative to weapon type being
wielded. I intend to add more variables before it's all said and done but this is the basic prototype. However
when i compile i have no problems, but when i execute the code it returns 0. The only way this is possible is if get_curr_str(ch) could be returning 0. or the initial test is invalid hence it does not execute at all. Any insights?

void do_os( CHAR_DATA * ch, char *argument)
        OBJ_DATA *wield;
        int os = 0;

        wield = get_eq_char( ch, WEAR_WIELD );
        if ( !IS_NPC(ch) && wield )
                if ( wield->value[3] == WEAPON_AXE )
                os = ((get_curr_str(ch) * 2) + get_curr_dex(ch) + get_curr_con(ch));
                else if ( wield->value[3] == WEAPON_DAGGER )
                os = ((get_curr_dex(ch) * 2) + get_curr_str(ch) + get_curr_ref(ch));
                else if ( wield->value[3] == WEAPON_SWORD )
                os = ((get_curr_str(ch) * 2) + get_curr_dex(ch) + get_curr_ref(ch));
                os = ((get_curr_str(ch) * 10));
                ch->os = os;
        ch_printf( ch, "Ok this is here to test: OS = %d\n\r", os );

[Go to top] top

Posted by Nick Gammon   Australia  (21,669 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Mon 05 Apr 2004 10:17 PM (UTC)
Can't see anything wrong with it - try some debugging, eg.

wield = get_eq_char( ch, WEAR_WIELD );
if (wield)
  ch_printf( ch, "wield->value[3] = %i\n\r", wield->value[3] );
  ch_printf( ch, "Not wielding a weapon\n\r");

- Nick Gammon

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

Posted by Meerclar   USA  (733 posts)  [Biography] bio
Date Reply #2 on Mon 05 Apr 2004 10:28 PM (UTC)
Interesting thing, I just grepped my admittedly stock smaug source code for the weapon_type flags you're checking against and came up with no matches. Might be something to look into.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
[Go to top] top

Posted by Valna   (15 posts)  [Biography] bio
Date Reply #3 on Tue 06 Apr 2004 03:33 AM (UTC)
I changed the weapon types. They are functional and affect
the applicable skills as they should. The flags have been
referrenced in other code. I'll throw that debugging code
in there that you suggested Nick.
[Go to top] top

Posted by Valna   (15 posts)  [Biography] bio
Date Reply #4 on Tue 06 Apr 2004 04:12 AM (UTC)
Yeah apparently one of the possible issues is the problem it's returning no weapon wielded. Any idea why?
I've seen this get_eq_char( ch, WEAR_WIELD ) function called successfully in fight.c. Ok i think i figured out
the problem... I had changed the wear locations around.
As far as i could tell the flag was the same only the bit
had changed. once I put get_eq_char( ch, 18 ) 18 = wear_loc wield.
It returned a value as it should.
[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.


It is now over 60 days since the last post. This thread is closed.     [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.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]