- Home /
Question by
Borzi · Apr 18, 2013 at 06:11 PM ·
multiplayerfpshealth
Bleeding and Health Generation Skript
Hey guys :) Im currently working on an FPS project and I created this fairly simple skript for Health generation, with the mechanic that the player can bleed out if he looses too much health. I get a compound error from unity saying this: 'js(43,1): BCE0044: expecting }, found ''.
I was wondering if you could help me out sorry if I made some simple mistakes im still learning :D
#pragma strict
var MaxHealth = 80.0;
var health = MaxHealth;
//Time Till the Player starts to Regenerate after timer Trigger
var regenTime = 100.0;
//How fast the Player Regenerates
var regenSpeed = 1.0;
//Time till the player starts to Bleed after timer Trigger
var bleedTime = 10.0;
//How fast the Player Bleeds
var bleedSpeed = -1.0;
//Timer for Regeneration/Bleeding
private var timer = 0.0;
function Start () {
}
function Update ()
{
if(health<=0)
die();
if(health<=21){
if(timer<regenTime) {
timer+=0.1;
}else{
health += regenSpeed/10;
}
if(health>=20){
if(timer<bleedTime) {
timer+=0.1;
}else{
health -= bleedSpeed/20;
}
}
}
Comment
Best Answer
Answer by LesPaul · Apr 18, 2013 at 07:58 PM
On line 28 you open the if(health<=21){ bracket. You need to close this bracket on line 34
Your answer
Follow this Question
Related Questions
Bullet Fire script not working 1 Answer
Restricted Area 2 Answers
How to run a script to only 1 player in a multiplayer fps 1 Answer
Shooting and health Help 0 Answers
Photon Combat script does not work 0 Answers