spawnbind with dasher or move

jonsilva

New member
hello
iam making an enemy that is about 10 times the size of the player
ive divide it into parts legs /torso /hands
and used spawnbind to connect it...

to make the parts move ive been using offset in -/+ 5 pixels up/down

but its taking a lot of frames of the same image
for example when he trows a punch i have to add about 70 images with the offset going y -5 until the hand reaches the floor...

now iam trying to add a tail to the enemy... to make a far back/low back attack...

if i could use the commands dasher / move together with spawnbind/spawngun it would be a lot easear and i could move the parts more freely..

is there a way to make a spawnbind entity move with @cmd dasher ???
 
Well you can't merge bind and move entity at once. Entity is bound so it can't move nor be moved.
If you want entity to move, it mustn't be bound.

Outside the box, for the purpose you're aiming, I usually have it like this:
1. Make master and slaves entities. Master usually main body while slaves are its limbs
2. Master controls slaves' movement directly. To avoid control conflict with gravity, all slaves are set to be unaffected by gravity

With this, when master move a slave, it simply set velocity to it for certain time before stopping it. Master is not moving at this action.
If master has to move together it can:
1. Simply move slaves with same velocity as it has
2. Bind slaves to it then unbind it after moving is done

#1 is great for static bosses while #2 is great for moving bosses

The tough part about this method is calculating movement of slaves. You have to calculate it so you can return them later
 
it seems complicated...
ive put the main body following the player with subtype chase
and the other parts making the attacks...

but can you tell me how to unbind the spawn entity...
how can i change the (bindentity) to (unbindentity) without having to spawn the enemie part again ?

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

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

i could do it the animation between frames
 
but its taking a lot of frames of the same image
for example when he trows a punch i have to add about 70 images with the offset going y -5 until the hand reaches the floor...
Don't do this. This defeats all the propouse of to have separated parts for each part of the char. Once you connect the entities, you just move the master and all the slaves moves togheter.

If you wanna just move parts in a separate way, moving front/back or up/down, its not too hard. But if you wanna to make it bend, like if was a snake made of many parts and bending/rotating each part...than you will need to use Beziér Curves and this is a NIGHTMARE to do, because of the joints (control points). The more control points (bends) you have, the harder it gets.
 
like if was a snake made of many parts and bending/rotating each part...than you will need to use Beziér Curves and this is a NIGHTMARE to do, because of the joints (control points). The more control points (bends) you haver, the harder it gets.

i know... i think people usually do that with some kind of application...

ive just found this script
void move(int dx, int dz,int da)
{ // Moves entity freely or ignores obstacles
    void self = getlocalvar("self");
    int x = getentityproperty(self,"x"); //Get character's x coordinate
    int z = getentityproperty(self,"z"); //Get character's z coordinate
    int a = getentityproperty(self,"a"); //Get character's a coordinate
    int dir = getentityproperty(self,"direction"); //Get character's facing direction

    if(dir==0){ // Facing left?
      changeentityproperty(self, "position", x-dx, z+dz, a+da); //Move
    }
    else if(dir==1){ // Facing right?
      changeentityproperty(self, "position", x+dx, z+dz, a+da); //Move
    }
}

it moves with position instead of velocity...
if the x and a could be altered to the offset x y it might be easer to make the parts move
 
Here are the extra functions for the purposes I mentioned above:

Code:
void spawnGun(void Name, float dx, float dy, float dz, int Num)
{ // Spawn gun, store it and bind it
   void self = getlocalvar("self");
   void Spawn;

   Spawn = spawn01(Name, dx, dy, dz);
   setentityvar(self, Num, Spawn); // Stores spawned gun to be killed later
   bindentity(Spawn, self, dx, dz, dy, 0); // Bind spawned gun
}

void GunControl(int Num, int Flag, float dx, float dy, float dz)
{ // Bind or release bound gun based on number
    void self = getlocalvar("self");
    void Gun = getentityvar(self, Num);

    if(Gun!=NULL()){
      if(Flag==0){
        bindentity(Gun, NULL());
      } else if(Flag==1){
        bindentity(Gun, self, dx, dz, dy, 0);
      }
    }
}

void killgun(int Num, int Flag)
{ // Kill bound gun based on number
    void self = getlocalvar("self");
    void Gun = getentityvar(self, Num);

    if(Gun!=NULL()){
      bindentity(Gun, NULL());
      if(Flag==1){
        damageentity(Gun, self, 1000, 0, openborconstant("ATK_NORMAL"));
      } else {
        killentity(Gun);
      }
    }
}

void dasherSl(int Num, float Vx, float Vy, float Vz)
{// Dash Slave with desired speed!
// Num = Slave number
// Vx = X Velocity
// Vy = Y Velocity
    void self = getlocalvar("self");
    void Slave = getentityvar(self, Num);
    int dir = getentityproperty(self,"direction");

    if(dir==0){ // Facing left?
      Vx = -Vx ;
    }

    changeentityproperty(Slave, "velocity", Vx, Vz, Vy); //Move!
}

void anichangeSl(int Num, void Ani)
{// Change Slave's animation
// Num = Slave number
// Ani = Desired animation
    void self = getlocalvar("self");
    void Slave = getentityvar(self, Num);

    changeentityproperty(Slave, "animation", openborconstant(Ani));
}

Yes, I know I'm inconsistent. Some functions call slave with gun but both refer to same entity in this case.

Try playing around with this. I used these to make Great Dragon from D&D ;)
 
thanks for the scripts bloodbane :)
ill use it in an older boss ive made witch is a static vehicle that only moves foward and back with a crane on top. and in future enemies.

ive just finish made this tall boss i dindt made him do an attack animation were he stops moving when the player is in certain range...
he keeps chasing the player and attacking...

this seems a complete diferent from of attack i would had to erase all the txt files and start writen new ones... making those files gave me a big headache :o
 
Back
Top Bottom