- Home /
Don't restart game after killing Orb
Hi everyone.
I'm using the 3rd Person Shooter of Unity 3.
When i killed the Orb, the game restarts. But i won't let the game restart after killing the Orb. And i want to remove the Healthbar of the Orb on the screen. What should i do to fix that. You can see the example how i want it in the first minute of this video: Pantera 3d Third Person Shooter Gameplay
Someone can help me maybe? Please
Thnx
This question is very difficult to understand. Perhaps reword it to explain what you are actually doing.
Answer by FourSheds · Jun 26, 2011 at 06:58 AM
It's the DeathManager script on the Controller object that is controlling the restart. If you comment-out these lines:
/*if (hc.tag == "Player")
StartCoroutine(PrepareRestart(false));
else {
StartCoroutine(PrepareRestart(true));
}*/
...you'll find that the game no longer restarts. If you killed the Orb, you'll need to Instantiate() another one!
If you want the player to respawn:
Change the code above to this, and notice the new position of the / /.
if (hc.tag == "Player")
StartCoroutine(PrepareRestart(false));
/*else {
StartCoroutine(PrepareRestart(true));
}*/
Now the Orb will die without causing restart, and the player will respawn
If you want two Orbs, and you've duplicated the Orb in the scene, go to the Death Manager script on Controller, drag Orb2 on to the word "Entities", and this will add a 3rd element to the array of objects being controlled by Death Manager. Now it will die.
A good exercise would be to make a copy of the Progress Bar script, add this to "Controller" so it has 3 Progress Bars, and modify it so it is below the other one and monitors Orb2.
were should i place this in the deathmanager? Because this is exact what's in the script. What should i do with that?
Place that code between / and / (as in my answer).
Those symbols will prevent the block of code between from running (called commenting out). Alternatively, you could delete that section of code, but it's sometimes safer to comment-out, as you can use/edit it again later if you need to.
And how can i remove the Healthbar of the Orb? I sorry but i'm still a noob
O$$anonymous$$, I'll try to give you an answer that involves no coding:
In the Hierarchy, select 'Controller', then in the Inspector, switch off the Progress Bar Script. This will prevent the health bars from being displayed.
Then select 'Orb' , find the Health Controller script in the Inspector and set $$anonymous$$ax Health to a large number like 10000000. Do the same for the 'Human'. This will ensure the player or the orb will not die. (well, unless you play a single game for a month!)
It's working :D Thank you. But one little problem, when i add an other Orb. Just the first one can die. The other can't die. I was shooting for 5 $$anonymous$$utes at him, (He has 100 Hitpoints) but he won't die. The first one died in a $$anonymous$$ute, but the other not, he can't die :S.
And maybe you can help me with an other question i asked it in an other Ask A Question. $$anonymous$$aybe you know what's the problem.
http://answers.unity3d.com/questions/135802/3rd-person-shooter-shadow-problem.html
Here is my other question about the shadow of the Human if he died.