• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved Changing outfit onEquip/DeEquip

Amiroslo

Excellent OT User
Joined
Jul 28, 2009
Messages
6,767
Solutions
5
Reaction score
769
Hello smart people,
I have ran into an issue and found no fix sadly.

The script does the following:
Checks if a person is wearing xHead, xArmor, xLegs and xFeet. If they are wearing all 4, it turns their outfit to 309, and if one of them gets deEquiped, the outfit is removed and their old outfit is back.

The issue right now is, if a player tries to deEquip or tries to right click any items, the server crashes right away with no errors. Any idea why or how to fix that?

TFS 0.4, r3777

Lua:
local outfitStorage = 16011

local condition = createConditionObject(CONDITION_OUTFIT)
setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition, CONDITION_PARAM_SUBID, 8)
addOutfitCondition(condition, {lookType = 309, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0})

function onEquip(cid, item, slot)
    if getPlayerSlotItem(cid, CONST_SLOT_HEAD).itemid == 9778 and getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid == 9776 and getPlayerSlotItem(cid, CONST_SLOT_LEGS).itemid == 9777 and getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid == 2646 then
        setPlayerStorageValue(cid,outfitStorage, getCreatureOutfit(cid).lookType)
        doAddCondition(cid, condition)
    end
    return true
end

function onDeEquip(cid, item, slot)
local look = getPlayerStorageValue(cid, outfitStorage)
    if look ~= -1 then
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        local outfit = {lookType = look, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}
        doRemoveCondition(cid, CONDITION_OUTFIT, 8)
        setPlayerStorageValue(cid, outfitStorage, -1)
    end
    return true
end

XML:
    <movevent type="Equip" itemid="9778" slot="head" function="onEquipItem" event="script" value="donset.lua"/>
    <movevent type="DeEquip" itemid="9778" slot="head" function="onDeEquipItem" event="script" value="donset.lua"/>

    <movevent type="Equip" itemid="9776" slot="armor" function="onEquipItem" event="script" value="donset.lua"/>
    <movevent type="DeEquip" itemid="9776" slot="armor" function="onDeEquipItem" event="script" value="donset.lua"/>
  
    <movevent type="Equip" itemid="9777" slot="legs" function="onEquipItem" event="script" value="donset.lua"/>
    <movevent type="DeEquip" itemid="9777" slot="legs" function="onDeEquipItem" event="script" value="donset.lua"/>
  
    <movevent type="Equip" itemid="2646" slot="feet" function="onEquipItem" event="script" value="donset.lua"/>
    <movevent type="DeEquip" itemid="2646" slot="feet" function="onDeEquipItem" event="script" value="donset.lua"/>
 
Last edited:
Solution
I think script has no problem, The issue must be in your old TFS when creating an item with a GM character and it goes directly to the slot.
Try disabling the script, Create the items and put them in your backpack then enable the script and equip items manually.
I think script has no problem, The issue must be in your old TFS when creating an item with a GM character and it goes directly to the slot.
Try disabling the script, Create the items and put them in your backpack then enable the script and equip items manually.
 
Solution
I think script has no problem, The issue must be in your old TFS when creating an item with a GM character and it goes directly to the slot.
Try disabling the script, Create the items and put them in your backpack then enable the script and equip items manually.
Oh wow, yeah that was the issue. I wore something else, and forcing the items to be created in my BP, it worked. Tried giving them to a normal account, and it also worked. Interesting, thank you a lot
Post automatically merged:

I think script has no problem, The issue must be in your old TFS when creating an item with a GM character and it goes directly to the slot.
Try disabling the script, Create the items and put them in your backpack then enable the script and equip items manually.
By any chance, do you know if anyone fixed this issue in the source somewhere?
 
Last edited:
By any chance, do you know if anyone fixed this issue in the source somewhere?
I don't remember seeing any fix anywhere and sadly I don't have enough experience in C++, Could have helped.
Your best bet is to compare your onEquip or additem function with this 0.4 or OTX 2 both are still maintained so possibly they fixed it.
Try also to create another thread to see if someone has a fix.
 
Back
Top