Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ Combat system tweaks
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Valna
(15 posts) Bio
|
Date
| Mon 05 Apr 2004 04:35 AM (UTC) 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. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 05 Apr 2004 10:17 PM (UTC) |
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 | Top |
|
Posted by
| Meerclar
USA (733 posts) Bio
|
Date
| Reply #2 on Mon 05 Apr 2004 10:28 PM (UTC) |
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 | Top |
|
Posted by
| Valna
(15 posts) Bio
|
Date
| Reply #3 on Tue 06 Apr 2004 03:33 AM (UTC) |
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. | Top |
|
Posted by
| Valna
(15 posts) Bio
|
Date
| Reply #4 on Tue 06 Apr 2004 04:12 AM (UTC) |
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. | 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.
17,644 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top