If the quest was to find one item I guess I could just update to another plot when it was found, but with 3 items I would need 6 plots at least for the log to "count them" properly.
Modifié par dewkl, 20 avril 2010 - 05:49 .
Guest_dewkl_*
Modifié par dewkl, 20 avril 2010 - 05:49 .
Guest_dewkl_*
Modifié par dewkl, 20 avril 2010 - 10:25 .
Modifié par Sunjammer, 20 avril 2010 - 11:46 .
#include "events_h"
#include "utility_h"
#include "wrappers_h"
#include "plt_fetch_ingredients"
void main()
{
event evEvent = GetCurrentEvent();
int nEventType = GetEventType(evEvent);
int bEventHandled = FALSE;
switch(nEventType)
{
case EVENT_TYPE_INVENTORY_ADDED:
{
object oOldOwner = GetEventCreator(evEvent);
int bImmediate = GetEventInteger(evEvent, 0);
object oItem = GetEventObject(evEvent, 0);
// check which item and set plot flag
if (GetTag(oItem) == "item_tag_1" || GetTag(oItem) == "item_tag_2" || GetTag(oItem) == "item_tag_3")
{
if (WR_GetPlotFlag(plt_fetch_ingredients, check_3_items) == TRUE) // have all items
{
WR_SetPlotFlag(plt_fetch_ingredients, have_3_items, TRUE);
}
else if (WR_GetPlotFlag(plt_fetch_ingredients, check_2_items) == TRUE) // have 2 items
{
WR_SetPlotFlag(plt_fetch_ingredients, have_2_items, TRUE);
}
else
{
WR_SetPlotFlag(plt_fetch_ingredients, have_1_item, TRUE);
}
bEventHandled = TRUE;
break;
}
}
}Modifié par TimelordDC, 20 avril 2010 - 11:46 .
I'm afraid that's not going to work. To tell when a player has picked up an item you have to a) set the ITEM_SEND_ACQUIRED_EVENT local variable on the item's blueprint and thendewkl wrote...
1. How do I tell the plot that the player has picked up one of the items? Could this work? (I'm getting "variable defined without type" at line 18 for some reason. Did I forget to include some header? How do I know which headers to include anyway?)
If you count the number of items with that tag (assuming it is unique) then in the aforementioned EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED event and they have 2 (or more) then you know they already had 1. The CountItemsByTag function should do that for you.dewkl wrote...
2. How do I know if the player already has one item when he's picking up a new one?
Modifié par Sunjammer, 20 avril 2010 - 11:47 .
Guest_dewkl_*
Modifié par dewkl, 21 avril 2010 - 04:29 .
Guest_dewkl_*
Guest_dewkl_*
Modifié par dewkl, 21 avril 2010 - 08:08 .
const string PLT_SJ_GATHERING_MAIN = "227DEAD0C9834C1E9FDFE3C1C3E5F547"; const int SJ_GATHERING_MAIN_AVAILABLE = 0; const int SJ_GATHERING_MAIN_OFFERED = 1; const int SJ_GATHERING_MAIN_ACCEPTED = 2; const int SJ_GATHERING_MAIN_COMPLETE = 3; const int SJ_GATHERING_MAIN_REWARDED = 4; const int SJ_GATHERING_MAIN_HAS_ALL_PLANTS = 256;
Modifié par Sunjammer, 21 avril 2010 - 11:06 .
Guest_dewkl_*
Modifié par dewkl, 23 avril 2010 - 12:52 .