Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
-1
Question by gamerX30 · Mar 06, 2014 at 02:47 AM · angry botscompile errors

im having a compile error

i dont usually do coding and this is my first time doing this this are the default coding that the unity free version had for me

pragma strict

public var maxHealth : float = 100.0; public var health : float = 100.0; public var regenerateSpeed : float = 0.0; public var invincible : boolean = false; public var dead : boolean = false;

public var damagePrefab : GameObject; public var damageEffectTransform : Transform; public var damageEffectMultiplier : float = 1.0; public var damageEffectCentered : boolean = true;

public var scorchMarkPrefab : GameObject = null; private var scorchMark : GameObject = null;

public var damageSignals : SignalSender; public var dieSignals : SignalSender;

private var lastDamageTime : float = 0; private var damageEffect : ParticleEmitter; private var damageEffectCenterYOffset : float;

private var colliderRadiusHeuristic : float = 1.0;

function Awake () { enabled = false; if (damagePrefab) { if (damageEffectTransform == null) damageEffectTransform = transform; var effect : GameObject = Spawner.Spawn (damagePrefab, Vector3.zero, Quaternion.identity); effect.transform.parent = damageEffectTransform; effect.transform.localPosition = Vector3.zero; damageEffect = effect.particleEmitter; var tempSize : Vector2 = Vector2(collider.bounds.extents.x,collider.bounds.extents.z); colliderRadiusHeuristic = tempSize.magnitude * 0.5; damageEffectCenterYOffset = collider.bounds.extents.y;

 }
 if (scorchMarkPrefab) {
     scorchMark = GameObject.Instantiate(scorchMarkPrefab, Vector3.zero, Quaternion.identity);
     scorchMark.SetActive (false);
 }

}

function OnDamage (amount : float, fromDirection : Vector3) { // Take no damage if invincible, dead, or if the damage is zero if(invincible) return; if (dead) return; if (amount <= 0) return;

 // Decrease health by damage and send damage signals

 // @HACK: this hack will be removed for the final game
 //  but makes playing and showing certain areas in the
 //  game a lot easier
 /*
 #if !UNITY_IPHONE && !UNITY_ANDROID && !UNITY_WP8
 if(gameObject.tag != "Player")
     amount *= 10.0;
 #endif
 */

 health -= amount;
 damageSignals.SendSignals (this);
 lastDamageTime = Time.time;

 // Enable so the Update function will be called
 // if regeneration is enabled
 if (regenerateSpeed > 0)
     enabled = true;

 // Show damage effect if there is one
 if (damageEffect) {
     damageEffect.transform.rotation = Quaternion.LookRotation (fromDirection, Vector3.up);
     if(!damageEffectCentered) {
         var dir : Vector3 = fromDirection;
         dir.y = 0.0;
         damageEffect.transform.position = (transform.position + Vector3.up * damageEffectCenterYOffset) + colliderRadiusHeuristic * dir;
     }
     // @NOTE: due to popular demand (ethan, storm) we decided
     // to make the amount damage independent ...
     //var particleAmount = Random.Range (damageEffect.minEmission, damageEffect.maxEmission + 1);
     //particleAmount = particleAmount * amount * damageEffectMultiplier;
     damageEffect.Emit();// (particleAmount);
 }

 // Die if no health left
 if (health <= 0)
 {
 if GameScore.RegisterDeath(gameObject);

     health = 0;
     dead = true;
     dieSignals.SendSignals (this);
     enabled = false;

     // scorch marks
     if (scorchMark) {
         scorchMark.SetActive (true);
         // @NOTE: maybe we can justify a raycast here so we can place the mark
         // on slopes with proper normal alignments
         // @TODO: spawn a yield Sub() to handle placement, as we can
         // spread calculations over several frames => cheap in total
         var scorchPosition : Vector3 = collider.ClosestPointOnBounds (transform.position - Vector3.up * 100);
         scorchMark.transform.position = scorchPosition + Vector3.up * 0.1;
         scorchMark.transform.eulerAngles.y = Random.Range (0.0, 90.0);
     }
 }

}

function OnEnable () { Regenerate (); }

// Regenerate health

function Regenerate () { if (regenerateSpeed > 0.0f) { while (enabled) { if (Time.time > lastDamageTime + 3) { health += regenerateSpeed;

             yield;

             if (health >= maxHealth) {
                 health = maxHealth;
                 enabled = false;
             }
         }
         yield WaitForSeconds (1.0f);
     }
 }

}

im having an error on the gamescore part Assets/default stuff/Scripts/Weapons/Health.js(95,17): BCE0005: Unknown identifier: 'GameScore'.

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image getyour411 · Mar 06, 2014 at 02:47 AM 1
Share

Please properly format this using 10101 button

avatar image xt-xylophone · Mar 06, 2014 at 03:41 AM 0
Share

You probably never declared the variable you have called GameScore.

and getyour411 is right, format the code properly. Its impossible to read.

avatar image abi-kr01 · Mar 06, 2014 at 05:01 AM 0
Share

go to edit section and press 101010 icon that will format ur code,which will be readable by users.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Compiling errors help? 0 Answers

Angry Bots sample: best practice? 0 Answers

unable to find a suitable compiler for sources with extension 'dll' 3 Answers

Angry Bots Audio Implementation 0 Answers

AngryBots bullet script problem 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges