Hey, whats up?
Here is a code that I've been trying to do the last 15 days... I Don't know how I Can make it... Its a NPC that transforms the character in a Troll. But I want the character a Troll FOREVER! Please, see if I wrote something wrong! There are no errors of Compile. Its a 8.11 XML Server.
Yeah, It Works, but when the character Logs out, he is transformed into a he's last Outfit again... I Want him to be a Troll FOREVER!! If you help... Rep ++ Don't Forget! It's a 8.11 XML Server! Thanks!
Here is a code that I've been trying to do the last 15 days... I Don't know how I Can make it... Its a NPC that transforms the character in a Troll. But I want the character a Troll FOREVER! Please, see if I wrote something wrong! There are no errors of Compile. Its a 8.11 XML Server.
Code:
local focus = 0
local talk_start = 0
local target = 0
local days = 0
local outfitId = {lookType = 76}
function onThingMove(creature, thing, oldpos, oldstackpos)
addOutfitCondition(condition,{lookType = 76, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet, lookAddons = 1})
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Gogogo!')
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('Say yes to go,and no to Stay here like a fucker...')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Wait for your Turn...')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'yes') then
selfSay('Thatz right, ' .. creatureGetName(cid) ..'! Go now!')
travel(cid, 131, 71, 15)
doSetCreatureOutfit(cid,{lookType = 76, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet, lookAddons = 1}, -1)
doPlayerAddOutfit(cid,outfitId, 2)
elseif msgcontains(msg, 'no') then
selfSay('...')
focus = 0
talk_start = 0
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('...')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 45 then
if focus > 0 then
selfSay('Next Pliz!')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
focus = 0
end
end
end
Yeah, It Works, but when the character Logs out, he is transformed into a he's last Outfit again... I Want him to be a Troll FOREVER!! If you help... Rep ++ Don't Forget! It's a 8.11 XML Server! Thanks!