• 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!

TFS 1.X+ onChangeOutfit shows previous outfit table

Snavy

Bakasta
Senator
Joined
Apr 1, 2012
Messages
1,249
Solutions
71
Reaction score
621
Location
Hell
I am trying to see if the player is already mounted or not. While doing some research on this, I came across this event called onChangeOutfit. When I tried printing the lookMount value it gave the PREVIOUS value instead of what the player currently has.

For example. Let's say I have a player which is not mounted right now and I press CTRL + R to activate the mount then the script below displays lookMount 0 (mounted), when I remove the mount it gives the lookMount which should have fetched the first time I activated it. Not sure how this onChangeOutfit behaves. Is it not updating correctly?
Lua:
function Creature:onChangeOutfit(outfit)

    local pleb = Creature(self)

    if(pleb:isPlayer()) then
        pleb:say(tostring(pleb:getOutfit().lookMount), TALKTYPE_MONSTER_SAY, false, 0, pleb:getPosition())
    end
    return true
end


SOLVED:

I was not trying to get the updated outfit using outfit parameter.
basically all I had to do was change from pleb:getOutfit().lookMount to outfit.lookMount
 
Last edited:
Solution
My guess is that this is a hook that happens during the change of an outfit, where the creature still has the old outfit, and this hook has a chance to interrupt and stop that process if you return false instead of true. It makes sense then that the creature currently has the old values, and the function parameter has the anticipated new values. (unless you meddle with them).

Intercepting outfits can be useful in several situations. Football/soccer event? Auto change outfit of each team to red/blue, while event is ongoing don't allow them to change to something else.

A guild leader could also decide to go into a war with all guild members change to his outfit, locking that outfit for the entire guild for a short while.
My guess is that this is a hook that happens during the change of an outfit, where the creature still has the old outfit, and this hook has a chance to interrupt and stop that process if you return false instead of true. It makes sense then that the creature currently has the old values, and the function parameter has the anticipated new values. (unless you meddle with them).

Intercepting outfits can be useful in several situations. Football/soccer event? Auto change outfit of each team to red/blue, while event is ongoing don't allow them to change to something else.

A guild leader could also decide to go into a war with all guild members change to his outfit, locking that outfit for the entire guild for a short while.
 
Solution
Back
Top