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

Change outfit and keeping the colors

combi

Active Member
Joined
Aug 9, 2013
Messages
18
Reaction score
25
Hello ,
I need help in a script, that should be used via talkaction or if possible via hotkey (like the ctrl+r for mounts).

When the player talk the action or use the hotkey ,the scripts change the outfit to another one. If im using citizen it ll only change to one especific outfit, for exemple the mage.

in other words, someway to import the Ids (lookhead, lookbody, looklegs, lookfeet and lookaddons.) from the previous outfit, changing only the looktype id
lookmount is not necessary.

The important part is, it must keep the colors id and the addons* of the previous one.

and when I talk/use hotkey again, or even move/walk it ll back to the initial outfit.

*By addons ,using the same exemple, if Im using citizen with only addon 1 activated, it ll change to a mage with only addon 1 activated.
 
Last edited:
Lua:
local temp = getCreatureOutfit(cid)
temp.lookType = 11111
doCreatureChangeOutfit(cid, temp)
 
TFS 1.0+
Lua:
local outfit = creature:getOutfit()
outfit.lookType = 123
creature:setOutfit(outfit)

You can use player storage values to keep track of outfit toggle state and looktypes if you want to toggle back to original outfit.
Reference.
 
TFS 1.2

Yeah, I did something like this, using another tutorial.

Now I wish 2 things :)
to remove it from spells, and put it like a talkaction..
and remove the addevent function and put a different form to back to normal stage
(when use the talkaction again, or move/walk it ll back to the initial outfit.)

this is what I got now:

function onCastSpell(creature, variant)
local outfit = creature:getOutfit()
local prevOutfit = outfit.lookType

if prevOutfit == 141 then
addEvent(function(cid, prev)
local creature = Creature(cid)
if not creature then
return
end


outfit.lookType = prevOutfit
creature:setOutfit(outfit)
end, 5000, creature:getId(), prevOutfit)

outfit.lookType = 269
creature:setOutfit(outfit)
end

return doCombat(creature, combat, variant)
end
 
TFS 1.2

Yeah, I did something like this, using another tutorial.

Now I wish 2 things :)
to remove it from spells, and put it like a talkaction..
and remove the addevent function and put a different form to back to normal stage
(when use the talkaction again, or move/walk it ll back to the initial outfit.)

this is what I got now:

function onCastSpell(creature, variant)
local outfit = creature:getOutfit()
local prevOutfit = outfit.lookType

if prevOutfit == 141 then
addEvent(function(cid, prev)
local creature = Creature(cid)
if not creature then
return
end


outfit.lookType = prevOutfit
creature:setOutfit(outfit)
end, 5000, creature:getId(), prevOutfit)

outfit.lookType = 269
creature:setOutfit(outfit)
end

return doCombat(creature, combat, variant)
end
In the latest TFS there is a method for player.
Lua:
function Player:onMoveCreature(creature, fromPosition, toPosition)
    return true
end
I have not tested exactly how this would work because it's the 1st time I've seen it.
 
Back
Top