3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: 1 [2]

Author Topic: Zombie Respawn - Script HELP!  (Read 2056 times)

« Reply #15 on: July 03, 2011, 10:22:03 AM »
Code: [Select]
if(IN_44<=0){
    limbo++;
     OUT_22 = 0;
    if(limbo==8){
     // hide the zombie
      iObjectHide(zombiemesh);
   
    }
So like that.
« Reply #16 on: July 03, 2011, 10:22:44 AM »
So like this
Code: [Select]
if(IN_44<=0){
    limbo++;
     OUT_22 = 0;
    if(limbo==8){
     // hide the zombie
      iObjectHide(zombiemesh);
   
    }
« Reply #17 on: July 03, 2011, 10:55:46 AM »
Well this is extremely weird
I have
Code: [Select]
//int health=100;
int limbo=0;
Vector3  spawnpoint;
int zombiemesh = OBJ_22;
int zombiechar = OBJ_88;
int zombierigid = OBJ_110;
int zombiepath = OBJ_132;
int zombie_Body = OBJ_22;
//int health = IN_44;
void Main(){

  if(iInitializing()){
  // spawnpoint=Vector3(x,y,z,"xyz");
   //spawnPoint[1]=Vector3(x,y,z,"xyz");
   //spawnPoint[2]=Vector3(x,y,z);
   iObjectLocationSet(zombiemesh,Vector3(-35,3,-10));
  }

  //get health
  if(IN_45<=0){
    limbo++;
     OUT_22=0;
    if(limbo==8){
      iObjectHide(zombiemesh);
      iObjectHide(zombiechar);
      iObjectHide(zombierigid);
      iObjectHide(zombiepath);
   
    }
    if(limbo>=8){
      limbo=0;
      OBJ_45=100;
      iObjectLocationSet(zombiemesh,Vector3(-35,3,-10));
      iObjectReset(zombiemesh);
    }
  }

}
And it seems to be working so far. But everytime I run it and go back to editing the ValuePrint is missing from the Object Handles list and I have to make a new valuePrint everytime. I tried un-attaching and re-attaching the ValuePrint but it doesn't show up???
« Reply #18 on: July 03, 2011, 12:05:16 PM »
that value print thing is weird... it shouldn't be happening...

but yeah... you seem to have gotten the hang of it...

just set up some spawn points (Vector3(0,0,0) for example, but make sure they're points on the terrain)... and you're set...

good luck...


--Mike
« Reply #19 on: July 04, 2011, 09:24:39 PM »
Code: [Select]
int health=100;
int respawn_delay=0;
bool respawn = false;
Vector3  location;
int zombiemesh = OBJ_22;
int zombiechar = OBJ_88;
int zombierigid = OBJ_110;
int zombiepath = OBJ_132;
int zombie_Body = OBJ_22;
int zombiedeath = OBJ_286;
int zombiesound = OBJ_154;
int zombiecounter = OBJ_264;
void Main(){

   if(IN_487 > 0 ){
      health -= 50;
   }
  if(health<=0){
    respawn_delay++;
    if(respawn_delay==8){
      iObjectHide(zombiemesh);
      iObjectStop(zombiemesh);
      iObjectStop(zombiechar);
      iObjectHide(zombierigid);
      iObjectStop(zombiepath);
      iObjectStop(zombiesound);
      OUT_24 = 3;
      respawn = true;
}
    }
   if(respawn == true){
    if(respawn_delay>=200){
      respawn_delay=0;
      health=100;
      iObjectShow(zombiemesh);
      iObjectStart(zombiepath);
      iObjectStart(zombiesound);
      iObjectStart(zombiechar);
      iObjectShow(zombierigid);
      iObjectReset(zombiecounter);
      iObjectLocationSet(zombiemesh,Vector3(-20,3,-10));
      OUT_22 = 1;
   }
  }
}
So far thats working when he dies it waits 200ms. Then it starts every part up again..but it doesn't reset the location..it continues from were it died at.
« Reply #20 on: July 05, 2011, 02:41:34 PM »
the mesh is linked to a character rigidbody...

it'll always stay with the rb... 

you've gotta reposition the rb, not the mesh... in this line of code below...

Code: [Select]
      iObjectLocationSet(zombiemesh,Vector3(-20,3,-10));
--Mike
« Last Edit: July 05, 2011, 02:43:08 PM by Mike Hense »
« Reply #21 on: July 05, 2011, 02:44:42 PM »
the mesh is linked to a character rigidbody...

it'll always stay with the rb... 

you've gotta reposition the rb, not the mesh... in this line of code below...

Code: [Select]
      iObjectLocationSet(zombiemesh,Vector3(-20,3,-10));
--Mike
Yea, Robertoo informed me of this :D Thanks a lot. I got him to spawn in random locations. Much obliged.
« Reply #22 on: July 05, 2011, 03:09:33 PM »
cool...

--Mike
Pages: 1 [2]