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 user-3180 (yahoo) · Jul 25, 2010 at 05:06 PM · aiattackzombiemelee

Ai Zombie Melee Attack script.

Well i'm need my zombies to attack when when they are like right next to me. soo Is there a script i can download or copy and past to my zombie for attack cause i have very little scripting knowledge and so i can't piece together anything to make one. update The zombie already follows me and chasees me but he just doesnt attack cause i want to give him like an invisable gun the goes like 1 or 2 feet in range

Comment
Add comment · Show 2
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 MikezNesh · Jul 26, 2010 at 12:02 AM 0
Share

people dont just script for you. learn to do it yourself.

avatar image psychentist · Apr 20, 2011 at 04:40 AM 0
Share

I used a zombie for an example trying to explain to someone the basics of having an enemy attack, maybe this will help you.

http://answers.unity3d.com/questions/52970/creating-basic-enemy-animation-and-attacking

5 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by slkjdfv · Jul 25, 2010 at 05:33 PM

All you need to do is use a raycast going from your zombie to the player and when it reaches a certain distance you tell your zombie to attack. hope this helps :)

here's a script. this may not be accurate but try hit : raycast; Physics.RayCast(transform.position,player.position,10); if (hit.distance<30) { //attack code here }

Comment
Add comment · Show 7 · 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 user-3180 (yahoo) · Jul 25, 2010 at 05:39 PM 0
Share

?? i'm really bad at scripting? or is that not a scrpt

avatar image slkjdfv · Jul 25, 2010 at 05:42 PM 0
Share

it is a script this may not be accurate but try

hit : raycast; Physics.RayCast(transform.position,player.position,10) if (hit.distance<30) { //attack code here }

avatar image user-3180 (yahoo) · Jul 25, 2010 at 05:45 PM 0
Share

So do i make a new script and put only that line to it and attach it to my zombie?

avatar image slkjdfv · Jul 25, 2010 at 05:49 PM 0
Share

you can yea or you could add it to your zombies current script. just make it a function. What the following code does is at the end of the update code it calls the function we set up. which is below the update code. :) function Update() { //your code

CheckDistance(); } function CheckDistance() { paste code i gave you here }

avatar image user-3180 (yahoo) · Jul 25, 2010 at 05:59 PM 0
Share

Yea im sorry i sound so stupid but what... i Littoraly don't know anything of how to make a script or a Function... i'm srry but i need like a whole script i can just attach to my zombie and im done... thats all

Show more comments
avatar image
1

Answer by MP2fps · Dec 06, 2011 at 07:54 AM

It would probably be good just to fiddle with scripts just to know what a function is or you could even google it

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
1

Answer by 09jgriffin · Mar 17, 2012 at 01:41 PM

if you have 2 box colliders when the player hits the first collider the first collider tells the zombie to play an animation called swipe or what ever you attack animation is called, (swipe is where the zombie swings his arm and hits you) then the second collider is the one in a gameobject attached to the swinging arm the you attach the floowing script to the player.

var health = 25;

function OnCollisionEnter(object : Collision){

if(object.gameObject.tag == "Bullet"){

health--;

Debug.Log("Enemy health" + health);

if (health <=0)

{

function OnGUI () GUI.Box(Rect(10,190,100,45),"u got eaten");

}

}

}

that should work, lemme know what happenes

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 Grayson302.du · Dec 03, 2011 at 04:55 AM

does any one have a working zombie scrip. all the other ones have compiler err.

PLEASE??????????????????????

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 TehWut · Dec 03, 2011 at 06:12 AM 1
Share

Learn to code. It takes like 4 lines for a decent Zombie attack script.

avatar image
0

Answer by 09jgriffin · Mar 17, 2012 at 05:40 PM

why don't you try to fix em

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Zombie attack script help 1 Answer

I'm still having Trouble with this AI script 2 Answers

Creating basic enemy animation and attacking 4 Answers

Zombie Alien Mellee Attack 1 Answer

ZOMBIE AI SCRIPT 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