Reply to this subject
Start a new subject
 
Refresh page
| Posted by |
Valna
(15 posts) 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. | top |
|
| Posted by |
Nick Gammon
Australia (18,770 posts) 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 | top |
|
| Posted by |
Meerclar
USA (554 posts) 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 | top |
|
| Posted by |
Valna
(15 posts) 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. | top |
|
| Posted by |
Valna
(15 posts) 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. | 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.
1,758 views.
Reply to this subject
Start a new subject
 
Refresh page
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )