• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Storing old outfit in some variable to cast it in another script

Obito

0x1337
Joined
Jun 4, 2008
Messages
399
Solutions
12
Reaction score
220
Good day,
I'm trying to store a variable that captures the player's "old outfit/looktype" so I can revert back to it later if needed. I have created a new condition that changes the player's outfit, but I need to keep track of the previous look. Can you help me determine the best way to store the old outfit so I can revert back to it using a revert script? I want to ensure that I can melt the current outfit and return to the original one
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ARROW)

function onCastSpell(creature, var)
   local targetCreature = Creature(var.number)
   local playerDirection = targetCreature:getDirection()
   if targetCreature:isPlayer() then
      if playerDirection == WEST then
         targetCreature:setOutfit({lookTypeEx = 7171})
      elseif playerDirection == NORTH then
         targetCreature:setOutfit({lookTypeEx = 7171})
      elseif playerDirection == EAST then
         targetCreature:setOutfit({lookTypeEx = 7306})
      elseif playerDirection == SOUTH then
         targetCreature:setOutfit({lookTypeEx = 7305})
      end
   end
end
 
Solution
X
If it's only meant to be a temporary outfit change.. then you should probably use a condition.
LUA:
local condition = Condition(CONDITION_OUTFIT)
condition:setOutfit({lookTypeEx = 7171})
condition:setTicks(time) -- probably in milliseconds. -1 means forever, until death/relog/it's removed
player:addCondition(condition)

otherwise.. your only other viable option is using storage values.. because there's no other way to retain the information between player sessions accurately.

So you'd need to store everything about the character.. in separate storages.
LUA:
lookType
lookHead
lookBody
lookLegs
lookFeet
lookAddons
lookMount
If it's only meant to be a temporary outfit change.. then you should probably use a condition.
LUA:
local condition = Condition(CONDITION_OUTFIT)
condition:setOutfit({lookTypeEx = 7171})
condition:setTicks(time) -- probably in milliseconds. -1 means forever, until death/relog/it's removed
player:addCondition(condition)

otherwise.. your only other viable option is using storage values.. because there's no other way to retain the information between player sessions accurately.

So you'd need to store everything about the character.. in separate storages.
LUA:
lookType
lookHead
lookBody
lookLegs
lookFeet
lookAddons
lookMount
 
Solution
If it's only meant to be a temporary outfit change.. then you should probably use a condition.
LUA:
local condition = Condition(CONDITION_OUTFIT)
condition:setOutfit({lookTypeEx = 7171})
condition:setTicks(time) -- probably in milliseconds. -1 means forever, until death/relog/it's removed
player:addCondition(condition)

otherwise.. your only other viable option is using storage values.. because there's no other way to retain the information between player sessions accurately.

So you'd need to store everything about the character.. in separate storages.
LUA:
lookType
lookHead
lookBody
lookLegs
lookFeet
lookAddons
lookMount
Thanks 🙂🙂.
Edit : this the best answer how can I mark it?
 
Last edited:
Back
Top