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

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

Obito

0x1337
Joined
Feb 17, 2011
Messages
351
Solutions
8
Reaction score
152
Location
Egypt
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
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:
Should be a checkmark to the side of the post under the up/down arrows.

If not, just report the post and a mod will do it for you.
 

Similar threads

Back
Top