Bind entity lower and upper body separate

danno

Moderator
Staff member
https://www.youtube.com/watch?v=wZsAsUfkhbc

Hey Guys, I finished  a two sided character using 2 different entity's, pressing left or right loads a different model, ran into a few problems doing this. when using a keyboard left and right can be pressed simultaneously which causes animation errors and loads the wrong model.

back to the drawing board

I need help with bind entity

The idea is to have the walk animations as just legs

NE8X5Hc.gif


and each animation is spawn binded to those legs on top

ukBu2uo.gif


I need help doing that and how to go about it
 
If you are loading the model over and over, rather than spawning it by ID, that will likely cause some glitches due to the slight delay of OpenBOR checking the model database to see if what you want is already loaded (and reloading if it isn't). Without seeing your code I'm not 100% sure if that's what you're doing though.

As for the back and forth on both keys, the way I would handle it is whenever a direction key is pressed, store it in a localvar. Then during the held direction key check, if both are active, look up the last key press you stored earlier, and use that as your direction. This way the last key pressed and held wins, same as the engine's native walking behavior.

If THAT doesn't work, then you could always move it to the onmovex scripts and base the bind on which direction you last moved.

HTH,
DC
 
another problem I forgot to mention Damon is syncing all the walk animations together

Code:
anim	idle
	loop	1
	delay	1
	bbox	10 4 27 71
	offset	25 74
        sync    follow5 idle walk
	@cmd	keyint "ANI_FOLLOW2" 0 "U" 0 0
	frame	Data/CHARS/robo/i1.gif

Code:
anim	walk
	loop	1
	delay	16
	offset	28 106
	bbox	18 38 23 68
        sync    follow5 walk idle
	frame	Data/CHARS/robo/w1.gif
	frame	Data/CHARS/robo/w2.gif
	frame	Data/CHARS/robo/w3.gif

Code:
anim follow5 #walkaimdown
	loop	1
	delay	16
	offset	28 106
	bbox	16 37 23 68
        sync    walk follow5 idle
	frame	Data/CHARS/robo/wd1.gif
	frame	Data/CHARS/robo/wd2.gif
	frame	Data/CHARS/robo/wd3.gif

I use keyscrpt to perform animations that I'm trying to sync but it seems to override the sync funtion

Code:
if(vAniID == openborconstant("ANI_FOLLOW2")){	// aim up?
		if (iRight){ // New key status of right pressed
			changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW4"));
			changeentityproperty(vSelf, "direction", 1); // Change to right facing
			changeentityproperty(vSelf, "velocity", 0.6, 0, 0); //Move
		}
}

if(vAniID == openborconstant("ANI_FOLLOW4")){ // walk aim up?
		if (iRightR || iUpR){ // up right key released?
			changeentityproperty(vSelf, "velocity", 0, 0, 0); //Stop
			setidle(vSelf, openborconstant("ANI_IDLE")); //Set idle	
		}
}

Not syncing the different walks looks crappy, will binding separate animations together to make a whole entity also override sync function? I'd like to avoid using keyscripts as much as possible.



 
Honestly I wouldn't do that (using keyscripts to walk and have different walk animations for aiming). Much as I love script, you generally want to build script around native functionality, not the other way around. I'd have to look into the engine code really closely to see where Sync applies in order of operations - but I can almost guarantee setting animations with script overrides and effectively breaks it. Which, is in reality a GOOD thing. You WANT script to take precedence over native functionality, because that makes the engine more versatile. But again, it means the way you are currently going about things probably won't work very well.

I would make the main entity the legs, not the upper body. Then I'd use the keyscripts to decide how the upper body binds and behaves (aiming, etc.), while the engine handles walking natively. Sync will work much better that way, and I think you'll find it easier overall.

HTH and I understand you correctly,
DC
 
You wouldnt need sync when legs are your player, cause you dont need other walks , just bind separate entity on spawn and control it in walk by intercepting key presses
 
Thanks guys, So I'll need a key press (bind) key release (unbind) function in keyscripts for upper body

I have bind sorted, so in idle animation as soon as I press right (walk) I bind entity "UW1"

function

Code:
if(vAniID == openborconstant("ANI_IDLE") ){
      if(iRight){ //right?
        spawnbind("UW1", -1, 41, 0, 1, 0);

		}
	}

script

Code:
void spawnbind(void Name, float dx, float dy, float dz, int iDir,int iBind)
{ // Spawn and bind other entity
   void self = getlocalvar("self");
   void Spawn;

   Spawn = spawn01(Name, dx, dy, 0);
   bindentity(Spawn, self, dx, dz, dy, iDir, iBind);
}

But after a few hours of trying different functions and scripts I can't get iRightR to work during walk anim

https://www.youtube.com/watch?v=rhbnT8Q5JtY

 
I've tried everything I can think of but unbinding entity via key release is beyond my skill set at the moment, every unbind script I've come across just doesn't work in keyscript.  I have a feeling some script might work in entity's animation data but I'm not exactly sure how.
 
Back
Top Bottom