• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.1/1.2 10.76 Modal Window Addon and Mount Doll

what's buggy about it o:
Events that t register is wrong, i needed to add a check on the creaturescript, someone of the IDS you gave me were wrong and the buttons were all wrong way around hahaha its all done now i just need to pack it as a zip and host it.. cbf using pastebin hahaa
 
Events that t register is wrong, i needed to add a check on the creaturescript, someone of the IDS you gave me were wrong and the buttons were all wrong way around hahaha its all done now i just need to pack it as a zip and host it.. cbf using pastebin hahaa
well I rushed through the looktypes cause it was a pain in the ass :p as for the buttons, that tends to happen sometimes :p it was just cause of where I was checking if they had a doll xD
 
well I rushed through the looktypes cause it was a pain in the ass :p as for the buttons, that tends to happen sometimes :p it was just cause of where I was checking if they had a doll xD
haha its all god it taught me heaps. i'll release my raid script tomorrow. ;)
 
@beastn Im sorry beastn but i was abit "dumb"? i guess. You could say in the Description that u have to add the type "modalwindow" in creaturescripts.xml^^

Cuz not everyone is familiar with Scripts etc. same for me, i just figured it out myself. i didnt know what type i should write in there.
 
@beastn Im sorry beastn but i was abit "dumb"? i guess. You could say in the Description that u have to add the type "modalwindow" in creaturescripts.xml^^

Cuz not everyone is familiar with Scripts etc. same for me, i just figured it out myself. i didnt know what type i should write in there.
ahh sorry dude.. i Originally had it in the thread but when i edited it with the pastebin i forget to re-add it. GOing to fix it all up properly now. I also found some errors with the script so if you wanbt to reupdate your scripts with thoe ones i'm about to post would be better for you ;)

EDIT: Just Updated all the scripts now they should now be 100%
 
Last edited:
Small Contribution, I noticed when testing in-game that the mount names dont match the IDs for 1.1 TFS. So I took the liberty to edit the modalMD attached to match the Mounts.xml.

(Most fit, just edited last 15 or so)

<3
- Creaturescript lua
Code:
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 = "Armoured Scorpion", ID = 36},
    [37] = {name = "Armoured Dragonling", ID = 37},
    [38] = {name = "Armoured Cavebear", ID = 38},
    [39] = {name = "The Hellgrip", ID = 39},
    [40] = {name = "Noble Lion", ID = 40},
    [41] = {name = "Golden Lion", 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 = "Floating Kashmir", ID = 67},
    [68] = {name = "Ringtail Waccoon", ID = 68},
    [69] = {name = "Night Waccoon", ID = 69},
    [70] = {name = "Emerald Waccoon", ID = 70},
    [71] = {name = "Glooth Glider", ID = 71},
    [72] = {name = "Shadow Hart", ID = 72},
    [73] = {name = "Black Stag", ID = 73},
    [74] = {name = "Emperor Deer", 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

Actions lua

Code:
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 = "Armoured Scorpion", ID = 36},
    [37] = {name = "Armoured Dragonling", ID = 37},
    [38] = {name = "Armoured Cavebear", ID = 38},
    [39] = {name = "The Hellgrip", ID = 39},
    [40] = {name = "Noble Lion", ID = 40},
    [41] = {name = "Golden Lion", 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 = "Floating Kashmir", ID = 67},
    [68] = {name = "Ringtail Waccoon", ID = 68},
    [69] = {name = "Night Waccoon", ID = 69},
    [70] = {name = "Emerald Waccoon", ID = 70},
    [71] = {name = "Glooth Glider", ID = 71},
    [72] = {name = "Shadow Hart", ID = 72},
    [73] = {name = "Black Stag", ID = 73},
    [74] = {name = "Emperor Deer", 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
 
If you have all addons, appears the button to confirm, when you confirm, the doll disappears ... how do you not disappear when I have all the addons?
 
Hello very nice thanks for the script! But mount script is working very good, when i use the doll, appears the window and the buttom "Confirm" and "Cancel"
But in Addons/Outfit window it doesnt appear the button "Confirm" only "Cancel" (Im using the doll in my backpack) any idea?

NVM i cheked the error n,n
 
Maybe this report isn't useful but... @beastn

When used byplayers that already have all mounts or all addons you get this error


Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/custom/modalAD.lua:onModalWindow
data/creaturescripts/scripts/custom/modalAD.lua:63: attempt to index a nil value

stack traceback:
        [C]: in function '__index'
        data/creaturescripts/scripts/custom/modalAD.lua:63: in function <data/cr
eaturescripts/scripts/custom/modalAD.lua:47>

Thanks!
 
Last edited:
I'm using the dolls and they are not removed after usage.

How do i make them to be removed?. They are permanent :(.

Very nice script, you're god! :)
 
Oh, i see, i changed only the itemid but not the removal id. I'm dumb, sorry.

Thank you so much!.
 
is there a specific way it needs to be entered i cant seem to it it to work, i keep getting unexpected error near "modalMD'
 
function onLogin(player)
local loginStr = "Welcome to " .. configManager.getString(configKeys.SERVER_NAME) .. "!"
if player:getLastLoginSaved() <= 0 then
loginStr = loginStr .. " Please choose your outfit."
player:sendOutfitWindow()
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)

-- Stamina
nextUseStaminaTime[player.uid] = 0

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

-- Events
player:registerEvent("PlayerDeath")
player:registerEvent("DropLoot")
return true
end
'modalAD',
'modalMD'
 
function onLogin(player)
local loginStr = "Welcome to " .. configManager.getString(configKeys.SERVER_NAME) .. "!"
if player:getLastLoginSaved() <= 0 then
loginStr = loginStr .. " Please choose your outfit."
player:sendOutfitWindow()
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)

-- Stamina
nextUseStaminaTime[player.uid] = 0

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

-- Events
player:registerEvent("PlayerDeath")
player:registerEvent("DropLoot")
return true
end
'modalAD',
'modalMD'
Code:
-- Events
player:registerEvent("PlayerDeath")
player:registerEvent("DropLoot")
player:registerEvent("modalAD")
player:registerEvent("modalMD")
return true
end
 
Back
Top