"Inventory" is a very vague term. It could be any of the body part slots, or it could be backpack. Maybe it's ammo slot? Who knows.
So you have to specify that when making such a request.
Also, when you say "activates an outfit", this is once again vague, because this could be interpreted as:
* Transforms player's outfit into something else
* Makes a new Outfit available to player in the
Set Outfit window.
With that said, here are some codes:
Change player appearance when item is equipped and change back when de-equipped:
lua script:
Lua:
function onEquip(cid, item, slot, boolean)
local outfitToTransformInto = 24
local m = getCreatureOutfit(cid)
local outfit = {lookType = outfitToTransformInto, lookHead = m.lookHead, lookAddons = m.lookAddons, lookLegs = m.lookLegs, lookBody = m.lookBody, lookFeet = m.lookFeet}
doSetCreatureOutfit(cid, outfit, -1)
return true
end
function onDeEquip(cid, item, slot, boolean)
doRemoveCondition(cid, CONDITION_OUTFIT)
return true
end
Unlock new outfit in
Set Outfit window while item is equipped:
In outfits.xml, where your outfit's ID is, add quest="somestorage", where somestorage is a storage key that has to be set to value "1" in order for this outfit to be wearable.
Code:
<outfit id="12" quest="29012">
<list gender="0" lookType="155" name="Pirate"/>
<list gender="1" lookType="151" name="Pirate"/>
</outfit>
Script that will add this storage to player/remove it from him upon equip/deequip:
Lua:
function onEquip(cid, item, slot, boolean)
setPlayerStorageValue(cid, 29012, 1)
return true
end
function onDeEquip(cid, item, slot, boolean)
setPlayerStorageValue(cid, 29012, -1)
return true
end
For both codes you will need a movements.xml to link the script to some item ID:
Code:
<moveevent type="Equip" itemid="2129" slot="neck" event="script" value="costumeAmulet.lua"/>
<moveevent type="DeEquip" itemid="2129" slot="neck" event="script" value="costumeAmulet.lua"/>