Solved Bug with shadow trails

Question that is answered or resolved.

dantedevil

Well-known member
During the final test to share the first demo of my mod, i find a new bug.
This only happend when 2 players are playing.
Never happend when play alone.

4RJkunK.png


Sometimes the shadows of super combo shows bad, like in the picture. Other times the shadows only shows with normal colors, not blue like i set.
I start to have problems when change the update.c script to create a animated menu.
CRxTRDude helpme to solve the problem.
But yesterday , I discovered while playing with my daughter, that the problem is still there. I guess with three players also malfunction.

Here the files:

updated.c:
Code:
#include "data/scripts/anititle.c"
#include "data/scripts/story/story_define.h"
#include "data/scripts/story.c"
#include "data/scripts/gettick.c"


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();      
   }
      mainLoop();
}

void mainLoop(){
    void scene=openborvariant("current_scene");
    if(openborvariant("in_level"))
    {
        turnWhite();
        storySystem();
    }
    if(openborvariant("in_titlescreen")){
        if (scene!="data/scenes/intro.txt"){
            inTitleLoop(1);
        }
    }
    else {
        inTitleLoop(0);   
    }
}





Here a example the trailer.c of Raiden :
Code:
#include "data/scripts/trailer.h"

void main()
{
    int i, j, k;
    void spr;
    int facing, cd;
    float a, z, x;
   
    void ent = getlocalvar("self");
    int anim = getentityproperty(ent, "animationid");
    void map;
    int elapsed_time = openborvariant("elapsed_time");

    if(anim == openborconstant("ANI_FREESPECIAL5")){ map = getentityproperty(ent, "colourtable", 0);}
    if(anim == openborconstant("ANI_FOLLOW8")){ map = getentityproperty(ent, "colourtable", 0);}
    if(anim == openborconstant("ANI_FOLLOW9")){ map = getentityproperty(ent, "colourtable", 0);}
    if(anim == openborconstant("ANI_FREESPECIAL14")){ map = getentityproperty(ent, "colourtable", 0);}
    setglobalvar("blahblah.map", map);


    if(elapsed_time%trailerd==0)
    {
        if((anim == openborconstant("ANI_FREESPECIAL5")) || (anim == openborconstant("ANI_FOLLOW8")) || (anim == openborconstant("ANI_FOLLOW9")) || (anim == openborconstant("ANI_FREESPECIAL14")))
        {
        spr = getentityproperty(ent, "sprite");
        x = getentityproperty(ent, "x");
        z = getentityproperty(ent, "z");
        a = getentityproperty(ent, "a");
        facing = !getentityproperty(ent, "direction");
        for(k=1; k<=trailermax; k++) //find an empty trailer slot
        {
            if(getglobalvar("trailer"+k+".s")==NULL())
            {
                setglobalvar("trailer"+k+".s", spr);
                setglobalvar("trailer"+k+".x", x);
                setglobalvar("trailer"+k+".z", z);
                setglobalvar("trailer"+k+".a", a);
                setglobalvar("trailer"+k+".f", facing);
                setglobalvar("trailer"+k+".c", trailerc*trailerd);
                break;
            }
        }
    }
    }
}

Here trailer.h:

Code:
int trailermax = 50; //total trailers the engine can handle
int trailerc = 5; // totally 5 trailer images for each character
int trailerd = 15; // delay to spawn next trailer, so trailer lasts for trailermax*trailerd


In every Level i must set:

updatescript data/scripts/traileru.c

Here the script:
Code:
#include "data/scripts/trailer.h"

void main()
{
    int i, j, k;
    void spr;
    int facing, cd;
    float a, z, x;
    float sx = 256;
    float sy = 256;
void map = getglobalvar("blahblah.map");
    for(i=1; i<=trailermax; i++)
    {
        spr = getglobalvar("trailer"+i+".s");
        if(spr)
        {
            cd = getglobalvar("trailer"+i+".c");
            if(!cd)
            {
                setglobalvar("trailer"+i+".c", NULL());
                setglobalvar("trailer"+i+".s", NULL());
                setglobalvar("trailer"+i+".x", NULL());
                setglobalvar("trailer"+i+".z", NULL());
                setglobalvar("trailer"+i+".a", NULL());
                setglobalvar("trailer"+i+".sx", NULL());
                setglobalvar("trailer"+i+".sy", NULL());
            }
            else
            {
                if(openborvariant("game_paused")==0)
                {
                    setglobalvar("trailer"+i+".c", cd-1);
                }
                x = getglobalvar("trailer"+i+".x");
                z = getglobalvar("trailer"+i+".z");
                a = getglobalvar("trailer"+i+".a");
                if ( getglobalvar("trailer"+i+".sx") != NULL()) { sx = getglobalvar("trailer"+i+".sx"); }
                if ( getglobalvar("trailer"+i+".sy") != NULL()) { sy = getglobalvar("trailer"+i+".sy"); }
                facing = getglobalvar("trailer"+i+".f");
                                //,entity ,flag ,scalex ,scaley ,flipx ,flipy ,shiftx ,alpha ,colourmap ,fillcolour ,rotate ,rotateflip ,transparencybg
                                //setdrawmethod(NULL(),1, 256,256,facing,0,0,6,0,0,0,0,0,getglobalvar("trailer"+i+".colormap"));
                                setdrawmethod(NULL(),1, sx, sy,facing,0,0,6,0,0,0,0,0,map);
                                //drawsprite(spr, x-openborvariant("xpos"), z-a-openborvariant("ypos"), z-i, 0);

                //setdrawmethod(NULL(), 1, 256, 256, facing, 0, 0, 6, 0);
                //drawsprite(sprite, int x, int y, int z, int sortid)
                drawsprite(spr, x-openborvariant("xpos"), z-a-openborvariant("ypos")-3, z-i, 0);
                                //setdrawmethod(NULL(),0, 256, 256,0,    0,0,0,0,0,0,0,0,NULL());
            }
        }
    }
}
 
Last edited:
Solution
dantedevil said:
OK, thanks.

Last question of this:
Code:
#import "data/scripts/shadowtrail.c"

void main() {
  void player = getlocalvar("self");

  check_shadow_trail(player);



    if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FREESPECIAL5")
               && getentityproperty(player, "animpos") < 7 ) {
        set_shad_trail_flag(player,1);
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FREESPECIAL5")
               && getentityproperty(player, "animpos") >= 7 ) {
        set_shad_trail_flag(player,0);
    }   

    else if ( getentityproperty(player, "defaultmodel") ==...
dantedevil said:
Ok my friend,  i made the line change.
But now if i set the alternatepal here like this:
Code:
setdrawmethod(NULL(), 1, 256, 256, facing, 0, 0, 6, 1, 0, 0, 0, 0, 2);

Openbor crash again with the log:

Code:
There's an exception while executing script 'updateentityscript' data/chars/caro/caro.txt

If no set the alternatepal, all works ok, without change change the colors of shadows.

post whole log
 
dantedevil said:
You mean this Ilusionista says:
Quote
changedrawmethod(NULL(), "tintmode", 1);
changedrawmethod(NULL(), "tintcolor", 0xFF00FF);
This will give the afterimage (the technical name for "shadow trail") a purple-ish color

So i need change the script?

What I meant is that the hex code "0xFF00FF" means purple, because FF00FF (or 255 0 255) is purple (magenta in fact) (255 red 0 green 255 blue).

To archive a blue-ish, it should be:
changedrawmethod(NULL(), "tintcolor", rgbcolor(0x00,0x00,0xFF));
 
dantedevil said:
I set like you say, but the shadows still show with the original pallete.

Like this one:
Code:
int draw_shadowtrail(void ent, int maxtrails, int refresh_frm, int min_transp, int max_transp, int swap_flag, int on_off_switch) {
     int i = 0, k = 0, c = 0;
	 void spr = getentityproperty(ent, "sprite");
	 float x = getentityproperty(ent, "x");
     float z = getentityproperty(ent, "z");
     float a = getentityproperty(ent, "y");
	 int facing = getentityproperty(ent, "direction");
	 int colourmap = getentityproperty(ent, "colourmap");
     int elapsed_time = openborvariant("elapsed_time");
     float xpos, zpos, apos;

	 if ( facing == 1 ) facing = 0;
	 else facing = 1;

	 if ( maxtrails > MAX_TRAILS ) maxtrails = MAX_TRAILS;

     //drawstring( 10,200,0,"k:  "+getlocalvar(ent+"_k")+"  oldk:  "+get_oldest(ent, maxtrails));
     if ( elapsed_time%refresh_frm == 0 && openborvariant("in_level") ) { // memorizziamo sprites e posizioni nel tempo
            if ( getlocalvar(ent+"_k") != NULL() ) k = getlocalvar(ent+"_k"); else k = 0;

            // SPRITES SWAP
            if ( swap_flag && getlocalvar(ent+"_k") != NULL() ) {
                int tk = k;
                void tspr = NULL();

                for( i = 0; i < maxtrails; ++i) {
                    --tk;
                    if ( tk < 0 ) tk = maxtrails-1;
                    tspr = getlocalvar("spr"+ent+"_"+tk);
                    --tk;
                    if ( tk < 0 ) tk = maxtrails-1;
                    setlocalvar("spr"+ent+"_"+tk, tspr); // inseriamo lo sprite precedente nello slot ancora precedente
                }
            }
            // END SPRITES SWAP

            if ( on_off_switch && on_off_switch != NULL() ) {
                setlocalvar("xpos"+ent+"_"+k, x);
                setlocalvar("zpos"+ent+"_"+k, z);
                setlocalvar("apos"+ent+"_"+k, a);
                setlocalvar("facing"+ent+"_"+k, facing);
                setlocalvar("spr"+ent+"_"+k, spr);
                ++k;
                if ( k >= maxtrails ) k = 0;
                setlocalvar(ent+"_k", k); // Impostiamo il k recente
            } else {
                int old_k = get_oldest(ent, maxtrails);

                if ( getlocalvar(ent+"_k") != NULL() ) k = getlocalvar(ent+"_k")-1; else k = 0;
                if (k < 0 ) k = maxtrails-1;

                if ( old_k != NULL() ) setlocalvar("spr"+ent+"_"+old_k, NULL()); // cancelliamo lo sprite più vecchio

                if ( old_k != NULL() && old_k == k ) {
                        clear_shadowtrail(ent); // se abbiamo cancellato anche l'ultimo sprite, puliamo tutto!!
                        return 0;
                }
            } // fine on/off switch
     }

	 if ( openborvariant("in_level") ) { // draw trails

		 for( i = 0; i < maxtrails; ++i) {
                int transp, gradient;
                int layer = getentityproperty(ent, "setlayer");

                if ( getlocalvar("spr"+ent+"_"+i) != NULL() ) {
                     x = getlocalvar("xpos"+ent+"_"+i);
                     z = getlocalvar("zpos"+ent+"_"+i);
                     a = getlocalvar("apos"+ent+"_"+i);
                     facing = getlocalvar("facing"+ent+"_"+i);
                     spr = getlocalvar("spr"+ent+"_"+i);

                     // naturalmente il più recente deve essere il meno trasparente, ecco perchè usiamo k e non i!!
                     if ( getlocalvar(ent+"_k") != NULL() ) k = getlocalvar(ent+"_k")-1; else k = 0;
                     if (k < 0 ) k = maxtrails-1;
                     // Presa la k più recente impostiamo la k corrispondente alla i dalla più recente alla meno recente
                     // Dobbiamo sottrarre quindi maxtrails-i a k
                     /*for ( c = 0; c < i; ++c ) {
                        --k;
                        if ( k < 0 ) k = maxtrails-1;
                     }
                     gradient = maxtrails-1;
                     for ( c = 0; c < k; ++c ) {
                        --gradient;
                        if ( gradient < 0 ) gradient = maxtrails-1;
                     }*/

                     c = maxtrails-1-k;
                     gradient = (i+c)%maxtrails;

                     changedrawmethod(NULL(), "enabled", 1);
                     changedrawmethod(NULL(), "reset", 1);
                     //changedrawmethod(NULL(), "flag", 1);
                     changedrawmethod(NULL(), "tintmode", 1);
                     changedrawmethod(NULL(), "tintcolor", rgbcolor(0xFF,0x00,0xFF));
                     transp = ( (max_transp-min_transp)*(gradient+1)/maxtrails )+min_transp;
                     changedrawmethod(NULL(), "channelg", transp);
                     changedrawmethod(NULL(), "channelr", transp);
                     changedrawmethod(NULL(), "channelb", transp);

                     // (entity, int flag, int scalex, int scaley, int flipx, int flipy, int shiftx, int alpha, int remap, int fillcolor, int rotate, int fliprotate, int transparencybg, void* colourmap, int centerx, int centery);
                     setdrawmethod(NULL(), 1, 256, 256, facing, 0, 0, 6, 1, 0, 0, 0, 0, colourmap); // map: -1 = Use entity's colormap.

                     if ( x != NULL() ) drawsprite(spr, x-openborvariant("xpos"), z-a-openborvariant("ypos")-4, z-(maxtrails-1-gradient), layer);
                     changedrawmethod(NULL(), "enabled", 0);
                     changedrawmethod(NULL(), "reset", 1);
                     setdrawmethod(NULL(), 0);
                } // fine if spr != NULL()

		 } // fine for
	 } // if in_level

    return 1;
}

ps. post whole log
 
Here the log:

Code:
-- LOG: Game proper ---------------------------

Level Loading:   'data/levels/training.txt'
Total Ram: 4294967295 Bytes
 Free Ram: 4294967295 Bytes
 Used Ram: 112046080 Bytes

Loading 'BODYGUARD' from data/chars/bodyguard/bodyguard.txt

Level Loaded:    'data/levels/training.txt'
Total Ram: 4294967295 Bytes
 Free Ram: 4294967295 Bytes
 Used Ram: 114216960 Bytes
Total sprites mapped: 5282

Function need a valid entity handle and at least 1 interger parameter, setdrawmethod(entity, int flag, int scalex, int scaley, int flipx, int flipy, int shiftx, int alpha, int remap, int fillcolor, int rotate, int fliprotate, int transparencybg, void* colourmap, centerx, centery)
Script function 'setdrawmethod' returned an exception, check the manual for details.
 parameters: <VT_EMPTY>   Unitialized, 1, 256, 256, 0, 0, 0, 6, 1, 0, 0, 0, 0, 2,  
 
********** An Error Occurred **********
*            Shutting Down            *

There's an exception while executing script 'updateentityscript' data/chars/caro/caro.txtTotal Ram: 4294967295 Bytes
 Free Ram: 4294967295 Bytes
 Used Ram: 114425856 Bytes
 
dantedevil said:
Here the log:

Code:
-- LOG: Game proper ---------------------------

Level Loading:   'data/levels/training.txt'
Total Ram: 4294967295 Bytes
 Free Ram: 4294967295 Bytes
 Used Ram: 112046080 Bytes

Loading 'BODYGUARD' from data/chars/bodyguard/bodyguard.txt

Level Loaded:    'data/levels/training.txt'
Total Ram: 4294967295 Bytes
 Free Ram: 4294967295 Bytes
 Used Ram: 114216960 Bytes
Total sprites mapped: 5282

Function need a valid entity handle and at least 1 interger parameter, setdrawmethod(entity, int flag, int scalex, int scaley, int flipx, int flipy, int shiftx, int alpha, int remap, int fillcolor, int rotate, int fliprotate, int transparencybg, void* colourmap, centerx, centery)
Script function 'setdrawmethod' returned an exception, check the manual for details.
 parameters: <VT_EMPTY>   Unitialized, 1, 256, 256, 0, 0, 0, 6, 1, 0, 0, 0, 0, 2,  
 
********** An Error Occurred **********
*            Shutting Down            *

There's an exception while executing script 'updateentityscript' data/chars/caro/caro.txtTotal Ram: 4294967295 Bytes
 Free Ram: 4294967295 Bytes
 Used Ram: 114425856 Bytes

ok the problem is in your entity.txt file.
use:
palette data/chars/don/001.gif
remap data/chars/don/001.gif data/chars/don/alt9.gif
remap data/chars/don/001.gif data/chars/don/alt8.gif # this is the number 2!! (you missing that one)


Here a modified version of draw_shadowtrail() with tint param:
Code:
int draw_shadowtrail(void ent, int maxtrails, int refresh_frm, int min_transp, int max_transp, int swap_flag, int on_off_switch, int alpha, int color) {
     int i = 0, k = 0, c = 0;
	 void spr = getentityproperty(ent, "sprite");
	 float x = getentityproperty(ent, "x");
     float z = getentityproperty(ent, "z");
     float a = getentityproperty(ent, "y");
	 int facing = getentityproperty(ent, "direction");
	 int colourmap = getentityproperty(ent, "colourmap");
     int elapsed_time = openborvariant("elapsed_time");
     float xpos, zpos, apos;

     if ( alpha == NULL() ) alpha = 6;

	 if ( facing == 1 ) facing = 0;
	 else facing = 1;

	 if ( maxtrails > MAX_TRAILS ) maxtrails = MAX_TRAILS;

     //drawstring( 10,200,0,"k:  "+getlocalvar(ent+"_k")+"  oldk:  "+get_oldest(ent, maxtrails));
     if ( elapsed_time%refresh_frm == 0 && openborvariant("in_level") ) { // memorizziamo sprites e posizioni nel tempo
            if ( getlocalvar(ent+"_k") != NULL() ) k = getlocalvar(ent+"_k"); else k = 0;

            // SPRITES SWAP
            if ( swap_flag && getlocalvar(ent+"_k") != NULL() ) {
                int tk = k;
                void tspr = NULL();

                for( i = 0; i < maxtrails; ++i) {
                    --tk;
                    if ( tk < 0 ) tk = maxtrails-1;
                    tspr = getlocalvar("spr"+ent+"_"+tk);
                    --tk;
                    if ( tk < 0 ) tk = maxtrails-1;
                    setlocalvar("spr"+ent+"_"+tk, tspr); // inseriamo lo sprite precedente nello slot ancora precedente
                }
            }
            // END SPRITES SWAP

            if ( on_off_switch && on_off_switch != NULL() ) {
                setlocalvar("xpos"+ent+"_"+k, x);
                setlocalvar("zpos"+ent+"_"+k, z);
                setlocalvar("apos"+ent+"_"+k, a);
                setlocalvar("facing"+ent+"_"+k, facing);
                setlocalvar("spr"+ent+"_"+k, spr);
                ++k;
                if ( k >= maxtrails ) k = 0;
                setlocalvar(ent+"_k", k); // Impostiamo il k recente
            } else {
                int old_k = get_oldest(ent, maxtrails);

                if ( getlocalvar(ent+"_k") != NULL() ) k = getlocalvar(ent+"_k")-1; else k = 0;
                if (k < 0 ) k = maxtrails-1;

                if ( old_k != NULL() ) setlocalvar("spr"+ent+"_"+old_k, NULL()); // cancelliamo lo sprite più vecchio

                if ( old_k != NULL() && old_k == k ) {
                        clear_shadowtrail(ent); // se abbiamo cancellato anche l'ultimo sprite, puliamo tutto!!
                        return 0;
                }
            } // fine on/off switch
     }

	 if ( openborvariant("in_level") ) { // draw trails

		 for( i = 0; i < maxtrails; ++i) {
                int transp, gradient;
                int layer = getentityproperty(ent, "setlayer");

                if ( getlocalvar("spr"+ent+"_"+i) != NULL() ) {
                     x = getlocalvar("xpos"+ent+"_"+i);
                     z = getlocalvar("zpos"+ent+"_"+i);
                     a = getlocalvar("apos"+ent+"_"+i);
                     facing = getlocalvar("facing"+ent+"_"+i);
                     spr = getlocalvar("spr"+ent+"_"+i);

                     // naturalmente il più recente deve essere il meno trasparente, ecco perchè usiamo k e non i!!
                     if ( getlocalvar(ent+"_k") != NULL() ) k = getlocalvar(ent+"_k")-1; else k = 0;
                     if (k < 0 ) k = maxtrails-1;
                     // Presa la k più recente impostiamo la k corrispondente alla i dalla più recente alla meno recente
                     // Dobbiamo sottrarre quindi maxtrails-i a k
                     /*for ( c = 0; c < i; ++c ) {
                        --k;
                        if ( k < 0 ) k = maxtrails-1;
                     }
                     gradient = maxtrails-1;
                     for ( c = 0; c < k; ++c ) {
                        --gradient;
                        if ( gradient < 0 ) gradient = maxtrails-1;
                     }*/

                     c = maxtrails-1-k;
                     gradient = (i+c)%maxtrails;

                     changedrawmethod(NULL(), "enabled", 1);
                     changedrawmethod(NULL(), "reset", 1);
                     //changedrawmethod(NULL(), "flag", 1);

                     changedrawmethod(NULL(), "alpha", alpha);
                     if ( color != NULL() ) {
                         changedrawmethod(NULL(), "tintmode", alpha);
                         changedrawmethod(NULL(), "tintcolor", color); // rgbcolor(0x00,0x00,0xFF)
                     }

                     transp = ( (max_transp-min_transp)*(gradient+1)/maxtrails )+min_transp;
                     changedrawmethod(NULL(), "channelg", transp);
                     changedrawmethod(NULL(), "channelr", transp);
                     changedrawmethod(NULL(), "channelb", transp);

                     // (entity, int flag, int scalex, int scaley, int flipx, int flipy, int shiftx, int alpha, int remap, int fillcolor, int rotate, int fliprotate, int transparencybg, void* colourmap, int centerx, int centery);
                     setdrawmethod(NULL(), 1, 256, 256, facing, 0, 0, alpha, 1, 0, 0, 0, 0, colourmap); // map: -1 = Use entity's colormap.

                     if ( x != NULL() ) drawsprite(spr, x-openborvariant("xpos"), z-a-openborvariant("ypos")-4, z-(maxtrails-1-gradient), layer);
                     changedrawmethod(NULL(), "enabled", 0);
                     changedrawmethod(NULL(), "reset", 1);
                     setdrawmethod(NULL(), 0);
                } // fine if spr != NULL()

		 } // fine for
	 } // if in_level

    return 1;
}

use:
draw_shadowtrail(getlocalvar("self"), 5, 15, 20, 160, 0,6,rgbcolor(0x00,0x00,0xFF));
 
You mean changing this part:
Code:
[int check_shadow_trail(void player) {
    if ( get_shad_trail_flag(player) != NULL() ) {
        if ( draw_shadowtrail(player, 5, 15, 20, 160, 0, get_shad_trail_flag(player)) == 0 ) set_shad_trail_flag(player,NULL());
    }
}
/code]

For this:

[code][int check_shadow_trail(void player) {
    if ( get_shad_trail_flag(player) != NULL() ) {
        if ( draw_shadowtrail(getlocalvar("self"), 5, 15, 20, 160, 0,6,rgbcolor(0x00,0x00,0xFF));
     }
}
/code]

I try and not work.
 
Update:
Code:
int check_shadow_trail(void player) {
    if ( get_shad_trail_flag(player) != NULL() && get_shad_trail_flag(player) != 0 ) {
        if ( draw_shadowtrail(player, 5, 15, 20, 160, 0, get_shad_trail_flag(player),rgbcolor(0x00,0x00,0xFF)) == 0 ) set_shad_trail_flag(player,NULL());
    }
}

Lib:
Code:
#define MAX_TRAILS 50

/*
Per pulire piano tutta la trail.
Impostare un flag ON come parametro nella func. Poi ad ogni aggiornamento dello sprite cancella la coda (localvar spr) 2 sprites per volta.
Quindi cancella 2 sprites e aggiorna di 1. Si cancellerà uno sprites per volta. Quando sono tutti cancellati pulisci la trail.
Se il flag è on e se tutta la coda è pulita allora non chiamare più il metodo draw_trail.
In alternativa si puà usare updated.c ed eseguire il metodo fintanto che la coda è piena...
*/


int clear_shadowtrail(void ent) {
    int i;

        for( i = 0; i < MAX_TRAILS; ++i) {
            setlocalvar("xpos"+ent+"_"+i, NULL());
            setlocalvar("zpos"+ent+"_"+i, NULL());
            setlocalvar("apos"+ent+"_"+i, NULL());
            setlocalvar("facing"+ent+"_"+i, NULL());
            setlocalvar("spr"+ent+"_"+i, NULL());
            setlocalvar(ent+"_k",NULL());
        }

   return 0;
}

int get_oldest(void ent, int maxtrails) {
    if ( getlocalvar(ent+"_k") == NULL() ) return NULL();
    else {
        int k,i;

        if ( getlocalvar(ent+"_k") != NULL() ) k = getlocalvar(ent+"_k")-1; else k = 0;
        if (k < 0 ) k = maxtrails-1;

        for( i = k+1; i < maxtrails; ++i) { // dal k+1 c'è possibilità di trovare il k-vecchio
            if ( getlocalvar("spr"+ent+"_"+i) != NULL() ) return i;
        }
        for( i = 0; i <= k; ++i) { // ricominciamo dall'inizio fino a k compreso (evidentemente 1 solo sprite in tutto)
            if ( getlocalvar("spr"+ent+"_"+i) != NULL() ) return i;
        }

        return NULL();
    }
}

int draw_shadowtrail(void ent, int maxtrails, int refresh_frm, int min_transp, int max_transp, int swap_flag, int on_off_switch, int alpha, int color, int new_map) {
     int i = 0, k = 0, c = 0;
	 void spr = getentityproperty(ent, "sprite");
	 float x = getentityproperty(ent, "x");
     float z = getentityproperty(ent, "z");
     float a = getentityproperty(ent, "y");
	 int facing = getentityproperty(ent, "direction");
	 int colourmap = getentityproperty(ent, "colourmap");
     int elapsed_time = openborvariant("elapsed_time");
     float xpos, zpos, apos;

     if ( new_map != NULL() ) {
         int map = getentityproperty(ent, "map");

         changeentityproperty(ent,"map",new_map);
         colourmap = getentityproperty(ent, "colourmap");
         changeentityproperty(ent,"map",map);
     }

     if ( alpha == NULL() ) alpha = 6;

	 if ( facing == 1 ) facing = 0;
	 else facing = 1;

	 if ( maxtrails > MAX_TRAILS ) maxtrails = MAX_TRAILS;

     //drawstring( 10,200,0,"k:  "+getlocalvar(ent+"_k")+"  oldk:  "+get_oldest(ent, maxtrails));
     if ( elapsed_time%refresh_frm == 0 && openborvariant("in_level") ) { // memorizziamo sprites e posizioni nel tempo
            if ( getlocalvar(ent+"_k") != NULL() ) k = getlocalvar(ent+"_k"); else k = 0;

            // SPRITES SWAP
            if ( swap_flag && getlocalvar(ent+"_k") != NULL() ) {
                int tk = k;
                void tspr = NULL();

                for( i = 0; i < maxtrails; ++i) {
                    --tk;
                    if ( tk < 0 ) tk = maxtrails-1;
                    tspr = getlocalvar("spr"+ent+"_"+tk);
                    --tk;
                    if ( tk < 0 ) tk = maxtrails-1;
                    setlocalvar("spr"+ent+"_"+tk, tspr); // inseriamo lo sprite precedente nello slot ancora precedente
                }
            }
            // END SPRITES SWAP

            if ( on_off_switch && on_off_switch != NULL() ) {
                setlocalvar("xpos"+ent+"_"+k, x);
                setlocalvar("zpos"+ent+"_"+k, z);
                setlocalvar("apos"+ent+"_"+k, a);
                setlocalvar("facing"+ent+"_"+k, facing);
                setlocalvar("spr"+ent+"_"+k, spr);
                ++k;
                if ( k >= maxtrails ) k = 0;
                setlocalvar(ent+"_k", k); // Impostiamo il k recente
            } else {
                int old_k = get_oldest(ent, maxtrails);

                if ( getlocalvar(ent+"_k") != NULL() ) k = getlocalvar(ent+"_k")-1; else k = 0;
                if (k < 0 ) k = maxtrails-1;

                if ( old_k != NULL() ) setlocalvar("spr"+ent+"_"+old_k, NULL()); // cancelliamo lo sprite più vecchio

                if ( old_k != NULL() && old_k == k ) {
                        clear_shadowtrail(ent); // se abbiamo cancellato anche l'ultimo sprite, puliamo tutto!!
                        return 0;
                }
            } // fine on/off switch
     }

	 if ( openborvariant("in_level") ) { // draw trails

		 for( i = 0; i < maxtrails; ++i) {
                int transp, gradient;
                int layer = getentityproperty(ent, "setlayer");

                if ( getlocalvar("spr"+ent+"_"+i) != NULL() ) {
                     x = getlocalvar("xpos"+ent+"_"+i);
                     z = getlocalvar("zpos"+ent+"_"+i);
                     a = getlocalvar("apos"+ent+"_"+i);
                     facing = getlocalvar("facing"+ent+"_"+i);
                     spr = getlocalvar("spr"+ent+"_"+i);

                     // naturalmente il più recente deve essere il meno trasparente, ecco perchè usiamo k e non i!!
                     if ( getlocalvar(ent+"_k") != NULL() ) k = getlocalvar(ent+"_k")-1; else k = 0;
                     if (k < 0 ) k = maxtrails-1;
                     // Presa la k più recente impostiamo la k corrispondente alla i dalla più recente alla meno recente
                     // Dobbiamo sottrarre quindi maxtrails-i a k
                     /*for ( c = 0; c < i; ++c ) {
                        --k;
                        if ( k < 0 ) k = maxtrails-1;
                     }
                     gradient = maxtrails-1;
                     for ( c = 0; c < k; ++c ) {
                        --gradient;
                        if ( gradient < 0 ) gradient = maxtrails-1;
                     }*/

                     c = maxtrails-1-k;
                     gradient = (i+c)%maxtrails;

                     changedrawmethod(NULL(), "enabled", 1);
                     changedrawmethod(NULL(), "reset", 1);
                     //changedrawmethod(NULL(), "flag", 1);

                     changedrawmethod(NULL(), "alpha", alpha);
                     if ( color != NULL() ) {
                         changedrawmethod(NULL(), "tintmode", alpha);
                         changedrawmethod(NULL(), "tintcolor", color); // rgbcolor(0x00,0x00,0xFF)
                     }

                     transp = ( (max_transp-min_transp)*(gradient+1)/maxtrails )+min_transp;
                     changedrawmethod(NULL(), "channelg", transp);
                     changedrawmethod(NULL(), "channelr", transp);
                     changedrawmethod(NULL(), "channelb", transp);

                     // (entity, int flag, int scalex, int scaley, int flipx, int flipy, int shiftx, int alpha, int remap, int fillcolor, int rotate, int fliprotate, int transparencybg, void* colourmap, int centerx, int centery);
                     setdrawmethod(NULL(), 1, 256, 256, facing, 0, 0, alpha, 1, 0, 0, 0, 0, colourmap); // map: -1 = Use entity's colormap.

                     if ( x != NULL() ) drawsprite(spr, x-openborvariant("xpos"), z-a-openborvariant("ypos")-4, z-(maxtrails-1-gradient), layer);
                     changedrawmethod(NULL(), "enabled", 0);
                     changedrawmethod(NULL(), "reset", 1);
                     setdrawmethod(NULL(), 0);
                } // fine if spr != NULL()

		 } // fine for
	 } // if in_level

    return 1;
}

Now you can set the new map! (last param)
other params set to NULL()

Recopy whole lib.
use:
draw_shadowtrail(getlocalvar("self"), 5, 15, 20, 160, 0,6,rgbcolor(0x00,0x00,0xFF));
or
draw_shadowtrail(getlocalvar("self"), 5, 15, 20, 160, 0,6,NULL(),2); // last 2 is the map 2!!
 
Something is wrong!
I try to find the error but i can't.

Here the log:

Code:
Script error: data/scripts/shadowtrail.c, line 180: Invalid function call or expression '2' (in production 'postfix_expr2')

        if ( draw_shadowtrail(player, 5, 15, 20, 160, 0, 6,NULL()2);
                                                                 ^



Script error: data/scripts/shadowtrail.c, line 181: Unknown error '}' (in production 'stmt')

    }
    ^



Script error: data/scripts/shadowtrail.c, line 184: Invalid declaration(expected comma, semicolon or initializer?) '(' (in production 'decl')

int get_shad_trail_flag(void player) {
                       ^



Script error: data/scripts/shadowtrail.c, line 184: Invalid declaration(expected comma, semicolon or initializer?) ')' (in production 'decl')

int get_shad_trail_flag(void player) {
                                   ^



Script error: data/scripts/shadowtrail.c, line 188: Invalid declaration(expected comma, semicolon or initializer?) '(' (in production 'decl')

int set_shad_trail_flag(void player, int value) {
                       ^

Identifier expected before 'int'.


Script error: data/scripts/shadowtrail.c, line 188: Invalid declaration(expected comma, semicolon or initializer?) 'int' (in production 'decl')

int set_shad_trail_flag(void player, int value) {
                                     ^



Script error: data/scripts/shadowtrail.c, line 188: Invalid declaration(expected comma, semicolon or initializer?) ')' (in production 'decl')

int set_shad_trail_flag(void player, int value) {
                                              ^



Script error: data/scripts/shadowtrail.c, line 191: Unknown error '' (in production 'stmt_list2')


^



Script error: data/scripts/shadowtrail.c, line 191: Unknown error '' (in production 'decl_list2')


^



Script error: data/scripts/shadowtrail.c, line 191: Unknown error '' (in production 'decl_list2')


^

Script error: failed to import 'data/scripts/shadowtrail.c': parsing failed

********** An Error Occurred **********
*            Shutting Down            *


Here the script:

Code:
#define MAX_TRAILS 50

/*
Per pulire piano tutta la trail.
Impostare un flag ON come parametro nella func. Poi ad ogni aggiornamento dello sprite cancella la coda (localvar spr) 2 sprites per volta.
Quindi cancella 2 sprites e aggiorna di 1. Si cancellerà uno sprites per volta. Quando sono tutti cancellati pulisci la trail.
Se il flag è on e se tutta la coda è pulita allora non chiamare più il metodo draw_trail.
In alternativa si puà usare updated.c ed eseguire il metodo fintanto che la coda è piena...
*/


int clear_shadowtrail(void ent) {
    int i;

        for( i = 0; i < MAX_TRAILS; ++i) {
            setlocalvar("xpos"+ent+"_"+i, NULL());
            setlocalvar("zpos"+ent+"_"+i, NULL());
            setlocalvar("apos"+ent+"_"+i, NULL());
            setlocalvar("facing"+ent+"_"+i, NULL());
            setlocalvar("spr"+ent+"_"+i, NULL());
            setlocalvar(ent+"_k",NULL());
        }

   return 0;
}

int get_oldest(void ent, int maxtrails) {
    if ( getlocalvar(ent+"_k") == NULL() ) return NULL();
    else {
        int k,i;

        if ( getlocalvar(ent+"_k") != NULL() ) k = getlocalvar(ent+"_k")-1; else k = 0;
        if (k < 0 ) k = maxtrails-1;

        for( i = k+1; i < maxtrails; ++i) { // dal k+1 c'è possibilità di trovare il k-vecchio
            if ( getlocalvar("spr"+ent+"_"+i) != NULL() ) return i;
        }
        for( i = 0; i <= k; ++i) { // ricominciamo dall'inizio fino a k compreso (evidentemente 1 solo sprite in tutto)
            if ( getlocalvar("spr"+ent+"_"+i) != NULL() ) return i;
        }

        return NULL();
    }
}

int draw_shadowtrail(void ent, int maxtrails, int refresh_frm, int min_transp, int max_transp, int swap_flag, int on_off_switch, int alpha, int color, int new_map) {
     int i = 0, k = 0, c = 0;
	 void spr = getentityproperty(ent, "sprite");
	 float x = getentityproperty(ent, "x");
     float z = getentityproperty(ent, "z");
     float a = getentityproperty(ent, "y");
	 int facing = getentityproperty(ent, "direction");
	 int colourmap = getentityproperty(ent, "colourmap");
     int elapsed_time = openborvariant("elapsed_time");
     float xpos, zpos, apos;

     if ( new_map != NULL() ) {
         int map = getentityproperty(ent, "map");

         changeentityproperty(ent,"map",new_map);
         colourmap = getentityproperty(ent, "colourmap");
         changeentityproperty(ent,"map",map);
     }

     if ( alpha == NULL() ) alpha = 6;

	 if ( facing == 1 ) facing = 0;
	 else facing = 1;

	 if ( maxtrails > MAX_TRAILS ) maxtrails = MAX_TRAILS;

     //drawstring( 10,200,0,"k:  "+getlocalvar(ent+"_k")+"  oldk:  "+get_oldest(ent, maxtrails));
     if ( elapsed_time%refresh_frm == 0 && openborvariant("in_level") ) { // memorizziamo sprites e posizioni nel tempo
            if ( getlocalvar(ent+"_k") != NULL() ) k = getlocalvar(ent+"_k"); else k = 0;

            // SPRITES SWAP
            if ( swap_flag && getlocalvar(ent+"_k") != NULL() ) {
                int tk = k;
                void tspr = NULL();

                for( i = 0; i < maxtrails; ++i) {
                    --tk;
                    if ( tk < 0 ) tk = maxtrails-1;
                    tspr = getlocalvar("spr"+ent+"_"+tk);
                    --tk;
                    if ( tk < 0 ) tk = maxtrails-1;
                    setlocalvar("spr"+ent+"_"+tk, tspr); // inseriamo lo sprite precedente nello slot ancora precedente
                }
            }
            // END SPRITES SWAP

            if ( on_off_switch && on_off_switch != NULL() ) {
                setlocalvar("xpos"+ent+"_"+k, x);
                setlocalvar("zpos"+ent+"_"+k, z);
                setlocalvar("apos"+ent+"_"+k, a);
                setlocalvar("facing"+ent+"_"+k, facing);
                setlocalvar("spr"+ent+"_"+k, spr);
                ++k;
                if ( k >= maxtrails ) k = 0;
                setlocalvar(ent+"_k", k); // Impostiamo il k recente
            } else {
                int old_k = get_oldest(ent, maxtrails);

                if ( getlocalvar(ent+"_k") != NULL() ) k = getlocalvar(ent+"_k")-1; else k = 0;
                if (k < 0 ) k = maxtrails-1;

                if ( old_k != NULL() ) setlocalvar("spr"+ent+"_"+old_k, NULL()); // cancelliamo lo sprite più vecchio

                if ( old_k != NULL() && old_k == k ) {
                        clear_shadowtrail(ent); // se abbiamo cancellato anche l'ultimo sprite, puliamo tutto!!
                        return 0;
                }
            } // fine on/off switch
     }

	 if ( openborvariant("in_level") ) { // draw trails

		 for( i = 0; i < maxtrails; ++i) {
                int transp, gradient;
                int layer = getentityproperty(ent, "setlayer");

                if ( getlocalvar("spr"+ent+"_"+i) != NULL() ) {
                     x = getlocalvar("xpos"+ent+"_"+i);
                     z = getlocalvar("zpos"+ent+"_"+i);
                     a = getlocalvar("apos"+ent+"_"+i);
                     facing = getlocalvar("facing"+ent+"_"+i);
                     spr = getlocalvar("spr"+ent+"_"+i);

                     // naturalmente il più recente deve essere il meno trasparente, ecco perchè usiamo k e non i!!
                     if ( getlocalvar(ent+"_k") != NULL() ) k = getlocalvar(ent+"_k")-1; else k = 0;
                     if (k < 0 ) k = maxtrails-1;
                     // Presa la k più recente impostiamo la k corrispondente alla i dalla più recente alla meno recente
                     // Dobbiamo sottrarre quindi maxtrails-i a k
                     /*for ( c = 0; c < i; ++c ) {
                        --k;
                        if ( k < 0 ) k = maxtrails-1;
                     }
                     gradient = maxtrails-1;
                     for ( c = 0; c < k; ++c ) {
                        --gradient;
                        if ( gradient < 0 ) gradient = maxtrails-1;
                     }*/

                     c = maxtrails-1-k;
                     gradient = (i+c)%maxtrails;

                     changedrawmethod(NULL(), "enabled", 1);
                     changedrawmethod(NULL(), "reset", 1);
                     //changedrawmethod(NULL(), "flag", 1);

                     changedrawmethod(NULL(), "alpha", alpha);
                     if ( color != NULL() ) {
                         changedrawmethod(NULL(), "tintmode", alpha);
                         changedrawmethod(NULL(), "tintcolor", color); // rgbcolor(0x00,0x00,0xFF)
                     }

                     transp = ( (max_transp-min_transp)*(gradient+1)/maxtrails )+min_transp;
                     changedrawmethod(NULL(), "channelg", transp);
                     changedrawmethod(NULL(), "channelr", transp);
                     changedrawmethod(NULL(), "channelb", transp);

                     // (entity, int flag, int scalex, int scaley, int flipx, int flipy, int shiftx, int alpha, int remap, int fillcolor, int rotate, int fliprotate, int transparencybg, void* colourmap, int centerx, int centery);
                     setdrawmethod(NULL(), 1, 256, 256, facing, 0, 0, alpha, 1, 0, 0, 0, 0, colourmap); // map: -1 = Use entity's colormap.

                     if ( x != NULL() ) drawsprite(spr, x-openborvariant("xpos"), z-a-openborvariant("ypos")-4, z-(maxtrails-1-gradient), layer);
                     changedrawmethod(NULL(), "enabled", 0);
                     changedrawmethod(NULL(), "reset", 1);
                     setdrawmethod(NULL(), 0);
                } // fine if spr != NULL()

		 } // fine for
	 } // if in_level

    return 1;
}

int check_shadow_trail(void player) {
    if ( get_shad_trail_flag(player) != NULL() && get_shad_trail_flag(player) != 0 ) {
        if ( draw_shadowtrail(player, 5, 15, 20, 160, 0, 6,NULL()2);
    }
} 

int get_shad_trail_flag(void player) {
    return getentityvar(player, "shadowtrail");
}

int set_shad_trail_flag(void player, int value) {
    setentityvar(player, "shadowtrail", value);
}

 
White Dragon said:
Error missing ", " and delete ";"

OK let's see:

If i set like this, OpenBor crash with the log of my previous post:
Code:
int check_shadow_trail(void player) {
    if ( get_shad_trail_flag(player) != NULL() && get_shad_trail_flag(player) != 0 ) {
        if ( draw_shadowtrail(player, 5, 15, 20, 160, 0, 6,NULL()2);
    }
}

If put like this works without crash (but still with cant use alternatepal):
Code:
int check_shadow_trail(void player) {
    if ( get_shad_trail_flag(player) != NULL() ) {
        if ( draw_shadowtrail(player, 5, 15, 20, 160, 0, get_shad_trail_flag(player)) == 0 ) set_shad_trail_flag(player,NULL());
    }
}

So where is the problem?
 
If paste this line:
Code:
if ( draw_shadowtrail(player, 5, 15, 20, 160, 0, 6, NULL(), 2);

Over this line:
Code:
if ( draw_shadowtrail(player, 5, 15, 20, 160, 0, get_shad_trail_flag(player)) == 0 ) set_shad_trail_flag(player,NULL());

Openbor crahs and give me this error log:
Code:
Script error: data/scripts/shadowtrail.c, line 181: Unknown error '}' (in production 'stmt')

    }
    ^



Script error: data/scripts/shadowtrail.c, line 184: Invalid declaration(expected comma, semicolon or initializer?) '(' (in production 'decl')

int get_shad_trail_flag(void player) {
                       ^



Script error: data/scripts/shadowtrail.c, line 184: Invalid declaration(expected comma, semicolon or initializer?) ')' (in production 'decl')

int get_shad_trail_flag(void player) {
                                   ^



Script error: data/scripts/shadowtrail.c, line 188: Invalid declaration(expected comma, semicolon or initializer?) '(' (in production 'decl')

int set_shad_trail_flag(void player, int value) {
                       ^

Identifier expected before 'int'.


Script error: data/scripts/shadowtrail.c, line 188: Invalid declaration(expected comma, semicolon or initializer?) 'int' (in production 'decl')

int set_shad_trail_flag(void player, int value) {
                                     ^



Script error: data/scripts/shadowtrail.c, line 188: Invalid declaration(expected comma, semicolon or initializer?) ')' (in production 'decl')

int set_shad_trail_flag(void player, int value) {
                                              ^



Script error: data/scripts/shadowtrail.c, line 191: Unknown error '' (in production 'stmt_list2')


^



Script error: data/scripts/shadowtrail.c, line 191: Unknown error '' (in production 'decl_list2')


^



Script error: data/scripts/shadowtrail.c, line 191: Unknown error '' (in production 'decl_list2')


^

Script error: failed to import 'data/scripts/shadowtrail.c': parsing failed

********** An Error Occurred **********
*            Shutting Down 

 
White Dragon said:
use this one:
Code:
int check_shadow_trail(void player) {
    if ( get_shad_trail_flag(player) != NULL() && get_shad_trail_flag(player) != 0 ) {
        if ( draw_shadowtrail(player, 5, 15, 20, 160, 0, get_shad_trail_flag(player),6,NULL(),2) == 0 ) set_shad_trail_flag(player,NULL());
    }
}

with latest lib:
http://www.chronocrash.com/forum/index.php?topic=2293.msg31255#msg31255

Works perfect my friend!

Thanks for ALL your help!
 
O Ilusionista said:
WD, there isn't a way to use alternatepal over remap? alternatepal is way easier to handle.

maybe yes, try to change this piece of code:
Code:
     if ( new_map != NULL() ) {
         int map = getentityproperty(ent, "map");

         changeentityproperty(ent,"map",new_map);
         colourmap = getentityproperty(ent, "colourmap");
         changeentityproperty(ent,"map",map);
     }

into:
Code:
     if ( new_map != NULL() ) {
         int map = getentityproperty(ent, "colourtable");

         changeentityproperty(ent,"map",new_map);
         colourmap = getentityproperty(ent, "colourmap");
         changeentityproperty(ent,"colourtable",map);
     }
 
dantedevil said:
Works perfect my friend!

Thanks for ALL your help!

Glad to help you! ;)

Ps. I forgot you to tell that the best way to handle this shadow trail is:
Code:
    if ( getentityproperty(player, "defaultmodel") == "LEO" && getentityproperty(player, "animationid") == openborconstant("ANI_CHARGEATTACK")
               && getentityproperty(player, "animpos") < 7 ) {
        set_shad_trail_flag(player,1);
        //draw_shadowtrail(player, 5, 15, 20, 160, 0);
    } else if ( getentityproperty(player, "defaultmodel") == "LEO" && getentityproperty(player, "animationid") == openborconstant("ANI_CHARGEATTACK")
               && getentityproperty(player, "animpos") >= 7 ) {
        set_shad_trail_flag(player,0);
        clear_shadowtrail(player);
    } else if ( getentityproperty(player, "defaultmodel") == "LEO" && getentityproperty(player, "animationid") != openborconstant("ANI_CHARGEATTACK")
               && get_shad_trail_flag(player) != 0 ) {
        set_shad_trail_flag(player,0);
        clear_shadowtrail(player);
    }


NOTE the  clear_shadowtrail(player); to clear previous  sprites.
 
OK, thanks.

Last question of this:
Code:
#import "data/scripts/shadowtrail.c"

void main() {
  void player = getlocalvar("self");

  check_shadow_trail(player);



    if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FREESPECIAL5")
               && getentityproperty(player, "animpos") < 7 ) {
        set_shad_trail_flag(player,1);
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FREESPECIAL5")
               && getentityproperty(player, "animpos") >= 7 ) {
        set_shad_trail_flag(player,0);
    }   

    else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FOLLOW4")
               && getentityproperty(player, "animpos") < 9 ) {
        set_shad_trail_flag(player,1);
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FOLLOW4")
               && getentityproperty(player, "animpos") >= 9 ) {
        set_shad_trail_flag(player,0);
    }

    else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FOLLOW5")
               && getentityproperty(player, "animpos") < 56 ) {
        set_shad_trail_flag(player,1);
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FOLLOW5")
               && getentityproperty(player, "animpos") >= 56 ) {
        set_shad_trail_flag(player,0);
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") != openborconstant("ANI_FOLLOW5")
               && getentityvar(player, "shadowtrail") != 0 ) {
        set_shad_trail_flag(player,0);
    }   
 
    else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FREESPECIAL11")
               && getentityproperty(player, "animpos") < 26 ) {
        set_shad_trail_flag(player,1);
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FREESPECIAL11")
               && getentityproperty(player, "animpos") >= 26 ) {
        set_shad_trail_flag(player,0);
    }

    else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") != openborconstant("ANI_FREESPECIAL5")
		&& getentityproperty(player, "animationid") != openborconstant("ANI_FOLLOW4") && getentityproperty(player, "animationid") != openborconstant("ANI_FOLLOW5")
		&& getentityproperty(player, "animationid") != openborconstant("ANI_FREESPECIAL11")
               && getentityvar(player, "shadowtrail") != 0 ) {
        set_shad_trail_flag(player,0);
    }
}

Why the "ANI_FOLLOW5 have this line at the end, and the others animations dont have it.
Code:
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") != openborconstant("ANI_FOLLOW5")
               && getentityvar(player, "shadowtrail") != 0 ) {
        set_shad_trail_flag(player,0);
 
dantedevil said:
OK, thanks.

Last question of this:
Code:
#import "data/scripts/shadowtrail.c"

void main() {
  void player = getlocalvar("self");

  check_shadow_trail(player);



    if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FREESPECIAL5")
               && getentityproperty(player, "animpos") < 7 ) {
        set_shad_trail_flag(player,1);
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FREESPECIAL5")
               && getentityproperty(player, "animpos") >= 7 ) {
        set_shad_trail_flag(player,0);
    }   

    else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FOLLOW4")
               && getentityproperty(player, "animpos") < 9 ) {
        set_shad_trail_flag(player,1);
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FOLLOW4")
               && getentityproperty(player, "animpos") >= 9 ) {
        set_shad_trail_flag(player,0);
    }

    else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FOLLOW5")
               && getentityproperty(player, "animpos") < 56 ) {
        set_shad_trail_flag(player,1);
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FOLLOW5")
               && getentityproperty(player, "animpos") >= 56 ) {
        set_shad_trail_flag(player,0);
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") != openborconstant("ANI_FOLLOW5")
               && getentityvar(player, "shadowtrail") != 0 ) {
        set_shad_trail_flag(player,0);
    }   
 
    else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FREESPECIAL11")
               && getentityproperty(player, "animpos") < 26 ) {
        set_shad_trail_flag(player,1);
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FREESPECIAL11")
               && getentityproperty(player, "animpos") >= 26 ) {
        set_shad_trail_flag(player,0);
    }

    else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") != openborconstant("ANI_FREESPECIAL5")
		&& getentityproperty(player, "animationid") != openborconstant("ANI_FOLLOW4") && getentityproperty(player, "animationid") != openborconstant("ANI_FOLLOW5")
		&& getentityproperty(player, "animationid") != openborconstant("ANI_FREESPECIAL11")
               && getentityvar(player, "shadowtrail") != 0 ) {
        set_shad_trail_flag(player,0);
    }
}

Why the "ANI_FOLLOW5 have this line at the end, and the others animations dont have it.
Code:
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") != openborconstant("ANI_FOLLOW5")
               && getentityvar(player, "shadowtrail") != 0 ) {
        set_shad_trail_flag(player,0);

I forgot it, sorry delete it  ;D
So the corrected code is:
Code:
#import "data/scripts/shadowtrail.c"

void main() {
  void player = getlocalvar("self");

  check_shadow_trail(player);



    if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FREESPECIAL5")
               && getentityproperty(player, "animpos") < 7 ) {
        set_shad_trail_flag(player,1);
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FREESPECIAL5")
               && getentityproperty(player, "animpos") >= 7 ) {
        set_shad_trail_flag(player,0);
	clear_shadowtrail(player);
    }   

    else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FOLLOW4")
               && getentityproperty(player, "animpos") < 9 ) {
        set_shad_trail_flag(player,1);
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FOLLOW4")
               && getentityproperty(player, "animpos") >= 9 ) {
        set_shad_trail_flag(player,0);
	clear_shadowtrail(player);
    }

    else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FOLLOW5")
               && getentityproperty(player, "animpos") < 56 ) {
        set_shad_trail_flag(player,1);
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FOLLOW5")
               && getentityproperty(player, "animpos") >= 56 ) {
        set_shad_trail_flag(player,0);
	clear_shadowtrail(player);
    }
 
    else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FREESPECIAL11")
               && getentityproperty(player, "animpos") < 26 ) {
        set_shad_trail_flag(player,1);
    } else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") == openborconstant("ANI_FREESPECIAL11")
               && getentityproperty(player, "animpos") >= 26 ) {
        set_shad_trail_flag(player,0);
	clear_shadowtrail(player);
    }

    else if ( getentityproperty(player, "defaultmodel") == "CAROLINA" && getentityproperty(player, "animationid") != openborconstant("ANI_FREESPECIAL5")
		&& getentityproperty(player, "animationid") != openborconstant("ANI_FOLLOW4") && getentityproperty(player, "animationid") != openborconstant("ANI_FOLLOW5")
		&& getentityproperty(player, "animationid") != openborconstant("ANI_FREESPECIAL11")
               && getentityvar(player, "shadowtrail") != 0 ) {
        set_shad_trail_flag(player,0);
	clear_shadowtrail(player);
    }
}

Note the clear_shadowtrail(player); when you set_shad_trail_flag to 0 (off) and
get_shad_trail_flag(player) instead of the entityvar
 
Solution
Back
Top Bottom