[Solved] Mask Picture's Value from variable

● ARCHIVED · READ-ONLY
Started by FoxySeta 9 posts View original ↗
  1. 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).
    Screenshot.png
    Thanks!​
  2. 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.
  3. @FoxySeta sure. if you can provide a demo that might help
  4. I'll be waiting for the fix then:kaojoy:
  5. 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. Thanks a bunch, really! (Also, I'm happy if this helped you devs notice a bug.)

    Archeia said:
    @FoxySeta sure. if you can provide a demo that might help
    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. FoxySeta said:
    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)

    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. 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.