Shadow Trails Demo

Exhibition Shadow Trails 2017 - tech demo 3.0

No permission to download
Projects meant as a technical demonstrator or instructional tutorial.
Sorry O' Ilusionista, I accidentally deleted your post!  :-[

To answer your question, no, it is in fact "colourmap" that gets the pointer for an entity's current color table.

The "colortable" property is get the color table pointer by index. You could use it to make your shadow trails always match up to a specific color map index regardless of which one the entity is currently using.

DC
 
Got it. So if we use colourtable, which works by index, we could get, for example, the 4th map from any entity, even if that palette is not the current one.
 
O Ilusionista said:
Got it. So if we use colourtable, which works by index, we could get, for example, the 4th map from any entity, even if that palette is not the current one.

Yep. Watch yourself though and make sure the value you want actually exists. Pointers are the ultimate power in OpenBOR script, but one mistake will cause a memory fault. Meaning an honest to goodness crash, not a logged shutdown.

DC
 
Thanks, Malik. I've updated to the newer version and works perfectly
3hC7hyc.png


Yep. Watch yourself though and make sure the value you want actually exists. Pointers are the ultimate power in OpenBOR script, but one mistake will cause a memory fault. Meaning an honest to goodness crash, not a logged shutdown.
So it would be better to use "mapcount" to retrieve the available map count.
 
O Ilusionista said:
Yep. Watch yourself though and make sure the value you want actually exists. Pointers are the ultimate power in OpenBOR script, but one mistake will cause a memory fault. Meaning an honest to goodness crash, not a logged shutdown.
So it would be better to use "mapcount" to retrieve the available map count.

Glad it worked for you. I do not see a need to use "mapcount" as any entity calling a shadow should be using a valid map even if it is just the default map 0.
 
O Ilusionista said:
The mapcount part was related to DC's comment, about getting a not active map.

I understand but I can never see a scenario when a non mapped entity will be calling this function as far as I am aware all entity's must have at least 1 map set.
 
Again, it's not related with your shadow trail, its related to another question :)
One example: you want to get the 3rd map from an entity - this entity isn't using that map right now - and want to use it on another entity on the fly, using script.
 
Can any of you paste the code to shadow.c and shadowon.c?

The mediafire link in the first post leads to a broken archive that can't be opened.
 
NickyP said:

Can any of you paste the code to shadow.c and shadowon.c?

The mediafire link in the first post leads to a broken archive that can't be opened.


Just tested and it works fine try using the latest winrar to extract it I do not know what you are using maybe z7 or something else ?


shadow.c
Code:
void shadow(int max, int delay, int timeout, int alpha, int tintm, int r, int g, int b)
{//animation script for shadow trails by msmalik681
	void self = getlocalvar("self"); //Get calling entity.
	int anim = getentityproperty(self, "animationid");//Get calling animation id.
	//if any values null set defaults
	if(max==NULL()){max=5;}
	if(delay==NULL()){delay=20;}
	if(timeout==NULL()){timeout=90;}
	if(alpha==NULL()){alpha=6;}
	if(tintm==NULL()){tintm=2;}
	if(r==NULL()){r=0;}
	if(g==NULL()){g=0;}
	if(b==NULL()){b=255;}
	//store all recorded data into entity variables.
	setentityvar(self,"shadow.anim", anim);
	setentityvar(self,"shadow.max", max);
	setentityvar(self,"shadow.delay", delay);
	setentityvar(self,"shadow.timeout", timeout);
	setentityvar(self,"shadow.alpha", alpha);
	setentityvar(self,"shadow.tintm", tintm);
	setentityvar(self,"shadow.r", r);
	setentityvar(self,"shadow.g", g);
	setentityvar(self,"shadow.b", b);


}

shadowon.c
Code:
void main()
{//shadow trail ondrawscript by msmalik681
	int i, j;
	void spr; 
	int facing;
	float y, z, x;
	void self = getlocalvar("self"); //get caller
	int ani = getentityproperty(self, "animationid"); //current animation id
	int time = openborvariant("elapsed_time");	//current time in game
	int timer = getlocalvar("shadow."+self+".timer");	//hold a variable for timer
	//recover all properties recovered from animation script
	int max = getentityvar(self,"shadow.max");
	int delay = getentityvar(self,"shadow.delay");
	int timeout = getentityvar(self,"shadow.timeout");
	int alpha = getentityvar(self,"shadow.alpha");
	int tintm = getentityvar(self,"shadow.tintm");
	int r = getentityvar(self,"shadow.r");
	int g = getentityvar(self,"shadow.g");
	int b = getentityvar(self,"shadow.b");
	int anim = getentityvar(self,"shadow.anim");
	if(timer==NULL()){setlocalvar("shadow."+self+".timer",-1);}	//if timer has no value set timer -1
	void table = getentityproperty(self, "colourmap");


if(ani==anim && timer<time) //if the animation id from animation script matches current animation id and timer below 0
{
	spr = getentityproperty(self, "sprite");		//caller current sprite
	x = getentityproperty(self, "x");			//caller x position
	z = getentityproperty(self, "z");			//caller z position
	y = getentityproperty(self, "y");			//caller y position
	facing = !getentityproperty(self, "direction");		//caller facing direction


//settextobj(0,55, 200,3,9999999999,"working");
//drawsprite(spr,openborvariant("xpos")+x,z-y-openborvariant("ypos")-10,z,50);


	for(i=1; i<=max; i++) //find an empty shadow slot and store cuurent sprite with other details
		{
			if(getlocalvar("shadow."+self+"."+i+".s")==NULL())
			 {
				setlocalvar("shadow."+self+"."+i+".s", spr);
				setlocalvar("shadow."+self+"."+i+".x", x);
				setlocalvar("shadow."+self+"."+i+".z", z);
				setlocalvar("shadow."+self+"."+i+".y", y);
				setlocalvar("shadow."+self+"."+i+".f", facing);
				setlocalvar("shadow."+self+"."+i+".tm", tintm);
				setlocalvar("shadow."+self+"."+i+".a", alpha);
				setlocalvar("shadow."+self+"."+i+".r", r);
				setlocalvar("shadow."+self+"."+i+".g", g);
				setlocalvar("shadow."+self+"."+i+".b", b);
				setlocalvar("shadow."+self+"."+i+".t", openborvariant("elapsed_time")+timeout);
				setlocalvar("shadow."+self+".timer",openborvariant("elapsed_time")+delay);	//set a delay before next sprite can be recorded
				break; //stop the loop
			 }
		}
}


		for(j=1; j<=max; j++)//show any stored shadows or if their time is up remove them
		 {
		  if(getlocalvar("shadow."+self+"."+j+".t")!=NULL())
		  {
			if (getlocalvar("shadow."+self+"."+j+".t")<openborvariant("elapsed_time"))
			{
			setlocalvar("shadow."+self+"."+j+".s", NULL());
			setlocalvar("shadow."+self+"."+j+".x", NULL());
			setlocalvar("shadow."+self+"."+j+".z", NULL());
			setlocalvar("shadow."+self+"."+j+".y", NULL());
			setlocalvar("shadow."+self+"."+j+".f", NULL());
			setlocalvar("shadow."+self+"."+j+".c", NULL());
			setlocalvar("shadow."+self+"."+j+".t", NULL());
			setlocalvar("shadow."+self+"."+j+".tm", NULL());
			setlocalvar("shadow."+self+"."+j+".a", NULL());
			setlocalvar("shadow."+self+"."+j+".r", NULL());
			setlocalvar("shadow."+self+"."+j+".g", NULL());
			setlocalvar("shadow."+self+"."+j+".b", NULL());
			} else	{
				changedrawmethod(NULL(),"reset",1);
				changedrawmethod(NULL(), "table", table);
				changedrawmethod(NULL(),"flipx",getlocalvar("shadow."+self+"."+j+".f")); //face same as caller
				changedrawmethod(NULL(),"alpha",getlocalvar("shadow."+self+"."+j+".a")); //apply alpha effect 
				changedrawmethod(NULL(),"tintmode",getlocalvar("shadow."+self+"."+j+".tm")); //apply tint effect 
				changedrawmethod(NULL(),"tintcolor",rgbcolor(getlocalvar("shadow."+self+"."+j+".r"),getlocalvar("shadow."+self+"."+j+".g"),getlocalvar("shadow."+self+"."+j+".b"))); //set a tint 
				drawsprite(getlocalvar("shadow."+self+"."+j+".s"),getlocalvar("shadow."+self+"."+j+".x")-openborvariant("xpos"),getlocalvar("shadow."+self+"."+j+".z")-getlocalvar("shadow."+self+"."+j+".y")-openborvariant("ypos")-4,getlocalvar("shadow."+self+"."+j+".z")-j);
				changedrawmethod(NULL(),"reset",1);
				}
		  }
		 }
}
 
It's strange. I have WinRAR, and it works for literally everything else I download (even downloaded my own files from Mediafire to test it). For some reason, it claims your archive is corrupted.

Thank you for the scripts, however! They work flawlessly in my mod!
 
Glad to hear you got it working.  I have had someone else say my files were corrupt so I have re-uploaded the file in zip format and I will try to stick with this format from now on.
 
Hey, this is an old threah huh? XD
Is this working the same way by now? wanted to give it  a try and it doesn't work anymore, my od crashes even by copying the playable character in this demo with the script info.
 
it just says:

Code:
Can't compile script 'Billy' data/chars/1billy/billy.txt

I even tried copying the Mandy character in the demo and she won't show up as a playable along with my characters, so I removed mine and left Mandy alone and at the char select screen Openbor gets stucked and crashes without log reports.

What I do is the exact instructions as the 1st post, I can't test the shadow trails, it chrashes right after adding these 2 lines:

Code:
animationscript		data/scripts/scripts.c
ondrawscript		data/scripts/shadowon.c


 
Back
Top Bottom