Am I missing something? (food items)
Pages
- 1
- 2
Author | Topic: Am I missing something? (food items) |
---|---|
Shock Trooper
Member # 4180
|
written Tuesday, April 6 2004 12:47
Profile
Is there an easy way to check if the party has any food items and take one away? Without checking for each individual type of food item, that is. -spyderbytes -------------------- -spyderbytes Posts: 200 | Registered: Wednesday, March 31 2004 08:00 |
Infiltrator
Member # 154
|
written Tuesday, April 6 2004 12:54
Profile
Food Items never really get taken by the player - when a player takes a food item, it adds some food to the food count and erases the item. Same with gold. -------------------- Apparently still annoying. Posts: 612 | Registered: Saturday, October 13 2001 07:00 |
Shock Trooper
Member # 4180
|
written Tuesday, April 6 2004 13:05
Profile
Umm... that doesn't answer my question (perhaps I asked it badly?). Food items do show up in inventory. What I'm wanting to do is to give the player a choice to give a (generic) food item to a NPC. Obviously, the option should only come up in dialog if someone in the party actually has a food item. But I don't care WHAT particular food item (fish, bread, steak, whatever) it might be. So... do I have to check for each food item the party MIGHT have individually (until I find one or work through every possible food item), or is there an easy way? -spdyerbytes -------------------- -spyderbytes Posts: 200 | Registered: Wednesday, March 31 2004 08:00 |
Warrior
Member # 1505
|
written Tuesday, April 6 2004 13:17
Profile
You have to give all food items in your scenario a special class (using the it_special_class item property). Then, when the player comes to the NPC, use the has_item_of_class() function. Snuff ling kin, I think you are thinking of BoE. [ Tuesday, April 06, 2004 13:18: Message edited by: Newtfeet ] -------------------- -Newtfeet Posts: 151 | Registered: Saturday, July 13 2002 07:00 |
Apprentice
Member # 4127
|
written Tuesday, April 6 2004 13:25
Profile
quote:You will have to change food and give it a special class (say 0). To do this, in your scenario data file, do things like this and so on. If you do this for all the foods, you can use the item_of_class functions everywhere to query for food. Edit: Newtfeet beat me to the post. [ Tuesday, April 06, 2004 13:27: Message edited by: Walker White ] Posts: 48 | Registered: Saturday, March 20 2004 08:00 |
Warrior
Member # 1505
|
written Tuesday, April 6 2004 13:28
Profile
What is that begindefinecreature bit in there? What does that have to do with items? -------------------- -Newtfeet Posts: 151 | Registered: Saturday, July 13 2002 07:00 |
Warrior
Member # 1505
|
written Tuesday, April 6 2004 13:29
Profile
Remind me why we have those "begindefineitem 450" and "import = 450" lines in there. Edit: And crap, I double posted. [ Tuesday, April 06, 2004 13:37: Message edited by: Newtfeet ] -------------------- -Newtfeet Posts: 151 | Registered: Saturday, July 13 2002 07:00 |
Apprentice
Member # 4127
|
written Tuesday, April 6 2004 13:35
Profile
quote:Heh. The danger of not reading before I post. This was a mistake and I editted while you posted. I copied the example from the Chitrach level bump in VoDT (which is creature, not item). I forgot to make definecreature as defineitem everywhere. Posts: 48 | Registered: Saturday, March 20 2004 08:00 |
Triad Mage
Member # 7
|
written Tuesday, April 6 2004 13:38
Profile
Homepage
quote:It's because we just want to edit item 4, instead of completely replacing it. Starting with begindefineitem 4; will just erase that item. -------------------- "At times discretion should be thrown aside, and with the foolish we should play the fool." - Menander ==== Drakefyre's Demesne - Happy Happy Joy Joy Encyclopedia Ermariana - Trapped in the Closet ==== You can take my Mac when you pry my cold, dead fingers off the mouse! Posts: 9436 | Registered: Wednesday, September 19 2001 07:00 |
Apprentice
Member # 4127
|
written Tuesday, April 6 2004 13:38
Profile
quote:Simple. I copied Bread into slot 450 which is the first empty item slot. I then cleared slot 4 (you can redefine ANY item slot you want) so that I could alter it. I loaded in all the data for Bread (which is now in slot 450) and added the extra definition to give it a special class. Rinse, lather, repeat. You cannot just say begindefineitem 4 as that will erase all the old Bread information. And I did not want to leave Bread as item 450, as then I would have two different types of Bread. Posts: 48 | Registered: Saturday, March 20 2004 08:00 |
Warrior
Member # 1505
|
written Tuesday, April 6 2004 13:43
Profile
Then why can't we just say: And then why do we have clear if saying begindefineitem already clears? Edit: Oh, wait; it's because it would import the empty item 4, right? [ Tuesday, April 06, 2004 13:45: Message edited by: Newtfeet ] -------------------- -Newtfeet Posts: 151 | Registered: Saturday, July 13 2002 07:00 |
Triad Mage
Member # 7
|
written Tuesday, April 6 2004 13:52
Profile
Homepage
We need to say 'clear' because the calls automatically import the last defined creature. -------------------- "At times discretion should be thrown aside, and with the foolish we should play the fool." - Menander ==== Drakefyre's Demesne - Happy Happy Joy Joy Encyclopedia Ermariana - Trapped in the Closet ==== You can take my Mac when you pry my cold, dead fingers off the mouse! Posts: 9436 | Registered: Wednesday, September 19 2001 07:00 |
Shock Trooper
Member # 4180
|
written Tuesday, April 6 2004 13:58
Profile
Yikes! That's way more work than the importance of this exchange to my scenario. :) I'll either figure out something different or make the NPC picky about what he eats. ;) I would have thought there would be a simple single call for this, since Jeff is most likely grouping all food together somewhere internally (to facilitate taking some when the party sleeps or enters certain terrain types or whatever). I mean, if all food has the same value for 'variety', he's bound to have some way to query inventory by variety, I would think. It's likely just not public. Thanks for explaining how to do it, though. :) -spyderbytes -------------------- -spyderbytes Posts: 200 | Registered: Wednesday, March 31 2004 08:00 |
Warrior
Member # 1505
|
written Tuesday, April 6 2004 14:34
Profile
Ok, so let me set this all out. clear: Obvious. Sets all the values for the object currently being edited to their defaults. property = new_value: Also obvious. Sets the value "property" to "new_value" for the object currently being edited. import = which_object: Replaces all the values for the object currently being edited to the values for "which_object". If "which_object" was already edited in this same script, it imports that. If it hasn't been, it imports from the core data. begindefine which_object: Sets the object currently being edited to "which_object". Copies the data from the object that was edited before this statement over the data of "which_object". Is that right? Oh, and spyderbytes: It's not that hard; just use this. It should work. [ Tuesday, April 06, 2004 14:35: Message edited by: Newtfeet ] -------------------- -Newtfeet Posts: 151 | Registered: Saturday, July 13 2002 07:00 |
Apprentice
Member # 4127
|
written Tuesday, April 6 2004 14:41
Profile
quote:Yes. Posts: 48 | Registered: Saturday, March 20 2004 08:00 |
Apprentice
Member # 4127
|
written Tuesday, April 6 2004 14:49
Profile
quote:It's more than not just public; it is not in the scripting language. He has functions in his engine for doing it. Those are C++ calls. The way scripts work, however, is part of the engine reads in the script text file (the thing doing the reader is called the interpreter) and converts it to C++ calls. If the interpreter does not know to translate calls about item variety into the existing C++ calls, then you can never use them in a script, whether you know their name or not. This is the big deal in the "Calls We Wish Existed Thread". If those calls already exist in C++ form in the engine, it is very easy for him to add them to AvernumScript; he could do it in a few minutes. If they don't, it is much harder to add them, and not necessarily advisable to do so, as it could break the engine. It's like the difference between needing a word in French for which the language translator does not know the correct word, and when there is no such word in French at all. [ Tuesday, April 06, 2004 14:51: Message edited by: Walker White ] Posts: 48 | Registered: Saturday, March 20 2004 08:00 |
Warrior
Member # 1505
|
written Tuesday, April 6 2004 14:53
Profile
quote:I think that's what spyderbytes meant. "Public" means about the same thing as "known by the interpreter". Oh, and I'm glad I finally got those custom objects straightened out. [ Tuesday, April 06, 2004 14:54: Message edited by: Newtfeet ] -------------------- -Newtfeet Posts: 151 | Registered: Saturday, July 13 2002 07:00 |
Apprentice
Member # 4127
|
written Tuesday, April 6 2004 14:57
Profile
quote:If you are a Microsoft programmer "not public" means "it is there and usable by anyone, but Microsoft won't tell me what it is so their Office programs can be better than mine." That's why I assumed that interpretation. I didn't mean any insult by it. Posts: 48 | Registered: Saturday, March 20 2004 08:00 |
Warrior
Member # 1505
|
written Tuesday, April 6 2004 14:59
Profile
quote:And neither did I. I'm just pointing out that it doesn't really make any difference what you call it; it means the same thing. -------------------- -Newtfeet Posts: 151 | Registered: Saturday, July 13 2002 07:00 |
Shock Trooper
Member # 4180
|
written Tuesday, April 6 2004 15:19
Profile
Thanks for the list, Newtfeet! I already decided it would be better if my NPC wanted a particular food item in this instance, however. Especially since the NPC is a talking dog (who would obviously prefer meat of some sort--it's a comical scenario so I can get by with such things ;) ) and if I add food items (and I'm sure I will) I'd have to ensure my lists stay in synch. The "any food" was just a compromise I was willing to make if there was a simple way to do it. Sorry you went to the effort and I'm not using it. :( Maybe it will help someone who comes along after me, though. And yes, I'm well aware of the distinction in interpreted and precompiled languages, and probably should have worded my post better. Still, there's no public call to access JV's private function, regardless of whether one is an apple and the other is an orange. :) -spyderbytes -------------------- -spyderbytes Posts: 200 | Registered: Wednesday, March 31 2004 08:00 |
Warrior
Member # 1505
|
written Tuesday, April 6 2004 16:06
Profile
No problem. It took about 30 seconds. -------------------- -Newtfeet Posts: 151 | Registered: Saturday, July 13 2002 07:00 |
Triad Mage
Member # 7
|
written Wednesday, April 7 2004 00:43
Profile
Homepage
There is a problem with doing this, however. Any food from other scenarios will not have the special class. -------------------- "At times discretion should be thrown aside, and with the foolish we should play the fool." - Menander ==== Drakefyre's Demesne - Happy Happy Joy Joy Encyclopedia Ermariana - Trapped in the Closet ==== You can take my Mac when you pry my cold, dead fingers off the mouse! Posts: 9436 | Registered: Wednesday, September 19 2001 07:00 |
Shock Trooper
Member # 4180
|
written Wednesday, April 7 2004 01:18
Profile
quote:Good point... and YA reason we need has_item_of_variety() to supplement has_item_of_class(). :) -------------------- -spyderbytes Posts: 200 | Registered: Wednesday, March 31 2004 08:00 |
Warrior
Member # 4202
|
written Wednesday, April 7 2004 01:24
Profile
Homepage
Certain items which stack in the inventory, including food, when you bring them into the new scenario will change into items of the same type in the new scenario. This is so stacking works properly. It also means that giving food a special class works (unless another scenario designer made a custom food item). If you want a totally foolproof mechanism, you'll have to use Advanced Item Management Calls: Actually, I'm not totally sure that would work. I'm not sure what item_type_in_slot returns when it checks a custom item from another scenario. -------------------- 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 # 4202
|
written Wednesday, April 7 2004 01:27
Profile
Homepage
quote:Do we? It's not in the BoA Editor Docs Appendices, unless I'm missing something. -------------------- 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 |
Pages
- 1
- 2