DeleteSkinInt(object, string)

Removes a persistent integer variable from a creature's skin item.

void DeleteSkinInt(
    object oCreature,
    string sVariableName



The creature object whose skin will have the variable removed from it.


The variable name used to identify the variable removed from the skin.


Removes a persistent integer variable from a creature's skin item. These variables are persistent when applied to a PC and travel with the character when exported.


The variable name specified in sVariableName will be stripped of all underscore characters. Thus, a variable name specified as "My_Custom_Variable" will actually be stored under the name "MyCustomVariable".

If the object specified by oCreature is an NPC, the variable is removed from the creature itself rather than its skin. If used on an NPC who possesses an item with the TAG "x3_it_pchide", that item will be destroyed.

If used on a PC, the variable is removed from the skin item equipped in the PC's creature armor slot.

If used on a PC who has no item equipped in the creature armor slot, the PC is searched for an item with the TAG "x3_it_pchide". If one is found, the variable is removed from that item and the PC is forced to try and equip it into its creature armor slot. Should the item found be one that is not equippable in the creature armor slot, the equip action will fail but the variable will still be removed from the item found.

If used on a PC who has no item equipped in the creature armor slot and also does not possess an item with the TAG "x3_it_pchide", a new skin item is created from the standard blueprint "x3_it_pchide" and added to the PC's inventory. The PC is forced to equip the new skin in the creature armor slot.

Because of the special treatment of items whose TAG is set to "x3_it_pchide", it is important to not create items with that TAG that are not skin items. It is also important to ensure creatures will never possess more than one item with the TAG "x3_it_pchide".

Known Bugs

Although not technically a bug per se, a PC that has no skin equipped who is carrying an item with the TAG "x3_it_pchide" will be commanded to equip that item into the creature armor slot even when the item is not a skin. This does not cause a bug, but it does waste time trying to make the PC do something he is incapable of.

Should this function be used on a PC who has no skin equipped and is carrying more than one item with the TAG "x3_it_pchide", there's no telling which of the items will have the variable removed from it.

Due to the fact that the variable name is stripped of all underscores, it is not possible to use this function (or GetSkinInt or SetSkinInt either) to treat two skin variables whose names differ only by underscores as independent separate variables. In other words, if you use a skin variable called "My_Custom_Variable" you cannot have a different skin variable called "MyCustomVariable" since this function (and GetSkinInt and SetSkinInt as well) will treat them both as the same variable. The easiest way to avoid any potential problems related to this issue is to simply not put any underscores into your skin variable names.


#include "x3_inc_skin"




// In this example a generic trigger is used to spawn an encounter. Once triggered
// by a player, a variable placed on the player's skin along with a timer is used
// to disable the trigger from spawning the encounter again for that player until
// ten minutes has passed.

// Trigger OnEnter script
#include "x3_inc_skin"

void main()
    // Find the player who is entering the trigger.
    object oPC = GetEnteringObject();

    // If the player could not be determined or is not a PC, do nothing further.
    {   return;   }

    // If the encounter is disabled for this player, his skin will have the
    // variable on it. If this variable is found, do nothing further.
    if(GetSkinInt(oPC, "Encounter Disabled"))
    {   return;   }

    // Otherwise the encounter should be spawned so find the waypoint to spawn the
    // goblins at.
    object oSpawnWaypoint = GetNearestObjectByTag("GoblinSpawn", oPC);

    // If the waypoint could not be found, return.
    {   return;   }

    // Otherwise spawn 4 goblins at the waypoint.
    int nGoblins = 4;
    while(--nGoblins >= 0)
    { // Randomly select a goblin type.
      string sGoblin = "";
      { case 0:                 sGoblin = "nw_goblinboss";   break;
        case 1:                 sGoblin = "nw_gobchiefb";    break;
        case 2:                 sGoblin = "nw_gobchiefa";    break;
        case 3: case 4:         sGoblin = "nw_gobwizb";      break;
        case 5: case 6:         sGoblin = "nw_gobwiza";      break;
        case 7: case 8: case 9: sGoblin = "nw_goblinb";      break;
        default:                sGoblin = "nw_goblina";      break;

      // Spawn the goblin at the waypoint.
      CreateObject(OBJECT_TYPE_CREATURE, sGoblin, GetLocation(oSpawnWaypoint));

    // Set the variable on the player's skin that disables the trigger.
    SetSkinInt(oPC, "Encounter Disabled", TRUE);

    // Start a timer that removes the variable and re-enables the encounter for
    // this player after a 10 minute delay.
    DelayCommand(600.0, DeleteSkinInt(oPC, "Encounter Disabled"));

For another example see SetSkinInt.

See Also

functions:  GetSkinInt | SetSkinInt
categories:  Get Data Functions | Get Data from Creature Functions | Local Variables Functions

author: Axe Murderer, editors: Mistress, Kolyana