Jump to content

Scripting ITEM SKIN


Go to solution Solved by changos,

Recommended Posts

Ola,estou com problema em uma Action script,estou tentando fazer um item que muda a outfit do player
A script funciona normalmente mas eu queria adicionar uma condição nela que seria "apenas x vocation pode dar use nesse item e mudar a outfit"
 

Spoiler

function onUse(cid, item)
--------------------------------------------------
local dolls = {
    [6506] = {outfit = 402, name = "KISAME CURTINDO VERAO"},
    [11207] = {outfit = 9, name = "NOME 2"},
    [9019] = {outfit = 15, name = "NOME 3"},
}
---------------------------------------------------
local go = dolls[item.itemid]
---------------------------------------------------
 if getVocation (cid) = 1 then
 return true
    if go then
        if getCreatureOutfit (cid).lookType ~= go.outfit then
            doCreatureChangeOutfit(cid, { lookType = go.outfit})
            doCreatureSay(cid, "SKIN!! ("..go.name..")", TALKTYPE_ORANGE_1)
            return true
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'SKIN EM USO!!')
            return true
        end
    end
end

 

Link to post
Share on other sites

Boa Tarde, estou aprendendo lua vou tentar ajudá-lo!

 

Spoiler

local dolls = {
    [6506] = {roupaMale = 0, roupaFemale = 402, name = "KISAME CURTINDO VERAO", voc = 3},
    [11207] = {roupaMale = 9, roupaFemale = 0, name = "NOME 2", voc = 1},
    [9019] = {roupaMale = 15, roupaFemale = 0,  name = "NOME 3", voc = 2}
}
function onUse(cid, item)
for k,v in pairs(dolls) do
if item.itemid == k then
   if getVocation(cid) == v.voc then
     if getPlayerSex(cid) == 0 then
        doSetCreatureOutfit(cid, v.roupaFemale)
    else
        doSetCreatureOutfit(cid, v.roupaMale)
    return true
end
   end
end
    end
end
 

 

Edited by Pedro 469 (see edit history)
Link to post
Share on other sites

testa assim.

Spoiler

local dolls = {
    [6506] = {roupaMale = 0, roupaFemale = 402, name = "KISAME CURTINDO VERAO", voc = 3},
    [11207] = {roupaMale = 9, roupaFemale = 0, name = "NOME 2", voc = 1},
    [9019] = {roupaMale = 15, roupaFemale = 0,  name = "NOME 3", voc = 2}
}

function onUse(cid, item)
for k,v in pairs(dolls) do
if item.itemid == k and getVocation(cid) == v.voc then
   doSetCreatureOutfit(cid, v.roupaMale)
   return true
  end
 end
end

 

Link to post
Share on other sites

  • Solution
local dolls = {
    [6506] = {name='Noob',outfit = 19, voc={1,2,5,6}},
	[11207] = {name='Puto',outfit = 9, voc={4,8}},
	[9019] = {name='Pendejo',outfit = 12,voc={3,7}}
	}
	
function onUse(cid,item,frompos,itemEx,topos)
local r,v = dolls[item.itemid],getThingPos(cid)
	if r then
		if isInArray(r.voc,getPlayerVocation(cid)) then
			if getCreatureOutfit (cid).lookType ~= r.outfit then
                doCreatureChangeOutfit(cid, {lookType = r.outfit})
				doPlayerSendTextMessage(cid,MESSAGE_FIRST,'Skin: '..r.name..'!')
				--doRemoveItem(item.uid,1)
			else
				doPlayerSendCancel(cid,'You already wear this outfit!')
				doSendMagicEffect(v,CONST_ME_POFF)
			end
		else
			doPlayerSendCancel(cid,'You have the wrong vocation!')
			doSendMagicEffect(v,CONST_ME_POFF)
                end
	else
		doPlayerSendCancel(cid,'Sorry not possible.')
	end
	return true
end

use this change the names and ids xd

<action itemid="id;id;id" event="script" value="name.lua"/>

 

 

with genders

 

local dolls = {
    [6506] = {name='Noob',outfit = {18,19}, voc={1,2,5,6}},
	[11207] = {name='Puto',outfit = {8,9}, voc={4,8}},
	[9019] = {name='Pendejo',outfit = {11,12},voc={3,7}}
	}
	
function onUse(cid,item,frompos,itemEx,topos)
local r,v = dolls[item.itemid],getThingPos(cid)
	if r then
		if isInArray(r.voc,getPlayerVocation(cid)) then
		--for i = 1, 2 do
			if getCreatureOutfit (cid).lookType ~= r.outfit then
                doCreatureChangeOutfit(cid, {lookType = r.outfit[getPlayerSex(cid) + 1]})
				doPlayerSendTextMessage(cid,MESSAGE_FIRST,'Skin: '..r.name..'!')
				--doRemoveItem(item.uid,1)
			else
				doPlayerSendCancel(cid,'You already wear this outfit!')
				doSendMagicEffect(v,CONST_ME_POFF)
			end
			--end
		else
			doPlayerSendCancel(cid,'You have the wrong vocation!')
			doSendMagicEffect(v,CONST_ME_POFF)
                end
	else
		doPlayerSendCancel(cid,'Sorry not possible.')
	end
	return true
end

 

Edited by changos (see edit history)
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By mjokreaxasa
      .Qual servidor ou website você utiliza como base? 
      dbko 8,54
      Qual o motivo deste tópico? 
      quando desloga muda outfit 
      Está surgindo algum erro? Se sim coloque-o aqui. 
       
      Você tem o código disponível? Se tiver publique-o aqui: 
         
      Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 
       

    • By cesarfilho55
      .Qual servidor ou website você utiliza como base? 
      tfs 0.4
      Qual o motivo deste tópico? 
      O otclient, ao utilizar as spells e andar, começa a dar sqm's pretos.
       No incio, suspeitei que o client não estava extendido, mesmo extendendo ele, o problema continuou.
      Existe algo que deva fazer para otclient funcionar corretamente? Usei o 0.6.3
       Quando eu tiver tempo, vou gravar um gif para mostrar.
       
       
    • By magrelo751
      Sempre que tento abrir o ot aparece o erro de load config.lua segue abaixo minha config.lua...
       
      -- The Forgotten Server Config
          -- Account manager
          accountManager = true
          namelockManager = true
          newPlayerChooseVoc = true
          newPlayerSpawnPosX = 1000    
          newPlayerSpawnPosY = 1000
          newPlayerSpawnPosZ = 7
          newPlayerTownId = 1
          newPlayerLevel = 1
          newPlayerMagicLevel = 0
          generateAccountNumber = false
          -- Auto Combo Dedecter
           comboTime = 100
              comboMembers = 2
              comboFriends = 3
              comboFriendsClearTime = 5 * 60 * 1000
              comboFriendsClearInterval = 1 * 60 * 1000
              comboShowAnimation = 1  
          -- Damage Guild/Party --
          noDamageToGuildMates = false -- if true then no damage, if false then damage
          noDamageToPartyMembers = false -- if true then no damage, if false then damage

          -- Unjustified kills
          -- NOTE: *Banishment and *BlackSkull variables are >summed up<
          -- (dailyFragsToRedSkull + dailyFragsToBanishment) with their
          -- *RedSkull equivalents.
          -- Auto banishing works only if useBlackSkull set to negative.
          -- advancedFragList is not advised if you use huge frags
          -- requirements.
          redSkullLength = 30 * 24 * 60 * 60
          blackSkullLength = 45 * 24 * 60 * 60
          dailyFragsToRedSkull = 3
          weeklyFragsToRedSkull = 5
          monthlyFragsToRedSkull = 10
          dailyFragsToBlackSkull = dailyFragsToRedSkull
          weeklyFragsToBlackSkull = weeklyFragsToRedSkull
          monthlyFragsToBlackSkull = monthlyFragsToRedSkull
          dailyFragsToBanishment = dailyFragsToRedSkull
          weeklyFragsToBanishment = weeklyFragsToRedSkull
          monthlyFragsToBanishment = monthlyFragsToRedSkull
          blackSkulledDeathHealth = 40
          blackSkulledDeathMana = 0
          useBlackSkull = true
          useFragHandler = true
          advancedFragList = false
          -- Banishments
          -- violationNameReportActionType 1 = just a report, 2 = name lock, 3 = player banishment
          -- killsBanLength works only if useBlackSkull option is disabled.
          notationsToBan = 3
          warningsToFinalBan = 4
          warningsToDeletion = 5
          banLength = 7 * 24 * 60 * 60
          killsBanLength = 7 * 24 * 60 * 60
          finalBanLength = 30 * 24 * 60 * 60
          ipBanishmentLength = 1 * 24 * 60 * 60
          broadcastBanishments = true
          maxViolationCommentSize = 200
          violationNameReportActionType = 2
          autoBanishUnknownBytes = false
          -- Battle
          -- NOTE: showHealingDamageForMonsters inheritates from showHealingDamage.
          -- loginProtectionPeriod is the famous Tibia anti-magebomb system.
          -- deathLostPercent set to nil enables manual mode.
          worldType = "pvp"
          protectionLevel = 1
          pvpTileIgnoreLevelAndVocationProtection = true
          pzLocked = 60 * 1000
          huntingDuration = 60 * 1000
          criticalHitChance = 7
          criticalHitMultiplier = 1
          displayCriticalHitNotify = true
          removeWeaponAmmunition = true
          removeWeaponCharges = true
          removeRuneCharges = true
          whiteSkullTime = 15 * 60 * 1000
          noDamageToSameLookfeet = false
          showHealingDamage = true
          showHealingDamageForMonsters = false
          fieldOwnershipDuration = 5 * 1000
          stopAttackingAtExit = false
          oldConditionAccuracy = false
          loginProtectionPeriod = 10 * 1000
          deathLostPercent = 10
          stairhopDelay = 2 * 1000
          pushCreatureDelay = 2 * 1000
          deathContainerId = 1987
          gainExperienceColor = 215
          addManaSpentInPvPZone = true
          squareColor = 0
          allowFightback = true
          -- Connection config
          worldId = 0
          ip = "hollywood.servegame.com"
          bindOnlyConfiguredIpAddress = false
          loginPort = 7171
          gamePort = 7172
          adminPort = 7171
          statusPort = 7171
          loginTries = 10
          retryTimeout = 5 * 1000
          loginTimeout = 60 * 1000
          maxPlayers = 1000
          motd = "Welcome to the Forgotten Server 8.60!"
          displayOnOrOffAtCharlist = false
          onePlayerOnlinePerAccount = true
          allowClones = false
          serverName = "Forgotten 8.60"
          loginMessage = "Welcome to the Forgotten Server 8.60!"
          statusTimeout = 5 * 60 * 1000
          replaceKickOnLogin = true
          forceSlowConnectionsToDisconnect = false
          loginOnlyWithLoginServer = false
          premiumPlayerSkipWaitList = false
          -- Database
          -- NOTE: sqlFile is used only by sqlite database, and sqlKeepAlive by mysql database.
          -- To disable sqlKeepAlive such as mysqlReadTimeout use 0 value.
          sqlType = "sqlite"
          sqlHost = "localhost"
          sqlPort = 3306
          sqlUser = "root"
          sqlPass = ""
          sqlDatabase = "theforgottenserver"
          sqlFile = "forgottenserver.s3db"
          sqlKeepAlive = 0
          mysqlReadTimeout = 10
          mysqlWriteTimeout = 10
          encryptionType = "plain"
          -- Deathlist
          deathListEnabled = true
          deathListRequiredTime = 1 * 60 * 1000
          deathAssistCount = 19
          maxDeathRecords = 5
          -- Guilds
          ingameGuildManagement = true
          levelToFormGuild = 8
          premiumDaysToFormGuild = 0
          guildNameMinLength = 4
          guildNameMaxLength = 20
          -- Highscores
          highscoreDisplayPlayers = 15
          updateHighscoresAfterMinutes = 60
          -- Houses
          buyableAndSellableHouses = true
          houseNeedPremium = true
          bedsRequirePremium = true
          levelToBuyHouse = 1
          housesPerAccount = 0
          houseRentAsPrice = false
          housePriceAsRent = false
          housePriceEachSquare = 1000
          houseRentPeriod = "never"
          houseCleanOld = 0
          guildHalls = false
          -- Item usage
          timeBetweenActions = 200
          timeBetweenExActions = 1000
          hotkeyAimbotEnabled = true
          -- Map
          -- NOTE: storeTrash costs more memory, but will perform alot faster cleaning.
          mapName = "test"
          mapAuthor = "Komic"
          randomizeTiles = true
          storeTrash = true
          cleanProtectedZones = true
          mailboxDisabledTowns = "-1"
          -- Process
          -- NOTE: defaultPriority works only on Windows and niceLevel on *nix
          -- coresUsed are seperated by comma cores ids used by server process,
          -- default is -1, so it stays untouched (automaticaly assigned by OS).
          defaultPriority = "high"
          niceLevel = 5
          coresUsed = "-1"
          -- Startup
          optimizeDatabaseAtStartup = true
          removePremiumOnInit = true
          confirmOutdatedVersion = false
          -- Spells
          formulaLevel = 5.0
          formulaMagic = 1.0
          bufferMutedOnSpellFailure = false
          spellNameInsteadOfWords = false
          emoteSpells = true
          -- Outfits
          allowChangeOutfit = true
          allowChangeColors = true
          allowChangeAddons = true
          disableOutfitsForPrivilegedPlayers = false
          addonsOnlyPremium = true
          -- Miscellaneous
          -- NOTE: promptExceptionTracerErrorBox works only with precompiled support feature,
          -- called "exception tracer" (__EXCEPTION_TRACER__ flag).
          dataDirectory = "data/"
          bankSystem = true
          displaySkillLevelOnAdvance = false
          promptExceptionTracerErrorBox = true
          separateViplistPerCharacter = false
          maximumDoorLevel = 500
          maxMessageBuffer = 4
          -- Saving-related
          -- useHouseDataStorage usage may be found at README.
          saveGlobalStorage = true
          useHouseDataStorage = false
          storePlayerDirection = false
          -- Loot
          -- monsterLootMessage 0 to disable, 1 - only party, 2 - only player, 3 - party or player (like Tibia's)
          checkCorpseOwner = true
          monsterLootMessage = 3
          monsterLootMessageType = 25
          -- Ghost mode
          ghostModeInvisibleEffect = false
          ghostModeSpellEffects = true
          -- Limits
          idleWarningTime = 14 * 60 * 1000
          idleKickTime = 15 * 60 * 1000
          expireReportsAfterReads = 1
          playerQueryDeepness = 2
          maxItemsPerPZTile = 0
          maxItemsPerHouseTile = 0
          -- Premium-related
          freePremium = false
          premiumForPromotion = true
          -- Blessings
          -- NOTE: blessingReduction* regards items/containers loss.
          -- eachBlessReduction is how much each bless reduces the experience/magic/skills loss.
          blessingOnlyPremium = true
          blessingReductionBase = 30
          blessingReductionDecreament = 5
          eachBlessReduction = 8
          -- Rates
          -- NOTE: experienceStages configuration is located in data/XML/stages.xml.
          -- rateExperienceFromPlayers 0 to disable.
          experienceStages = true
          rateExperience = 5.0
          rateExperienceFromPlayers = 0
          rateSkill = 3.0
          rateMagic = 3.0
          rateLoot = 2.0
          rateSpawn = 1
          -- Monster rates
          rateMonsterHealth = 1.0
          rateMonsterMana = 1.0
          rateMonsterAttack = 1.0
          rateMonsterDefense = 1.0
          -- Experience from players
          -- NOTE: min~Threshold* set to 0 will disable the minimum threshold:
          -- player will gain experience from every lower leveled player.
          -- max~Threshold* set to 0 will disable the maximum threshold:
          -- player will gain experience from every higher leveled player.
          minLevelThresholdForKilledPlayer = 0.9
          maxLevelThresholdForKilledPlayer = 1.1
          -- Stamina
          -- NOTE: Stamina is stored in miliseconds, so seconds are multiplied by 1000.
          -- rateStaminaHits multiplies every hit done a creature, which are later
          -- mult
      lied by player attack speed.
          -- rateStaminaGain is divider of every logged out second, eg:
          -- 60000 / 3 = 20000 milliseconds, what gives 20 stamina seconds for 1 minute being logged off.
          -- rateStaminaThresholdGain is divider for the premium stamina.
          -- staminaRatingLimit* is in minutes.
          rateStaminaLoss = 1
          rateStaminaGain = 3
          rateStaminaThresholdGain = 12
          staminaRatingLimitTop = 41 * 60
          staminaRatingLimitBottom = 14 * 60
          rateStaminaAboveNormal = 1.5
          rateStaminaUnderNormal = 0.5
          staminaThresholdOnlyPremium = true
          -- Party
          -- NOTE: experienceShareLevelDifference is float number.
          -- experienceShareLevelDifference is highestLevel * value
          experienceShareRadiusX = 30
          experienceShareRadiusY = 30
          experienceShareRadiusZ = 1
          experienceShareLevelDifference = 2 / 3
          extraPartyExperienceLimit = 20
          extraPartyExperiencePercent = 5
          experienceShareActivity = 2 * 60 * 1000
          -- Global save
          -- NOTE: globalSaveHour means like 03:00, not that it will save every 3 hours,
          -- if you want such a system please check out data/globalevents/globalevents.xml.
          globalSaveEnabled = false
          globalSaveHour = 8
          shutdownAtGlobalSave = true
          cleanMapAtGlobalSave = false
          -- Spawns
          deSpawnRange = 2
          deSpawnRadius = 50
          -- Summons
          maxPlayerSummons = 2
          teleportAllSummons = false
          teleportPlayerSummons = false
          -- Status
          ownerName = ""
          ownerEmail = "@otland.net"
          url = "http://otland.net/"
          location = "Europe"
          displayGamemastersWithOnlineCommand = false
          -- Logs
          -- NOTE: This kind of logging does not work in GUI version.
          -- For such, please compile the software with __GUI_LOGS__ flag.
          adminLogsEnabled = false
          displayPlayersLogging = true
          prefixChannelLogs = ""
          runFile = ""
          outLogName = ""
          errorLogName = ""
          truncateLogsOnStartup = false
       
    • By magrelo751
      Salve Familia do TK, bom venho pedir uma ajuda por aqui, pois tentei de diversas maneiras e não tive exito...
      Quando tento por o servidor online com o TFS, simplemente aparece um erro de dll que fica na pasta System32, eu já atualizei o pc pelo update, já substitui o arquivo diretamente na system32, já instalei varias vezes o visual 2010/2013/2015 e o erro ainda persiste, alguma dica?
       

      Problema já solucionado, podem fechar o tópico!
  • Recently Browsing   0 members

    No registered users viewing this page.


×
×
  • Create New...

Important Information

Confirmação de Termo