How can I have an item or something set a plot flag when the item is acquired from a placeable?
Have an item set a plot flag when picked up?
Débuté par
0x30A88
, nov. 24 2010 03:19
#1
Posté 24 novembre 2010 - 03:19
#2
Posté 24 novembre 2010 - 04:07
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
Posté 24 novembre 2010 - 04:40
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
Posté 24 novembre 2010 - 05:38
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]
[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
Posté 24 novembre 2010 - 05:50
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
Posté 24 novembre 2010 - 08:40
Can you please give a name for this variable?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.
#7
Posté 24 novembre 2010 - 09:08
ITEM_SEND_LOST_EVENT ITEM_SEND_ACQUIRED_EVENT





Retour en haut






