Aller au contenu

Photo

Have an item set a plot flag when picked up?


6 réponses à ce sujet

#1
0x30A88

0x30A88
  • Members
  • 1 081 messages
How can I have an item or something set a plot flag when the item is acquired from a placeable?

#2
Karma

Karma
  • Members
  • 391 messages
You could have your placeable script set the plot flag (though that wouldn't guarantee the player would pick up the item), or you could use the EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED event to set the plot flag once the item has been acquired.

#3
0x30A88

0x30A88
  • Members
  • 1 081 messages
is the EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED in the module core or the placeable core? Does it come with a variable stating what item was acquired?

#4
Karma

Karma
  • Members
  • 391 messages
In your module core, you could do:
[dascript]
        case EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED:
        {
            object oAcquirer = GetEventCreator(ev);
            object oItemAcquired = GetEventObject(ev, 0);

            if (GetTag(oItemAcquired) == "insert item tag here")
            {
                DisplayFloatyMessage(oAcquirer, "Item Acquired", FLOATY_MESSAGE, 16777215, 1.5);
                WR_SetPlotFlag(PLT_BLAH, BLAH_ITEM_FOUND, TRUE);
            }
            break;
        }
[/dascript]

or in your placeable script, you could do:
[dascript]
        case EVENT_TYPE_USE:
        {
            object oUser = GetEventCreator(ev);
            object oPlaceable = GetObjectByTag("placeable_tag");

            UT_AddItemToInventory(R"item_name.uti", 1);
            DisplayFloatyMessage(oUser, "Item Acquired", FLOATY_MESSAGE, 16777215, 1.5);
            WR_SetPlotFlag(PLT_BLAH, BLAH_ITEM_FOUND, TRUE);
            SetObjectActive(oPlaceable, FALSE);  //delete this line if you don't want the placeable to disappear
            nEventHandled = TRUE;
            break;
        }
[/dascript]

#5
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
Note that if you use the EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED there is a local variable on the item which has to be set, otherwise the event won't fire.

#6
0x30A88

0x30A88
  • Members
  • 1 081 messages

DavidSims wrote...

Note that if you use the EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED there is a local variable on the item which has to be set, otherwise the event won't fire.

Can you please give a name for this variable?

#7
FergusM

FergusM
  • Members
  • 460 messages
ITEM_SEND_LOST_EVENT ITEM_SEND_ACQUIRED_EVENT