Grabbed by enemy

ABK

Well-known member
Im dealing currently with this move, enemy grabs player and holds him from back, what do you guys do when enemy is hit and how you then release player from bind to his idle ?
I tried to detect if player is not in his pain9 which is his being grabbed animation but that doesnt work too well.
Any ideas how to make it in as less conflicting and convulted way as possible so there wont be any bugs like enemy holding nothing or player still in bind when enemy was hit?
Also tried to use default grab animation in enemy but they just dont want to grab player on their own, i had to make regular attack with followcond.
 
6315 but i can switch to newer ones
Id like to have ability for second player to hit enemy that grabs first player and other enemies to hit player thats grabbed by enemy, so other players could set him free and other eemies could beat him up while hes grabbed.
That would require weapon model with its own pain animations while grabbed , right ?
Im just almost finishing the game, i left it for very end cause its a bit of headache to get it done correctly without bugs and with  most freedom
 
I have too on my DD game this exact system you want and it does not use any weapon models. And yes it's stable and all but since it requires a series of interactions + slam scripts it will take me too long try to explain it here. I would anyways say you better wait for DC to post his system which will be probably the better one. But just in case, you have me as an backup.  ;)

Ps: You are right, it really was a headache!
 
Sweet. That means you can use some (not all) of the newer binding access functions. They allow you to get binding properties. The old one could only set them, so you had to somehow keep track of binds yourself.

First thing, let's tackle release on interruption. I've modified a portion of my grapple system for you to use. It's fully self contained, supports grappling multiple entities at once and takes care of anything that might interrupt a slam or grab (time over, scripted damage, taking a hit, etc.). Here's how to use it.

[list type=decimal]
[*]Give the grabbing entity a takedamagescript.c if they don't already have one.
[*]In the takedamagescript, run this function. Its only argument is target (the grabbing entity).
[*]The function checks all entities in play for two conditions: A) In a grappled pose. You'll want to adjust this for your own module. B) Has a bind, and its bind target is the grappler (entities don't bind others to themselves, they bind themselves to other entities). If these conditions are met, the bound entity releases itself and takes a 0 damage attack to reset its animation/ai routines. You can modify this portion too if you don't want them reeling from a hit.
[/list]
 
That doesnt work as intended, and its crashing when enemy  doesnt hold anyone but is attacked, i also have enemy hands on top of player so theres 2 entities bind to enemy ,his hands and player
Code:
// Caskey, Damon V.
// 2018-08-27
// -- Modified for bwwd 2018-12-20
//
// Release all of the target entity's grappled
// targets. Call this when the target is damaged
// or gets interrupted some way before it can finish
// a grapple move.
int dc_grapple_release_all(void target)
{
	
	int i;					// Loop cursor.
	int entity_count;		// Entites on screen.
	int entity_exists;		// Entity cursor is not a dangling pointer.
	void entity_cursor;		// Entity in loop.
	int drop;				// Falling state.
	void binding;			// Binding property.
	void bind_target;		// 
	int animation_current;
	int release_count;		// How many entities have been released?

	release_count = 0;
	entity_count = openborvariant("count_entities");

	// Loop through entity collection.
	for (i = 0; i < entity_count; i++)
	{
		// Get entity cursor for this loop increment.
		entity_cursor = getentity(i);

		// Make sure we got a valid target pointer.
		if (!entity_cursor)
		{
			continue;
		}

		// Make sure the entity exists in play. We perform this
		// check because it's possible for an entity to be
		// removed but its pointer is still valid.
		entity_exists = getentityproperty(entity_cursor, "exists");

		if (!entity_exists)
		{
			continue;
		}

		// In a grappled pose?
		animation_current = get_entity_property(entity_cursor, "animation_animation");

		if (animation_current != openborconstant("ANI_FOLLOW12"))
		{
			continue;
		}

		// Bound to function's target?
		binding = get_entity_property(entity_cursor, "binding");
		bind_target = get_binding_property(binding, "target");

		if (bind_target != target)
		{
			continue;
		}

		// Reelase bind and knock entity down to ensure
		// it is "reset".
		set_binding_property(binding, "target", NULL());
		damageentity(entity_cursor, target, 0, 0, openborconstant("ATK_NORMAL"));

		// Increment reelase count;
		release_count++;
	}

	return release_count;
}
 
bWWd said:

Well it is a quick modification I made from a much larger piece. I'm using it right now without any problems at all. Mind showing me your full implementation in takedamage.c?

As for hands, you'll just need to add a filter somewhere in the loop so it ignores them. FYI, in a for loop, continue is similar to break, but it doesn't stop the whole loop, just immediately ends that iteration of the loop.

Code:
if(<some condition that identifies the hands>)
{
     continue;
}
 
What i posted in previous post is my rel.c script which is in header as takedamagescript
Code:
  grabdistance 40
  grabback 1
 cantgrab 1
 paingrab 1
 falldie  2
nodieblink  1
   jugglepoints  20
 animationscript  data/scripts/ani.c
 takedamagescript   data/scripts/rel.c
   bounce  1
   score 1 -1
 aimove chasez
  weapons  footkn
 modelflag 3
  weaploss 3
  projectilehit  enemy obstacle
   subject_to_platform  1

Whats "animation_animation" property  in  animation_current = get_entity_property(entity_cursor, "animation_animation"); ?
Theres some stuff in script that i dont know if are typos or new properties , i only know :
"animating",
"animation",
"animationid",
"animheight",
"animhits",
"animnum",
"animpos",
"animvalid",
And i used animationid to check if enemy is in follow12 but that didnt work...
Having this in takedamage will run this script everytime enemy gets hit and i dont want that, whats other easy way to bring back player to idle if enemy is attacked while grabbing player ?
 
bWWd said:
Having this in takedamage will run this script everytime enemy gets hit and i dont want that, whats other easy way to bring back player to idle if enemy is attacked while grabbing player ?

That's the entire point. No other way is 100% stable, full stop. Besides, why do you care? The function is extremely fast. And you still didn't show me how you ran it. If all you did was copy it verbatim into a takedamage.c file of course it will crash. You need to run it from main(). I assumed you already knew that since you've done some scripts before.

Code:
void main()
{
     void ent = getlocalvar("self");
     
     dc_grapple_release_all(ent);
}

// Caskey, Damon V.
// 2018-08-27
// -- Modified for bwwd 2018-12-20
//
// Release all of the target entity's grappled
// targets. Call this when the target is damaged
// or gets interrupted some way before it can finish
// a grapple move.
int dc_grapple_release_all(void target)
{
	
	int i;					// Loop cursor.
	int entity_count;		// Entites on screen.
	int entity_exists;		// Entity cursor is not a dangling pointer.
	void entity_cursor;		// Entity in loop.
	int drop;				// Falling state.
	void binding;			// Binding property.
	void bind_target;		//
	int animation_current;
	int release_count;		// How many entities have been released?

	release_count = 0;
	entity_count = openborvariant("count_entities");

	// Loop through entity collection.
	for (i = 0; i < entity_count; i++)
	{
		// Get entity cursor for this loop increment.
		entity_cursor = getentity(i);

		// Make sure we got a valid target pointer.
		if (!entity_cursor)
		{
			continue;
		}

		// Make sure the entity exists in play. We perform this
		// check because it's possible for an entity to be
		// removed but its pointer is still valid.
		entity_exists = getentityproperty(entity_cursor, "exists");

		if (!entity_exists)
		{
			continue;
		}

		// In a grappled pose?
		animation_current = get_entity_property(entity_cursor, "animation_animation");

		if (animation_current != openborconstant("ANI_FOLLOW12"))
		{
			continue;
		}

		// Bound to function's target?
		binding = get_entity_property(entity_cursor, "binding");
		bind_target = get_binding_property(binding, "target");

		if (bind_target != target)
		{
			continue;
		}

		// Reelase bind and knock entity down to ensure
		// it is "reset".
		set_binding_property(binding, "target", NULL());
		damageentity(entity_cursor, target, 0, 0, openborconstant("ATK_NORMAL"));

		// Increment reelase count;
		release_count++;
	}

	return release_count;
}
 
When i use it then my enemy hands stay onscreen when player is released even if i have animid 4 in bindentity and it works properly without takedamagescript(just removes itself like it should with flag 4).
Ive got one situation, to solve, player gets hit while grabbed and falls but enemy still stays in his grab animation, i cant check this enemy opponent animation (player animation) because player is not his opponent anymore, hes opponent of that other enemy who just hit player.
---
Got it working a bit different, i parented enemy to player , on player fall and hit anims i setidle to parent and nullify parent
How i can access child of the parent from other parent animations ?
 
Hi! I stumbled upon this thread while trying to get an enemy to grab a player, thanks specially Damon Caskey. May I use your script to implement a back grab for enemies to hold the player, SoR-style? Thanks in advance.

Edit: Nevermind, I already deduced it, but now my question is: is possible for other enemy to damage the player while is being held by an enemy during the slamstart/bind combo? (Like TMNT Turtles in Time, where a foot could grab hold of the player) Thanks again!
 
Back
Top Bottom