Obstacle reacting to hit without beiing killed

NED

Well-known member
Obstacle reacting to hit without beiing killed

I would like to see if there is a way to make an obstacle (or any non playable and still entity) 1-to react to all hits (like a pain anim)
2-but without being killed.

I know 2 is easily done with "nolife  1" and perhaps a big health like 999999999
but what about hit reaction?

The entity should not be grabbable at all and receive only attackboxes damages.

I think Ilu and JonSilva used something kind of similar in their mods for destructible obstacles (SF2 car bonus stage type damage) Any idea?

Thanks.

(Mostly, my problem is that obstacles entity don't handle pain anim at all AFAIK)
 
The key lies in its takedamagescript (which is located on its header):
Code:
takedamagescript @script
void main()
{
void self = getlocalvar("self");
if(getentityproperty(self,"animationid")==openborconstant("ani_idle"))
   {
          void opp = getentityproperty(self,"opponent");
	  int direction = getentityproperty(opp,"direction");
	  if(direction == 1)performattack(self,openborconstant("ani_follow1"));
	  if(direction == 0)performattack(self,openborconstant("ani_follow2"));
   }

}

@end_script

It detects from which side you hit it, and change to the desired animation (follow 1 or follow2) based on that.
 
Thanks for the explanations.
I have experimented a bit.

But I have a logfile error.

Code:
Fatal Error in load_cached_model, file: data/sprites/rsidemove.txt, line 10, message: Unable to load animation script!

I don't know where is the missing script  ??? I presume it's about a missing script.
 
Sorry, my question was more like what element of grabscript.c do I need to insert in my similar script file. (mine is named slam.c , but when I delare this one it don't finds the code)

This is the complete file for the obstacle.
The header elements are not definitive. (WIP)

Code:
name	rsidemove
type    obstacle#none#obstacle
shadow	0
health  99999999#1
diesound  data/sounds/wood.wav
nolife  1
noatflash 1
nomove 1 1# pas de move - pas de turn
#gfxshadow 0#1


animationscript data/scripts/grabscript.c

takedamagescript @script
void main()
{
void self = getlocalvar("self");
if(getentityproperty(self,"animationid")==openborconstant("ani_idle"))
   {
          void opp = getentityproperty(self,"opponent");
	  int direction = getentityproperty(opp,"direction");
	  if(direction == 1)performattack(self,openborconstant("ani_follow1"));
	  if(direction == 0)performattack(self,openborconstant("ani_follow2"));
   }

}

@end_script



	
anim	idle
	loop	1
	delay	6
	offset	57 161#57 156#50 115#720 426
	bbox	26 25 47 177
	frame	data/sprites/rsidemove00.gif

anim	follow1
	loop	0
	delay	10
	offset	57 161#57 156#50 115#720 426
	bbox	26 25 47 177
	frame	data/sprites/rsidemove02.gif

anim	follow2
	loop	0
	delay	10
	offset	57 161#57 156#50 115#720 426
	bbox	26 25 47 177
	frame	data/sprites/rsidemove03.gif
 
But you are not using any single function from grabscript. If you assign a script and doesn't use anything from it, the engine will close.
Just remove that line with animationscript.
 
Thanks for clarifiying it.
I finally tried without declaring the unused script (I deleted the line)

But I have a crash with logfile saying:

Code:
Unable to load takedamagescript '@script' in file 'data/sprites/rsidemove.txt'.

But I start to undertand where can be the problem.
I think it's due to my old build of Openbor. I think some old build don't accept/detect some of these inserted script in entity file.

EDIT : yes, this is definitly the problem.
I tried with some new builds (tha kind of build that are not compatible with my game, making it unstable and major bugs)
And yes, it works.
So, officially I'm f*ck*d, unless there is a way to make this script an external one.
I think BB once showed me a possibility to get the script out of an entity, making it part of script files.

To explain things I would like to add this reaction ob obstacle to simulate some of the possible ring rope interaction : If someone hit the ropes, they will shake a little bit.
But it seems to create 2 major problems.
-the generic hitsound of ropes getting hit by a character (exagerated for this use)
-the fact these ropes should have a width in Z axis (even if I give them a wall, the bbox will be limited and strange to react with characters)

I should forget it an simplify to usual rope interaction. (irish whip)
With some chance, this particular feature could be added without script IN entity
 
Simply save this as, for example, react.c

Code:
void main()
{
void self = getlocalvar("self");
if(getentityproperty(self,"animationid")==openborconstant("ani_idle"))
   {
          void opp = getentityproperty(self,"opponent");
	  int direction = getentityproperty(opp,"direction");
	  if(direction == 1)performattack(self,openborconstant("ani_follow1"));
	  if(direction == 0)performattack(self,openborconstant("ani_follow2"));
   }

}

And call it:

Code:
takedamagescript data/scripts/react.c

But if this old version are giving you bugs, you will need to update it sooner or later...
 
Thanks, I'll give it a try tomorrow. I'm going to bed right now  :)

Also about my project. It plays perfectly with the old builds.
Basically.

OLD BUILDS :
Plays perfectly
Have been coded with these version

Don't allow all the new features (including some code implementation)

NEWER BUILDS :
most of the regular moves simply can't be done
Enemies don't act like I want
Some precision problems with obstacles display +walls

allows all new features etc
 
Thanks a lot, it worked perfectly.

Now only 2 things could be fixed for this particular function of ropes.
Any idea how to do it?

-making the obstacle damage over writting the hitsound with silence (or another soundFX)
-making the obstacle hittable in all it's width (Z axis)
 
O Ilusionista said:
1- Just put a sound on the animation you want it to use
2- just make its bbox wider (yes, bbox HAVE Z value. OpenBORstats just ignores it)

1-when a character punches or kicks the rope, the regular hitsound is just unnatural. So I want it to be replaced if it's possible
2-definitly! I completly forgot it, because I never used Z in bboxes (BTW, I don't use OpenBorStats yet for any coding, should I do?)

Thanks
 
1- I think its unnatural, actually, to be able to punch or kick a rope :) The default hitsound is called beat.wav, so you can change it for a silent file and call the desired effect when you want to. But you will need to make it in all attacks. I remember OpeBOR let you use a custom flash/hitspark for each entity (which is amazing by the way), dunno if let you do it with sounds too.

2- I use OpenBORstats, Modderstool, Notepad++ (perfect for scripts) and Fighter Factory for palettes.
 
1- you're right. The more I think, the more I feel like the same.
But I will definitly use this script for sandbag entity in one of my 2 training modes :)
Also, this trick of beat.wav would be OK, really. 5I keep it in mind for further use)
Actually, I used similar "cheat" with land.wav because it triggers automatically during some custom slams when oppoenent goes under Y=0. The I added it manually to all the anims where a land sound is needed.

2-I'll give a try to these softwares. I have notepad++, but never used it seriously.
And I really need to switch officially to FF (for mugen works), I know it's kind of a shame, but I never switched to it I was still using MCM (even if it's not reliable even for winmugen stuff)

Is Piccolo's modertool kind of stable? I know he's very skilled in coding :)

I'll create a new thread to work on my ropes in a different way. (Irish whip only)
 
O Ilusionista said:
...OpeBOR let you use a custom flash/hitspark for each entity (which is amazing by the way), dunno if let you do it with sounds too...

I can't remember myself, but it doesn't matter - because there's a simple trick that makes life so much easier for sounds. Don't use beat sounds at all (silence the default beat.wav). Then simply play the beat sounds from your flash effects. You can use script to play different sounds depending on conditions, or just make different flash texts for each type of hit. Either way, this is far simpler than using the default hitsound system because you only have one control point to worry about (which hitflash to play) instead of two.

Same goes for landing. Move the falling, landing, jumping, sounds into your dust effect entities.

DC
 
Back
Top Bottom