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]

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

« on: June 29, 2011, 08:11:44 PM »
Hello I am trying to make zombies respawn on this game I am making.
So far i have
Code: [Select]
int group = OBJ_0;
int skinmesh = OBJ_22;
int valueprint = OBJ_44;
int zombiescript = OBJ_66;
int zombiechar = OBJ_88;
int zombierigid = OBJ_110;
int zombiepath = OBJ_132;
int zombiesound = OBJ_154;
bool dead = false;
bool reborn = false;
bool alive = true;
int zombiehealth = IN_44;

///-----------------------------------------------------
///                  Main                              |
///-----------------------------------------------------
void Main(){
if(alive == true){
if(zombiehealth <= 0){
   dead = true;
   Death(); //start death process
   }else{
   return;
   }
}
}

///------------------------------------------------------
///                   Death                             |
///------------------------------------------------------
void Death(){
if(dead == true){
   iObjectStop(group);
   iObjectHide(skinmesh);
   iObjectStop(zombiescript);
   iObjectStop(zombiechar);
   iObjectHide(zombierigid);
   iObjectStop(zombiesound);
   reborn = true;
   Reborn();
   }else{
   Main();
   }
}

///------------------------------------------------------
///                   Reborn                            |
///------------------------------------------------------
void Reborn(){
if(reborn == true){
   iObjectReset(group);
   iObjectReset(skinmesh);
   iObjectReset(zombiescript);
   iObjectReset(zombiechar);
   iObjectReset(zombierigid);
   iObjectReset(zombiesound);
   alive = true;
   dead = false;
}
Main();
}   
But every time I press spacebar to see if it works 3D freezes.
Is this code wrong??
Or what is it???

What this is supposed to do is when the valueprint = 0 it stops all parts of the zombies then resets them.

When I "Check Script" no errors come up.
« Reply #1 on: June 30, 2011, 09:23:31 AM »
This script makes absolutely NO sense. You are literally making up functions! Death() And you have to say OBJ_XXX whenever you return an iObject(Whichever) and the main is at the BOTTOM of the page instead of the near the TOP.
« Reply #2 on: June 30, 2011, 09:28:21 AM »
This script makes absolutely NO sense. You are literally making up functions! Death() And you have to say OBJ_XXX whenever you return an iObject(Whichever) and the main is at the BOTTOM of the page instead of the near the TOP.
What? it makes perfect sense.
This is what i have now
Code: [Select]
int group = OBJ_0;
int skinmesh = OBJ_22;
int valueprint = OBJ_44;
int zombiescript = OBJ_66;
int zombiechar = OBJ_88;
int zombierigid = OBJ_110;
int zombiepath = OBJ_132;
int zombiesound = OBJ_154;
int zombiehealth = OBJ_176;
int camera = OBJ_220;
int animationset = OBJ_242;
bool  alive = true;
bool reborn = false;
///-----------------------------------------------------
///                  Main                              |
///-----------------------------------------------------
void Main(){
if(alive == true){
   if(IN_44 <= 0){
      alive = false;
      }
   Death();
   }
}
///------------------------------------------------------
///                   Death                             |
///------------------------------------------------------
void Death(){
if(alive == false){
   iObjectStop(group);
   iObjectStop(skinmesh);
   iObjectStop(zombiescript);
   iObjectStop(zombiechar);
   iObjectStop(zombierigid);
   iObjectStop(zombiesound);
   iObjectStop(zombiepath);
  iObjectStop(animationset);
   reborn = true;
   Reborn();
   }else{
      return;
   }
}
///------------------------------------------------------
///                   Reborn                            |
///------------------------------------------------------
void Reborn(){
if(reborn == true){
   iObjectReset(OBJ_0);
   iObjectReset(OBJ_22);
   iObjectReset(OBJ_66);
   iObjectStart(OBJ_88);
   iObjectReset(OBJ_110);
   iObjectReset(OBJ_154);
   iObjectReset(OBJ_132);
   iObjectReset(OBJ_44);
   iObjectReset(OBJ_176);
   iObjectStart(animationset);
   iObjectShow(OBJ_198);//he is alive text
   alive = true;
   reborn = false;
}
return;
}
i did that last night.
But now when his health is at 0 it resets its positions but it doesn't move.
« Last Edit: June 30, 2011, 09:30:33 AM by miker95 »
« Reply #3 on: June 30, 2011, 09:48:17 AM »
It doesnt make much sense to me but okay I think you have to also reset the script or whatever makes it move and it's animation
« Reply #4 on: June 30, 2011, 09:52:08 AM »
It doesnt make much sense to me but okay I think you have to also reset the script or whatever makes it move and it's animation
Yea thats OBJ_66.
But whenever I kill him it just repeats the skinmesh animation.
Pages: [1]