Jump to content

Recommended Posts

Posted

I have no idea why this doesn't return the tag of an object. Am I missing something?

void main()
{
     object oPC = GetFirstPC();
     object oItem = GetObjectByTag("u_a_unde_02");
     string szMessage = GetTag(oItem);
     SendMessageToPC( oPC, szMessage);
}

Is there some condition in the game for GetObjectByTag() to work? For some reason when I assign oItem through a different function it will print the tag.

void main()
{
     object oPC = GetFirstPC();
     object oItem = GetItemInSlot(1, oPC);
     string szMessage = GetTag(oItem);
     SendMessageToPC( oPC, szMessage);
}

That works?  And I have tried out different strings to pass to GetObjectByTag().

Posted

GetObjectByTag applies to objects in the level itself.

 

If you want to get an object that is inside someone's inventory, you can try this:

void main()
{
    string sTag;
    object oItem = GetItemPossessedBy(GetObjectByTag("<tag of creature, placeable, or store>"), "<tag of object>");

    if(GetIsObjectValid(oItem))
    {
        sTag = GetTag(oItem);
    }
    else
    {
        sTag = "";
    }
}

And you've already found out how to get an item that is equipped. :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Guidelines.