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
➜ problem with variables in one_hit
problem with variables in one_hit
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| RyueOkami
(9 posts) Bio
|
Date
| Mon 08 Dec 2003 08:46 AM (UTC) |
Message
| I have a small problem with the smaug engine:
I have 2 sh_int variables (combat,fighting) stored
in the character.
for the one_hit, I use those two to calculate a to hit number (called offensiv and is from type int).
offensiv, combat and fighting are 0 each.
but when I say
offensiv=ch->combat+ch->fighting;
offensiv gets a real high value (12753 or so).
can someone say me what to do? | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #1 on Mon 08 Dec 2003 09:26 AM (UTC) |
Message
| Looks like you didn't actually initialize your variable. They don't default to 0 when you declare them; you have to manually set them to 0 when the character object is created.
Read this post for some more information on uninitialized variables:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=3532 |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| RyueOkami
(9 posts) Bio
|
Date
| Reply #2 on Mon 08 Dec 2003 05:53 PM (UTC) |
Message
| nö hab es initialisiert und mir die jeweiligen Variablenwerte einzeln ausgeben lassen (dann passt es, aber sobald ich die zuweisung mache, dann passt es nimma)
OBJ_DATA *wield;
int diceroll=0;
int Offensiv=0;
int Defensiv=0;
int Damage_Reduction=0;
int Damage_Done=0;
int Critical=0;
ch_ret retcode = rNONE;
static bool dual_flip = FALSE;
Offensiv=((int) (ch->DBZ_combat))+((int)(ch->DBZ_Fighting)); //Ab hier hat Offensiv den seltsamen Wert
Damage_Done=ch->DBZ_physical+ch->DBZ_Fighting;
Defensiv=victim->DBZ_combat+ch->DBZ_Evade;
Damage_Reduction=victim->DBZ_Defense;
dann eines noch, die DBZ_physical und so setz ich in der load_mobile....muss ich die sonst noch wo setzen? (die Werte gehen irgendwo verloren) | Top |
|
Posted by
| RyueOkami
(9 posts) Bio
|
Date
| Reply #3 on Mon 08 Dec 2003 06:55 PM (UTC) |
Message
| Correction the Offensiv is now set right....only thing is, that he doesn't remember the values set in load_mobiles to one_hit | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #4 on Mon 08 Dec 2003 07:19 PM (UTC) |
Message
| You need to put the calculated values back. eg.
ch->DBZ_combat = (something); |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #5 on Mon 08 Dec 2003 08:42 PM (UTC) |
Message
| RyueOkami, if you could post that message again in English, that'd be nice... I know German enough to get the general idea of what you're saying but it would be nice to be more precise about things. :) |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| RyueOkami
(9 posts) Bio
|
Date
| Reply #6 on Tue 09 Dec 2003 04:03 AM (UTC) |
Message
| Upsi sry overlooked that I wrote it in german *g*.
The problem with the value of offensive is solved.
(tnx).
The translation is
(with some additions ;) ): I set the variable DBZ_physical
in load_mobiles. But it seems the value I set it to
is forgotten when I get to one_hit. Must I set the
value again somewhere else too? | 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.
18,167 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top