[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]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Combat system tweaks
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Combat system tweaks

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


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

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

Message
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));
                else
                os = ((get_curr_str(ch) * 10));
                ch->os = os;
        }
        ch_printf( ch, "Ok this is here to test: OS = %d\n\r", os );
}


thanks.
[Go to top] top

Posted by Nick Gammon   Australia  (19,492 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Mon 05 Apr 2004 10:17 PM (UTC)  quote  ]
Message
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] );
else
  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  (587 posts)  [Biography] bio
Date Reply #2 on Mon 05 Apr 2004 10:28 PM (UTC)  quote  ]
Message
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
storm-bringer.org:4500
www.storm-bringer.org
[Go to top] top

Posted by Valna   (15 posts)  [Biography] bio
Date Reply #3 on Tue 06 Apr 2004 03:33 AM (UTC)  quote  ]
Message
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)  quote  ]
Message
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.


2,288 views.

[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.

[Home]

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]