Re: [CODING] Fight System Crash, in act.offensive

From: Chi Hue (Mystikarc@softhome.net)
Date: 12/12/01


--Snipped loop--

> ----> This loop is definitely where it crashes. Your summary of your
> code may miss some vital commands ie. return calls, which takes you out
> of the loop for your gun code. But, I can only work with what I am
> given. Anyways, you definitely do not need the WAIT_STATE in the LOOP!
> You can put it at the end of the command if you like, but not in the
> loop!
Acutally, I found the problem, It was that when I set
the integer to the wielded weapon type, it assumed were wielding one, and
didnt know how to handle it if you didnt. so I put in a check to do so, made
the code a little better, and it works fine now. Its 4am, but I got it right
:)
Although the loop wasnt the crash, I will check out the waitstate thing you
mentioned.

> Now, let me put a scenario to you. Att1, Att2 and Att3 hits the victim
> three times. Victim then dies and victim is a mob. NOW, I know you think
> that all of fight.c does checks etc etc, but the checks assume you are
> passing valid parameters. In this instance, you are still in your while
> loop. Att4 tries to call hit(ch, vict, TYPE_UNDEFINED) BUT BUT vict
> doesnt exist anymore! Forget all the checks at fight.c, your hit() calls
> are passing an invalid vict pointer.
>
> I am assuming you did a similar thing with your gun scenario by calling
> hit() without the appropriate checks.
hit() is fine, but thanks.
I havnt had a problem with the way its set up, because it calls die
correctly, and doesnt attempt to hit() if !dead (hence, !POS_DEAD)
which I did in fight.c and offensive.c
I don't mean to sound rude of course, its always hard to help without being
able to see all the code, and therefore must assume what a person knows.

> So, my re-write would be:-
> // assuming you already checked if (GET_EQ(ch, WEAR_WIELD))
> if (GET_OBJ_VAL(GET_EQ(ch, WEAR_WIELD), 3) == 15) {
> blah blah
> return;  // so as to not continue along the function
Dont forget about my part, check if wielded (to anyone trying to do the
same)


> PS: I really dont think players will appreciate having a wait state of
> ten rounds if they have five attacks per round.
Maybe true, But I wanted to add some lag for the Big Guns..
Maybe Il give make a switch and give em about 3 to 4?

> If you are still having problems, email me with your complete do_hit bit
> and I will try to help.
I thank you for you help, And appreciate your trying to understand my
complex code.
(complex only because I tend to code at 2-4am, and it comes wierd, wierd but
does get right :p
)

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/24/03 PDT