Been a long time and i'm trying to get back into the swing of things but hitting a wall. I turned to the script generator but it just doesn't seem to be working. I want to check for an item on the PC, if they don't have it then a random chance of teleporting them to a pocket dimension. This is for an on enter script, what am I missing?
int iTalkVolume = TALKVOLUME_TALK;
int iTalkFlag = 0;
void ClearAndJumpToObject(object oDestination);
void ClearAndJumpToObject(object oDestination)
// Get the creature who triggered this event.
object oPC = GetEnteringObject();
// Only fire for (real) PCs.
if ( !GetIsPC(oPC) || GetIsDMPossessed(oPC) )
// Abort if the PC has the item "IT_Pocket_Token".
if ( GetItemPossessedBy(oPC, "IT_Pocket_Token") != OBJECT_INVALID )
// Decide what to do based on a die roll.
switch ( d100() )
// Send a message to the player's chat window.
SendMessageToPC(oPC, "You suddenly feel very strange...");
// Find the location to which to teleport.
oTarget = GetWaypointByTag("WP_Pocket_Dimension");
// Teleport the PC.
eVFX = EffectVisualEffect(VFX_IMP_UNSUMMON);
DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC));
DelayCommand(4.0, AssignCommand(oPC, ClearAndJumpToObject(oTarget)));