Hurting Obstacles with enemies bodies.

PS_VITA

Active member
How can I damage obstacle boxes if I throw an enemy against them?

I've already created the obstacle breakable boxes
And can hurt them with the player attacks.




 
Kratus said:
PS VITA
First, like other members already said, the "projectilehit" function controls who will be damaged when the character is falling after a throw/slam move.
projectilehit  enemy obstacle

- By default, if you are using the native engine "throw" system, it will work automatically.
- If you are using scripted grabs like "@cmd slamstart", you need to check if your "@cmd throw" function has the following line inside the code. It is used to add the "projectilehit" status to the thrown entity.
- If you are developing your own grab script, make sure you have this line at the moment you are releasing the opponent when the grab move ends.
Code:
changeentityproperty(target, "aiflag", "projectile", 1);

In addition, I don't know if it is exactly the problem you are having, but there's another detail. Obstacle entities have some kind of a native platform by default. So, when the character starts the "fall" animation he will be blocked by this obstacle, and if the character's atbox does not connect to the obstacle's bbox, the obstacle entity will remain intact.

To solve this problem there's a trick in OpenBOR. If you add a "platform" function inside the obstacle entity, it will remove the default obstacle coordinates and replace by the values defined in the "platform" function. But if you do not want to edit this, make sure the obstacle's bbox is large enough to be damaged by falling entities that have activated atboxes during the fall animation. You can activate the debug to see both atbox/bbox.
Code:
anim idle
	loop	1
	delay	6
	offset	100 167
	bbox 	80 89 48 80
	shadowcoords 100 161
	platform 72 72 138 138 6 1000
	frame	data/chars/obstacles/arcade00.gif
	@cmd offScreenKill 50 0
	frame	data/chars/obstacles/arcade01.gif

Another thing, you can customize the "projectilehit" function by using scripts and it is possible to define what "character type" the entities can hit during the falling animation for a specific situation.
Code:
changeentityproperty(target, "projectilehit", "type_enemy", "type_obstacle");

And for last, the "projectile" function you mentioned below is not related to "projectilehit" function. The "projectile" function below is used to spawn entities as projectiles.
Do I add projectile {relative} {name} {x} {z} {y} {direction} {ptype} {type} {map}
in the fall animation?

Here are both descriptions in the manual:

PROJECTILE
projectile {relative} {name} {x} {z} {y} {direction} {ptype} {type} {map}
~ Despite the name, it can be used to spawn any type of entity. Useful for using more than one "spawnframe" or
any other method as it offers much more control.
~ {relative} - Affects all other settings. See bellow
~ {name} - name of the spawned position, from models.txt
~ {x} - X spawn position, defaults to 0. Accept decimals. If relative is 0, the position will count from the edge of
the screen, while if 1, it will use the parent x position as a it's x value
~ {z} - Z spawn position, defaults to 0. Accept decimals.
~ {y} - Y spawn position, defaults to 0. Accept decimals.
~ {direction} - direction of the spawn. According to the source, defaults to DIRECTION_RIGHT. If relative is 0,
if will default to DIRECTION_RIGHT, but if relative is 1, it will uses it's parent direction.
~{ptype} - Defaults to 0. If it has any value other than 0, the projectile is given a default name of "shot" and a
model index of -1 as opposed to the parent model's predefined knife or pshot index. Best left ignored.
~{type} - "0" - will use "knife' behaviour. "1" will use "bomb" behaviour (and ignores the ptype above). defaults
to 0
~{map} - map of the spawned entity, defaults to 0

PROJECTILEHIT
projectilehit {type1} {type2} ...
~Optional.
~Do not let the name confuse you, this is not for projectiles. This
setting specifies what types this entity will hit when thrown from a grab. *~Available types are enemy, player, npc,
obstacle, shot and you can use as many as you need. If you don't want entity to hit anything, just set 'none' here.
~Be aware if you use this setting, you must provide all types you wish this entity to be able to hit when thrown.
That is to say, an enemy with ‘projectilehit player’ will only hit players when thrown, not other enemies.

I hope it helps  :)

Kratus

Thank you so very much for this very informative post, it has actually opened up my eyes in understanding the difference between native functions suchs as throw and custom scripted attacks and throws.
I also, learned about how off I was in my bbox they were to thin and to sum it all all up nothing was working for me do to many points you mentioned in your post.

But from all this something good came out of it  (atleast I think it did) ... after some trial and error I came up with an object that I named hobstacles ( hurt obstacles) that spawns via spawnframe during an enemy fall animation or wherever I need it and it's working really well for me.

I'm on the phone at the moment but I will post the full code whenever I get the chance.

Fingers crossed that you guys actually think it's a good idea.

I was worried about optimization but perhaps once I post the code you guys can let me know if it's a good idea or not.

The alternative would have been to much work so I'm hoping this is mw meeting myself in the middle.
 
Code:
name	hobstacles
type	 none
shadow	0
health   1
nolife   1
nomove 1 1
nodieblink 1
candamage	obstacle
subject_to_gravity 0
subject_to_hole 1
subject_to_wall 1
lifespan 0.1







anim spawn
	loop	0
	delay	9
	offset	0 32
        attackone 1
        attack 10 15 90 80 10 0
	frame	data/chars/misc/empty.png
        attack 0 0 0 0 0 0
	frame	data/chars/misc/empty.png

This ^ is the new entity I came up with and
I use it in the enemies anim fall via spawnframe ( in various frames) so it gives me more flexibility - and it's not limited to
just throws .

But, I'm not sure if it's a good idea or if it will slow down the game when a bunch enemies start hitting the floor and perform their fall animation -- hence I used lifespan with a very low value.

feed back is appreciated.
 
Hmmm.... with this trick, enemy will hurt obstacles whether they are blasted or not. So if an enemy is jumpkicked or finished with combo finisher, he/she will hurt obstacles behind him/her. Is that what you want?

If you want feedback, my 1st feedback is to post enemy's FALL animation here :).

I think there's an easier way with script but I'd need to test that :).
 
Here's the enemies fall anim

Thank you for the feedback and yeah "hobstacle" will alow me to use it so that enemies can break obstacles when they  fall above them. With whatever attacks I decide and I don't have to care about projectile hit or using blast, ect.

Code:
anim fall
	loop	0
	offset	77 170
       spawnframe 7 -60 0 55 0
       custentity hobstacles
      spawnframe 5 -60 0 55 0
       custentity hobstacles
bbox	10 85 90 80
	delay   8
      landframe 7
      @cmd    degravity -0.15
      @cmd bind 0 0 0 0 0
      @cmd    depost 0
	frame	data/chars/williams2/fall06a.gif
      frame	data/chars/williams2/fall06a.gif
      delay   10
      @cmd    antiwall4 -20 "ANI_FOLLOW37"
      frame	data/chars/williams2/fall01.gif
      frame	data/chars/williams2/fall01.gif
      @cmd    antiwall4 -20 "ANI_FOLLOW37"
      frame	data/chars/williams2/fall01.gif
      delay   20
      @cmd    antiwall4 -20 "ANI_FOLLOW37"
      frame	data/chars/williams2/fall02.gif
      delay   500
      frame	data/chars/williams2/fall02.gif
bbox	0 0 0 0
      delay   8
      sound	data/sounds/falll.wav
	frame	data/chars/williams2/fall02.gif
	frame	data/chars/williams2/rise0.gif
      delay   2
      @cmd    anichange "ANI_FOLLOW80"
      frame	data/chars/williams2/rise0.gif



 
I have tested it and it's possible to activate projectilehit on normal knockdown. You simply use this takedamagescript:
hurty.c
Code:
void main()
{// Activates projectile hit when attacked
    void self = getlocalvar("self");

    changeentityproperty(self, "projectile", 1);
}

Declare that with:
takedamagescript data/scripts/hurty.c

With this script, knocked down enemy can hurt other entities (defined by projectilehit) even if they aren't blasted. Provided enemy has attackbox in FALL animation like this:
Code:
anim	fall
	delay	20
	landframe 2
	offset	120 154
	bbox	78 86 87 56
	attack	78 86 87 56 10 1 1
	frame	data/chars/jake/fall1.png
	delay	500
	frame	data/chars/jake/fall2.png
	delay	20
	bbox	0
	attack	0
	frame	data/chars/jake/fall3.png

I asked about attackbox in other thread cause that's required aspect.
 
Bloodbane said:
I have tested it and it's possible to activate projectilehit on normal knockdown. You simply use this takedamagescript:
hurty.c
Code:
void main()
{// Activates projectile hit when attacked
    void self = getlocalvar("self");

    changeentityproperty(self, "projectile", 1);
}

Declare that with:
takedamagescript data/scripts/hurty.c

With this script, knocked down enemy can hurt other entities (defined by projectilehit) even if they aren't blasted. Provided enemy has attackbox in FALL animation like this:
Code:
anim	fall
	delay	20
	landframe 2
	offset	120 154
	bbox	78 86 87 56
	attack	78 86 87 56 10 1 1
	frame	data/chars/jake/fall1.png
	delay	500
	frame	data/chars/jake/fall2.png
	delay	20
	bbox	0
	attack	0
	frame	data/chars/jake/fall3.png

I asked about attackbox in other thread cause that's required aspect.


Wow this incredible,  and what's good about this system is that I can set up multiple attackboxes in difrent frames.

Thanks!
 
Back
Top Bottom