Type None and Walls

Viper Snake

Member
How do I get type none to behave like player/enemy types when it hits the side of a wall?

Code:
name torpor1
type none
remove 0
jumpheight 7.5
setlayer -1
speed 12
nolife	1
shadow	0
nodrop 2
nopain 1
candamage none
offscreenkill 59
animationscript  data/scripts/script.c
palette data/chars/constanze/effect/torpor/torpor.png
subject_to_wall 1
subject_to_platform 1
subject_to_obstacle 0
subject_to_basemap 1
no_adjust_base 0



anim	idle
	landframe	1
	loop	0
	offset	16 16
	delay	300	
	@cmd	spawnsub "trail2" 0 0 0	
	frame	data/chars/constanze/effect/torpor/torpor.png
	delay	2	
	@cmd	shooter2 "torpor2" 0 0 0 0
	frame	data/chars/marianne/blank.png	
	@cmd	suicide
	frame	data/chars/marianne/blank.png
IkfRCXJ.png

As type none, if this entity hits the side of a wall it instantly teleports to the top of the wall no matter where it hits.
9xbHBlm.png

Changing this entity to type enemy allows it to collide correctly with the wall and fall to the ground.
 
If I remember well, its the defaul behaviour for type NONE. NONE was intended to use less memory than other types, so there are some things which acts differently for it.
I think you should use an antiwall code
 
O Ilusionista said:
If I remember well, its the defaul behaviour for type NONE. NONE was intended to use less memory than other types, so there are some things which acts differently for it.
I think you should use an antiwall code

I've already tried antiwall code, it works for enemies but simply does nothing for type none. Here are the scripts I have tried:
Code:
void antiwall(int Dist, void Ani)
{// Checks if there is wall at defined distance (Dist)
// If there is wall, change animation to Ani
   void self = getlocalvar("self");
   int Direction = getentityproperty(self, "direction");
   int x = getentityproperty(self, "x");
   int y = getentityproperty(self, "a");
   int z = getentityproperty(self, "z");
   float H;

   if (Direction == 0){ //Is entity facing left?                  
      Dist = -Dist; //Reverse Dist to match facing
   }

   H = checkwall(x+Dist,z);
   if(H > y)
   {
      changeentityproperty(self, "animation", openborconstant(Ani));
   }
}

void wallstop(int Dist)
{// Checks if there is wall at defined distance (Dist)
// If there is wall, stop movement.
   void self = getlocalvar("self");
   int Direction = getentityproperty(self, "direction");
   int x = getentityproperty(self, "x");
   int y = getentityproperty(self, "a");
   int z = getentityproperty(self, "z");
   float H;

   if (Direction == 0){ //Is entity facing left?                  
      Dist = -Dist; //Reverse Dist to match facing
   }

   H = checkwall(x+Dist,z);
   if(H > y)
   {
     changeentityproperty(self, "velocity", 0, 0, 0); //Stop moving!
   }
}
 
antiwall and any functions declared in animation is only run when the frame is played. So if you want to check walls while being tossed you need to loop the frame when torpor1 is floating like this:

Code:
anim	idle
	loop	1 1 3
	landframe	4
	offset	16 16
	delay	1	
	@cmd	spawnsub "trail2" 0 0 0	
	frame	data/chars/constanze/effect/torpor/torpor.png
	delay	5	
	@cmd	antiwall {x} {Ani}
	frame	data/chars/constanze/effect/torpor/torpor.png
	@cmd	antiwall {x} {Ani}
	frame	data/chars/constanze/effect/torpor/torpor.png
	@cmd	antiwall {x} {Ani}
	frame	data/chars/constanze/effect/torpor/torpor.png
	delay	2	
	@cmd	shooter2 "torpor2" 0 0 0 0
	frame	data/chars/marianne/blank.png	
	@cmd	suicide
	frame	data/chars/marianne/blank.png

In this setting, antiwall is run couple times while torpor1 is still floating in air. When it lands, it plays frame 5 ending the loop
Oh don't forget to set value to antiwall function
 
Back
Top Bottom