* *
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 15, 2017, 10:36:19 PM

Login with username, password and session length

Tint Script Woes (binding, steal/dot, drawmethods)

  • 11 Replies
  • 1067 Views
*

Online Miru

  • Sr. Member
  • ****
  • 446
Tint Script Woes (binding, steal/dot, drawmethods)
« on: July 10, 2017, 02:22:51 PM »
I have installed Damon Caskey's element attack tint script, but I also want to add  generated flames onto burned targets with this tint script as well. The flames should be able to fit on the target, and depend based on size of target and damage. (For now, I'll just do it manually and setting them individually) Also, how do you make the burn tint effect cycle colors ala KOF?

Similarity, with Freeze, I'd like to add clusters of ice on targets that dissapear once they thaw, and electric sparks for SHOCK.

Another problem that emerged is that the tint script is now conflicting with the zoom script. I managed to fix this thanks to Bloodbane, but it still conflicts with the drawmethods that I want to use. :-\ :-[
« Last Edit: August 07, 2017, 01:30:58 AM by Miru »
Here to sprite.

*

Offline nsw25

  • Hero Member
  • *****
  • 1748
    • Thatcher Productions
Re: Tint Script Help!
« Reply #1 on: July 10, 2017, 11:33:29 PM »
There is some issues with the tinting demo DC provided. I brought this up almost 2 years ago and didn't get any help... you will though so good luck, its certainly a cool feature to implement. I'm glad someone else has asked about it so I can linger around and see if this tint script gets updated ;)

FYI issues raised before in case you ran into it also.

http://www.chronocrash.com/forum/index.php?topic=2236.msg35733#msg35733
Bad ass babes
http://store.steampowered.com/app/529000/

see more of my games and projects at
www.thatcherproductions.org

*

Online Miru

  • Sr. Member
  • ****
  • 446
Re: Tint Script Help!
« Reply #2 on: July 11, 2017, 10:29:42 AM »
Here is the code I use for the tints:


This code is for UPDATED
Quote
// Import functions.
#import "data/scripts/common/effect_tint.c"

void main(){

    void    ent         = NULL();   // Target entity pointer.
    int     ent_count   = 0;        // Entity count.
    int     i           = 0;        // Loop counter.

    // Get entity count.
    ent_count = openborvariant("ent_max");

    // Loop over each entity index.
    for(i=0; i<ent_count; i++)
    {
        // Get entity pointer.
      ent = getentity(i);

      // Execute tint effect on entity.
        effect_tint(ent);
    }

    // If you have any screen controlling functions, such
    // as full screen zooming, place them here.


}

void zoom()
{
   void vscreen = openborvariant("vscreen");
   int maxz=openborvariant("PLAYER_MAX_Z")+1000;
   int zoom_value=getglobalvar("zoomvalue");
   int zoom_x=getglobalvar("zoomx");
   int zoom_y=getglobalvar("zoomy");
   void ent=getglobalvar("zoomentity");
   int px=getentityproperty(ent,"x") +  zoom_x - openborvariant("xpos");
   int py=getentityproperty(ent,"z") + zoom_y - openborvariant("ypos") - getentityproperty(ent,"a");
   void zoom_scr = getglobalvar("zoomscreen");
   if(!zoom_scr){
      zoom_scr = allocscreen(openborvariant("hResolution"),openborvariant("vResolution"));
      setglobalvar("zoomscreen",zoom_scr);
   }
   clearscreen(zoom_scr);

   //draw what we need
   drawspriteq(zoom_scr,0,openborconstant("MIN_INT"),maxz,0,0);
   //setup drawMethod
   changedrawmethod(NULL(),"reset",1);
   changedrawmethod(NULL(),"enabled",1);
   changedrawmethod(NULL(),"scalex",zoom_value);
   changedrawmethod(NULL(),"scaley",zoom_value);
   changedrawmethod(NULL(),"centerx",px);
   changedrawmethod(NULL(),"centery",py);
   //Draw the resized customized screen to main screen.
   drawscreen(zoom_scr,px,py, maxz+1);
   changedrawmethod(NULL(),"enabled", 0);
   drawspriteq(vscreen, 0, maxz+1,maxz+1, 0, 0);
   drawspriteq(vscreen, 0, maxz+2,openborconstant("MAX_INT"), 0, 0);
   clearspriteq();
}


void main(){
   if(getglobalvar("zoomentity"))
   {
      zoom();       
   }
}

I think it invalidates the zoom because the zoom acceptance code and the tint code are both named "main". When I renamed the tint code "tint" it ceased to work.


This is the code to the tint script itself:

Quote
#ifndef EFFECT_TINT_CON

    // These are core functionality constants. Unless
    // you know what you're doing, leave them alone.
    #define     EFFECT_TINT_CON 1
    #define     EFFECT_TINT_VAR_KEY "effect_tint"

    // The various settings go here so we can keep them
    // all in one place. Feel free to play around with them.
    #define     EFFECT_TINT_BURN           rgbcolor(255, 102, 0)    // Burn color.
    #define     EFFECT_TINT_BURN_MODE      1                        // Burn tint alpha mode

    #define     EFFECT_TINT_FREEZE         255                      // Freze color (maximum blue intensity).
    #define     EFFECT_TINT_FREEZE_MODE    1                        // Freeze tint alpha mode.

    #define   EFFECT_TINT_SHOCK   rgbcolor(255, 255, 153)
    #define   EFFECT_TINT_SHOCK_MODE   4

    #define   EFFECT_TINT_STEAL   rgbcolor (0, 202, 101)
    #define   EFFECT_TINT_STEAL_MODE   3

#endif

void effect_tint(void ent)
{
    // effect_tint
    // License - http://www.caskeys.com/dc/?p=5067
    // Caskey, Damon V.
    // 2015-05-04
    //
    // Apply color tint for hit effects.

    float time_percentage   = 0.0;  // Calculated time percentage.
    int time_effect         = 0;    // The normal set time for an effect to expire.
    float time_remaining    = 0.0;  // Actuall time in seconds before an effect will expire.
    float time_current      = 0.0;  // The current engine time.
    float time_initial      = 0.0;  // Time an effect was applied.
    int   map_default       = 0;    // Remap entity was spawned into play with.
    int   animation         = 0;    // Animation ID currently in use.

    int rgb_r = 0,  // RGB color settings.
        rgb_g = 0,
        rgb_b = 0;

    // Verify entity or exit.
    if(typeof(ent) != openborconstant("VT_PTR")) return;
    if(!getentityproperty(ent, "exists")) return;

    // First lets turn drawmethod on. If we don't, nothing below will
    // work at all.
    changedrawmethod(ent, "enabled", 1);

    // For time controlled effects, we need to know
    // current time and the time an effect was first
    // applied.
    time_current    += openborvariant("elapsed_time");
    time_initial    += getentityvar(ent, EFFECT_TINT_VAR_KEY + "_initial");

    // If entity is frozen, apply a freeze tint.
    if(getentityproperty(ent, "aiflag", "frozen") == 1)
    {
        // First we need to know how long the entity is meant to be frozen.
        time_effect = getentityproperty(ent, "freezetime");

        // Now let's see if we have a time when the freeze took place.
        // If not, this, entity was just frozen, so let's
        // record the time to an entity var.
        if(!time_initial)
        {
            time_initial = time_effect - time_current;
            setentityvar(ent, EFFECT_TINT_VAR_KEY + "_initial", time_initial);
        }

        // How much time is left before freeze effect is set to expire?
        time_remaining  = time_effect - time_current;

        // Now let's find out want to know what % of the original
        // freeze time is left. Then we'll multiply that by
        // maximum intensity of 255 and apply it to blue color setting.
        time_percentage = (time_remaining) / (time_initial);
        rgb_b = EFFECT_TINT_FREEZE * time_percentage;

        // Make green sam intensity as blue - this makes a much
        // stronger looking freeze effect than blue alone.
        rgb_g = rgb_b;

        // Unless fmap is set to -1, OpenBOR ALWAYS applies an fmap on frozen entities.
        // Since the default fmap is 0, that means entities without an fmap revert
        // back to their default palette. Obviously we don't we don't want that since
        // the whole point is to use dynamic tinting instead of a remap. To fix the
        // problem we'll get the map that entity was spawned into play with (ie. was
        // using before being set to an fmap), and force the engine to use it here.
        map_default = getentityproperty(ent, "mapdefault");
        changedrawmethod(ent, "remap", map_default);

        // Set transparency mode for tint, and apply blue intensity based
        // on % of initial freeze time is left.
        changedrawmethod(ent, "tintmode", EFFECT_TINT_FREEZE_MODE);
        changedrawmethod(ent, "tintcolor", rgbcolor(0, rgb_g, rgb_b));

        // No reason to do anything else, so exit the function.
        return;
    }


    // For most effects checking the animations will work, so
    // let's grab the current animation here.
    animation = getentityproperty(ent, "animationid");

    // In a burning animation? Then we'll apply burn tint.
    if(animation == openborconstant("ANI_BURN") || animation == openborconstant("ANI_BURNPAIN"))
    {
        // Set transparency mode for tint, and apply tint color.
        changedrawmethod(ent, "tintmode", EFFECT_TINT_BURN_MODE);
        changedrawmethod(ent, "tintcolor", EFFECT_TINT_BURN);

        // Nothing else to do, so exit the function.
        return;
    }

    ///////

    // If you want to add other tint effects, like shock, poison,
    // and so on, put them here. Use the burn example as a
    // template.

// In a shock animation? Then we'll apply shock tint.
    if(animation == openborconstant("ANI_SHOCK") || animation == openborconstant("ANI_SHOCKPAIN"))
    {
        // Set transparency mode for tint, and apply tint color.
        changedrawmethod(ent, "tintmode", EFFECT_TINT_SHOCK_MODE);
        changedrawmethod(ent, "tintcolor", EFFECT_TINT_SHOCK);

        // Nothing else to do, so exit the function.
        return;
    }

    ///////

    ///////

    // If we got this far without exiting, there was no effect to apply.
    // Clear any previous tints and entity vars.
    changedrawmethod(ent, "tintmode", 0);
    changedrawmethod(ent, "tintcolor", 0);

    setentityvar(ent, EFFECT_TINT_VAR_KEY + "_initial", NULL());
}

I think either turning the zoom into a separate script or redoing this within the main script would be a good fix.
« Last Edit: July 11, 2017, 05:55:32 PM by Miru »
Here to sprite.

*

Offline Bloodbane

  • Hero Member
  • *****
  • 3192
  • Dark Dragon
Re: Tint Script Help!
« Reply #3 on: July 13, 2017, 01:31:50 AM »
 I thought there's worse problem here. Anyways, try this new main:

Code: [Select]
void main(){

    void    ent         = NULL();   // Target entity pointer.
    int     ent_count   = 0;        // Entity count.
    int     i           = 0;        // Loop counter.

    // Get entity count.
    ent_count = openborvariant("ent_max");

    // Loop over each entity index.
    for(i=0; i<ent_count; i++)
    {
        // Get entity pointer.
      ent = getentity(i);

      // Execute tint effect on entity.
        effect_tint(ent);
    }

    // If you have any screen controlling functions, such
    // as full screen zooming, place them here.

   if(getglobalvar("zoomentity"))
   {
      zoom();       
   }
}

 Delete the other main{} and use this main only

*

Online Miru

  • Sr. Member
  • ****
  • 446
Re: Tint Script Help!
« Reply #4 on: July 13, 2017, 10:44:41 AM »
I thought there's worse problem here. Anyways, try this new main:

Code: [Select]
void main(){

    void    ent         = NULL();   // Target entity pointer.
    int     ent_count   = 0;        // Entity count.
    int     i           = 0;        // Loop counter.

    // Get entity count.
    ent_count = openborvariant("ent_max");

    // Loop over each entity index.
    for(i=0; i<ent_count; i++)
    {
        // Get entity pointer.
      ent = getentity(i);

      // Execute tint effect on entity.
        effect_tint(ent);
    }

    // If you have any screen controlling functions, such
    // as full screen zooming, place them here.

   if(getglobalvar("zoomentity"))
   {
      zoom();       
   }
}

 Delete the other main{} and use this main only

Used that and it worked wonders. Thank you so much Bloodbane!

(all i need to do now is to figure out how to add bind flames/etc with this)
Here to sprite.

*

Online Miru

  • Sr. Member
  • ****
  • 446
Now my Drawmethod doesn't work
« Reply #5 on: August 06, 2017, 12:54:37 PM »
Sorry for bumping this topic, but I discovered this has screwed up the use of drawmethods like scaling and clipping. I have specified "changedrawmethod", but it doesn't work.

Here is my Drawmethod code.

Quote
//draw what we need
   drawspriteq(zoom_scr,0,openborconstant("MIN_INT"),maxz,0,0);
   //setup drawMethod
   changedrawmethod(NULL(),"reset",1);
   changedrawmethod(NULL(),"enabled",1);
   changedrawmethod(NULL(),"scalex",zoom_value);
   changedrawmethod(NULL(),"scaley",zoom_value);
   changedrawmethod(NULL(),"centerx",px);
   changedrawmethod(NULL(),"centery",py);
   //Draw the resized customized screen to main screen.
   drawscreen(zoom_scr,px,py, maxz+1);
   changedrawmethod(NULL(),"enabled", 0);
   drawspriteq(vscreen, 0, maxz+1,maxz+1, 0, 0);
   drawspriteq(vscreen, 0, maxz+2,openborconstant("MAX_INT"), 0, 0);
   clearspriteq();

For now, I will just use the manual method of binding flames into a tinted burn victim.

I will also update to the latest version to check.

Edit: Have updated to latest version. They still don't work.
« Last Edit: August 07, 2017, 02:58:13 PM by Miru »
Here to sprite.

*

Offline Damon Caskey

  • Administrator
  • Hero Member
  • *****
  • 1809
    • DC Current
Re: Tint Script Woes (binding, steal/dot, drawmethods)
« Reply #6 on: August 08, 2017, 11:19:18 AM »
Guys as I was more than clear when I first posted about this, and with the instructions that came with it, AND with comments in the script itself - this is a very basic example of what automatic tint is and what it looks like in action. It's not a magic bullet you can just copy+paste whole into an existing module and expect to work.

You'll need to properly integrate it with your own scripts if you want them to get along with each other. I broke everything down into functions to make that easy as it can be, but I can't tell you specifically how to do it beforehand because every module will have a different layout and scripts depending on your own needs and tastes.

Why don't you give us an outlay of what your module does. What I mean by that is, where do you activate your own special effects and such. What other parts of your module are using drawmethod and how? Then we can start looking at how to get automatic tints going for you.

Also, miru - for the second time, please stop using the quote tag for code and text. It ruins the code formatting and makes it very difficult to read. We have a code tag specifically so you can post script and module text. That will go a long way to help us to help you. :)

DC
Projects in progress are now available here: https://github.com/DCurrent

*

Online Miru

  • Sr. Member
  • ****
  • 446
Re: Tint Script Woes (binding, steal/dot, drawmethods)
« Reply #7 on: August 08, 2017, 02:28:02 PM »
It's complex.

Well, this is actually a modification (and upgrade) for Marvel Infinity War that I got permission from ZVitor to do. The characters who use drawmethods are Wasp (scale), Psylocke, Vision, Kitty Pryde, Blackheart (clip), Nico Minoru, Doctor Strange, Nightcrawler, Thanos, Vision, Cable, Enchantress (partial transparency), Thor, Venom, Carnage (tint).

The problem is that of these, only Wasp used "drawmethod" originally (to have her vary in size). The others all relied on redundant sprites for clipping or remap for a tint. Wasp's drawmethod code simply read "drawmethod" with no method specified, followed by a series of numbers like 165, closer to a hitdef. These are the only drawmethod uses Zvitor added to the mod. I need these fixed before I add any of my desired additional drawmethods.

Drawmethod seems to otherwise be exclusively referenced in the "main" script where i also refer to zoom and effect tints.
« Last Edit: August 08, 2017, 02:36:09 PM by Miru »
Here to sprite.

*

Offline Damon Caskey

  • Administrator
  • Hero Member
  • *****
  • 1809
    • DC Current
Re: Tint Script Woes (binding, steal/dot, drawmethods)
« Reply #8 on: August 08, 2017, 02:52:29 PM »
That does sound like a headache - especially the use of tint already in place, but it should be doable. Just needs a bit of planning first.

I would suggest you finish up fixing the current drawmethod calls first. That will help a lot. Then we can have a closer look.

DC
Projects in progress are now available here: https://github.com/DCurrent

*

Offline O Ilusionista

  • Global Moderator
  • Hero Member
  • *****
  • 5050
  • >> I WILL BE AWAY FOR SOME TIME <<
    • BMT - Brazil Mugen Team
Re: Tint Script Woes (binding, steal/dot, drawmethods)
« Reply #9 on: August 09, 2017, 07:06:57 AM »
Miru, the drawmethod with many values is the full version of drawmethod, which uses values from 0-255 to scale, for example. You can replace it by the short version (drawmethod scale "decimal value"). Scale 0.5, for example, will scale the entity to 50% and so on. I've added this info in the manual long time ago.

About the clipping, is one of those experimental things someone added (utunnels) but never explained very well. He is a great guy and a great coder, don't get me wrong, but wasn't too much fan of documenting stuff.

We don't know for sure how clipping works (I already used it but don't remember too): it starts to clip from the top left of the image or from image axis?

I remember White Dragon explaining it back on the past, you will need to search for it.
« Last Edit: August 09, 2017, 07:09:00 AM by O Ilusionista »

*

Online Miru

  • Sr. Member
  • ****
  • 446
Re: Tint Script Woes (binding, steal/dot, drawmethods)
« Reply #10 on: August 11, 2017, 01:55:46 PM »
Code: [Select]
anim idle
loop 1
delay 3
offset 60 133
bbox 41 43 36 60
drawmethod scalex 0.5
drawmethod scaley 0.4
frame data/chars/wasp/s1.gif
frame data/chars/wasp/s2.gif
frame data/chars/wasp/s3.gif
frame data/chars/wasp/s2.gif


I did it! Her drawmethod is now up to modern standards.
Here to sprite.

*

Offline O Ilusionista

  • Global Moderator
  • Hero Member
  • *****
  • 5050
  • >> I WILL BE AWAY FOR SOME TIME <<
    • BMT - Brazil Mugen Team
Re: Tint Script Woes (binding, steal/dot, drawmethods)
« Reply #11 on: August 11, 2017, 08:47:40 PM »
Congrats :)

 

Recent

Members
Stats
  • Total Posts: 47530
  • Total Topics: 3262
  • Online Today: 49
  • Online Ever: 316
  • (January 04, 2013, 09:43:02 AM)
Users Online
Users: 1
Guests: 22
Total: 23