I just gave it a try the way I had it in mind earlier, try this:
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <mtlFX.c>
///////////////////////////////
//Tentacle Test
var segments = 50;
var roots = 20;
var speed = 3;
#define nextSegment skill10
void segmentsCreate(ENTITY* eParent, int numSegments)
{
ENTITY* eNewSegment = ent_create("tentacle.mdl",eParent.x,NULL);
set(eNewSegment,PASSABLE);
eNewSegment.material = mtl_specBump;
eNewSegment.scale_x = eParent.scale_x * .95;
eNewSegment.scale_y = eNewSegment.scale_x;
eNewSegment.scale_z = eNewSegment.scale_x;
eParent.nextSegment = eNewSegment;
if(numSegments > 0) segmentsCreate(eNewSegment, numSegments-1);
}
action creature()
{
set(my,INVISIBLE | UNLIT);
int i;
for(i = 0; i < roots; i++)
{
you = ent_create("tentacle.mdl",my.x,NULL);
you.material = mtl_specBump;
your.pan = random(360);
your.tilt = random(360);
your.roll = random(360);
segmentsCreate(you,segments);
my.skill[19+i] = you; // my.skill[19+0] is the same as my.skill20
}
var mainAngle = 0;
while(1)
{
mainAngle += speed*time_step;
for(i = 0; i < roots; i++)
{
ENTITY* eRoot = my.skill[19+i];
eRoot.pan += time_step;
eRoot.tilt += time_step;
eRoot.roll += time_step;
ENTITY* eSegment = eRoot.nextSegment;
ENTITY* eParent = eRoot;
var extraAngle = 0;
while(eSegment)
{
var angleAdd = 5 * sinv(mainAngle+extraAngle);
eSegment.pan = eParent.pan + angleAdd;
eSegment.tilt = eParent.tilt + angleAdd;
eSegment.roll = eParent.roll + angleAdd;
vec_for_vertex(eSegment.x,eParent,15);
eParent = eSegment;
eSegment = eSegment.nextSegment;
extraAngle += 10;
}
}
wait(1);
}
}
function main()
{
sky_color.red = 0;
sky_color.green = 57;
sky_color.blue = 77; // bright blue sky
video_mode = 10;
random_seed(0);
d3d_antialias = 9;
max_entities = 9999;
level_load(NULL);
ent_create(CUBE_MDL,nullvector,creature);
camera.x -= 150;
def_move();
}
Number of roots is limited (by 80 or 100 if you change the code), segments "unlimited", you could vary their lengths as well.
Personally, I'd make this all one model though, as you want to keep the number of objects low.
One model, let's say 9 tentacles, which are rotated via bones around the origin. The actual tentacle movement would be realized with a vertex shader that does all the heavy lifting, and you're good.