• 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!

mount doll with store mounts

darkmu

Well-Known Member
Joined
Aug 26, 2007
Messages
274
Solutions
1
Reaction score
50
Location
Paraná,Brazil
I modified my mount doll to receive mounts from the store too, but I am in doubt of what I did wrong, because the mounts from the store I am not receiving.

Action:
Lua:
local mounts = {
        [1] = {name = "Widow", ID = 1},
        [2] = {name = "Racing Bird", ID = 2},       
        [3] = {name = "War Bear", ID = 3},     
        [4] = {name = "Black Sheep", ID = 4},     
        [5] = {name = "Titanica", ID = 7},
        [6] = {name = "Tin Lizzard", ID = 1},
        [7] = {name = "Rapid Boar", ID = 8},
        [8] = {name = "Undead Cavebear", ID = 12},
        [9] = {name = "Donkey", ID = 13},
        [10] = {name = "Tiger Slug", ID = 14},     
        [11] = {name = "Crystal Wolf", ID = 16},
        [12] = {name = "War Horse", ID = 17},
        [13] = {name = "Kingly Deer", ID = 18},
        [14] = {name = "Tamed Panda", ID = 19},
        [15] = {name = "Dromedary", ID = 20},
        [16] = {name = "Rented Horse", ID = 22},
        [17] = {name = "Rented Horse II", ID = 25},
        [18] = {name = "Rented Horse III", ID = 26},
        [19] = {name = "Water Buffalo", ID = 35},
        [20] = {name = "Noble Lion", ID = 40},
        [21] = {name = "Shock Head", ID = 42},
        [22] = {name = "Walker", ID = 43},
        [23] = {name = "Azudocus", ID = 44},
        [24] = {name = "Carpacosaurus", ID = 45},
        [25] = {name = "Platesaurian", ID = 37},           
        [26] = {name = "Battle Badger", 147},
        [27] = {name = "Bloodcurl", 92},
        [28] = {name = "Cave Tarantula", 117},
        [29] = {name = "Copper Fly", 61},
        [30] = {name = "Coralripper", 79},
        [31] = {name = "Cranium Spider", 116},
        [32] = {name = "Ember Saurian", 111},
        [33] = {name = "Flitterkatzen", 75},
        [34] = {name = "Floating Augur", 155},
        [35] = {name = "Floating Sage", 153},
        [36] = {name = "Floating Scholar", 154},
        [37] = {name = "Gloom Widow", 118},
        [38] = {name = "Golden Dragonfly", 59},
        [39] = {name = "Jungle Saurian", 110},
        [40] = {name = "Lagoon Saurian", 112},
        [41] = {name = "Marsh Toad", 120},
        [42] = {name = "Nightmarish Crocovile", 143},
        [43] = {name = "Plumfish", 80},
        [44] = {name = "Sanguine frog", 121},
        [45] = {name = "Sea Devil", 78},       
        [46] = {name = "Steel bee", 60},
        [47] = {name = "Swamp crocovile", 142},
        [48] = {name = "Sea Devil", 78},
        [49] = {name = "Toxic toad", 122},
    }
      
    
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(11211) >= 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

Creaturescript:
Lua:
local mounts = {
        [1] = {name = "Widow", ID = 1},
        [2] = {name = "Racing Bird", ID = 2},       
        [3] = {name = "War Bear", ID = 3},     
        [4] = {name = "Black Sheep", ID = 4},     
        [5] = {name = "Titanica", ID = 7},
        [6] = {name = "Tin Lizzard", ID = 1},
        [7] = {name = "Rapid Boar", ID = 8},
        [8] = {name = "Undead Cavebear", ID = 12},
        [9] = {name = "Donkey", ID = 13},
        [10] = {name = "Tiger Slug", ID = 14},     
        [11] = {name = "Crystal Wolf", ID = 16},
        [12] = {name = "War Horse", ID = 17},
        [13] = {name = "Kingly Deer", ID = 18},
        [14] = {name = "Tamed Panda", ID = 19},
        [15] = {name = "Dromedary", ID = 20},
        [16] = {name = "Rented Horse", ID = 22},
        [17] = {name = "Rented Horse II", ID = 25},
        [18] = {name = "Rented Horse III", ID = 26},
        [19] = {name = "Water Buffalo", ID = 35},
        [20] = {name = "Noble Lion", ID = 40},
        [21] = {name = "Shock Head", ID = 42},
        [22] = {name = "Walker", ID = 43},
        [23] = {name = "Azudocus", ID = 44},
        [24] = {name = "Carpacosaurus", ID = 45},
        [25] = {name = "Platesaurian", ID = 37},           
        [26] = {name = "Battle Badger", 147},
        [27] = {name = "Bloodcurl", 92},
        [28] = {name = "Cave Tarantula", 117},
        [29] = {name = "Copper Fly", 61},
        [30] = {name = "Coralripper", 79},
        [31] = {name = "Cranium Spider", 116},
        [32] = {name = "Ember Saurian", 111},
        [33] = {name = "Flitterkatzen", 75},
        [34] = {name = "Floating Augur", 155},
        [35] = {name = "Floating Sage", 153},
        [36] = {name = "Floating Scholar", 154},
        [37] = {name = "Gloom Widow", 118},
        [38] = {name = "Golden Dragonfly", 59},
        [39] = {name = "Jungle Saurian", 110},
        [40] = {name = "Lagoon Saurian", 112},
        [41] = {name = "Marsh Toad", 120},
        [42] = {name = "Nightmarish Crocovile", 143},
        [43] = {name = "Plumfish", 80},
        [44] = {name = "Sanguine frog", 121},
        [45] = {name = "Sea Devil", 78},       
        [46] = {name = "Steel bee", 60},
        [47] = {name = "Swamp crocovile", 142},
        [48] = {name = "Sea Devil", 78},
        [49] = {name = "Toxic toad", 122},
    }
      
function onModalWindow(player, modalWindowId, buttonId, choiceId)
    player:unregisterEvent("modalMD")
 
    if modalWindowId == 1001 then
        if buttonId == 100 then
                        if player:getItemCount(11211) == 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(11211, 1)
            player:addMount(mounts[choiceId].ID)
            player:getPosition():sendMagicEffect(CONST_ME_GREENSMOKE)
        end
    end
end
 
Back
Top