BR
action

[TFS 1.x] Critical System

Por Bruno, 05 de jun. de 2015 em Globalevents e Spells

script
55
23.3k
curruwilliamC
06 de junho de 2015 às 15:04

Só não consegui adicionar no 'login.lua':

-- ordered as in creaturescripts.xml
local events = {
	'TutorialCockroach',
	'ElementalSpheresOverlords',
	'BigfootBurdenVersperoth',
	'BigfootBurdenWarzone',
	'BigfootBurdenWeeper',
	'BigfootBurdenWiggler',
	'SvargrondArenaKill',
	'NewFrontierShardOfCorruption',
	'NewFrontierTirecz',
	'ServiceOfYalaharDiseasedTrio',
	'ServiceOfYalaharAzerus',
	'ServiceOfYalaharQuaraLeaders',
	'InquisitionBosses',
	'InquisitionUngreez',
	'KillingInTheNameOfKills',
	'MastersVoiceServants',
	'SecretServiceBlackKnight',
	'ThievesGuildNomad',
	'WotELizardMagistratus',
	'WotELizardNoble',
	'WotEKeeper',
	'WotEBosses',
	'WotEZalamon',
	'PlayerDeath',
	'AdvanceSave',
	'AdvanceRookgaard',
	'PythiusTheRotten',
	'DropLoot',
	'CriticalSystem'
}

local function onMovementRemoveProtection(cid, oldPosition, time)
	local player = Player(cid)
	if not player then
		return true
	end

	local playerPosition = player:getPosition()
	if (playerPosition.x ~= oldPosition.x or playerPosition.y ~= oldPosition.y or playerPosition.z ~= oldPosition.z) or player:getTarget() then
		player:setStorageValue(Storage.combatProtectionStorage, 0)
		return true
	end

	addEvent(onMovementRemoveProtection, 1000, cid, oldPosition, time - 1)
end

function onLogin(player)
	local loginStr = 'Welcome to ' .. configManager.getString(configKeys.SERVER_NAME) .. '!'
	if player:getLastLoginSaved() <= 0 then
		loginStr = loginStr .. ' Please choose your outfit.'
		player:sendTutorial(1)
	else
		if loginStr ~= '' then
			player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
		end

		loginStr = string.format('Your last visit was on %s.', os.date('%a %b %d %X %Y', player:getLastLoginSaved()))
	end
	player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)

	local playerId = player.uid

	-- Stamina
	Game.getStorageValue("stamina")[playerId] = 0

	-- Promotion
	local vocation = player:getVocation()
	local promoted = player:isPromoted()
	if player:isPremium() then
		local value = player:getStorageValue(Storage.Promotion)
		if promoted and value ~= 1 then
			player:setStorageValue(Storage.Promotion, 1)
		elseif not promoted and value == 1 then
			player:setVocation(vocation:getPromotion())
		end
	elseif promoted then
		player:setVocation(vocation:getDemotion())
	end

	-- Events
	for i = 1, #events do
		player:registerEvent(events[i])
	end

	if player:getStorageValue(Storage.combatProtectionStorage) <= os.time() then
		player:setStorageValue(Storage.combatProtectionStorage, os.time() + 10)
		onMovementRemoveProtection(playerId, player:getPosition(), 10)
	end
	return true
end

Tu instalou a lib certinho?

SIm, como vou saber se ta dando critical?

LumusL
06 de junho de 2015 às 15:17


-- ordered as in creaturescripts.xml

local events = {

'TutorialCockroach',

'ElementalSpheresOverlords',

'BigfootBurdenVersperoth',

'BigfootBurdenWarzone',

'BigfootBurdenWeeper',

'BigfootBurdenWiggler',

'SvargrondArenaKill',

'NewFrontierShardOfCorruption',

'NewFrontierTirecz',

'ServiceOfYalaharDiseasedTrio',

'ServiceOfYalaharAzerus',

'ServiceOfYalaharQuaraLeaders',

'InquisitionBosses',

'InquisitionUngreez',

'KillingInTheNameOfKills',

'MastersVoiceServants',

'SecretServiceBlackKnight',

'ThievesGuildNomad',

'WotELizardMagistratus',

'WotELizardNoble',

'WotEKeeper',

'WotEBosses',

'WotEZalamon',

'PlayerDeath',

'AdvanceSave',

'AdvanceRookgaard',

'PythiusTheRotten',

'DropLoot',

'CriticalSystem'

}

 

local function onMovementRemoveProtection(cid, oldPosition, time)

local player = Player(cid)

if not player then

return true

end

 

local playerPosition = player:getPosition()

if (playerPosition.x ~= oldPosition.x or playerPosition.y ~= oldPosition.y or playerPosition.z ~= oldPosition.z) or player:getTarget() then

player:setStorageValue(Storage.combatProtectionStorage, 0)

return true

end

 

addEvent(onMovementRemoveProtection, 1000, cid, oldPosition, time - 1)

end

 

function onLogin(player)

local loginStr = 'Welcome to ' .. configManager.getString(configKeys.SERVER_NAME) .. '!'

if player:getLastLoginSaved() <= 0 then

loginStr = loginStr .. ' Please choose your outfit.'

player:sendTutorial(1)

else

if loginStr ~= '' then

player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)

end

 

loginStr = string.format('Your last visit was on %s.', os.date('%a %b %d %X %Y', player:getLastLoginSaved()))

end

player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)

 

local playerId = player.uid

 

-- Stamina

Game.getStorageValue("stamina")[playerId] = 0

 

-- Promotion

local vocation = player:getVocation()

local promoted = player:isPromoted()

if player:isPremium() then

local value = player:getStorageValue(Storage.Promotion)

if promoted and value ~= 1 then

player:setStorageValue(Storage.Promotion, 1)

elseif not promoted and value == 1 then

player:setVocation(vocation:getPromotion())

end

elseif promoted then

player:setVocation(vocation:getDemotion())

end

 

-- Events

for i = 1, #events do

player:registerEvent(events)

end

 

if player:getStorageValue(Storage.combatProtectionStorage) <= os.time() then

player:setStorageValue(Storage.combatProtectionStorage, os.time() + 10)

onMovementRemoveProtection(playerId, player:getPosition(), 10)

end

 

-- Critical System

if player:getCriticalLevel() == -1 then

player:setCriticalLevel(0)

end

return true

end

curruwilliamC
06 de junho de 2015 às 15:23

Beleza, descobri.. acho que agora está tudo certo rep + :D

Tava chupando manga aqui, e tava colocando depois do return...


Acho que tem algo com problema, os players não leva dano de bixo nenhum.

 

@Edit

Aquela lib faz com que os player não leve dano de monstros..

Editado Junho 6 por curruwilliam

BrunoB
06 de junho de 2015 às 20:50

Beleza, descobri.. acho que agora está tudo certo rep + :D

Tava chupando manga aqui, e tava colocando depois do return...

Acho que tem algo com problema, os players não leva dano de bixo nenhum.

 

@Edit

Aquela lib faz com que os player não leve dano de monstros..

A mesma lib pertence a outro sistema,

O Dodge System que defende metade dos hits enquanto o Critical aumenta.

Super SonicS
06 de junho de 2015 às 22:02

deu erro aq tfs parou de funcionar

BrunoB
07 de junho de 2015 às 01:16

deu erro aq tfs parou de funcionar

Tfs parou de funcionar não é um erro do script, para de funcionar quando você faz exatamente o que?

sheptS
07 de junho de 2015 às 09:57

amigo, deu um erro estranho.. tipo.. meus chares novos não recebem nenhum tipo de dano de monstros

eles são atacados, mas não recebem dano

BrunoB
07 de junho de 2015 às 11:00

amigo, deu um erro estranho.. tipo.. meus chares novos não recebem nenhum tipo de dano de monstros

eles são atacados, mas não recebem dano

Você ta usando no tfs 1.1 ou 1.2?

Você fez alguma alteração?

sheptS
07 de junho de 2015 às 11:26

1.2, sem alterações que podem influenciar, minhas alterações na source são só de canal de loot e tal, não tem ligação... eu removi o creaturescript do seu sistema e meus chares voltarão a levar danos.

BrunoB
07 de junho de 2015 às 11:56

1.2, sem alterações que podem influenciar, minhas alterações na source são só de canal de loot e tal, não tem ligação... eu removi o creaturescript do seu sistema e meus chares voltarão a levar danos.

Mas o creaturescript é o script em si.

sheptS
07 de junho de 2015 às 12:06

Mas o creaturescript é o script em si.

sim eu sei, mas eu removi pra ver se o bug era o seu script ou a minha source... e também desbugar meus chares pra mim fazer outras coisas

BrunoB
07 de junho de 2015 às 12:11

sim eu sei, mas eu removi pra ver se o bug era o seu script ou a minha source... e também desbugar meus chares pra mim fazer outras coisas

Sim, eu entendo.

Gera algum erro no console ao usar o script?

sheptS
07 de junho de 2015 às 13:25

não há erro algum, verifiquei tudo, sobre o case sensitive do registro do login, não tinha nada errado, mais tarde vou testar novamente, com outro data pack e um char novo

curruwilliamC
07 de junho de 2015 às 13:26

A mesma lib pertence a outro sistema,

O Dodge System que defende metade dos hits enquanto o Critical aumenta.

Então tenho que usar o outro sistema tbm ?

BrunoB
07 de junho de 2015 às 14:32

Então tenho que usar o outro sistema tbm ?

Não...

Eu quis dizer que com a mesma lib você consegue usar o sistema Dodge também!

Ela serve para ambos.