• 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 Outfit change

tatara

New Member
Joined
Jan 1, 2023
Messages
36
Reaction score
3
GitHub
Tatara
Hi guys, i have an npc on serv, who uses GM commands, so i`m wondering if its possible to make npc, who will use different command.
I have a command on server /outfit to give to players monster outfits, so im wondering if its possible to make such npc.
command to use example : "/outfit Admin Tatara, 73". So the point is that player comes to npc, and provides him monster name in which he want to be turned ( 18= Ghoul , 19= Slime ) as a payment for skin change will be item with id 2178.
 
Hi guys, i have an npc on serv, who uses GM commands, so i`m wondering if its possible to make npc, who will use different command.
I have a command on server /outfit to give to players monster outfits, so im wondering if its possible to make such npc.
command to use example : "/outfit Admin Tatara, 73". So the point is that player comes to npc, and provides him monster name in which he want to be turned ( 18= Ghoul , 19= Slime ) as a payment for skin change will be item with id 2178.
Hey, it looks like it might be possible. Could you post the NPC script and let me know which TFS it's related to? I'll try to create the script for you.
 
Hey, it looks like it might be possible. Could you post the NPC script and let me know which TFS it's related to? I'll try to create the script for you.
im not sure if 7.6 version uses tfs :D would be also dope if you could tell me how to get know that, because everyone is asking for TFS, but i dont even know what is it or how to check it :D

script of existing npc who uses GM command :

focus = 0
talk_start = 0
target = 0
following = false
attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end


function onCreatureTurn(creature)

end


function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end


function onCreatureSay(cid, type, msg)
msg = string.lower(msg)

if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hiho ' .. creatureGetName(cid) .. '! Welcome to the gm shop, here you can buy more hp or mana.')
focus = cid
talk_start = os.clock()

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')

elseif focus == cid then
talk_start = os.clock()

if msgcontains(msg, 'health') or msgcontains(msg, 'hp') then
if pay(cid,5000000) then
selfSay('/health ' .. creatureGetName(cid) .. '')
end

elseif msgcontains(msg, 'mana') then
if pay(cid,5000000) then
selfSay('/mana ' .. creatureGetName(cid) .. '')
end


elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end
 
im not sure if 7.6 version uses tfs :D would be also dope if you could tell me how to get know that, because everyone is asking for TFS, but i dont even know what is it or how to check it :D

script of existing npc who uses GM command :

focus = 0
talk_start = 0
target = 0
following = false
attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end


function onCreatureTurn(creature)

end


function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end


function onCreatureSay(cid, type, msg)
msg = string.lower(msg)

if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hiho ' .. creatureGetName(cid) .. '! Welcome to the gm shop, here you can buy more hp or mana.')
focus = cid
talk_start = os.clock()

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')

elseif focus == cid then
talk_start = os.clock()

if msgcontains(msg, 'health') or msgcontains(msg, 'hp') then
if pay(cid,5000000) then
selfSay('/health ' .. creatureGetName(cid) .. '')
end

elseif msgcontains(msg, 'mana') then
if pay(cid,5000000) then
selfSay('/mana ' .. creatureGetName(cid) .. '')
end


elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end
I'm sorry, but I won't be able to create the script for you. I don't know if it's based on TFS or an old ancient XML server, so I need to know which version of TFS the server is based on before I can proceed.
 
Back
Top