[Solved] Mask Picture's Value from variable

Discussion in 'Visual Novel Maker Support' started by FoxySeta, Jul 17, 2018.

Thread Status:
Not open for further replies.
  1. FoxySeta

    FoxySeta Cleric, script kiddie and fudanshi Veteran

    Messages:
    270
    Likes Received:
    110
    Location:
    Lugo, RA, IT
    First Language:
    Italian
    Primarily Uses:
    RMMV
    I'm working on a set of common events to manage a simple Health Bar. One of these "Update Health Bar", has a Mask Picture command in it. It works just fine when I use a constant value, but for some reason It does not when using local variables.

    I've already checked if the value of the variable was really the one I wanted with a show message (it was).
    [​IMG]
    Thanks!​
     
    #1
  2. Kentou

    Kentou Admin Veteran

    Messages:
    182
    Likes Received:
    43
    Hi FoxySeta,

    I checked the underlying code and it seems that variables are actually not supported for the mask value yet. But it is very easy to fix, I could provide you a quick fix if you tell me which version of VN Maker you are using.
     
    #2
  3. FoxySeta

    FoxySeta Cleric, script kiddie and fudanshi Veteran

    Messages:
    270
    Likes Received:
    110
    Location:
    Lugo, RA, IT
    First Language:
    Italian
    Primarily Uses:
    RMMV
    #3
  4. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,588
    Likes Received:
    14,301
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    @FoxySeta sure. if you can provide a demo that might help
     
    #4
  5. FoxySeta

    FoxySeta Cleric, script kiddie and fudanshi Veteran

    Messages:
    270
    Likes Received:
    110
    Location:
    Lugo, RA, IT
    First Language:
    Italian
    Primarily Uses:
    RMMV
    I'll be waiting for the fix then:kaojoy:
     
    #5
  6. Kentou

    Kentou Admin Veteran

    Messages:
    182
    Likes Received:
    43
    Hi, there are two ways how to apply the fix, the easiest is to just replace the entire content of the Components > Component_CommandInterpreter script in Script Editor with this:



    When VN Maker updates to Version 1086 in the future that fix gets overridden which is not an issue because the fix has been added to 1086 anyway. The only issue with this approach is that if you want to apply multiple fixes. But since that is not the case, you should be fine with this one.






    Otherwise, you have to create a new script BELOW Component_CommandInterpreter with the following content, just call it MaskPictureFix or something.

    Code:
    # ===================================================================
    #
    #   Script: MaskPictureFix
    #
    #   $$COPYRIGHT$$
    #
    # ===================================================================
    class Component_MaskPictureFix extends gs.Component_CommandInterpreter
        ###*
        * Executes a masking-effect on a game object..
        *
        * @method maskObject
        * @param {gs.Object_Base} object - The game object to execute a masking-effect on.
        * @param {Object} A params object containing additional info.
        ###
        maskObject: (object, params) ->
            easing = gs.Easings.fromObject(params.easing)
    
            if params.mask.type == 0
                object.mask.type = 0
                object.mask.ox = @numberValueOf(params.mask.ox)
                object.mask.oy = @numberValueOf(params.mask.oy)
                if object.mask.source?.videoElement?
                    object.mask.source.pause()
    
                if params.mask.sourceType == 0
                    object.mask.source = ResourceManager.getBitmap("Graphics/Masks/#{params.mask.graphic?.name}")
                else
                    object.mask.source = ResourceManager.getVideo("Movies/#{params.mask.video?.name}")
                    if object.mask.source
                        object.mask.source.play()
                        object.mask.source.loop = yes
            else
                duration = @durationValueOf(params.duration)
                mask = Object.flatCopy(params.mask)
                mask.value = @numberValueOf(mask.value)
                object.animator.maskTo(mask, duration, easing)
    
            if params.waitForCompletion and not (duration == 0 or @isInstantSkip())
                @isWaiting = yes
                @waitCounter = duration
    
    gs.Component_CommandInterpreter = Component_MaskPictureFix
    
    However, that approach has the disadvantages that you might forget to delete it after updating to 1086.
     
    #6
    FoxySeta likes this.
  7. FoxySeta

    FoxySeta Cleric, script kiddie and fudanshi Veteran

    Messages:
    270
    Likes Received:
    110
    Location:
    Lugo, RA, IT
    First Language:
    Italian
    Primarily Uses:
    RMMV
    Thanks a bunch, really! (Also, I'm happy if this helped you devs notice a bug.)

    Done. Is it okay for you check the post before deciding if a demo might be useful? (This way I may avoid a needless 3MB uplod)
     
    #7
  8. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,588
    Likes Received:
    14,301
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    OK now that I've read everything, if it's gonna be patched on the next version we don't want to add it on that thread. It's only for snippets that will be useful for the longest time not something that's a "bug" or going to be "patched" on later versions.
     
    #8
    FoxySeta likes this.
  9. slimmmeiske2

    slimmmeiske2 Little Red Riding Hood Moderator

    Messages:
    5,565
    Likes Received:
    4,123
    Location:
    Belgium
    First Language:
    Dutch
    Primarily Uses:
    RMXP

    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

     
    #9
Thread Status:
Not open for further replies.

Share This Page