Results 1 to 3 of 3

Thread: Randomization Script?

  1. #1

    Post Randomization Script?

    Hello there, I have a black jack server that releases draws according to a timer. Every now and then when it comes out I have to tell everyone to shuffle it once as the first item in the chest will be the same. Is there a script to when it comes out, its already shuffled?

    The current script I have for the drops is:

    function onObjectLeaveContainer()
    self.randomize()
    end

    But then again as I said they have to shuffle it first still as the first item is still the same.

    Any comments will help thank you very much.
    Last edited by MusicGamer; 07-01-2018 at 07:15 PM.

  2. #2
    You can shuffle it in onLoad too. And then whenever an item is added if you need to.
    Code:
    fucntion onLoad()
        self.randomize()
    end
    or
    Code:
    -- Save current item count
    local itemCount = 0
    function onLoad()
        self.randomize()
        itemCount = #self.getObjects()
    end
    
    -- Shuffle if new item is put in the bag
    function onObjectDestroy()
        -- if item count changed, shuffle it up
        if #self.getObjects() ~= itemCount then
            itemCount = #self.getObjects()
            self.randomize()
        end
    end
    
    -- Update the count if an item leaves
    function onObjectLeaveContainer(container)
        if container == self then
            itemCount = #self.getObjects()
        end
    end

  3. #3
    Okay I will try these scripts out. Thank you very much!

Similar Threads

  1. [SOLVED] Need A Certain Type of Script
    By MusicGamer in forum Scripting
    Replies: 2
    Last Post: 01-22-2018, 11:41 PM
  2. Replies: 4
    Last Post: 05-14-2017, 07:17 PM
  3. infinite bag script
    By Gully0815 in forum Scripting
    Replies: 9
    Last Post: 03-06-2017, 06:46 AM
  4. Infinite bag script - how to get object?
    By Mosby in forum Scripting
    Replies: 2
    Last Post: 12-28-2016, 03:36 PM
  5. Can you script tooltips?
    By DopeGhoti in forum Scripting
    Replies: 4
    Last Post: 04-18-2016, 01:50 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •