• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

[TFS 1.2] Raid Starter with Cooldown 2.0

Thats it young one
Ok so i read this wrong ;d i thought i could use this script like as an item? Lets say someone loots a boss raid token and wants to use it, but the item never expires :| any way to make it remove item on use? i have tried adding 'doRemoveItem(item.uid, 1)' but it removes the item when the item is on cooldown
 
Ok so i read this wrong ;d i thought i could use this script like as an item? Lets say someone loots a boss raid token and wants to use it, but the item never expires :| any way to make it remove item on use? i have tried adding 'doRemoveItem(item.uid, 1)' but it removes the item when the item is on cooldown
what do you want to do... Do it in dot point form..

Like this
1) Loot Item
2) use item
3) pick raid take money and item away
 
like this?

removeitem = true,

nvm it didnt work ;d i will just use it for something else.

lmao wtf? come on man... if you want to learn actually read the script and check your functions!! >.<
After this
Code:
  self:removeMoney(raids.cost)
Put This
Code:
self:removeItem(ITEM ID HERE, COUNT HERE )
example this will remove 1 crystal coin
Code:
self:removeItem(2160, 1)
 
lmao wtf? come on man... if you want to learn actually read the script and check your functions!! >.<
After this
Code:
  self:removeMoney(raids.cost)
Put This
Code:
self:removeItem(ITEM ID HERE, COUNT HERE )
example this will remove 1 crystal coin
Code:
self:removeItem(2160, 1)
What i needed was it to remove the item i use to spawn the raid :p it takes away money and it spawns the raid but lets say a player loots the item 'Gold Raid Token' they use it and it spawns a raid but it will also remove the item.
 
What i needed was it to remove the item i use to spawn the raid :p it takes away money and it spawns the raid but lets say a player loots the item 'Gold Raid Token' they use it and it spawns a raid but it will also remove the item.
self:removeItem(xxxx, 1)

Come on man atleast make an effort to learn instead of posting 587367 requests a day.
 
self:removeItem(xxxx, 1)

Come on man atleast make an effort to learn instead of posting 587367 requests a day.
I try to learn but i have like 10000 other things i need to fix, and to waste an hour on one script when i can fix other scripts in few minutes, id rather just leave a post and wait for a reply ;d i am also patient which is why i reply and wait.
 
I try to learn but i have like 10000 other things i need to fix, and to waste an hour on one script when i can fix other scripts in few minutes, id rather just leave a post and wait for a reply ;d i am also patient which is why i reply and wait.
Read what he said. Just replace 2160 with the item value you want. Is it really that difficult?

If it takes you an hour to figure that out you need to re evaluate getting into coding.
 
@God Mythera Incase you didn't get it working
Code:
function Player:sendBossRaidWindow(raids)
    local function buttonCallback(button, choice)
    -- Modal window functionallity
        if button.text == "Confirm" then
        -- Start Checks
            -- Check if the system is on cooldown.
            if Game.getStorageValue(raids.raidStorage) > os.time() then
                self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must wait ".. showTimeLeft(Game.getStorageValue(raids.raidStorage) - os.time(), true) ..", before you can start another boss raid.")
            return false
            end
   
            -- Check if the player has enough enough
            if self:getMoney() < raids.cost then
                self:sendTextMessage(MESSAGE_EVENT_ADVANCE, raids.moneyMsg)
            return false
            end
           
            if self:getItemCount(21399) < 1 then
                self:sendTextMessage(MESSAGE_EVENT_ADVANCE, raids.moneyMsg)
            return false
            end
           
        -- End Checks
       
        self:removeMoney(raids.cost)
        self:removeItem(21399, 1)
        self:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
        Game.startRaid(raids[choice.id].raid)
        Game.setStorageValue(raids.raidStorage, os.time() + raids.cooldown)
        return true
    end
end
   
-- Modal window design
    local window = ModalWindow {
        title = raids.mainTitle, -- Title of the modal window
        message = raids.mainMsg, -- The message to be displayed on the modal window
    }

    -- Add buttons to the window (Note: if you change the names of these you must change the functions in the modal window functionallity!)
    window:addButton("Confirm", buttonCallback)
    window:addButton("Cancel")

    -- Set what button is pressed when the player presses enter or escape
    window:setDefaultEnterButton("Confirm")
    window:setDefaultEscapeButton("Cancel")

    -- Add choices from the action script
    for i = 1, #raids do
    local o = raids[i].raid
        window:addChoice(o)
    end

    -- Send the window to player
    window:sendToPlayer(self)
end
like the others said its a super simple fix... you just needed to add removeItem() and add an if statement to check whether or not you have the item.
 
15weaoo.jpg
 
Dumb question, but.. Would it work as well if instead of using an action, I started the script with an talkaction?

Should I just add it in talkactions.xml, like for example:

<talkaction words="!raidstart" script="start_bossRaid.lua" />

And it would work?
 
Dumb question, but.. Would it work as well if instead of using an action, I started the script with an talkaction?

Should I just add it in talkactions.xml, like for example:

<talkaction words="!raidstart" script="start_bossRaid.lua" />

And it would work?
yes. -)
 
Possible to make it so when a boss is spawned already no one can use it? People keep spawning bosses in event area ; S
 
Back
Top