[SCRIPT] Water Puddle Effect v1.61 (old version)

jonsilva said:
could there be a missing function called (water_puddle_found) in lib_water_puddle.c ?!

ive tested it in both BOR versions TMN shell sock altitude (y)(a)

"water_puddle_found" is a label for a localvar setted into check_entities();
the script works well. tested.
What are you missing?
 
ive recopied all the scripts again from page 1... but the result was the same.
the entire effect goes missing... water ripple/water splash / player clip.
when i change the player ondrawscript to the old one the effect comes back up...

the only thing ive made diferent was add the
load water_splash
load water_ripple_front
load water_ripple_back
in water_puddle_test entity...
ive used TMNT_SS [REV5769] ive also tried with the additional scripts left on player.txt
Code:
ondrawscript 		data/scripts/water_puddle_script.c

onspawnscript 		data/scripts/spawn.c
onblockwscript 		data/scripts/wall_splat.c
script			data/scripts/player_script.c
ondeathscript		data/scripts/player_death_script.c
didblockscript		data/scripts/player_onblock.c
didhitscript		data/scripts/player_didhit.c
takedamagescript	data/scripts/player_ontakedamage.c
ondoattackscript	data/scripts/player_ondoattack.c

 
lib_water_puddle.c
Code:
#define gpp getplayerproperty
#define cpp changeplayerproperty
#define gep getentityproperty
#define cep changeentityproperty
#define ov  openborvariant
#define cv  changeopenborvariant
#define oc  openborconstant
#define clp changelayerproperty
#define glv getlocalvar
#define slv setlocalvar
#define sev setentityvar
#define gev getentityvar
#define sgv setglobalvar
#define ggv getglobalvar

#define SPLASH_SOUNDFX "data/sounds/water_splash01.wav"
#define ENT_WATER_SPLASH "water_splash"
#define ENT_RIPPLE_FRONT "water_ripple_front"
#define ENT_RIPPLE_BACK  "water_ripple_back"
#define RIPPLE_SPAWNING_FRAMES_PAUSE 2
#define SPLASH_DOWN_START_FRAME 2
#define RIPPLE_XSHIFT 3


void spawnsubentity(char ent, float x, float z, float a) {
    void subent;

      clearspawnentry();
      setspawnentry("name", ent);
      subent = spawn();

      changeentityproperty(subent, "position", x, z, a);

    return subent;
}

void spawnsubentity_parent(char ent, float x, float z, float a, void parent) {
    void subent;

      clearspawnentry();
      setspawnentry("name", ent);
      subent = spawn();

      changeentityproperty(subent, "parent", parent);
      changeentityproperty(subent, "position", x, z, a);

    return subent;
}

void spawnsubentity_relative(char ent, float rx, float rz, float ra, void parent) {
    void subent;
    float x, z, a, base;

      clearspawnentry();
      setspawnentry("name", ent);
      subent = spawn();

      if ( getentityproperty(parent,"exists") ) {
          int p_dir = getentityproperty(parent,"direction");

          if (!p_dir) rx *= -1;
          changeentityproperty(subent, "parent", parent);
          x = getentityproperty(parent, "x");
          z = getentityproperty(parent, "z");
          a = getentityproperty(parent, "y");
          base = getentityproperty(parent, "base");
          changeentityproperty(subent, "direction", p_dir);

          changeentityproperty(subent, "parent", parent);
      } else {
          x = 0;
          z = 0;
          a = 0;
      }

      if ( ra != NULL() ) {
        changeentityproperty(subent, "position", x+rx, z+rz, a+ra);
        changeentityproperty(subent, "base", a+ra);
      } else {
        changeentityproperty(subent, "position", x+rx, z+rz, base);
        changeentityproperty(subent, "base", base);
      }

    return subent;
}

int is_on_base(void self) {
    float a = getentityproperty(self,"y");
    float base = getentityproperty(self,"base");

    if ( a <= base ) return 1;
    else return 0;
}

int is_stopped(void self) {
    float xdir = getentityproperty(self,"xdir");
    float zdir = getentityproperty(self,"zdir");
    float tossv = getentityproperty(self,"tossv");

    if ( xdir == 0 && zdir == 0 && tossv == 0 ) return 1;
    else return 0;
}

int is_name(void self, char model, char name) {
    char model_name = getentityproperty(self, model);

    if ( model_name == name ) return 1;
    else return 0;
}

int is_for(void entity, void orig_owner) {
	 void parent = getentityproperty(entity,"parent");
	 void owner = getentityproperty(entity,"owner");
  	void subentity = getentityproperty(entity, "subentity");

  	if ( parent == NULL() ) parent = owner;
  	if ( parent == NULL() ) parent = subentity;

  	if ( orig_owner == parent ) return 1;
    else return 0;
}





int check_ripple(void self) {
    int is_on_puddle;
    int is_on_base;
    int was_on_puddle = glv("was_on_puddle");
    int was_on_base = glv("was_on_base");
    void ripple = glv("ripple");
    void splash = glv("splash");
    int ripple_frame = RIPPLE_SPAWNING_FRAMES_PAUSE;

    is_on_puddle = is_on_puddle(self); // check if this ent is on puddle (like stairs)
    is_on_base = is_on_base(self); // or is in "y" of puddle

    // CHECK EXISTENCE
    if ( !is_name(ripple,"defaultmodel",ENT_RIPPLE_FRONT) || !is_for(ripple,self) ) { slv("ripple",NULL()); ripple = glv("ripple"); }
    if ( !is_name(splash,"defaultmodel",ENT_WATER_SPLASH) || !is_for(splash,self) ) { slv("splash",NULL()); splash = glv("splash"); }

    if ( is_on_puddle ) {
        if ( is_on_base ) {
            if ( is_stopped(self) ) { // Se il pg è fermo crea un ripple per volta
                if ( ripple == NULL() || !gep(ripple,"exists") ) ripple = ripple_spawn(self,"ripple_front","ripple_back",ENT_RIPPLE_FRONT,ENT_RIPPLE_BACK); // spawn ent if not exists (mem ripple in a localvar)
                //else if ( !is_name(ripple,"defaultmodel",ENT_RIPPLE_FRONT) ) { slv("ripple",NULL()); ripple = glv("ripple"); }
            } else {
                // Se il pg è in movimento crea nuovi ripple dopo il frame X
                if ( ripple == NULL() || !gep(ripple,"exists") ) ripple = ripple_spawn(self,"ripple_front","ripple_back",ENT_RIPPLE_FRONT,ENT_RIPPLE_BACK);
                else {
                    //if ( !is_name(ripple,"defaultmodel",ENT_RIPPLE_FRONT) ) { slv("ripple",NULL()); ripple = glv("ripple"); }
                    if ( ripple != NULL() ) {
                        if ( gep(ripple,"animpos") >= ripple_frame ) ripple = ripple_spawn(self,"ripple_front","ripple_back",ENT_RIPPLE_FRONT,ENT_RIPPLE_BACK);
                    }
                }  // fine if ripple exists
            } // fine if is_in_movement
        } // fine if is_on_base

        if ( !was_on_puddle ) {
            slv("splash",spawn_splash(self,ENT_WATER_SPLASH,SPLASH_SOUNDFX,SPLASH_DOWN_START_FRAME)); // splash down
            splash = glv("splash");
        }

        // adjust splash position for speedy moves
        if ( !check_splash_pos(self,glv("splash"),ENT_WATER_SPLASH) ) slv("splash",NULL());
    } else {
        //if ( was_on_puddle ) spawn_splash(self); // splash up
        if ( is_stopped(self) ) {
            delete_ripple(self,"ripple_front","ripple_back",ENT_RIPPLE_FRONT,ENT_RIPPLE_BACK);
            slv("ripple",NULL());
            ripple == glv("ripple");
        }
    }

    if ( was_on_puddle && !is_on_base && was_on_base ) spawn_splash(self,ENT_WATER_SPLASH,SPLASH_SOUNDFX); // splash up
    //if ( !is_on_base && was_on_base ) spawn_splash(self); // splash up

    slv("was_on_puddle",is_on_puddle);
    slv("was_on_base",is_on_base);
    slv("ripple",ripple);
    slv("splash",splash);
}

int is_on_puddle(void self) {
    if ( getlocalvar("is_on_water_puddle") > 0 ) return 1;
    else return 0;
}

void ripple_spawn(void self, char ripple_front, char ripple_back, char front_ripple_name, char back_ripple_name) {
    slv(ripple_front,spawnsubentity_relative(front_ripple_name,RIPPLE_XSHIFT,0.1,NULL(),self));
    slv(ripple_back,spawnsubentity_relative(back_ripple_name,0,-1.0,NULL(),glv(ripple_front)));

    //changeentityproperty(glv(ripple_front),"parent",self);
    changeentityproperty(glv(ripple_back),"parent",self);

    return glv(ripple_front);
}

int delete_ripple(void self, char ripple_front, char ripple_back, char front_ripple_name, char back_ripple_name) {
    if ( gep(glv(ripple_front),"exists") ) {
        if ( is_name(glv(ripple_front),"defaultmodel",front_ripple_name) && is_for(glv(ripple_front),self) ) { killentity(glv(ripple_front)); }
    }
    slv(ripple_front,NULL());

    if ( gep(glv(ripple_back),"exists") ) {
        if ( is_name(glv(ripple_back),"defaultmodel",back_ripple_name) && is_for(glv(ripple_back),self) ) { killentity(glv(ripple_back)); }
    }
    slv(ripple_back,NULL());

    return 1;
}

void spawn_splash(void self, char water_splash_name, char splash_sound_name, int frame) {
    void splash;

    splash = spawnsubentity_relative(water_splash_name,RIPPLE_XSHIFT,1,NULL(),self);
    changeentityproperty(splash,"parent",self);
    if ( frame != NULL() ) {
        changeentityproperty(splash,"animpos",frame);
        playsample(loadsample(splash_sound_name));
    }

    return splash;
}

// return 0 if it doesn't exists
int check_splash_pos(void self, void splash, char model_name) {
    if ( gep(splash,"exists") ) {
        int anim_pos = gep(splash,"animpos");

        if ( !is_name(splash,"defaultmodel",model_name) || !is_for(splash,self) ) return 0;

        if ( anim_pos <= SPLASH_DOWN_START_FRAME ) {
            float x = gep(self,"x");
            int dir = gep(self,"direction");
            float ex = gep(splash,"x");
            float xshift = RIPPLE_XSHIFT;

            if ( !dir ) xshift *= -1;
            if ( ex != x+xshift ) {
                cep(splash,"position",x+xshift,NULL(),NULL());
            }
        } // fine if animpos

        return 1;
    } else return 0; // fine if exists
}

int check_puddle(void self, int no_a_flag) {
    int i;

    if ( getglobalvar("in_menu") != 1 && getlevelproperty("type") != 2 ) { // Waiting, Select
        for (i = 0; i < openborvariant("count_entities"); ++i) { // openborconstant("MAX_ENTS")
            void ent = getentity(i);

            if ( getentityproperty(ent, "exists") ) {
                if ( getentityvar(ent, 0) == "water_puddle" ) {
                    if ( no_a_flag && no_a_flag != NULL() ) return check_water_puddle_no_a(self, ent);
                    else return check_water_puddle(self, ent, 1);
                }
            } // fine if exists
        } // fine for all_ents

        return 0;
    }
}

int check_water_puddle(void self, void ent, int check_only_flag) {
                int p = getentityproperty(self, "playerindex");
                float x = getentityproperty(self, "x");
                float z = getentityproperty(self, "z");
                float a = getentityproperty(self, "y");
                float base = getentityproperty(self, "base");
                float ex = getentityproperty(ent, "x");
                float ez = getentityproperty(ent, "z");
                float ea = getentityproperty(ent, "y");
                float ebase = getentityproperty(ent, "base");
                float height = getentityproperty(ent, "height");
                float width = getentityvar(ent, 1);
                float depth = getentityvar(ent, 3);
                float new_base, ezhift, exhift;

                // Lunghezza della scala
                if (x > ex) exhift = x-ex;
                else exhift = ex-x;

                if ( getentityvar(ent, 0) == "water_puddle" ) {
                    if ( x <= ex+width && x >= ex && z <= ez+2+depth/2 && z >= ez-depth/2 && a <= ebase+2+height && a >= ebase-2 ) {
                        if ( !check_only_flag || check_only_flag == NULL() ) {
                            draw_clipping_transp(self, 140, height+5, 30);
                            clip_character(self, -190, height);
                            setlocalvar("is_on_water_puddle", 1);
                        } else return 1;
                    } else {
                        if ( !check_only_flag || check_only_flag == NULL() ) {
                            if ( getlocalvar("is_on_water_puddle") == 1 ) {
                                reset_water_puddle_clipping(self);
                                setlocalvar("is_on_water_puddle", NULL());
                            }
                        } else return 0;
                    } // fine if coords
                }
}

int check_water_puddle_no_a(void self, void ent) {
                float x = getentityproperty(self, "x");
                float z = getentityproperty(self, "z");
                float a = getentityproperty(self, "y");
                float ex = getentityproperty(ent, "x");
                float ez = getentityproperty(ent, "z");
                float ea = getentityproperty(ent, "y");
                float width = getentityvar(ent, 1);
                float depth = getentityvar(ent, 3);

                if ( getentityvar(ent, 0) == "water_puddle" ) {
                    if ( x <= ex+width && x >= ex && z <= ez+2+depth/2 && z >= ez-depth/2 ) {
                        return 1;
                    } else {
                        return 0;
                    } // fine if coords
                }
}

int reset_water_puddle_clipping(void self, int shadow_flag) {
    changedrawmethod(NULL(), "enabled", 0);
    changedrawmethod(NULL(), "reset", 1);
    setdrawmethod(NULL(), 0);
    changedrawmethod(self, "enabled", 0);
    changedrawmethod(self, "reset", 1);
    setdrawmethod(self, 0);

    if ( !shadow_flag || shadow_flag == NULL() ) {
        if ( !getentityproperty(self,"gfxshadow") ) changeentityproperty(self,"gfxshadow",1);
    }
}

int reset_water_puddle(void self) {
    if ( glv("was_on_puddle") != NULL() || glv("was_on_base") != NULL() || glv("is_on_water_puddle") != NULL() ) {
        reset_water_puddle_clipping(self);
        setlocalvar("water_puddle_found",NULL());
        slv("was_on_puddle",NULL());
        slv("was_on_base",NULL());
        slv("is_on_water_puddle",NULL());
    }
}

int clip_character(void self, float clipx, float clipy) {
    /*int anim_id = getentityproperty(self,"animationid");
    int anim_pos = getentityproperty(self,"animpos");

    if ( (anim_id == oc("ANI_SPAWN") || anim_id == oc("ANI_RESPAWN")) && anim_pos <= 1 ) return;*/

    if ( openborvariant("in_level") ) {
        //void spr = getentityproperty(self, "sprite");
        float x = getentityproperty(self, "x");
        float z = getentityproperty(self, "z");
        float a = getentityproperty(self, "y");
        float base = getentityproperty(self, "base");
        int layer = getentityproperty(self, "setlayer");
        float xpos = openborvariant("xpos");
        float ypos = openborvariant("ypos");
        int colourmap = getentityproperty(self, "colourmap");

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

            //drawstring( 10,190,0,"Var (): "+trunc(xpos));
            if ( getentityproperty(self,"gfxshadow") ) changeentityproperty(self,"gfxshadow",0);

            //changedrawmethod(NULL(), "clip", 10, 20);
            changedrawmethod(self, "cliph", 256); // 75 ----> sono pixel che compongono il quadrato
            changedrawmethod(self, "clipw", 512); // 256 -> se aumento clipw poi devo aumentare anche clipx
            changedrawmethod(self, "clipx", clipx); // -100
            changedrawmethod(self, "clipy", -256-20+a-base); // -100  -> più abbassi e più tagli
            //changedrawmethod(self, "clipy", -100+a);
            // ####### TOGLI -base se vuoi che cambi il clipy in base a quello!!!

            // (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(self, 1, 256, 256, facing, 0, 0, 6, 1, 0, 0, 0, 0, colourmap); // map: -1 = Use entity's colormap.
            setdrawmethod(self, 1, 256, 256, 0, 0, 0, 0, 1, 0, 0, 0, 0, colourmap); // map: -1 = Use entity's colormap.

            changedrawmethod(NULL(), "enabled", 0);
            changedrawmethod(NULL(), "reset", 1);
            setdrawmethod(NULL(), 0);
    }
}

int draw_clipping_transp(void self, float clipx, float clipy, int transp) {
    /*int anim_id = getentityproperty(self,"animationid");
    int anim_pos = getentityproperty(self,"animpos");

    if ( (anim_id == oc("ANI_SPAWN") || anim_id == oc("ANI_RESPAWN")) && anim_pos <= 1 ) return;*/

    if ( openborvariant("in_level") ) {
        void spr = getentityproperty(self, "sprite");
        float x = getentityvar(self, "x");
        float z = getentityvar(self, "z");
        float a = getentityvar(self, "y");
        float base = getentityvar(self, "base");
        int facing = getentityvar(self, "direction");
        int layer = getentityproperty(self, "setlayer");
        float xpos = openborvariant("xpos");
        float ypos = openborvariant("ypos");
        int colourmap = getentityproperty(self, "colourmap");
        //float transp = 40; //255

        if ( x == NULL() ) x = getentityproperty(self, "x");
        if ( z == NULL() ) z = getentityproperty(self, "z");
        if ( a == NULL() ) a = getentityproperty(self, "y");
        if ( base == NULL() ) base = getentityproperty(self, "base");
        if ( facing == NULL() ) facing = getentityproperty(self, "direction");

        if ( spr != NULL() ) {
            if (facing == 1) facing = 0;
            else facing = 1;

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

            //drawstring( 10,190,0,"Var (): "+trunc(xpos));

            //changedrawmethod(NULL(), "clip", 10, 20);
            changedrawmethod(NULL(), "cliph", 356);
            changedrawmethod(NULL(), "clipw", 512); // se aumento clipw poi devo aumentare anche clipx
            changedrawmethod(NULL(), "clipx", x-xpos-clipx);
            changedrawmethod(NULL(), "clipy", z-a-ypos-4-clipy);

            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.

            drawsprite(spr, x-xpos, z-a-ypos-4, z+2, layer);

            changedrawmethod(NULL(), "enabled", 0);
            changedrawmethod(NULL(), "reset", 1);
            setdrawmethod(NULL(), 0);
        }

    }
}

water_puddle_script.c
Code:
#import "data/scripts/lib_water_puddle.c"

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

    // ENTITIES COUNT FUNCS
    check_entities(self);

    if ( getlocalvar("water_puddle_found") == 1 ) check_ripple(self);
}

int check_entities(void self) {
    int i = 0;
    int water_puddle_found_flag = 0, water_puddle_is_on = 0;

    if ( openborvariant("in_level") != 1 && getlevelproperty("type") != 2 ) { // Waiting, Select
        for (i = 0; i < openborvariant("count_entities"); ++i) { // openborconstant("MAX_ENTS")
            void ent = getentity(i);

            if ( getentityproperty(ent, "exists") ) {
                /// WATER PUDDLE ///
                if ( getentityvar(ent, 0) == "water_puddle" ) {
                    int anim_id = getentityproperty(self,"animationid");
                    int water_puddle_flag = 0;

                    water_puddle_found_flag = 1;
                    if ( anim_id == openborconstant("ANI_SPAWN") || anim_id == openborconstant("ANI_RESPAWN") ) {
                        int anim_pos = getentityproperty(self,"animpos");
                        if ( anim_pos <= 1 ) water_puddle_flag = 1;
                    }
                    if ( !water_puddle_flag && !water_puddle_is_on ) water_puddle_is_on = check_water_puddle(self, ent);
                    if ( !water_puddle_is_on && getlocalvar("water_puddle_found") != 1 ) setlocalvar("water_puddle_found",1);
                }
            } // fine if exists
        } // fine for all_ents

        /// WATER PUDDLE RESET ///
        if ( !water_puddle_found_flag || water_puddle_is_on <= 0 ) {
            reset_water_puddle(self);
        }
    }
}
 
OK sorry the wrong line is
if ( openborvariant("in_level") != 1 && getlevelproperty("type") != 2 ) {
change it to
if ( openborvariant("in_level") && getlevelproperty("type") != 2 ) {
TESTED! Again sorry!!
 
thanks its working now...
the old setentityvar(self, 2, 15);    // height
on water_puddle_test.txt still doesnt change from ex.
(self, 2, 15);
to
(self, 2, 40);
i manage to change it to (40) in the old lib_water_puddle.c... by changing this line...in  int clip_character... to 226
            //changedrawmethod(self, "cliph", 256); // 75 ----> sono pixel che compongono il quadrato
            changedrawmethod(self, "cliph", 226); // 75 ----> sono pixel che compongono il quadrato

TESTED! Again sorry!!
?!? :o why are you asking sorry ?!
you ve done me a big favor and to everyone iam sure a lot of people will use levels with walk on water from now on... or maybe not i dont know... but if it was me I wouldn't miss the chance
 
Thanks!
Dont change entityvar '2' to change the height.
To change the height use the height value in water_puddle_test entity
However I know your problem. I will write another update for this script
 
jonsilva said:
the old setentityvar(self, 2, 15);    // height
on water_puddle_test.txt still doesnt change from ex.
(self, 2, 15);
to
(self, 2, 40);
i manage to change it to (40) in the old lib_water_puddle.c... by changing this line...in  int clip_character... to 226
            //changedrawmethod(self, "cliph", 256); // 75 ----> sono pixel che compongono il quadrato
            changedrawmethod(self, "cliph", 226); // 75 ----> sono pixel che compongono il quadrato

Script updated!!

- to change water height (deepness), simply change:
  height 20 # <--- change this param to change the water height (water deepness)
  in water_puddle_test
  ps. forget set/get entityvar(self, 2, 15);

- to change ripple/splash position (relative to the character) change these params:
  #define RIPPLE_XSHIFT 3
  #define RIPPLE_ASHIFT 0

TESTED AND WORKING!
 
White Dragon said:
OK sorry the wring line is
if ( openborvariant("in_level") != 1 && getlevelproperty("type") != 2 ) {
change it to
if ( openborvariant("in_level") && getlevelproperty("type") != 2 ) {
TESTED! Again sorry!!

He he I was going to ask you about this because the in_level != 1 wasn't making much sense to me since it would trigger exactly when you are not on a stage :)
 
thanks its working
ive been trying to spawn the values in level...
spawn water_puddle_test
@script
void main() {
void self = getlocalvar("self");
setentityvar(self, 0, "water_puddle"); // name/type
setentityvar(self, 1, 300); // width
setentityvar(self, 3, 80);  // depth
    changeentityproperty(self, "height", 100); // height

}
@end_script
coords 0 910 0
at 0
but the height doesnt seem to work
ive never figure it out how to use the height in scripts... 
 
jonsilva said:
thanks its working
ive been trying to spawn the values in level...
spawn water_puddle_test
@script
void main() {
void self = getlocalvar("self");
setentityvar(self, 0, "water_puddle"); // name/type
setentityvar(self, 1, 300); // width
setentityvar(self, 3, 80);  // depth
    changeentityproperty(self, "height", 100); // height
}
@end_script
coords 0 910 0
at 0
but the height doesnt seem to work
ive never figure it out how to use the height in scripts...

changeentityproperty(self, "height", 100) is correct, but you cant change a property in a spawnscript.
BTW I updated lib_water_puddle.c (re-copy it) to add your feature: to change params in spawning

now you can change all params ex.:
spawn water_puddle_test
@script
void main() {
void self = getlocalvar("self");
setentityvar(self, 0, "water_puddle"); // name/type
setentityvar(self, 1, 300); // width
setentityvar(self, 3, 80);  // depth
setentityvar(self, 2, 50); // height
}
@end_script

Ripple/Splash altitude will be adjusted automatically!  ;)

Enjoy!
 
UPDATE:
- added map param
- added alpha transp param

add these params like in the 1st post in water_puddle_test entity:
setentityvar(self, "map", 0);  // ripple/splash map
setentityvar(self, "transp", 30);  // alpha transp value
 
i found what could be an error !!!
it could make the script not to work for a lot of people...

it seems maybe you ve made an invisible player in TMN shell shock costume player select screen (title_script.c)

its preventing the 1st load player in models.txt on standard BOR when he is using the
ondrawscript data/scripts/water_puddle_script.c

after select new game it crashes with no errors on log...
but all the other players seem to work fine only the 1st one crashes with ondrawscript



 
jonsilva said:
i found what could be an error !!!
it could make the script not to work for a lot of people...

it seems maybe you ve made an invisible player in TMN shell shock costume player select screen (title_script.c)

its preventing the 1st load player in models.txt on standard BOR when he is using the
ondrawscript data/scripts/water_puddle_script.c

after select new game it crashes with no errors on log...
but all the other players seem to work fine only the 1st one crashes with ondrawscript

?? no invisible player. the script works with all players ^__^
 
I tested and it works fine. Then I upload a new rev of tmnt ss

ok...
but i think youve might have build the water script based on the costume menus in TMN SS...
the game also crashes when you pass a level and go to a select level in levels.txt
In log it seems to crash until memory runs out...
Code:
Total Ram: 3488911360 Bytes
 Free Ram: 1972752384 Bytes
 Used Ram: 2863104 Bytes

debug:nativeWidth, nativeHeight, bpp  1360, 768, 32

0 joystick(s) found!
OpenBoR v3.0 Build , Compile Date: Sep  1 2014

Game Selected: ./Paks/Art of Fighting - Beats of Rage Remix III (v1.3 final with Trance music).pak

FileCaching System Init......	Disabled
Initializing video............
Reading video settings from 'data/video.txt'.
Initialized video.............	480x272 (Mode: 1, Depth: 32 Bit)

Loading menu.txt.............	Done!
Loading fonts................	1 2 3 4 Done!
Timer init...................	Done!
Initialize Sound..............	
Loading sprites..............	Done!
Loading level order..........	Done!
Loading model constants......	Done!
Loading script settings......	Done!
Loading scripts..............	Done!
Loading models...............

Cacheing 'water_puddle_test' from data/chars/misc/ladder/water_puddle_test.txt
Cacheing 'water_splash' from data/chars/misc/water/water_splash/water_splash.txt
Cacheing 'water_ripple_front' from data/chars/misc/water/water_ripple/water_ripple_front.txt
Cacheing 'water_ripple_back' from data/chars/misc/water/water_ripple/water_ripple_back.txt
Cacheing 'Flash0' from data/chars/misc/flash/flash/flash0.txt
Cacheing 'Flash' from data/chars/misc/flash/flash/flash.txt
Cacheing 'Flash2' from data/chars/misc/flash/flash/flash2.txt
Cacheing 'Flash3' from data/chars/misc/flash/flash/flash3.txt
Cacheing 'Flash4' from data/chars/misc/flash/flash/flash4.txt
Cacheing 'Flash5' from data/chars/misc/flash/flash/flash5.txt
Cacheing 'Flash6' from data/chars/misc/flash/flash/flash6.txt
Cacheing 'Flash7' from data/chars/misc/flash/flash/flash7.txt
Cacheing 'Flash8' from data/chars/misc/flash/flash/flash8.txt
Cacheing 'Flashb' from data/chars/misc/flash/flash/flashb.txt
Cacheing 'Flashc' from data/chars/misc/flash/flash/flashc.txt
Cacheing 'blooda' from data/chars/misc/flash/flash/blooda.txt
Cacheing 'bloodb' from data/chars/misc/flash/flash/bloodb.txt
Cacheing 'exel' from data/chars/misc/flash/flash/exel.txt
Cacheing 'kohkn' from data/chars/misc/flash/flash/kohkn.txt
Cacheing 'haskk' from data/chars/misc/flash/flash/haskk.txt
Cacheing 'kohkn2' from data/chars/misc/flash/flash/kohkn2.txt
Cacheing 'haskk2' from data/chars/misc/flash/flash/haskk2.txt
Cacheing 'hsken' from data/chars/misc/flash/flash/hsken.txt

-------------------about-1000-lines-here--------//--------------
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 

---------------------------------//-------------------------------

Level Unloading: 'data/levels/68lvl.txt'
Total Ram: 3488911360 Bytes
 Free Ram: 1864474624 Bytes
 Used Ram: 95846400 Bytes

Done.
Total Ram: 3488911360 Bytes
 Free Ram: 1870036992 Bytes
 Used Ram: 89858048 Bytes

Can't play music file 'data/music/complete'
Level Loading:   'data/levels/0begin.txt'
Total Ram: 3488911360 Bytes
 Free Ram: 1871810560 Bytes
 Used Ram: 87724032 Bytes

WARNING: data/levels/0begin.txt tries to load a nonnumeric value at spawn1, where a number is expected!
erroneus string: a

Level Loaded:    'data/levels/0begin.txt'
Total Ram: 3488911360 Bytes
 Free Ram: 1861447680 Bytes
 Used Ram: 96567296 Bytes
Total sprites mapped: 3853

Level Unloading: 'data/levels/0begin.txt'
Total Ram: 3488911360 Bytes
 Free Ram: 1864704000 Bytes
 Used Ram: 96575488 Bytes

Done.
Total Ram: 3488911360 Bytes
 Free Ram: 1864704000 Bytes
 Used Ram: 96575488 Bytes

could theres be missing an endlevel script to clear all variables in previous levels (water level)  ?
 
jonsilva said:
I tested and it works fine. Then I upload a new rev of tmnt ss

ok...
but i think youve might have build the water script based on the costume menus in TMN SS...
the game also crashes when you pass a level and go to a select level in levels.txt
In log it seems to crash until memory runs out...
Code:
Total Ram: 3488911360 Bytes
 Free Ram: 1972752384 Bytes
 Used Ram: 2863104 Bytes

debug:nativeWidth, nativeHeight, bpp  1360, 768, 32

0 joystick(s) found!
OpenBoR v3.0 Build , Compile Date: Sep  1 2014

Game Selected: ./Paks/Art of Fighting - Beats of Rage Remix III (v1.3 final with Trance music).pak

FileCaching System Init......	Disabled
Initializing video............
Reading video settings from 'data/video.txt'.
Initialized video.............	480x272 (Mode: 1, Depth: 32 Bit)

Loading menu.txt.............	Done!
Loading fonts................	1 2 3 4 Done!
Timer init...................	Done!
Initialize Sound..............	
Loading sprites..............	Done!
Loading level order..........	Done!
Loading model constants......	Done!
Loading script settings......	Done!
Loading scripts..............	Done!
Loading models...............

Cacheing 'water_puddle_test' from data/chars/misc/ladder/water_puddle_test.txt
Cacheing 'water_splash' from data/chars/misc/water/water_splash/water_splash.txt
Cacheing 'water_ripple_front' from data/chars/misc/water/water_ripple/water_ripple_front.txt
Cacheing 'water_ripple_back' from data/chars/misc/water/water_ripple/water_ripple_back.txt
Cacheing 'Flash0' from data/chars/misc/flash/flash/flash0.txt
Cacheing 'Flash' from data/chars/misc/flash/flash/flash.txt
Cacheing 'Flash2' from data/chars/misc/flash/flash/flash2.txt
Cacheing 'Flash3' from data/chars/misc/flash/flash/flash3.txt
Cacheing 'Flash4' from data/chars/misc/flash/flash/flash4.txt
Cacheing 'Flash5' from data/chars/misc/flash/flash/flash5.txt
Cacheing 'Flash6' from data/chars/misc/flash/flash/flash6.txt
Cacheing 'Flash7' from data/chars/misc/flash/flash/flash7.txt
Cacheing 'Flash8' from data/chars/misc/flash/flash/flash8.txt
Cacheing 'Flashb' from data/chars/misc/flash/flash/flashb.txt
Cacheing 'Flashc' from data/chars/misc/flash/flash/flashc.txt
Cacheing 'blooda' from data/chars/misc/flash/flash/blooda.txt
Cacheing 'bloodb' from data/chars/misc/flash/flash/bloodb.txt
Cacheing 'exel' from data/chars/misc/flash/flash/exel.txt
Cacheing 'kohkn' from data/chars/misc/flash/flash/kohkn.txt
Cacheing 'haskk' from data/chars/misc/flash/flash/haskk.txt
Cacheing 'kohkn2' from data/chars/misc/flash/flash/kohkn2.txt
Cacheing 'haskk2' from data/chars/misc/flash/flash/haskk2.txt
Cacheing 'hsken' from data/chars/misc/flash/flash/hsken.txt

-------------------about-1000-lines-here--------//--------------
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 
drawing water ... 

---------------------------------//-------------------------------

Level Unloading: 'data/levels/68lvl.txt'
Total Ram: 3488911360 Bytes
 Free Ram: 1864474624 Bytes
 Used Ram: 95846400 Bytes

Done.
Total Ram: 3488911360 Bytes
 Free Ram: 1870036992 Bytes
 Used Ram: 89858048 Bytes

Can't play music file 'data/music/complete'
Level Loading:   'data/levels/0begin.txt'
Total Ram: 3488911360 Bytes
 Free Ram: 1871810560 Bytes
 Used Ram: 87724032 Bytes

WARNING: data/levels/0begin.txt tries to load a nonnumeric value at spawn1, where a number is expected!
erroneus string: a

Level Loaded:    'data/levels/0begin.txt'
Total Ram: 3488911360 Bytes
 Free Ram: 1861447680 Bytes
 Used Ram: 96567296 Bytes
Total sprites mapped: 3853

Level Unloading: 'data/levels/0begin.txt'
Total Ram: 3488911360 Bytes
 Free Ram: 1864704000 Bytes
 Used Ram: 96575488 Bytes

Done.
Total Ram: 3488911360 Bytes
 Free Ram: 1864704000 Bytes
 Used Ram: 96575488 Bytes

could theres be missing an endlevel script to clear all variables in previous levels (water level)  ?

no bug for me... maybe some errors in your code?
what is the line where there is the "a" non-numeric value in spawn1?
 
no bug for me... maybe some errors in your code?
what is the line where there is the "a" non-numeric value in spawn1?
i dont know where the "a" error is coming from... but its no big deal
"0begin.txt" its an intro level...
Code:
music		data/music/begin.bor

background	data/bgs/0begin/back.gif
layer		data/bgs/0begin/back1.gif -3000 0 0 0 -20 0 0 -1 1 1 0 0 0 0 0 0.5
layer		data/bgs/0begin/back3.gif -2000 0 0 0 35 0 0 -1 1 1 0 0 0 0 0 0.6
layer		data/bgs/0begin/back2.gif -1000 0 0 0 45 0 0 -1 1 1 0 0 0 0 0 0.7
layer		data/bgs/0begin/middle.gif -5000 0 0 -400 60 0 0 -1 1 0 0 3 0.1 1.4 1 1.7
panel		data/bgs/0begin/panel.gif
layer		data/bgs/0begin/front1.gif 400 0 0 0 205 0 0 -1 1 1 0 0 0 0 0 2
layer		data/bgs/0begin/front2.gif 500 0 0 0 0 0 0 -1 1 1 1 0 0 0 0 4

spawn1  	75 140 a
spawn2  	125 70
spawn3  	125 50
order	        a
notime          1
custfade	50
#nopause		1
type 		2

bgspeed		10
#setweap		1



#-------------------------------//---------------
load	mrzero

spawn  	aofint1
coords  230 30
at      0

spawn  	aofint3
coords  240 125
at      0

#---------------------------//----------------

spawn  	aofint2
coords  860 195
at      0

spawn  	aofint2
@script void main() {
   performattack(getlocalvar("self"), openborconstant("ANI_FOLLOW1"));
} @end_script
coords  765 195
at      0

spawn  	aofint2
@script void main() {
   performattack(getlocalvar("self"), openborconstant("ANI_FOLLOW2"));
} @end_script
coords  600 195
at      0

#---------------------------//----------------

spawn   ghosttest
coords  530 140
at      0

#-------------------------------//---------------

the game crashes when it goes to the next level... but it doesnt show on log...
its a select player .txt level (data/bgs/select2.txt)
Code:
music		data/music/begin2.bor
background	data/bgs/select2.gif


allowselect     Ryo Robert Yuri FastRyo kgnrob syuri

if i change this line (allowselect    Ryo Robert Yuri FastRyo kgnrob syuri
)
to (allowselect    mrzero Ryo Robert Yuri FastRyo kgnrob syuri
)
the game no longer crashes... its beacause (mrzero) is a player that doesnt uses the ondrawscript, and its the 1st player that loads in models.txt
#--------players-/-characters------------

load mrzero data/chars/0null/mrzero.txt
load Ryo data/chars/1ryo/ryo.txt
load Robert data/chars/1robert/robert.txt
load Yuri data/chars/0yuri/yuri.txt
load FastRyo data/chars/1ryo/fastryo/fastryo.txt
load kgnrob data/chars/1robert/kgnrob/kgnrob.txt
load sYuri data/chars/0yuri/syuri/syuri.txt
load pltank data/chars/beyond/4stank/pltank.txt

but the error its very easy to spot, you can download this neo pack
http://www.mediafire.com/download/gw759srdo4rxaf3/BOR_edit_pack.rar
remove the # from ondrawscript on player kula
(#ondrawscript data/scripts/water_puddle_script.c)

but if this error is only happening to me its strange... i will try to run the scripts on a diferent computer see if it still crashes...
 
Back
Top Bottom