what's wrong with this code?

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).
AuthorTopic: what's wrong with this code?
Shock Trooper
Member # 4180
Profile #0
At the risk of making a pest of myself, I'd like to know why this doesn't work. :) I decided to code around the problem with damage_near_loc passing through walls, and came up with this:

beginstate 3; // attacking
...stuff here that's ok...

// time to spit more poison?
if (tick_difference(last_abil_time, get_current_tick()) > 1) {
// don't use damage_near_loc, because it damages where it shouldn't
i = 0;
while (i < 4) {
distance = char_dist_to_loc(i, my_loc_x(), my_loc_y());
if (distance == 1) { // character is adjacent
print_named_str(ME, "spits poison!");
play_sound(42); // acid hiss
damage_char(i, get_ran(3, 1, 3), 2);
}
i = i + 1;
}
}

do_attack();
break;
That seems to me as if it should work, but any character that's adjacent ends up taking damage four times, instead of only once. So where did I go wrong?

-spyderbytes

EDIT: DOH! It's always the simple gotchas. :D Adding last_abil_time = get_current_tick(); before the last curly bracket makes it work as expected. Sorry 'bout dat!

[ Monday, April 05, 2004 20:28: Message edited by: spyderbytes ]

--------------------
-spyderbytes
Posts: 200 | Registered: Wednesday, March 31 2004 08:00