char_on_loc

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: char_on_loc
Warrior
Member # 4492
Profile #0
I set a 1 square special encounter on location (13,3) with the script char_on_loc(13,3).
However it always returns a -1. So I tried debugging by changing it to char_on_loc(13,4) with the special encounter still placed on (13,3)and it returns the character standing on (13,4) the turn before I trigger the special encounter.
So how can I actually make it return the number of the character at(13,3)?
Posts: 61 | Registered: Wednesday, June 9 2004 07:00
The Establishment
Member # 6
Profile #1
Does this involve a PC stepping on the space? If so, there is perhaps an alternate way of doing this. This assumes the leading character will be the character to step on the space.

i = 0;
while (i < 5) {
if (char_ok(i)) {
lead_char = i;
i = 5;
}
else
i = i + 1;
}
Now, check the value of lead_char and that is the party member. Not as versatile, but gets the job done under appropriate conditions.

Nonetheless email spidweb@spiderwebsoftware.com[/url] to report this bug.

--------------------
Your flower power is no match for my glower power!
Posts: 3726 | Registered: Tuesday, September 18 2001 07:00
Warrior
Member # 4492
Profile #2
Sounds feasible. Imma go try it.

Edit: Yup it works. Thanks.

[ Sunday, June 20, 2004 08:16: Message edited by: Kiexcolo ]
Posts: 61 | Registered: Wednesday, June 9 2004 07:00
Warrior
Member # 4202
Profile Homepage #3
Firstly, it is not a bug. Specials trigger before the character actually enters the square. That way they can, for instance, block the party from entering it.

The most efficient way to get what you want is first_group_member(0). Group 0 is the party.

--------------------
Creator of the 3D Blades of Avernum Editor for Mac. Get it at Ingenious Isaac's Illusion, my web page. Better yet, get Battle for Wesnoth, a wonderful free TBS game.
Posts: 192 | Registered: Sunday, April 4 2004 08:00
Warrior
Member # 4492
Profile #4
I didn't really test on this because I have moved on to something else but I think just using first_group_member(0) always returns 0 in which I might as well use 0. But if character 0 dies, then character 1 takes his spot in the game but remains character 1 so it will not return the correct character standing at that spot.
Its a bit messy but I think you know what I mean. *i's usage of char_ok(i) suits me better. Thanks anyway.
Posts: 61 | Registered: Wednesday, June 9 2004 07:00