Ir para conteúdo

Script movements não esta executando da forma correta


UroTTa

Posts Recomendados

Juntei o do beholder e do techrlz deu certo, script ficou perfeito.

 

Obrigado a todos que tentaram me ajudar, fico grato.

 

script ficou assim:

local pos = {
	{x = 33258, y = 31079, z = 8},
	{x = 33259, y = 31089, z = 8},
	{x = 33266, y = 31084, z = 8},
	{x = 33263, y = 31093, z = 8}
}


function doClearMissionArea(fromPos, toPos)
	for x = fromPos.x, toPos.x do
		for y = fromPos.y, toPos.y do
			for z = fromPos.z, toPos.z do
				if(getTopCreature({x = x, y = y, z = z}).uid > 0) then
					if(isPlayer(getTopCreature({x = x, y = y, z = z}).uid)) then
						doTeleportThing(getTopCreature({x = x, y = y, z = z}).uid, {x = 33353, y = 31410, z = 8})
						doSendMagicEffect({x = 33353, y = 31410, z = 8}, CONST_ME_TELEPORT)
					else
						doRemoveCreature(getTopCreature({x = x, y = y, z = z}).uid)
					end
				end
			end
		end
	end
	return true
end

function TirarEscada()
    local escada = getTileItemById({x = 33265, y = 31116, z = 8}, 3687)
    local escada2 = getTileItemById({x = 33265, y = 31116, z = 7}, 3219)
    if escada then
        doRemoveItem(escada.uid, 1)
	doRemoveItem(escada2.uid, 1)
	doCreateItem(11097, 1, {x = 33265, y = 31116, z = 7})
    end
    return true
end


function onStepIn(cid, item, position, lastPosition)
	start = 0
	if item.actionid == 8014 then
		doCreatureSay(cid, "A clicking sound tatters the silence.", TALKTYPE_ORANGE_1)
		for i = 1, 4 do
			local creature = getTopCreature(pos[i]).uid
			if creature > 0 then
				if isPlayer(creature) then
					if getGlobalStorageValue(8014) < 1 then
						if getPlayerStorageValue(creature, 1050) == 19 then
							start = start + 1
						end
					end
				end
			end
		end
		if start == 4 then
			doCreatureSayWithRadius(cid, "The army is complete again. You hear a hatch opening elsewhere, followed by a grinding sound.", TALKTYPE_ORANGE_1, 33261, 31086, {x =  33261, y = 31086, z = 8})
			doCreateItem(3687, 1, {x = 33265, y = 31116, z = 8})
			doCreateItem(3219, 1, {x = 33265, y = 31116, z = 7})
			addEvent(TirarEscada, 30 * 1000)
			setGlobalStorageValue(8014, 1)
			addEvent(setGlobalStorageValue, 8014, 0)
			creature = ""
			for k = 1, 4 do
				for j = 1, 20 do
					if(k < 3) then
						creature = "eternal guardian"
					else
						creature = "lizard chosen"
					end
					summonPos = {x = math.random(33239, 33295), y = math.random(31100, 31132), z = 7}
					addEvent(doSummonCreature, k * 30 * 1000, creature, summonPos)
					addEvent(doSendMagicEffect, k * 30 * 1000, summonPos, CONST_ME_TELEPORT)
				end
			end
			addEvent(doClearMissionArea, 5 * 30 * 1000, {x = 33239, y = 31100, z = 7}, {x = 33295, y = 31132, z = 7})
			addEvent(setPlayerStorageValue, 5 * 30 * 1000, cid, 15335, 2)
			addEvent(setPlayerStorageValue, 5 * 30 * 1000, cid, 1050, 20)
		end
	end

return true
end

Pode fechar o topico.

 

REP+

Editado por UroTTa
Link para o comentário
Compartilhar em outros sites

Boa, essa função é nova ou já tinha antes? Não lembro de ter visto ela...

 

Funções do TFS 1.0:

 

 

addDamageCondition(condition, rounds, time, value)

addEvent(callback, delay, ...)

addOutfitCondition(condition, lookTypeEx, lookType, lookHead, lookBody, lookLegs, lookFeet)

broadcastMessage(message, type)

canPlayerLearnInstantSpell(cid, name)

canPlayerWearOutfit(cid, lookType, addons)

cleanMap()

createCombatArea( {area}, <optional> {extArea} )

createCombatObject()

createConditionObject(type)

Creature.getClosestFreePosition(self, position, extended)

debugPrint(text)

doAddCondition(cid, condition)

doAddContainerItem(uid, itemid, <optional> count/subtype)

doAddContainerItemEx(uid, virtualId)

doAddMapMark(cid, pos, type, description)

doAreaCombatCondition(cid, pos, area, condition, effect)

doAreaCombatDispel(cid, pos, area, type, effect)

doAreaCombatHealth(cid, type, pos, area, min, max, effect)

doAreaCombatMana(cid, pos, area, min, max, effect)

doChallengeCreature(cid, target)

doChangeSpeed(cid, delta)

doChangeTypeItem(uid, newtype)

doCombat(cid, combat, param)

doConvinceCreature(cid, target)

doCreateItem(itemid, type/count, pos)

doCreateItemEx(itemid, <optional> count/subtype)

doCreateNpc(name, pos)

doCreateTeleport(itemid, topos, createpos)

doCreatureAddHealth(cid, health)

doCreatureChangeOutfit(cid, outfit)

doCreatureSay(cid, text, type, ...)

doCreatureSayWithRadius(cid, text, type, radiusx, radiusy, position)

doCreatureSetLookDir(cid, direction)

doDecayItem(uid)

doForceSummonCreature(name, pos)

doMonsterChangeTarget(cid)

doMoveCreature(cid, direction)

doPlayerAddBlessing(cid, blessing)

doPlayerAddExp(cid, exp, useMult, ...)

doPlayerAddItem(cid, itemid, <optional: default: 1> count, <optional: default: 1> canDropOnMap, <optional: default: 1>subtype)

doPlayerAddItem(uid, itemid, <optional: default: 1> count/subtype)

doPlayerAddItemEx(cid, uid, ...)

doPlayerAddMana(cid, mana, ...)

doPlayerAddManaSpent(cid, mana)

doPlayerAddMoney(cid, money)

doPlayerAddMount(cid, mountId)

doPlayerAddOutfit(cid, lookType, addons)

doPlayerAddPremiumDays(cid, days)

doPlayerAddSkillTry(cid, skillid, n)

doPlayerAddSoul(cid, soul)

doPlayerFeed(cid, food)

doPlayerJoinParty(cid, leaderId)

doPlayerPopupFYI(cid, message)

doPlayerRemOutfit(cid, lookType, addons)

doPlayerRemoveItem(cid, itemid, count, <optional> subtype, <optional> ignoreEquipped)

doPlayerRemoveMoney(cid, money)

doPlayerRemoveMount(cid, mountId)

doPlayerRemovePremiumDays(cid, days)

doPlayerSendCancel(cid, text)

doPlayerSendTextMessage(cid, type, text, ...)

doPlayerSetBalance(cid, balance)

doPlayerSetGuildLevel(cid, level)

doPlayerSetGuildNick(cid, nick)

doPlayerSetOfflineTrainingSkill(cid, skill)

doPlayerSetSex(cid, sex)

doPlayerSetTown(cid, town)

doPlayerSetVocation(cid, vocation)

doRelocate(pos, posTo)

doRemoveCondition(cid, type[, subId])

doRemoveCreature(cid)

doRemoveItem(uid, ...)

doSendDistanceShoot(fromPos, toPos, distanceEffect, ...)

doSendMagicEffect(pos, magicEffect, ...)

doSendTutorial(cid, tutorialId)

doSetCreatureDropLoot(cid, doDrop)

doSetCreatureLight(cid, lightLevel, lightColor, time)

doSetCreatureOutfit(cid, outfit, time)

doSetItemActionId(uid, actionId)

doSetItemOutfit(cid, item, time)

doSetItemSpecialDescription(uid, desc)

doSetItemText(uid, text)

doSetMonsterOutfit(cid, name, time)

doSetMonsterTarget(cid, target)

doShowTextDialog(cid, itemId, text)

doSummonCreature(name, pos)

doTargetCombatCondition(cid, target, condition, effect)

doTargetCombatDispel(cid, target, type, effect)

doTargetCombatHealth(cid, target, type, min, max, effect)

doTargetCombatMana(cid, target, min, max, effect)

doTeleportThing(uid, dest, pushMovement)

doTileAddItemEx(pos, uid)

doTransformItem(uid, newItemId, ...)

Game.convertIpToString(ip)

Game.getStorageValue(key)

Game.setStorageValue(key, value)

getAccountNumberByPlayerName(name)

getBlessingsCost(level)

getConfigInfo(info)

getContainerCap(uid)

getContainerCapById(itemId)

getContainerItem(uid, slot)

getContainerSize(uid)

getCreatureBaseSpeed(cid)

getCreatureCondition(cid, condition[, subId])

getCreatureHealth(cid)

getCreatureMaster(cid)

getCreatureMaxHealth(cid)

getCreatureName(cid)

getCreatureOutfit(cid)

getCreaturePosition(cid)

getCreatureSpeed(cid)

getCreatureSummons(cid)

getCreatureTarget(cid)

getDepotId(uid)

getDistanceBetween(firstPosition, secondPosition)

getFluidSourceType(itemId)

getGlobalStorageValue(key)

getGuildId(guildName)

getHouseAccessList(id, listId)

getHouseByPlayerGUID(playerGUID)

getHouseEntry(houseId)

getHouseName(houseId)

getHouseOwner(houseId)

getHouseRent(id)

getHouseTilesSize(houseId)

getHouseTown(houseId)

getInstantSpellInfoByName(cid, name)

getInstantSpellWords(name)

getIPByPlayerName(name)

getItemDescriptions(itemId)

getItemIdByName(name)

getItemName(itemId)

getItemRWInfo(uid)

getItemWeight(itemId, ...)

getItemWeightByUID(uid, ...)

getMonsterFriendList(cid)

getMonsterTargetList(cid)

getOnlinePlayers()

getPartyMembers(cid)

getPlayerAccess(cid)

getPlayerAccountType(cid)

getPlayerBalance(cid)

getPlayerBlessing(cid, blessing)

getPlayerByName(name)

getPlayerDepotItems(cid, depotId)

getPlayerFlagValue(cid, flag)

getPlayerFood(cid)

getPlayerFreeCap(cid)

getPlayerGroupId(cid)

getPlayerGUID(cid)

getPlayerGUIDByName(name)

getPlayerGuildId(cid)

getPlayerGuildLevel(cid)

getPlayerGuildName(cid)

getPlayerGuildNick(cid)

getPlayerGuildRank(cid)

getPlayerInstantSpellCount(cid)

getPlayerInstantSpellInfo(cid, index)

getPlayerIp(cid)

getPlayerItemById(cid, deepSearch, itemId, ...)

getPlayerItemCount(cid, itemId, ...)

getPlayerLastLoginSaved(cid)

getPlayerLearnedInstantSpell(cid, name)

getPlayerLevel(cid)

getPlayerLight(cid)

getPlayerLookDir(cid)

getPlayerLossPercent(cid)

getPlayerMagLevel(cid)

getPlayerMana(cid)

getPlayerMasterPos(cid)

getPlayerMaxMana(cid)

getPlayerMoney(cid)

getPlayerMount(cid, mountId)

getPlayerName(cid)

getPlayerParty(cid)

getPlayerPosition(cid)

getPlayerPremiumDays(cid)

getPlayersByAccountNumber(accountNumber)

getPlayersByIPAddress(ip, mask)

getPlayerSex(cid)

getPlayerSkill(cid, skillId)

getPlayerSkullType(cid)

getPlayerSlotItem(cid, slot)

getPlayerSoul(cid)

getPlayerStorageValue(cid, key)

getPlayerTown(cid)

getPlayerVocation(cid)

getPromotedVocation(vocationId)

getPvpBlessingCost(level)

getSpectators(centerPos, rangex, rangey, multifloor, onlyPlayers)

getThing(uid)

getThingfromPos(pos)

getThingPos(uid)

getTibianTime()

getTileHouseInfo(pos)

getTileInfo(position)

getTileItemById(position, itemId, ...)

getTileItemByType(position, itemType)

getTilePzInfo(position)

getTileThingByPos(position)

getTileThingByTopOrder(position, topOrder)

getTopCreature(position)

getTownId(townName)

getTownName(townId)

getTownTemplePosition(townId)

getWaypointPosition(name)

getWorldCreatures(type)

getWorldLight()

getWorldTime()

getWorldUpTime()

hasProperty(uid, prop)

isContainer(uid)

isCorpse(uid)

isCreature(cid)

isDepot(uid)

isDruid(cid)

isInArray(array, value)

isInRange(pos, fromPos, toPos)

isInWar(cid, target)

isItem(uid)

isItemContainer(itemId)

isItemDoor(itemId)

isItemFluidContainer(itemId)

isItemMovable(itemId)

isItemRune(itemId)

isItemStackable(itemId)

isKnight(cid)

isMonster(cid)

isMovable(uid)

isNpc(cid)

isNumber(str)

isPaladin(cid)

isPlayer(cid)

isPlayerGhost(cid)

isPlayerPzLocked(cid)

isPremium(cid)

isSightClear(fromPos, toPos, floorCheck)

isSorcerer(cid)

isSummon(cid)

isValidUID(uid)

mayNotMove(cid, value)

numberToVariant(number)

Player.feed(self, food)

Player.isUsingOtClient(self)

Player.sendCancelMessage(self, message)

Player.sendExtendedOpcode(self, opcode, buffer)

playerLearnInstantSpell(cid, name)

Position.getNextPosition(self, direction, steps)

positionToVariant(pos)

pushThing(thing)

queryTileAddThing(thing, position, ...)

registerClass(className, baseClass, newFunction)

registerCreatureEvent(cid, name)

registerEnum(value)

registerEnumIn(tableName, value)

registerGlobalMethod(functionName, function)

registerGlobalVariable(name, value)

registerMetaMethod(className, functionName, function)

registerMethod(className, functionName, function)

registerTable(tableName)

registerVariable(tableName, name, value)

saveServer()

sendChannelMessage(channelId, type, message)

sendGuildChannelMessage(guildId, type, message)

setCombatArea(combat, area)

setCombatCallBack(combat, key, function_name)

setCombatCondition(combat, condition)

setCombatFormula(combat, type, mina, minb, maxa, maxb)

setCombatParam(combat, key, value)

setConditionFormula(combat, mina, minb, maxa, maxb)

setConditionParam(condition, key, value)

setGlobalStorageValue(key, value)

setHouseAccessList(id, listId, listText)

setHouseOwner(id, guid)

setPlayerGroupId(cid, groupId)

setPlayerStorageValue(cid, key, value)

stopEvent(eventid)

string.split(str, sep)

stringToVariant(string)

targetPositionToVariant(pos)

unregisterCreatureEvent(cid, name)

variantToNumber(var)

variantToPosition(var)

variantToString(var)

 

Editado por Techrlz
Link para o comentário
Compartilhar em outros sites

 

Creio que de para usar deste jeito também, com a função normal.

local pos = {x = x, y = y, z = z}
doCreatureSay(cid, "", TALKTYPE_ORANGE_1, false, 0, pos)

 

Na verdade no TFS 1.0 a função não possui parametro de position.

Link para o comentário
Compartilhar em outros sites

Beholder, so tem um pequeno detalhe novamente no script:

 

Desse metodo qualquer pessoa que passar em cima do action id 8014 iria aparecer a mensagem para ele, o certo era aparecer so para quem tivesse a storage (1050,19) e era pra checar se estava sendo executado o evento ou não exemplo:

 

Estava assim:


function onStepIn(cid, item, position, lastPosition)
	start = 0
	if item.actionid == 8014 then
		doCreatureSay(cid, "A clicking sound tatters the silence.", TALKTYPE_ORANGE_1)
		for i = 1, 4 do
			local creature = getTopCreature(pos[i]).uid
			if creature > 0 then
				if isPlayer(creature) then
					if getGlobalStorageValue(8014) < 1 then
						if getPlayerStorageValue(creature, 1050) == 19 then
							start = start + 1
						end
					end
				end
			end
		end

O certo era para ficar assim, mas não funcionou e bugou o evento:

function onStepIn(cid, item, position, lastPosition)
	start = 0
	if item.actionid == 8014 then
		if getPlayerStorageValue(creature, 1050) == 19 then
			if getGlobalStorageValue(8014) < 1 then
			doCreatureSay(cid, "A clicking sound tatters the silence.", TALKTYPE_ORANGE_1)
				for i = 1, 4 do
					local creature = getTopCreature(pos[i]).uid
					if creature > 0 then
						if isPlayer(creature) then
							start = start + 1
						end
					end
				end
			end
		end
Editado por UroTTa
Link para o comentário
Compartilhar em outros sites


function onStepIn(cid, item, position, lastPosition)

start = 0

if item.actionid == 8014 then

for i = 1, 4 do

local creature = getTopCreature(pos).uid

if creature > 0 then

if isPlayer(creature) then

if getGlobalStorageValue(8014) < 1 then

if getPlayerStorageValue(creature, 1050) == 19 then

start = start + 1

if creature == cid then

doCreatureSay(cid, "A clicking sound tatters the silence.", TALKTYPE_ORANGE_1)

end

end

end

end

end

end

Link para o comentário
Compartilhar em outros sites

Demonbholder, pode me ajudar na ultima coisa? Seguinte,

 

O script tem 3 funções la em baixo de executar depois de um certo tempo um addevent que teleporta os jogadores da area para o templo, eu gostaria que essa função so teleportaria jogadores com a storage (1050,19) e nessa função adicionar 2 storages nova (15335, 2) (1050, 20) ficaria mais ou menos assim.

local pos = {
	{x = 33258, y = 31079, z = 8},
	{x = 33259, y = 31089, z = 8},
	{x = 33266, y = 31084, z = 8},
	{x = 33263, y = 31093, z = 8}
}


function doClearMissionArea(fromPos, toPos)
	for x = fromPos.x, toPos.x do
		for y = fromPos.y, toPos.y do
			for z = fromPos.z, toPos.z do
				if(getTopCreature({x = x, y = y, z = z}).uid > 0) then
					if(isPlayer(getTopCreature({x = x, y = y, z = z}).uid)) then
                                                if getPlayerStorageValue(creature, 1050) == 19 then
						doTeleportThing(getTopCreature({x = x, y = y, z = z}).uid, {x = 33353, y = 31410, z = 8})
						doSendMagicEffect({x = 33353, y = 31410, z = 8}, CONST_ME_TELEPORT)
			                        setPlayerStorageValue(cid, 15335, 2)
			                        setPlayerStorageValue(cid, 1050, 20)
					else
						doRemoveCreature(getTopCreature({x = x, y = y, z = z}).uid)
					end
				end
                        end
			end
		end
	end
	return true
end

function TirarEscada()
    local escada = getTileItemById({x = 33265, y = 31116, z = 8}, 3687)
    local escada2 = getTileItemById({x = 33265, y = 31116, z = 7}, 3219)
    if escada then
        doRemoveItem(escada.uid, 1)
	doRemoveItem(escada2.uid, 1)
	doCreateItem(11097, 1, {x = 33265, y = 31116, z = 7})
    end
    return true
end


function onStepIn(cid, item, position, lastPosition)
	start = 0
	if item.actionid == 8014 then
		for i = 1, 4 do
			local creature = getTopCreature(pos[i]).uid
			if creature > 0 then
				if isPlayer(creature) then
					if getGlobalStorageValue(8014) < 1 then
						if getPlayerStorageValue(creature, 1050) == 19 then
							start = start + 1
							if creature == cid then
								doCreatureSay(cid, "A clicking sound tatters the silence.", TALKTYPE_ORANGE_1)
							end
						end
					end
				end
			end
		end
		if start == 4 then
			doCreatureSayWithRadius(cid, "The army is complete again. You hear a hatch opening elsewhere, followed by a grinding sound.", TALKTYPE_ORANGE_1, 33261, 31086, {x =  33261, y = 31086, z = 8})
			doCreateItem(3687, 1, {x = 33265, y = 31116, z = 8})
			doCreateItem(3219, 1, {x = 33265, y = 31116, z = 7})
			addEvent(TirarEscada, 30 * 1000)
			setGlobalStorageValue(8014, 1)
			addEvent(setGlobalStorageValue, 8014, 0)
			creature = ""
			for k = 1, 4 do
				for j = 1, 20 do
					if(k < 3) then
						creature = "eternal guardian"
					else
						creature = "lizard chosen"
					end
					summonPos = {x = math.random(33239, 33295), y = math.random(31100, 31132), z = 7}
					addEvent(doSummonCreature, k * 30 * 1000, creature, summonPos)
					addEvent(doSendMagicEffect, k * 30 * 1000, summonPos, CONST_ME_TELEPORT)
				end
			end
			addEvent(doClearMissionArea, 5 * 30 * 1000, {x = 33239, y = 31100, z = 7}, {x = 33295, y = 31132, z = 7})
		end
	end

return true
end

Mas esses setPlayerStorageValue(cid, 15335, 2), setPlayerStorageValue(cid, 1050, 20) não seta a storage na function.

Editado por UroTTa
Link para o comentário
Compartilhar em outros sites


function doClearMissionArea(fromPos, toPos)

for x = fromPos.x, toPos.x do

for y = fromPos.y, toPos.y do

for z = fromPos.z, toPos.z do

local cid = getTopCreature({x = x, y = y, z = z}).uid

if cid > 0 then

if isPlayer(cid) then

if getPlayerStorageValue(cid, 1050) == 19 then

setPlayerStorageValue(cid, 15335, 2)

setPlayerStorageValue(cid, 1050, 20)

doTeleportThing(cid, {x = 33353, y = 31410, z = 8})

doSendMagicEffect({x = 33353, y = 31410, z = 8}, CONST_ME_TELEPORT)

end

else

doRemoveCreature(cid)

end

end

end

end

end

return true

end

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...