Aller au contenu

Photo

Crafting recipes and scripting


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
Phaenan

Phaenan
  • Members
  • 315 messages
Hey.


I'm not holding my breath, but I have to ask since I'm aware how great I am at missing obvious stuff. So here goes : is there a way to figure through scripts whether a recipe was acquired/learned by the player, or not ? The items with the "crafting recipe" basetype are apparently treated completely apart from the others (and don't even trigger a EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED event, and yep I didn't forgot my ITEM_SEND_ACQUIRED_EVENT) so I'm not sure by which end I should hold the stick.

I've got a trick in my sleeve (already alive & kicking, actually) in case that's impossible to test whether recipes are already known, but still, my code would be much cleaner if some direct way existed. So I'm just asking. :blush:

Modifié par Phaenan, 09 décembre 2009 - 12:05 .


#2
georage

georage
  • Members
  • 247 messages
I have no idea.



But, I would check out GetAbilityCount ... perhaps it (or some other ability check) can be used to check whether a player has the ability to concoct a recipe? That would indicate the recipe was obtained and learned.



I am not near the toolset or I would check it out for you.

#3
Phaenan

Phaenan
  • Members
  • 315 messages
Hmm.

Can't try right now, but I doubt that'd work as recipes are not abilities and remain far from the ABI table. In fact the ID don't even have to be unique across the two tables. And as far as savegames goes, they are not stored in the skills, stats or spells, but in a "crafting recipe list" element. My guess would be the acquired recipes are simply stored in an invisible "inventory" somewhere.

#4
AND04

AND04
  • Members
  • 154 messages

Phaenan wrote...

Hmm.
Can't try right now, but I doubt that'd work as recipes are not abilities and remain far from the ABI table. In fact the ID don't even have to be unique across the two tables. And as far as savegames goes, they are not stored in the skills, stats or spells, but in a "crafting recipe list" element. My guess would be the acquired recipes are simply stored in an invisible "inventory" somewhere.


thats quite right - a recipe is just a item that is in the inventory - you'd just have to check for that particular subtype - and as for the event - "Inventory_Item_Added" (not sure on the exact phrase) should work.

#5
Phaenan

Phaenan
  • Members
  • 315 messages
Hmm.
No love either. Recipes aren't found once added to the party inventory :
- http://pastie.org/735518
The EVENT_TYPE_INVENTORY_ADDED does work on placeables, tho, but I don't want to override the player_core (doing so wouldn't be that smooth, huh) so that's not an option. The only event I could be relying on is EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED unfortunately recipes don't trigger it, even with the right local var.

So... I guess I'm stuck with my plot flags workaround, and with my recipes created with a basetype which ain't "crafting recipe". The problem is, with that solution I have no way of marking recipes as "unknown" / "known" in the store panel. -_-"

// Edit :
Never mind, I had to alter stores inventories to include the recipes anyway, so I'll just have the update script remove known recipes from their inventories... >_>

Modifié par Phaenan, 09 décembre 2009 - 04:40 .