Items on locations

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: Items on locations
Master
Member # 5977
Profile Homepage #0
I have a puzzle in which has to be hecked whether or not a certain item is on a certain spot. However, it fails to work correctly. The relevant bit of code is here:

beginstate START_STATE;

if (get_flag(13,5) == 0 && item_of_class_on_spot(26,33,1) == 1);
set_flag(13,5,1);

if (get_flag(13,5) == 4 && item_of_class_on_spot(34,33,2) == 1);
set_flag(13,5,5);

break;
The first if-call checks for a slith spear, the second one for a greatsword. Can enybody see what is wrong in this script that it might not work?

If somebod knows a better way to do the same, I would very appreciate it if he told me how to, as this call does actually not do exactly what I want it to do.

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
Infiltrator
Member # 5576
Profile Homepage #1
The item_of_class_on_spot() call only checks for items of that special class, set by it_special_class. Did you redefine the greatsword and slith spear so that this property is set to 2 and 1 respectively on these items?

--------------------
Überraschung des Dosenöffners!
"On guard, you musty sofa!"
Posts: 627 | Registered: Monday, March 7 2005 08:00
Master
Member # 5977
Profile Homepage #2
Woops, I didn't know that was necessary. I'll do it right away. Thanks!

EDIT: Hmmm, still doesn't seem to work right. I probably did something wrong:

datascript:

// *** ITEMS ***

// Slith spear and greatsword

begindefineitem 445;
import = 371;
it_special_class = 1;

begindefineitem 446;
import = 61;
it_special_class = 2;
townscript:

beginstate START_STATE;

if ((get_flag(13,5) == 0) && (item_of_class_on_spot(26,33,1) == 1)) {
set_flag(13,5,1);
}

if ((get_flag(13,5) == 4) && (item_of_class_on_spot(34,33,2) == 1)) {
set_flag(13,5,5);
}

break;
I put a print_num(num) call at the first if-call of the START_STATE, to see if it's triggered at all, and it's not. I think everything is right now, yet it doesn't work. What can be the problem now? Yes, I did put the right items in the town (445 and 446).

[ Friday, April 06, 2007 05:01: Message edited by: Thralni ]

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
Lifecrafter
Member # 6193
Profile Homepage #3
Remove the flag checks and put a print_str() in each of the item checks, just to see what the problem is. It looks like it should work, perhaps the flags are just messed up.

--------------------
Guaranteed to blow your mind.

Frostbite: Get It While It's...... Hot?
Posts: 900 | Registered: Monday, August 8 2005 07:00
Law Bringer
Member # 4153
Profile Homepage #4
quote:
Originally written by The Gators Win it All....... Again:

perhaps the flags are just messed up.
I bet this is it. Try it out with a fresh party, or manually reset the flag via character editor for whatever save you're using for testing.

(It really helps to search your other scripts for places where you might've accidentally set one of those flags. That's happened to me a few times now.)

--------------------
Gamble with Gaea, and she eats your dice.

I hate undead. I really, really, really, really hate undead. With a passion.
Posts: 4130 | Registered: Friday, March 26 2004 08:00
Master
Member # 5977
Profile Homepage #5
Okay, I'll try that. I, too, thought it might be the flags, although I really doubt it. I will do that sometime tomorrow, as the party of last night, the beer I drank and the last night sleep, plus the 5 hours of orchstra repetition have basically killed me.

Anyway, thanks.

EDIT: Just couldn't leave it alone, could I. Once I get obsessed with such things like these, i keep going until it works, and now it does. I still don't quite understand what the problem was, though. I took out the flags, and checked to what the flags were set, which were set correctly. Then I put in the flag checks, and it still worked. Then I took out the flags' checks of print_num() and it still works.

Thanks for all the help guys, you made me a very happy man.

[ Friday, April 06, 2007 11:54: Message edited by: Thralni ]

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00