Trailer.c issues with the "colourtable" property.

ChrisFalconSTB

Active member
I'm using the trailer.c script for Shadow Trails in my mod.

I managed to get everything fine, set the openborconstant variable to the desired animation and such. But I still have one problem: each of the playable characters have four selectable colors, with a fifth hidden color for the use of the Shadow Trail palette.

if(anim == openborconstant("ANI_RUN")){ map = getentityproperty(ent, "colourtable", 4);}
I used this code for setting the fifth palette on the shadow trail, but whenever the animation is played, the trails appear using the first pal.

For clarification, I've put an attachment with the issue I'm trying to solve in a screenshot.


[attachment deleted by admin]
 
Shadow trails are something I wanted to fix for my mod for a long time if I find a fix I will post it up.
 
Think I know the issue, but there are several "trailer.c" scripts floating about. Mind posting yours so I can know for certain?

DC
 
The trailer.c script goes like this:
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_RUN")){ map = getentityproperty(ent, "colourtable", 4);}

	setglobalvar("blahblah.map", map);


	if(elapsed_time%trailerd==0)
	{
		if((anim == openborconstant("ANI_RUN")))
		{
		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;
			}
		}
	}
	}
}

And this is the code of my character:
Code:
name 	 	  Shimo
health	 	  100
mp                100
speed	 	  9
type	 	  player
gfxshadow 	  1
running	    	  20 3 2 1 0
diesound 	  data/sounds/shimodown.wav
icon     	  data/chars/Ran/icon.png #icon
palette	 	  data/chars/Ran/icon.png #0
alternatepal 	  data/chars/Ran/igre.png #1
alternatepal      data/chars/Ran/iran.png #2
alternatepal      data/chars/Ran/ishi.png #3
alternatepal      data/chars/Ran/shad.png #4
hmap 		  4 4
atchain           1 1 2 3 4
animationscript   data/scripts/script.c
script            data/scripts/trailer.c
com a2		  freespecial

anim	attack1
	loop	0
	delay	4
	offset	240 204
	bbox.position.x	220
	bbox.position.y	100
	bbox.size.x	55
	bbox.size.y	105
	frame	Data/CHARS/Ran/atk1_0.png
	jugglecost	2
	attack.damage.force	4
	attack.position.x	253
	attack.position.y	103
	attack.reaction.fall.force	0
	attack.size.x	66
	attack.size.y	43
	attack.size.z.1	30
	attack.reaction.fall.velocity.x	0.5
	attack.reaction.fall.velocity.y	3.5
	frame	Data/CHARS/Ran/atk1_1.png
	frame	Data/CHARS/Ran/atk1_2.png
	delay	7
	jugglecost	2
	frame	Data/CHARS/Ran/atk1_3.png
	frame	Data/CHARS/Ran/atk1_4.png
	delay	5
	frame	Data/CHARS/Ran/atk1_5.png
		
anim	attack2
	loop	0
	delay	4
	offset	240 204
	bbox.position.x	220
	bbox.position.y	110
	bbox.size.x	55
	bbox.size.y	95
	frame	Data/CHARS/Ran/atk2_0.png
	frame	Data/CHARS/Ran/atk2_1.png
	jugglecost	2
	attack.damage.force	4
	attack.effect.hit.flash.disable	1
	attack.position.x	258
	attack.position.y	116
	attack.reaction.fall.velocity.x	0.5
	attack.reaction.fall.velocity.y	3.5
	attack.size.x	56
	attack.size.y	39
	attack.size.z.1	30
	frame	Data/CHARS/Ran/atk2_2.png
	frame	Data/CHARS/Ran/atk2_3.png
	frame	Data/CHARS/Ran/atk2_4.png
	frame	Data/CHARS/Ran/atk2_5.png
	frame	Data/CHARS/Ran/atk2_6.png
		
anim	attack3
	loop	0
	delay	4
	offset	240 204
	bbox.position.x	200
	bbox.position.y	110
	bbox.size.x	60
	bbox.size.y	100
	frame	Data/CHARS/Ran/atk3_0.png
	jugglecost	2
	attack.damage.force	3
	attack.position.x	257
	attack.position.y	148
	attack.size.x	56
	attack.size.y	47
	attack.size.z.1	30
	attack.reaction.fall.velocity.x	0.5
	attack.reaction.fall.velocity.y	3.5
	frame	Data/CHARS/Ran/atk3_1.png
	frame	Data/CHARS/Ran/atk3_2.png
	frame	Data/CHARS/Ran/atk3_3.png
	jugglecost	2
	frame	Data/CHARS/Ran/atk3_4.png
	frame	Data/CHARS/Ran/atk3_5.png
		
anim	attack4
	loop	0
	offset	240 204
	bbox.position.x	200
	bbox.position.y	105
	bbox.size.x	80
	bbox.size.y	100
	delay	4
	frame	Data/CHARS/Ran/atk4_0.png
	delay	6
	frame	Data/CHARS/Ran/atk4_1.png
	delay	9
	frame	Data/CHARS/Ran/atk4_2.png
	jugglecost	2
	offset	240 204
	delay	6
	frame	Data/CHARS/Ran/atk4_3.png
	delay	3
	jugglecost	2
	attack.damage.force	4
	attack.position.x	253
	attack.position.y	121
	attack.size.x	50
	attack.size.y	86
	attack.size.z.1	30
	attack.reaction.fall.force	1
	attack.reaction.fall.velocity.x	0.5
	attack.reaction.fall.velocity.y	3.5
	frame	Data/CHARS/Ran/atk4_4.png
	frame	Data/CHARS/Ran/atk4_5.png
	frame	Data/CHARS/Ran/atk4_6.png
	frame	Data/CHARS/Ran/atk4_7.png
	frame	Data/CHARS/Ran/atk4_8.png
	frame	Data/CHARS/Ran/atk4_9.png
	frame	Data/CHARS/Ran/atk4_10.png
		
anim	fall
	loop	0
	landframe	8
	dropframe	5
	offset	240 204
	delay	4
	dropframe	6
	delay	20
	landframe	7
	frame	Data/CHARS/Ran/fall_0.png
	frame	Data/CHARS/Ran/fall_1.png
	frame	Data/CHARS/Ran/fall_2.png
	frame	Data/CHARS/Ran/fall_3.png
	frame	Data/CHARS/Ran/fall_4.png
	frame	Data/CHARS/Ran/fall_5.png
	frame	Data/CHARS/Ran/fall_6.png
	frame	Data/CHARS/Ran/fall_7.png
	frame	Data/CHARS/Ran/fall_8.png
	frame	Data/CHARS/Ran/fall_9.png
	frame	Data/CHARS/Ran/fall_10.png
	frame	Data/CHARS/Ran/fall_11.png
	frame	Data/CHARS/Ran/fall_12.png
		
anim	freespecial
	offset	240 204
	delay	5
	bbox.position.x	195
	bbox.position.y	110
	bbox.size.x	85
	bbox.size.y	100
	frame	Data/CHARS/Ran/uatk_0.png
	jugglecost	2
	attack.damage.force	4
	attack.position.x	241
	attack.position.y	81
	attack.reaction.fall.force	1
	attack.reaction.fall.velocity.x	0.5
	attack.reaction.fall.velocity.y	3.5
	attack.size.x	49
	attack.size.y	128
	attack.size.z.1	30
	bbox.position.x	215
	bbox.position.y	105
	bbox.size.x	60
	bbox.size.y	100
	frame	Data/CHARS/Ran/uatk_1.png
	frame	Data/CHARS/Ran/uatk_2.png
	jugglecost	2
	delay	11
	frame	Data/CHARS/Ran/uatk_3.png
	frame	Data/CHARS/Ran/uatk_4.png
	frame	Data/CHARS/Ran/uatk_5.png
		
anim	get
	loop	0
	delay	4
	offset	240 204
	frame	Data/CHARS/Ran/get_1.png
	frame	Data/CHARS/Ran/get_2.png
	frame	Data/CHARS/Ran/get_3.png
	frame	Data/CHARS/Ran/get_4.png
	frame	Data/CHARS/Ran/get_5.png
	frame	Data/CHARS/Ran/get_6.png
	frame	Data/CHARS/Ran/get_7.png
	frame	Data/CHARS/Ran/get_8.png
	frame	Data/CHARS/Ran/get_9.png
	frame	Data/CHARS/Ran/get_10.png
	frame	Data/CHARS/Ran/get_11.png
	frame	Data/CHARS/Ran/get_12.png
	frame	Data/CHARS/Ran/get_13.png
		
anim	idle
	loop	1
	delay	6
	bbox.position.x	205
	bbox.position.y	105
	bbox.size.x	65
	bbox.size.y	100
	offset	240 204
	frame	Data/CHARS/Ran/idle_0.png
	frame	Data/CHARS/Ran/idle_1.png
	frame	Data/CHARS/Ran/idle_2.png
	frame	Data/CHARS/Ran/idle_3.png
	frame	Data/CHARS/Ran/idle_4.png
	frame	Data/CHARS/Ran/idle_5.png
	frame	Data/CHARS/Ran/idle_6.png
	frame	Data/CHARS/Ran/idle_7.png
	frame	Data/CHARS/Ran/idle_8.png
	frame	Data/CHARS/Ran/idle_9.png
	frame	Data/CHARS/Ran/idle_10.png
	frame	Data/CHARS/Ran/idle_11.png
		
anim	jump
	loop	0
	offset	240 204
	delay	5
	bbox.position.x	205
	bbox.position.y	80
	bbox.size.x	65
	bbox.size.y	130
	frame	Data/CHARS/Ran/jump_0.png
	frame	Data/CHARS/Ran/jump_1.png
	frame	Data/CHARS/Ran/jump_2.png
	frame	Data/CHARS/Ran/jump_3.png
	frame	Data/CHARS/Ran/jump_4.png
	frame	Data/CHARS/Ran/jump_5.png
	frame	Data/CHARS/Ran/jump_6.png
	frame	Data/CHARS/Ran/jump_7.png
	frame	Data/CHARS/Ran/jump_8.png
	frame	Data/CHARS/Ran/jump_9.png
	frame	Data/CHARS/Ran/jump_10.png
	frame	Data/CHARS/Ran/jump_11.png
	frame	Data/CHARS/Ran/jump_12.png
	delay	1000
	frame	Data/CHARS/Ran/jump_13.png
	frame	Data/CHARS/Ran/jump_14.png
		
anim	jumpattack
	loop	0
	delay	6
	offset	240 204
	bbox.position.x	205
	bbox.position.y	105
	bbox.size.x	75
	bbox.size.y	90
	frame	Data/CHARS/Ran/jatk1_0.png
	delay	5
	jugglecost	4
	attack.damage.force	6
	attack.position.x	250
	attack.position.y	145
	attack.reaction.fall.force	1
	attack.size.x	45
	attack.size.y	40
	attack.size.z.1	30
	attack.reaction.fall.velocity.x	1.5
	attack.reaction.fall.velocity.y	2.5
	frame	Data/CHARS/Ran/jatk1_1.png
	delay	4
	frame	Data/CHARS/Ran/jatk1_2.png
	delay	5
	frame	Data/CHARS/Ran/jatk1_3.png
	frame	Data/CHARS/Ran/jatk1_4.png
		
anim	jumpattack2
	loop	0
	offset	240 204
	bbox.position.x	196
	bbox.position.y	106
	bbox.size.x	65
	bbox.size.y	86
	delay	6
	frame	Data/CHARS/Ran/jatk2_0.png
	delay	3
	frame	Data/CHARS/Ran/jatk2_1.png
	delay	4
	frame	Data/CHARS/Ran/jatk2_2.png
	jugglecost	2
	attack.damage.force	4
	attack.position.x	210
	attack.position.y	75
	attack.reaction.pause.time	5
	attack.size.x	55
	attack.size.y	110
	attack.size.z.1	30	
	attack.reaction.fall.velocity.x 0.5
	attack.reaction.fall.velocity.y	3.5
	frame	Data/CHARS/Ran/jatk2_3.png
	delay	3
	frame	Data/CHARS/Ran/jatk2_4.png
	frame	Data/CHARS/Ran/jatk2_5.png
	delay	4
	frame	Data/CHARS/Ran/jatk2_6.png
	delay	6
	frame	Data/CHARS/Ran/jatk2_7.png
		
anim	land
	loop	0
	offset	240 204
	bbox.position.x	210
	bbox.position.y	105
	bbox.size.x	55
	bbox.size.y	100
	delay	4
	frame	Data/CHARS/Ran/jump_15.png
	frame	Data/CHARS/Ran/jump_16.png
	frame	Data/CHARS/Ran/jump_17.png
	frame	Data/CHARS/Ran/jump_18.png
	frame	Data/CHARS/Ran/jump_19.png
	frame	Data/CHARS/Ran/jump_20.png
	frame	Data/CHARS/Ran/jump_21.png
	frame	Data/CHARS/Ran/jump_22.png
		
anim	pain
	loop	0
	offset	240 204
	bbox.position.x	200
	bbox.position.y	105
	bbox.size.x	90
	bbox.size.y	100
	delay	5
	frame	Data/CHARS/Ran/pain_0.png
	frame	Data/CHARS/Ran/pain_1.png
	frame	Data/CHARS/Ran/pain_2.png
	frame	Data/CHARS/Ran/pain_3.png
	frame	Data/CHARS/Ran/pain_5.png
	frame	Data/CHARS/Ran/pain_6.png
		
anim	rise
	loop	0
	offset	240 204
	delay	4
	frame	Data/CHARS/Ran/rise_0.png
	frame	Data/CHARS/Ran/rise_1.png
	frame	Data/CHARS/Ran/rise_2.png
	frame	Data/CHARS/Ran/rise_3.png
	frame	Data/CHARS/Ran/rise_4.png
	frame	Data/CHARS/Ran/rise_5.png
	frame	Data/CHARS/Ran/rise_6.png
		
anim	run
	loop	1
	offset	240 204
	delay	4
	bbox.position.x	185
	bbox.position.y	140
	bbox.size.x	90
	bbox.size.y	65
	frame	Data/CHARS/Ran/run_0.png
	frame	Data/CHARS/Ran/run_1.png
	frame	Data/CHARS/Ran/run_2.png
	
		
anim	walk
	loop	1
	delay	7
	offset	240 204
	bbox.position.x	210
	bbox.position.y	105
	bbox.size.x	55
	bbox.size.y	100
	frame	Data/CHARS/Ran/walk_0.png
	frame	Data/CHARS/Ran/walk_1.png
	frame	Data/CHARS/Ran/walk_2.png
	frame	Data/CHARS/Ran/walk_3.png
	frame	Data/CHARS/Ran/walk_4.png
	frame	Data/CHARS/Ran/walk_5.png
	frame	Data/CHARS/Ran/walk_6.png
	frame	Data/CHARS/Ran/walk_7.png
	frame	Data/CHARS/Ran/walk_8.png
	frame	Data/CHARS/Ran/walk_9.png
	frame	Data/CHARS/Ran/walk_10.png
	frame	Data/CHARS/Ran/walk_11.png
		
#|edited by openBor Stats v 0.56

Edit: I agree with Ilusionista on this. Is it possible to implement on the engine?
 
O Ilusionista said:
That function is something I believe should be coded into the engine, kinda like mugen does.


Normally if something can be implemented by script it should be. At the moment the engine is being cleaned to remove any unneeded and legacy code to give us a lighter more stable engine to work with.


I have split all my scripts into separate text files so all entity's can point to 1 animation script with multiple lines importing each script so this will make it easy for anyone to pick out only the scripts they need and add it to their mod.


this is my animation script for all entity's in my mod:


Code:
#import "data/scripts/gravity.c"
#import "data/scripts/fanim.c"
#import "data/scripts/slams.c"
#import "data/scripts/spawns.c"
#import "data/scripts/tossx.c"
#import "data/scripts/randomsfx.c"
#import "data/scripts/smartbomb.c"
//enemy scripts
#import "data/scripts/ttarget.c"
#import "data/scripts/wcheck.c"
#import "data/scripts/timer.c"
//speech entity
#import "data/scripts/speech.c"
#import "data/scripts/cleartext.c"
#import "data/scripts/menugo.c"


Don't know if I can pull it off but I am trying to remake Orochi X's shadow trail script using only local variables.
 
Normally if something can be implemented by script it should be. At the moment the engine is being cleaned to remove any unneeded and legacy code to give us a lighter more stable engine to work with.

I am no stranger to that concept. And that is not a set in the stone rule. Take a look at basemap, for example.
But since it relies on updatescript, I dunno if it would be a good idea.
 
happy I could help the tint option can help cover up the inability to set shadows to alternate maps for now.
 
Back
Top Bottom