This is a
tag-based script. It will fire whenever any of the following events happen with this item: OnActivateItem, OnAcquireItem, OnPlayerEquipItem , OnPlayerUnEquipItem, OnUnAcquireItem, OnSpellCastAt, and OnHitCast. What you need to do is figure out which event is being called and execute your code only for that event.
#include "x2_inc_switches"
void main()
{
// Abort if we're not activating the item
if (GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE)
return;
object oPC = GetItemActivator();
CreateObject(OBJECT_TYPE_PLACEABLE, "jer_boombarrel", GetLocation(oPC));
// Should this be...?
// object oItem = GetItemActivated();
object oItem = GetItemPossessedBy(oPC, "jer_explosives");
if (GetIsObjectValid(oItem))
DestroyObject(oItem, 1.0);
}
Modifié par Squatting Monk, 10 août 2013 - 08:56 .