Ir para conteúdo
  • Cadastre-se

[Modal Window] Addon & Mount Doll


Posts Recomendados

Achei esse script na OtLand, e achei interessante, é um script para addon doll e mount doll, mas ele usa Modal Window. Sem digitar !addon mage. Tudo o que voce precisa fazer é selecionar a montaria/addon na lista.

 

Testado em TFS 1.1 e 1.2

 

Registre no login.lua

'modalAD',
'modalMD'

actions.xml

<action itemid="8982" script="modalAD.lua"/>
    <action itemid="9019" script="modalMD.lua"/>

actions - modalMD.lua

local mounts = {
		[1] = {name = "Widow Queen", ID = 1},
		[2] = {name = "Racing Bird", ID = 2},
		[3] = {name = "War Bear", ID = 3},
		[4] = {name = "Black Sheep", ID = 4},
		[5] = {name = "Midnight Panther", ID = 5},
		[6] = {name = "Draptor", ID = 6},
		[7] = {name = "Titanica", ID = 7},
		[8] = {name = "Tin Lizard", ID = 8},
		[9] = {name = "Blazebringer", ID = 9},
		[10] = {name = "Rapid Boar", ID = 10},
		[11] = {name = "Stampor", ID = 11},
		[12] = {name = "Undead Cavebear", ID = 12},
		[13] = {name = "Donkey", ID = 13},
		[14] = {name = "Tiger Slug", ID = 14},
		[15] = {name = "Uniwheel", ID = 15},
		[16] = {name = "Crystal Wolf", ID = 16},
		[17] = {name = "War horse", ID = 17},
		[18] = {name = "Kingly Deer", ID = 18},
		[19] = {name = "Tamed Panda", ID = 19},
		[20] = {name = "Dromedary", ID = 20},
		[21] = {name = "King Scorpion", ID =21},
		[22] = {name = "Rented Horse", ID = 22},
		[23] = {name = "Armoured War Horse", ID = 23},
		[24] = {name = "Shadow Draptor", ID =24},
		[25] = {name = "Rented Horse", ID = 25},
		[26] = {name = "Rented Horse", ID = 26},
		[27] = {name = "Ladybug", ID = 27},
		[28] = {name = "Manta Ray", ID = 28},
		[29] = {name = "Ironblight", ID =29},
		[30] = {name = "Magma Crawler", ID = 30},
		[31] = {name = "Dragonling", ID = 31},
		[32] = {name = "Gnarlhound", ID = 32},
		[33] = {name = "Crimson Ray", ID = 33},
		[34] = {name = "Steelbeak", ID = 34},
		[35] = {name = "Water Buffalo", ID = 35},
		[36] = {name = "Tombstinger", ID = 36},
		[37] = {name = "Platesaurian", ID = 37},
		[38] = {name = "Ursagrodon", ID = 38},
		[39] = {name = "The Hellgrip", ID = 39},
		[40] = {name = "Noble Lion", ID = 40},
		[41] = {name = "Desert King", ID = 41},
		[42] = {name = "Shock Head", ID = 42},
		[43] = {name = "Walker", ID = 43},
		[44] = {name = "Azudocus", ID = 44},
		[45] = {name = "Carpacosaurus", ID = 45},
		[46] = {name = "Death Crawler", ID = 46},
		[47] = {name = "Flamesteed", ID = 47},
		[48] = {name = "Jade Lion", ID = 48},
		[49] = {name = "Jade Pincer", ID = 49},
		[50] = {name = "Nethersteed", ID = 50},
		[51] = {name = "Tempest", ID = 51},
		[52] = {name = "Winter King", ID = 52},
		[53] = {name = "Doombringer", ID = 53},
		[54] = {name = "Woodland Prince", ID = 54},
		[55] = {name = "Hailtorm Fury", ID = 55},
		[56] = {name = "Siegebreaker", ID = 56},
		[57] = {name = "Poisonbane", ID = 57},
		[58] = {name = "Blackpelt", ID = 58},
		[59] = {name = "Golden Dragonfly", ID = 59},
		[60] = {name = "Steel Bee", ID = 60},
		[61] = {name = "Copper Fly", ID = 61},
		[62] = {name = "Tundra Rambler", ID = 62},
		[63] = {name = "Highland Yak", ID = 63},
		[64] = {name = "Glacier Vagabond", ID = 64},
		[65] = {name = "Glooth Glider", ID = 65},
		[66] = {name = "Shadow Hart", ID = 66},
		[67] = {name = "Black Stag", ID = 67},
		[68] = {name = "Emperor Deer", ID = 68},
		[69] = {name = "Flying Divan", ID = 69},
		[70] = {name = "Magic Carpet", ID = 70},
		[71] = {name = "Floating Kashmir", ID = 71},
		[72] = {name = "Ringtail Wazzoon", ID = 72},
		[73] = {name = "Night Wazzoon", ID = 73},
		[74] = {name = "Emerald Waccoon", ID = 74},  
    }
	
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    player:registerEvent("modalMD")

    local title = "Choose your mount!"
    local message = "You will receive the mount you select!"

    local window = ModalWindow(1001, title, message)
	if player:getItemCount(9019) >= 1 then
		window:addButton(100, "Confirm")
		window:setDefaultEnterButton(100)
	else
		window:setDefaultEnterButton(101)
end
    window:addButton(101, "Cancel")
    window:setDefaultEscapeButton(101)
   
    for i = 1, #mounts do
		local o = mounts[i].name
		if not player:hasMount(mounts[i].ID) then
			window:addChoice(i, o)
		end
    end
	
	if window:getChoiceCount() == 0 then
        window:setMessage("You have all the mounts! You have been awarded the achievement and a custom mount!")
		--add achievement 
    end

    window:sendToPlayer(player)
    return true
end

actions - modalAD.lua

local outfits = {
        [1] = {name = "Citizen", male = 128, female = 136},
        [2] = {name = "Hunter", male = 129, female = 137},
        [3] = {name = "Mage", male = 130, female = 138},
        [4] = {name = "Knight", male = 131, female = 139},
        [5] = {name = "Noble", male = 132, female = 140},
        [6] = {name = "Summoner", male = 133, female = 141},
        [7] = {name = "Warrior", male = 134, female = 142},
        [8] = {name = "Barbarian", male = 143, female = 147},
        [9] = {name = "Druid", male = 144, female = 148},
        [10] = {name = "Wizard", male = 145, female = 149},
        [11] = {name = "Oriental", male = 146, female = 150},
        [12] = {name = "Pirate", male = 151, female = 155},
        [13] = {name = "Assassin", male = 152, female = 156},
        [14] = {name = "Beggar", male = 153, female = 157},
        [15] = {name = "Shaman", male = 154, female = 158},
        [16] = {name = "Norse", male = 251, female = 252},
        [17] = {name = "Nightmare", male = 268, female = 269},
        [18] = {name = "Jester", male = 273, female = 270},
        [19] = {name = "Brotherhood", male = 278, female = 279},
        [20] = {name = "Demonhunter", male = 289, female = 288},
        [21] = {name = "Yalaharian", male = 325, female = 324},
        [22] = {name = "Warmaster", male = 335, female = 336},
        [23] = {name = "Wayfarer", male = 367, female = 366},
        [24] = {name = "Afflicted", male = 430, female = 431},
        [25] = {name = "Elementalist", male = 432, female = 433},
        [26] = {name = "Deepling", male = 463, female = 464},
        [27] = {name = "Insectoid", male = 465, female = 466},
        [28] = {name = "Entrepreneur", male = 472, female = 471},
        [29] = {name = "Crystal Warlord", male = 512, female = 513},
        [30] = {name = "Soil Guardian", male = 516, female = 514},
        [31] = {name = "Demon", male = 541, female = 542},
        [32] = {name = "Cave Explorer", male = 574, female = 575},
        [33] = {name = "Dream Warden", male = 577, female = 578},
        [34] = {name = "Champion", male = 633, female = 632},
        [35] = {name = "Conjurer", male = 634, female = 635},
        [36] = {name = "Beastmaster", male = 637, female = 636},
        [37] = {name = "Chaos Acolyte", male = 665, female = 664},
        [38] = {name = "Death Herald", male = 667, female = 666},
        [39] = {name = "Ranger", male = 684, female = 683},
        [40] = {name = "Ceremonial Garb", male = 695, female = 694},
        [41] = {name = "Puppeteer", male = 697, female = 696},
        [42] = {name = "Spirit Caller", male = 699, female = 698},
    }

function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    player:registerEvent("modalAD")

    local title = "Choose your outfit!"
    local message = "You will receive the outfit and both addons!"

    local window = ModalWindow(1000, title, message)
	if player:getItemCount(8982) >= 1 then
		window:addButton(100, "Confirm")
		window:setDefaultEnterButton(100)
	else
		window:setDefaultEnterButton(101)
end
    window:addButton(101, "Cancel")
    window:setDefaultEscapeButton(101)
   
    for i = 1, #outfits do
        local o = outfits[i].name
        if not player:hasOutfit(outfits[i].male, 3) and not player:hasOutfit(outfits[i].female, 3) then
            if outfits[i].name == "Noble" or outfits[i].name == "Norse" then
                if player:getSex() == 0 then
                    o = o .. "woman"
                else
                    o = o .. "man"
                end
            end
            window:addChoice(i, o)
        end
    end
	
	if window:getChoiceCount() == 0 then
        window:setMessage("You have all the outfits! You have been awarded the achievement and a custom outfit!")
		--add achievement 
    end

    window:sendToPlayer(player)
    return true
end

creaturescripts.xml

	<event type="modalwindow" name="modalAD" script="modalAD.lua"/>
    <event type="modalwindow" name="modalMD" script="modalMD.lua"/>

creaturescripts - modalMD.lua

local mounts = {
	[1] = {name = "Widow Queen", ID = 1},
	[2] = {name = "Racing Bird", ID = 2},
	[3] = {name = "War Bear", ID = 3},
	[4] = {name = "Black Sheep", ID = 4},
	[5] = {name = "Midnight Panther", ID = 5},
	[6] = {name = "Draptor", ID = 6},
	[7] = {name = "Titanica", ID = 7},
	[8] = {name = "Tin Lizard", ID = 8},
    [9] = {name = "Blazebringer", ID = 9},
    [10] = {name = "Rapid Boar", ID = 10},
    [11] = {name = "Stampor", ID = 11},
    [12] = {name = "Undead Cavebear", ID = 12},
    [13] = {name = "Donkey", ID = 13},
    [14] = {name = "Tiger Slug", ID = 14},
    [15] = {name = "Uniwheel", ID = 15},
    [16] = {name = "Crystal Wolf", ID = 16},
    [17] = {name = "War horse", ID = 17},
    [18] = {name = "Kingly Deer", ID = 18},
    [19] = {name = "Tamed Panda", ID = 19},
    [20] = {name = "Dromedary", ID = 20},
    [21] = {name = "King Scorpion", ID =21},
    [22] = {name = "Rented Horse", ID = 22},
    [23] = {name = "Armoured War Horse", ID = 23},
    [24] = {name = "Shadow Draptor", ID =24},
    [25] = {name = "Rented Horse", ID = 25},
    [26] = {name = "Rented Horse", ID = 26},
    [27] = {name = "Ladybug", ID = 27},
    [28] = {name = "Manta Ray", ID = 28},
    [29] = {name = "Ironblight", ID =29},
    [30] = {name = "Magma Crawler", ID = 30},
    [31] = {name = "Dragonling", ID = 31},
    [32] = {name = "Gnarlhound", ID = 32},
    [33] = {name = "Crimson Ray", ID = 33},
    [34] = {name = "Steelbeak", ID = 34},
    [35] = {name = "Water Buffalo", ID = 35},
    [36] = {name = "Tombstinger", ID = 36},
    [37] = {name = "Platesaurian", ID = 37},
    [38] = {name = "Ursagrodon", ID = 38},
    [39] = {name = "The Hellgrip", ID = 39},
    [40] = {name = "Noble Lion", ID = 40},
    [41] = {name = "Desert King", ID = 41},
    [42] = {name = "Shock Head", ID = 42},
    [43] = {name = "Walker", ID = 43},
    [44] = {name = "Azudocus", ID = 44},
    [45] = {name = "Carpacosaurus", ID = 45},
    [46] = {name = "Death Crawler", ID = 46},
    [47] = {name = "Flamesteed", ID = 47},
    [48] = {name = "Jade Lion", ID = 48},
    [49] = {name = "Jade Pincer", ID = 49},
    [50] = {name = "Nethersteed", ID = 50},
    [51] = {name = "Tempest", ID = 51},
    [52] = {name = "Winter King", ID = 52},
    [53] = {name = "Doombringer", ID = 53},
    [54] = {name = "Woodland Prince", ID = 54},
    [55] = {name = "Hailtorm Fury", ID = 55},
    [56] = {name = "Siegebreaker", ID = 56},
    [57] = {name = "Poisonbane", ID = 57},
    [58] = {name = "Blackpelt", ID = 58},
    [59] = {name = "Golden Dragonfly", ID = 59},
    [60] = {name = "Steel Bee", ID = 60},
    [61] = {name = "Copper Fly", ID = 61},
    [62] = {name = "Tundra Rambler", ID = 62},
    [63] = {name = "Highland Yak", ID = 63},
    [64] = {name = "Glacier Vagabond", ID = 64},
    [65] = {name = "Glooth Glider", ID = 65},
    [66] = {name = "Shadow Hart", ID = 66},
    [67] = {name = "Black Stag", ID = 67},
    [68] = {name = "Emperor Deer", ID = 68},
    [69] = {name = "Flying Divan", ID = 69},
    [70] = {name = "Magic Carpet", ID = 70},
    [71] = {name = "Floating Kashmir", ID = 71},
    [72] = {name = "Ringtail Wazzoon", ID = 72},
    [73] = {name = "Night Wazzoon", ID = 73},
    [74] = {name = "Emerald Waccoon", ID = 74},  
    }
	
function onModalWindow(player, modalWindowId, buttonId, choiceId)
    player:unregisterEvent("modalMD")

    if modalWindowId == 1001 then
        if buttonId == 100 then
			if player:getItemCount(9019) == 0 then
				player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must have a Mount Doll in your backpack!")
			return false
			end
            if choiceId == 0 then
                return false
            end
            player:removeItem(9019, 1)
            player:addMount(mounts[choiceId].ID)
            player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
        end
    end
end

creaturescripts - modalAD.lua

local outfits = {
        [1] = {name = "Citizen", male = 128, female = 136},
        [2] = {name = "Hunter", male = 129, female = 137},
        [3] = {name = "Mage", male = 130, female = 138},
        [4] = {name = "Knight", male = 131, female = 139},
        [5] = {name = "Noble", male = 132, female = 140},
        [6] = {name = "Summoner", male = 133, female = 141},
        [7] = {name = "Warrior", male = 134, female = 142},
        [8] = {name = "Barbarian", male = 143, female = 147},
        [9] = {name = "Druid", male = 144, female = 148},
        [10] = {name = "Wizard", male = 145, female = 149},
        [11] = {name = "Oriental", male = 146, female = 150},
        [12] = {name = "Pirate", male = 151, female = 155},
        [13] = {name = "Assassin", male = 152, female = 156},
        [14] = {name = "Beggar", male = 153, female = 157},
        [15] = {name = "Shaman", male = 154, female = 158},
        [16] = {name = "Norse", male = 251, female = 252},
        [17] = {name = "Nightmare", male = 268, female = 269},
        [18] = {name = "Jester", male = 273, female = 270},
        [19] = {name = "Brotherhood", male = 278, female = 279},
        [20] = {name = "Demonhunter", male = 289, female = 288},
        [21] = {name = "Yalaharian", male = 325, female = 324},
        [22] = {name = "Warmaster", male = 335, female = 336},
        [23] = {name = "Wayfarer", male = 367, female = 366},
        [24] = {name = "Afflicted", male = 430, female = 431},
        [25] = {name = "Elementalist", male = 432, female = 433},
        [26] = {name = "Deepling", male = 463, female = 464},
        [27] = {name = "Insectoid", male = 465, female = 466},
        [28] = {name = "Entrepreneur", male = 472, female = 471},
        [29] = {name = "Crystal Warlord", male = 512, female = 513},
        [30] = {name = "Soil Guardian", male = 516, female = 514},
        [31] = {name = "Demon", male = 541, female = 542},
        [32] = {name = "Cave Explorer", male = 574, female = 575},
        [33] = {name = "Dream Warden", male = 577, female = 578},
        [34] = {name = "Champion", male = 633, female = 632},
        [35] = {name = "Conjurer", male = 634, female = 635},
        [36] = {name = "Beastmaster", male = 637, female = 636},
        [37] = {name = "Chaos Acolyte", male = 665, female = 664},
        [38] = {name = "Death Herald", male = 667, female = 666},
        [39] = {name = "Ranger", male = 684, female = 683},
        [40] = {name = "Ceremonial Garb", male = 695, female = 694},
        [41] = {name = "Puppeteer", male = 697, female = 696},
        [42] = {name = "Spirit Caller", male = 699, female = 698},
		[43] = {name = "Glooth Engineer", male = 610, female = 618},
    }
	
function onModalWindow(player, modalWindowId, buttonId, choiceId)
    player:unregisterEvent("modalAD")
	
    if modalWindowId == 1000 then
        if buttonId == 100 then
			if player:getItemCount(8982) == 0 then
				player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must have a Addon Doll in your backpack!")
				return false
			end
            if choiceId == 0 then
                return false
            end
            player:removeItem(8982, 1)
            if player:getSex() == 0 then
                    player:addOutfitAddon(outfits[choiceId].female, 3)
                else
                    player:addOutfitAddon(outfits[choiceId].male, 3)
            end
            player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
        end
    end
end

não sou a melhor pessoa para explicar as coisas, basicamente é isso:

AD = Addon Doll

MD = Mount Doll

 

Se voce quiser trocar o doll, mude no actions.xml o ID, e mude nos scripts, na linha if player:getItemCount(ID) == 0 then - Substitui o ID pelo o ID do doll que voce queira.

 

 

Créditos: beastn

discord.pngDiscord: vankk #7765

Precisando de ajuda? Entre em contato comigo via Discord.

 

Muitos vêm seus muitos dias de glória, mas poucos vêm seus muitos dias de luta.

Link para o post
Compartilhar em outros sites
  • 1 month later...
  • 5 weeks later...
  • 5 weeks later...
  • 1 year later...
  • 1 year later...

Cara eu segui esse passo a passo, mais quando clico no item pra ele entregar o addon ele só me entrega o addon 2, e não o addon full.

 

Alguém pode me ajudar a resolver esse problema!

Editado por tanan05 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
Em 10/11/2015 em 18:22, vankk disse:

if player:getSex() == 0 then player:addOutfitAddon(outfits[choiceId].female, 3) else player:addOutfitAddon(outfits[choiceId].male, 3) end

 

1 hora atrás, tanan05 disse:

Alguém pode me ajudar a resolver esse problema!

Tenta mudar isto: 

if player:getSex() == 0 then 
	player:addOutfitAddon(outfits[choiceId].female, 3)
else 
	player:addOutfitAddon(outfits[choiceId].male, 3)
end

Por isto: 

if player:getSex() == 0 then
	player:addOutfitAddon(outfits[choiceId].female, 1)
	player:addOutfitAddon(outfits[choiceId].female, 2)
else
	player:addOutfitAddon(outfits[choiceId].male, 1)
	player:addOutfitAddon(outfits[choiceId].male, 2)
end

 

Link para o post
Compartilhar em outros sites
Em 07/09/2019 em 19:12, luanluciano93 disse:

 

Tenta mudar isto: 


if player:getSex() == 0 then 
	player:addOutfitAddon(outfits[choiceId].female, 3)
else 
	player:addOutfitAddon(outfits[choiceId].male, 3)
end

Por isto: 


if player:getSex() == 0 then
	player:addOutfitAddon(outfits[choiceId].female, 1)
	player:addOutfitAddon(outfits[choiceId].female, 2)
else
	player:addOutfitAddon(outfits[choiceId].male, 1)
	player:addOutfitAddon(outfits[choiceId].male, 2)
end

 



Eu alterei como falou mais nada aconteceu!

Continua somente entregado o addon 2 e cada outfit :(

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo