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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by Dreadnaught666 · Feb 25, 2014 at 04:06 PM · enemyweaponattackrpg-gamehealth

how do I edit enemy stats

So I am new to unity, I searched the Forums and haven't found an answer to my question. Basically, I want to have different sized monsters with different healths, attack, etc. The closest thing I could find applies to all of a type of monster, not each monster individually. Do I have to write a different script for each one, or is there something else I can do?

Thanks for the advice, however, the monster I am used is a prefab, from the Skeleton asset pack. I don't understand how to properly edit these monsters.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Klarax · Feb 25, 2014 at 04:31 PM

This ?

http://answers.unity3d.com/questions/247521/using-thistag-as-a-variable.html

Comment
Add comment · Show 1 · 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
avatar image Dreadnaught666 · Feb 25, 2014 at 05:28 PM 0
Share

Thanks, this might help, but can I make the variable applicable to a height? So that I just make a monster a certain height and the variables are applied automatically?

avatar image
0

Answer by Regalith · Feb 25, 2014 at 05:32 PM

Just create a prefab for each monster, and set the variables you want to set yourself to public variables

in javascript its

 public var variable: variableType;

in c# its

 public variableType variable;

once you set them to public, when you click on the object in your scene, you can edit the variables in the Inspector

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
avatar image
0

Answer by gwubgwub · Feb 25, 2014 at 06:15 PM

depending on how random you want the monster sizes to be, if you want a hand full of different sized monsters you could make an array would hold your different sized monsters as prefabs and load them in randomly. For this have a look at http://unity3d.com/learn/tutorials/modules/beginner/scripting/arrays and http://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/infinite-runner

With the different health you could make a int that would generate a random number (health) when called on.

 int health =  (random.range(50,100));


maybe something like this I have not tested it but hopefully you can get an idea.

Comment
Add comment · Show 1 · 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
avatar image Dreadnaught666 · Feb 25, 2014 at 06:18 PM 0
Share

Thanks, this seems to be what I am looking for!

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

Show only selected enemy's health bar 1 Answer

Weapon and enemy health 0 Answers

Melee Damage script by collision 2 Answers

I use this script, but the enemy lose health if i don´t target him. 1 Answer

Attack,Health and enemy health. 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