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
0
Question by Lil_Rimmy333 · May 01, 2013 at 10:50 AM · collisionattackzombie

My attack script is broken, please help.

Right, a bit of explaining for this first. Ok, so I was working on my game, and I had a short hiatus due to lots of school assignments. When I came back, I kept having the issue of "Internal Complier Error". I tried as hard as I could, but no matter what, I couldn't find the problem. Until, that is, I found an empty file. I deleted it. And then the complier error was fixed.

Problem is, I thought the source of the problem was my zombie attack script, as that was the last thing I had been scripting when the error appeared. So that meant after weeks of frustration, I tore the script apart, testing and testing, trying to find out what the issue was.

And when the issue was fixed and script returned, it won't work anymore. I have re-written it, searched online, copied other scripts to try them, but nothing will work. As in, I can fix the compiler errors, that's easy, but the problem is that the zombies will rush the player, then just kind of float on his head, doing no damage and just clipping into him.

So, last resort, I am posting any related scripts here in a desperate hope for help. It just seems to not work, and I have no idea why. Please help.

Zombie Attack Script:

 var damage = 10;
  
 function OnCollisionEnter(col : Collision) {
 if(col.gameObject.tag=="Player"){ 
 col.gameObject.BroadCastMessage("HealthDamage", damage, SendMessageOptions.DontRequireReceiver);
  }
 }

Note, that is not my original script. I have tried tons of different scripts, and tried combining some, but nothing works.

Player Health Script:

 var PlayerMaxHealth : int = 100;
 var PlayerCurrentHealth : int;
 var ZombieDamage : int = 25;
 
 function Start () {
 
 PlayerCurrentHealth = PlayerMaxHealth;
 
 }
 
 function OnGUI () {
 
 GUI.Label (Rect (40, 40, 150, 40),"Health: " + PlayerCurrentHealth);
 
 }
 
 function HealthDamage (damage : int) {
     
     PlayerCurrentHealth -= damage; 
     
 }
 
 function Update () {
 
 
 if ( PlayerCurrentHealth <= 0){ // if life reached 0 load level ShowScore
         Application.LoadLevel("ShowScore");
        
               
                                   
 }
 
 }


I also have some scraps of code that I saved, I believe this is the closest I have left to my original code, but this isn't a functioning script, but merely a notepad of code.

 enter code herefunction OnCollisionEnter (col : Collision) {
     col.gameObject.BroadCastMessage("ApplyDamage", ZombieAttack, SendMessageOptions.DontRequireReceiver);
 
 
 
 var ZombieAttack : int = 25;
  
 
 
 function Start () {
 
 
 
 }
 
 function OnTriggerEnter (collision : Collider) 
 {
     if (collision.CompareTag ("Player")) // Need to call CompareTag!
     {
         var options = SendMessageOptions.DontRequireReceiver;
         collision.SendMessage("ApplyDamage");
 
 }
 }


I am happy to post anything else that could help, but I am really out of ideas. Please help.

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Fornoreason1000 · May 01, 2013 at 11:18 AM

"Internal Complier Error" is bad news... Internal compiler errors usually have nothing to do with your scripting ... (though they can be made by overlapping Generics in C#.) errors like these should be Bug reported. sometimes restarting Unity fixes them. there's isn't really much you can do.

also this isn't the first time this question has been answered. the devs tend to get anal over duplicated questions.

try googling "Unity Internal Compiler Error".

Comment
Add comment · Share
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

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

13 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

Related Questions

Ai Zombie Melee Attack script. 5 Answers

Zombie attack script help 1 Answer

How can I make my Axe in unity do damage to my Zombies 6 Answers

Attack Script 1 Answer

Script Attack zombie 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