negative captain, with the extra continue clause jack now doesn't interact at all.
C:/* * Caskey, Damon V. * 2023-01-26 - Refactored from inline * code by danno. * * Accept range and animation parameters. * * If an ally is within range, set both * entities to accepted animations. */ void dc_team_attack(int range_x, int range_y, int range_z, int ally_position_y_min, int ally_position_y_max, int acting_animation, int ally_animation) { void acting_entity = getlocalvar("self"); void ally_entity = NULL(); int ally_direction = openborconstant("DIRECTION_RIGHT"); float ally_position_y = 0.0; int acting_direction = openborconstant("DIRECTION_RIGHT"); int entity_count = 0; int cursor = 0; int ally_animation_old = 0; int ally_type = openborconstant("TYPE_NONE"); int distance_x = 0; int distance_z = 0; char ally_model_name = ""; /* * Get entity count and start looping. * */ entity_count = openborvariant("count_entities"); for (cursor = 0; cursor < entity_count; cursor++) { /* * Get entity from index curosr. Make sure * it is valid before moving on. */ ally_entity = getentity(cursor); if (!ally_entity) { continue; } /* * The model text checks downstream are * slow. Let's optimize a bit by eliminating * entity types we don't care about first. */ ally_type = getentityproperty(ally_entity, "type"); if (!(ally_type & (openborconstant("TYPE_PLAYER") | openborconstant("TYPE_NPC")))) { continue; } ally_animation_old = getentityproperty(ally_entity, "animationID"); /* * Compare animations. If entity is not * in one of the desired animations then * we move on. */ ally_animation_old = getentityproperty(ally_entity, "animationID"); if (ally_entity != openborconstant("ANI_FORWARDJUMP") && ally_entity != openborconstant("ANI_RUNJUMP")) { continue; } /* * Check models. */ ally_model_name = getentityproperty(ally_entity, "name"); if (ally_model_name != "Chris" && ally_model_name != "Hong") { continue; } /* * Check absolute positions. */ ally_position_y = getentityproperty(ally_entity, "y"); if (ally_position_y < ally_position_y_min && ally_position_y > ally_position_y_max) { continue; } /* * Check range. */ distance_x = getRange(acting_entity, ally_entity, "x", 0); distance_z = getRange(acting_entity, ally_entity, "z", 0); if (distance_x > range_x || distance_z > range_z) { continue; } /* * Now we know we have a valid ally and it * can perform the team attack. Get direction * values and set up accordingly. */ ally_direction = getentityproperty(ally_entity, "direction"); acting_direction = getentityproperty(acting_entity, "direction"); if (ally_direction == openborconstant("DIRECTION_RIGHT")) { if (acting_direction == openborconstant("DIRECTION_LEFT")) { performattack(ally_entity, ally_animation); changeentityproperty(acting_entity, "direction", openborconstant("DIRECTION_LEFT")); performattack(acting_entity, acting_animation); } else { performattack(ally_entity, ally_animation); changeentityproperty(acting_entity, "direction", openborconstant("DIRECTION_RIGHT")); performattack(acting_entity, acting_animation); } } else { if (acting_direction == openborconstant("DIRECTION_LEFT")) { changeentityproperty(acting_entity, "direction", openborconstant("DIRECTION_LEFT")); performattack(ally_entity, ally_animation); performattack(acting_entity, acting_animation); } else { performattack(ally_entity, ally_animation); changeentityproperty(acting_entity, "direction", openborconstant("DIRECTION_RIGHT")); performattack(acting_entity, acting_animation); } } } }
typo's fixed
Oh, I see the problem. Between deadlift sets right now, lol. Soon as I'm out of the gym ill post the fix.
DC