This site uses cookies! Learn More

This site uses cookies! uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Search the Community: Showing results for tags 'scripts'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


    • Introduce yourself
    • Discussions
    • Showcase
    • Need help?
    • Seeking team members?
    • Offtopic
    • unity3D | Example Projects
    • unity3D | Scripts
    • unity3D | Shaders
    • unity3D | Tutorials
    • 3D models
    • Animated 3D Models
    • Graphic design
    • Textures
    • Sounds
    • Other
    • FPSKit Download
    • FPSKit Modifications/Tutorials
    • FPSKit WIP/Showcase
    • Discussions / Bug reports


  • Free Projects
  • Free Assets
  • Game Demos


  • MajesticMahir's Blog
  • Official Renegrad Studios Blog
  • Bibbobbib's Blog
  • Special Ops Official Page
  • Altered Planet Studios' Blog
  • Fallen Nation FPS
  • DarkParadise offical blog
  • RiseFrame Updates
  • MobileRPG
  • Wonderland
  • technoshaman's Blog
  • Diab0lical
  • Fantasy MMORPG Blog
  • NXTGenerationsTV's Blog
  • Terrain Creator
  • andyman1995's Blog
  • TheRockeR93's Model Blog!
  • Armed Assault: The Fall
  • Unique Game Concepts
  • soulreafers blog
  • 314 Arts Devlogs
  • My all about all blog )


  • Community Calendar

Facebook URL

Twitter URL

IndieGoGo URL

Kickstarter URL


GreenLight URL



Found 28 results

  1. Hey guys, so I decided to make a thread about the useful scripts that are in this very useful forum. This thread will be updated regularly as soon as I (or you) find some useful scripts. If you found this helpful then leave a "like"! FORMAT: (thread name) by (author of thread) [language (C#/JS)] LIST [@DaBossTMR] Flashlight Script v2.1.1 by DaBossTMR [C#] Bullet Trajectory/Physics by DaBossTMR (credits to Jeremy Clark) [C#] Player Push (less glitchier) by DaBossTMR [C# and JS] [NGUI] Changing Screen Resolutions by DaBossTMR [C#] Top-down Shooter Camera by DaBossTMR [C#] Object Impact Sound by DaBossTMR [C# and JS] Populate Terrain Grass by DaBossTMR [C#] Realistic Camera Shake by DaBossTMR [C#] (credits go to UTnT) Find Closest Transform With Tag by DaBossTMR [C#] Disable ALT-F4 In Game by DaBossTMR [C# and JS] Extended FPS Counter by DaBossTMR [C#] [@OneManArmy] Jeremy Clark's FPS Scripts by OneManArmy [JS] RTS Camera by OneManArmy [JS] Rigidbody Controller by OneManArmy [JS] Buoyancy (Floating Objects) by OneManArmy [C#] Audio Effect When Falling by OneManArmy [JS] Cigarette Smoke Trail by OneManArmy [JS] [@OcularCash] Save/Load Method (Player Prefs) by OcularCash [JS] Health Regeneration by OcularCash [JS] Bouncing Betty/Freddy by OcularCash [JS] COD Style Cooked Grenades by OcularCash [JS] Javelin Script by OcularCash [JS] Stealth Bomber by OcularCash [JS] Harrier with Airstrike by OcularCash [JS] Anti-Spawn Trapping by OcularCash [JS] Predator Missile by OcularCash [JS] Weapon Wheel (GUI) by OcularCash [JS] MW2 Style Semtex Grenade by OcularCash [JS] Team Selection (Private Match) by OcularCash [JS] Flare Gun (with Exploding Rounds) by OcularCash [JS] Explosion (Linear Falloff Damage) by OcularCash [JS] Using Enums To Call Functions by OcularCash [JS] Basic Procedural Player + Movement + Walkable Area by OcularCash [JS] [@Duxducis404] Quake Map Loader (pk3 files) by Duxducis404 [C#] [@YoungDeveloper] Simple Teleport by YoungDeveloper [C#] [@T3kaT0kIkuTa] Particle Magnet by T3kaT0kIkuTa [C#] [@DarkChaos] Wall Avoidance by DarkChaos [JS] Disable Shadows For One Camera by DarkChaos [JS] Improved Sniper Scope System by DarkChaos [JS] Frames Per Second Counter by DarkChaos [JS] Knife Script with Animation Support by DarkChaos [JS] Countdown Timer by DarkChaos [JS] [@themars2011] Extended Timer/Counter by themars2011 [JS] Useful Networking Scripts by themars2011 [JS] Toggle Aim by themars2011 [JS] Mouse Look w/ Custom Editor by themars2011 [JS] [@bxboy15] Weapon Sway/Rotation by bxboy15 [JS] [@ProRussianMn] Save/Load Method (XML) by ProRussianMn [JS] [@jordanblythe104] Weapon Sway Script (Red Orchestra Style) by jordanblythe103 [JS] [@aeditz50] Cinematic Camera Shake by aeditz50 [C#] [@nightbird0] Smart FPS Counter by nightbird0 [C#] [@Epic-Shot] Fullscreen Video Using GUI (Pro Only) by Epic-Shot [C#] [@loftail] Zombie AI (Pro Only) by loftail [JS] [@dreadt9] Sentry Gun by dreadt9 [JS] l4mishotiz (Unity Forums) FPS Starter Scripts by l4mishotiz [uNKNOWN] [@jediaction] Peek Script by jediaction [JS] SIMPLE SCRIPTS/TOOLS Simple Tips System by pspdude [JS] Javascript to C# Converter by M2H [C# people]
  2. Hello everyone! Wave Survival Multiplayer is for whoever wants to kickstart their project as fast as possible, but without poor quality gameplay or lack of features. Spend less time on the burdensome technical requirements of making your game and dive into the fun stuff, let me take care of the boring parts for you! With Wave Survival Multiplayer you get the complete package: from zombies that will try to eat you and your friends brains to a nicely custom designed multiplayer lobby. Stop worrying about the hard part about making games, and jump straight to implementing your ideas. Let creativity be your only barrier! Price for the package: only $11.99 Feel like taking a better look at it? Check it out at Sellfy: Thanks!
  3. Hello guys can u help me with some good learning C# in unity?Thank U!
  4. Hello everyone! I've created another package inside Unity called Vaijk Network Chat. This package includes many features such as: - Simple network framework; - Chat scrollbar; - Custom text wrapping; - Random player name colors; - Adapted for both the legacy GUI and the new Unity UI system; - Adapted for both the legacy Network system and the new UNET system; - 2 straight-forward scripts. Price for the package: only $2.99 Feel like taking a better look at it? Check it out at Sellfy: Thanks! Especial note: A massive thank you to everyone who has purchased my other package (the Wave Survival Multiplayer package), I just wanted to let you guys know that the motivation and self-improvement that this has proportionated to me is beyond words. Again, thank you very much. Sometimes I think that I'm not selling assets, but instead receiving donations and giving something back in gratitude!
  5. This is my first time posting here so please be easy on me if I do this wrong. This script was derived from various scripts found all over the web and some of my own scripting added. I used and tested this script under Unity 5.2 using ThirdPerson Controller script. HOW TO USE THIS SCRIPT: 1. Drop this script onto your camera. 2. Select your target. 3. Select Camera Type desired. (Freelook with or without collision) (WOW type with or without collision) 4. Set Camera Tag to MainCamera. 4. Set desired Height, Distance, Speed, etc... 5. Make sure you have Input for Mouse X and Mouse Y in your input manager. WOW mode: Click and Hold Right Mouse Button to orbit Release Right Mouse Button stop orbit Use Mouse Wheel to zoom Enjoy! // WOW/FreeLook type Camera with Smoothing, Zoom, and Collision Control @Header ("Object For Camera To Target") var target : Transform; @Header ("Camera Type") var cameraType: OPTIONSWOW = OPTIONSWOW.WOW; @Header ("Camera Hight Above/Below Target") var targetHeight = 2.0f; @Header ("Camera Distance From Target") var distance = 5.0f; var maxDistance = 20f; var minDistance = 2.5f; @Header ("Camera Rotation Speed Sencativity") var xSpeed = 250.0; var ySpeed = 120.0; @Header ("Camera Up and Down Limits") var yMinLimit = -20; var yMaxLimit = 80; @Header ("Camera Rotation Smoothing/Dampening") var smoothing = 20f; private var smoothedMouse = new Vector2( 0f, 0f ); var inputSensitivity = 125f; private var Ydirection = 1f; @Header ("Camera Zoom Speed") var spinAccleration = 5f; private var spinSpeed = spinAccleration; private var deltaDistance = 0f; private var x = 0.0; private var y = 0.0; public enum OPTIONSWOW { FreeLook = 0, FreeLookNoCollision = 1, WOW = 2, WOWNoCollision = 3, } @script AddComponentMenu("Camera-Control/WoW Camera") function Start () { var angles = transform.eulerAngles; x = angles.y; y = angles.x; // Freeze Rotation if (GetComponent.<Rigidbody>()) GetComponent.<Rigidbody>().freezeRotation = true; } function LateUpdate () { if(!target) return; switch (cameraType) { case OPTIONSWOW.FreeLook: smoothedMouse = Vector2.Lerp( smoothedMouse, new Vector2( Input.GetAxis( "Mouse X" ), Input.GetAxis( "Mouse Y" ) ), 1f/smoothing ); x += (smoothedMouse.x * inputSensitivity)*Time.deltaTime; y -= (smoothedMouse.y * Ydirection * inputSensitivity)*Time.deltaTime; distance += deltaDistance; distance = Mathf.Clamp (distance, minDistance, maxDistance); y = ClampAngle(y, yMinLimit, yMaxLimit); doAction (); break; case OPTIONSWOW.FreeLookNoCollision: smoothedMouse = Vector2.Lerp( smoothedMouse, new Vector2( Input.GetAxis( "Mouse X" ), Input.GetAxis( "Mouse Y" ) ), 1f/smoothing ); x += (smoothedMouse.x * inputSensitivity)*Time.deltaTime; y -= (smoothedMouse.y * Ydirection * inputSensitivity)*Time.deltaTime; distance += deltaDistance; distance = Mathf.Clamp (distance, minDistance, maxDistance); y = ClampAngle(y, yMinLimit, yMaxLimit); doNoCollision (); break; case OPTIONSWOW.WOW: // If right mouse button is held down, let mouse govern camera position if (Input.GetMouseButton(1)) { smoothedMouse = Vector2.Lerp( smoothedMouse, new Vector2( Input.GetAxis( "Mouse X" ), Input.GetAxis( "Mouse Y" ) ), 1f/smoothing ); x += (smoothedMouse.x * inputSensitivity)*Time.deltaTime; y -= (smoothedMouse.y * Ydirection * inputSensitivity)*Time.deltaTime; } distance += deltaDistance; distance = Mathf.Clamp (distance, minDistance, maxDistance); y = ClampAngle(y, yMinLimit, yMaxLimit); doAction (); break; case OPTIONSWOW.WOWNoCollision: // If right mouse button is held down, let mouse govern camera position if (Input.GetMouseButton(1)) { smoothedMouse = Vector2.Lerp( smoothedMouse, new Vector2( Input.GetAxis( "Mouse X" ), Input.GetAxis( "Mouse Y" ) ), 1f/smoothing ); x += (smoothedMouse.x * inputSensitivity)*Time.deltaTime; y -= (smoothedMouse.y * Ydirection * inputSensitivity)*Time.deltaTime; } distance += deltaDistance; distance = Mathf.Clamp (distance, minDistance, maxDistance); y = ClampAngle(y, yMinLimit, yMaxLimit); doNoCollision (); break; } // Mouse Zoom Start if (Input.GetAxis ("Mouse ScrollWheel") < 0f) { deltaDistance = Mathf.Lerp (deltaDistance, Mathf.Min (spinSpeed, maxDistance - distance), spinAccleration/10f * Time.deltaTime); } else if (Input.GetAxis ("Mouse ScrollWheel") > 0f) { deltaDistance = Mathf.Lerp (deltaDistance, -Mathf.Min (spinSpeed, distance - minDistance), spinAccleration/10f * Time.deltaTime); } else { deltaDistance = Mathf.Lerp (deltaDistance, 0f, spinAccleration * Time.deltaTime); } // Mouse Zoom End } function doAction (){ var rotation:Quaternion = Quaternion.Euler(y, x, 0); var position = target.position - (rotation * Vector3.forward * distance + Vector3(0,-targetHeight,0)); transform.rotation = rotation; transform.position = position; // IS VIEW BLOCKED? var hit : RaycastHit; var trueTargetPosition : Vector3 = target.transform.position - Vector3(0,-targetHeight,0); // Cast the line to check: if (Physics.Linecast (trueTargetPosition, transform.position, hit)) { // If so, shorten distance so camera is in front of object: var tempDistance = Vector3.Distance (trueTargetPosition, hit.point) - 0.28; // Finally, rePOSITION the CAMERA: position = target.position - (rotation * Vector3.forward * tempDistance + Vector3(0,-targetHeight,0)); transform.position = position; } } function doNoCollision (){ var rotationA:Quaternion = Quaternion.Euler(y, x, 0); var positionA = target.position - (rotationA * Vector3.forward * distance + Vector3(0,-targetHeight,0)); transform.rotation = rotationA; transform.position = positionA; } static function ClampAngle (angle : float, min : float, max : float) { if (angle < -360) angle += 360; if (angle > 360) angle -= 360; return Mathf.Clamp (angle, min, max); }
  6. I made this same "tutorial" on a comment on another post and I though it would be worth while to make a post about it. So, here is what i've come up with to help beginners start coding! You learn by doing! What I did was I learned some basic stuff from youtube (what variables are, how to organize your code, basic functions, ext.) and once you got the basics mastered, you can start writing your very first script! You will want to start with something basic. What my first script did is a good example of a really good starting script. It changed the color of a game object in the scene. I learned lots of things from that script. Example: How to access the game object's components. Once you practice that a couple times, you learn if statements from youtube. Apply one to your script you already made. Then what I did was I started learning new functions. A good place to learn some is the Unity documentation: http://docs.unity3d....criptReference/ Eventually, you will come across functions or statements that you don't know. Just put the thing your trying to find out in google followed by unity. Example: OnTriggerEnter Unity. And thats my tutorial I guess on how to start coding in Unity Hope this helped! Please add anything else I missed in the comments bellow P.S. I know it's short
  7. good, I am looking for a simple or complex system for the sniper sights, compatible with unity 5, someone help me?
  8. who can help me i'll mentionate hi on credits of my game
  9. Hey! I updated my crafting system, including an update on gathering resources, and new inventory! All scripts from the video included and the icons for the inventory items! Video on how to set up the scene will be linked here after it's posted! Hope you enjoy it! Please let me know if there are any problems.
  10. I was recently tasked with creating Preloaders for a friends unity game. I began to think, and play around with the idea for a while, and wanted to incorporate mechanim into it as to make for easy animation editing and expanding. So here's what was asked of me... C# - Check (although not much code is even needed, and can easily be converted to js). Mechanim - Check (with mechanim these animations for the preloaders can be added to nearly anything for custom preloader designs). 2D/3D - Check (the animations can be applied to 3d objects with very small changes or stick with any 2d object). Minimalistic - Check (keep your project small and organized). Time: 1 Hour Preview: Here Download: Here Say thanks if you found this in any way helpful the source code and the entire project is open and free to do whatever you want with! The code is nicely commented for further explanation and includes 3 animations. Although you can expand upon it if you wish or ask and I will help anyway I can. Feel free to help contribute! You can use this project for learning or for whatever you want, I hope to see people contribute to this project and make it even more awesome! ALL UPDATES WILL BE ADDED TO BOTH THE PREVIEW AND DOWNLOAD AUTOMATICALLY
  11. Hey, I made a tutorial on my crafting system I'm working on for my game, and I thought I'd share the scripts with you Hope you all enjoy it! Stay tuned for part 2, where there will be included an inventory as well. I will also, later on, make some tutorials on using these gathered materials for crafting. (Download the package in the description)
  12. Hi I have a bug with my lench on my right sight: #pragma strict var leanAngle : float = 35.0; var leanSpeed : float = 5.0; var leanBackSpeed : float = 6.0; function Update () { if (Input.GetKey("q")) { LeanLeft(); } else if (Input.GetKey("e")) { LeanRight(); } else { LeanBack(); } } function LeanLeft() { // current Z-rotation var currAngle : float = transform.rotation.eulerAngles.z; //var rot : Quaternion = transform.rotation; // target Z-rotation var targetAngle : float = leanAngle; if ( currAngle > 180.0 ) { //targetAngle = 0.0 - leanAngle; currAngle = 360 - currAngle; } //lerp value from current to target var angle : float = Mathf.Lerp( currAngle, targetAngle, leanSpeed * Time.deltaTime ); //Debug.Log ( "Left : currAngle " + currAngle + " : targetAngle " + targetAngle + " : angle " + angle ); // rotate char var rotAngle : Quaternion = Quaternion.Euler( transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, angle ); transform.rotation = rotAngle; } function LeanRight() { // current Z-rotation var currAngle : float = transform.rotation.eulerAngles.z; // target Z-rotation var targetAngle : float = leanAngle - 360.0; if ( currAngle > 180.0 ) { targetAngle = 360.0 - leanAngle; } //lerp value from current to target var angle : float = Mathf.Lerp( currAngle, targetAngle, leanSpeed * Time.deltaTime ); //Debug.Log ( "Right : currAngle " + currAngle + " : targetAngle " + targetAngle + " : angle " + angle ); // rotate char var rotAngle : Quaternion = Quaternion.Euler( transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, angle ); transform.rotation = rotAngle; } function LeanBack() { // current Z-rotation var currAngle : float = transform.rotation.eulerAngles.z; // target Z-rotation var targetAngle : float = 0.0; if ( currAngle > 180.0 ) { targetAngle = 360.0; } //lerp value from current to target var angle : float = Mathf.Lerp( currAngle, targetAngle, leanBackSpeed * Time.deltaTime ); //Debug.Log ( "Center : currAngle " + currAngle + " : targetAngle " + targetAngle + " : angle " + angle ); var rotAngle : Quaternion = Quaternion.Euler( transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, angle ); transform.rotation = rotAngle; }
  13. Hi, so i have a little problem, with not equal to the right variable properties, i bet it is the for loop is something wrong with and i know it is. This is the MobAI script: using UnityEngine; using System.Collections; [RequireComponent(typeof(NavMeshAgent))] public class MobAI : MonoBehaviour { MobCreator mc; public float health = 57f; public float minDamage = 5f; public float maxDamage = 10f; public float scale = 1f; public float attackSpeed = 1500f; public string runAnim; public string walkAnim; public string idleAnim; public bool attackable; float distance; int i = 0; NavMeshAgent nma; void Awake() { mc = GameObject.Find("_CREATORSCRIPTS").GetComponent<MobCreator>(); nma = GetComponent<NavMeshAgent>(); } void Start() { } // Update is called once per frame void Update () { distance = Vector3.Distance(GameObject.FindWithTag("Player").transform.position, transform.position); if(distance <= 15 && distance > 2f) { nma.SetDestination(GameObject.FindWithTag("Player").transform.position); } for(int i = 0; i < mc.mobCreator.Count; i++) { Debug.Log("For start"); health = mc.mobCreator[i].health; minDamage = mc.mobCreator[i].minDamage; maxDamage = mc.mobCreator[i].maxDamage; scale = mc.mobCreator[i].scale; nma.speed = mc.mobCreator[i].runSpeed; attackSpeed = mc.mobCreator[i].attackSpeed; runAnim = mc.mobCreator[i].runAnim; walkAnim = mc.mobCreator[i].walkAnim; idleAnim = mc.mobCreator[i].idleAnim; attackable = mc.mobCreator[i].attackable; Debug.Log("For end"); } } } Then the mobcreator script(A script for easy making new mobs in inspector): using UnityEngine; using System.Collections; using System.Collections.Generic; public class MobCreator : MonoBehaviour { [System.Serializable] public class Mob { public enum MobType { Normal, Elite, Boss } public enum MobTypeState { Hostile, Aggressive, Friendly } public enum MobDamageType { Physical, Ranged, PhysicalAndRanged, Fire, Arcane, Earth, Frost } public string name = "Unnamed"; public float health = 57f; public float minDamage = 5f; public float maxDamage = 10f; public int minLevel = 1; public int maxLevel = 10; public float scale = 1f; public float runSpeed = 4f; public float attackSpeed = 1500f; public GameObject mob; public string runAnim; public string walkAnim; public string idleAnim; public MobType mobType; public MobTypeState mobTypeState; public MobDamageType mobDamageType; public bool attackable; } public List<Mob> mobCreator = new List<Mob>(); // Use this for initialization void Start () { GameObject mobTest = (GameObject)Instantiate(mobCreator[0].mob, GameObject.Find("MobSpawn").transform.position, Quaternion.identity); } // Update is called once per frame void Update () { } } Example to what i want: I have 3 mobs in the mobcreator list, Thug, thief and rat so i instantiate Thug, and the instantiated thug should have the variable properties from the thug in the list, but instead it does so the thug variable properties is equals to the last in the list which is the rat, so the thug has the rat properties which i don't want, what i want is the thug has the thug properties and thief has the thief properties and rat has the rat properties, because it doesn't really make sense if i have a thug with rat properties or a thief with rat properties So i appreciate any help i can get, and i appreciate tips on how i could make things better. Also a link to screenshot below shows the list i have of the mobs
  14. hi, im a bit of an idiot when it comes to programming and need some help. can someone help me make a simple boat script? I found some online but for some reason they all have errors im only using this for practise as I understand programming
  15. Useful Script Package

    Version 1.0


    Welcome to my second pack! Thank you for visiting my asset page! This time i bring you a useful script package, this pack includes several scripts that can help you build your game quicker! The Screenshots are from my Test/Tutorial Game you do not receive the scenes only the scripts! So whats in the pack for all changes see the changelog! Credits = Scrolling credits, just apply the script to a camera that is above the 3D Text Menu Credits = The same as above! To get the credits, make a duplicate from your Credits and make some GUI Text saying "Press Space to return to menu" and make a new Empty GameObject and drag the Skip To Menu and SpaceGone scripts on to it. Follow = Make a GameObject follow you, Add component on a empty gameobject. Button = A script for a working button. Loading = MY EXAMPLE: Add a cube, position it to middle, do your lighting so all the cube sides are lit up, create an Empty GameObject, add the script Loading.cs to the Empty GameObject, fill out the variables (Tex being the cube) (Speedleft and Speedfor do not matter), LevelToLoad is the level to load after default 6 seconds, Make the Camera and place it correctly, Create and position "Please Wait", and "Loading" text, then your done. This Loading script doesn't load anything its just an effect. Move Camera = A script to move a camera like the camera in the editor. Empty GameObject Pause Menu = A GUI pause menu using script. Empty GameObject Rotate = Rotate anything. Empty GameObject Wait = Wait a certain amount of time before loading a level. Empty GameObject That is all! Copyright: What you can do: Use in your commercial game, videos, etc. What you can't do: Sell in anyway this pack without my saying so or change then sell without me saying so Michael Foster, Titan Studios, 2014, Commercial Use Allowed Contact for any copyright problems. Please subscribe to ExtraGaming01 on youtube! Enjoy Pack Number 2, Michael Foster
  16. Version v0.01


    This Is A Library Not Like JQuery But Its A Library Of Scripts On Armed Unity ! Feel Free To Add Scripts What I Missed !
  17. Heyy Guys, Just a little question. I'm making a Mobile Game for a project (I.T.) at school, and Well I just wounding, does anyone have an Idea how to shoot Items Up? Somethink like fruit ninja and then they fall down.? Can someone link me to a place or give me a little guide on how to do this? Thank you. Caleb!.
  18. Hello everybody, as am not professional so i came here to you for an advice and help. Well i got problem with combinating two scripts ill drop them here... While one script uses animation for idle,walk,run,jump and another one has idleattack and death. Thing that happens while you play character simply wont do the attack animation, but in inspector it is showing its already attacking. Need some help. Thanks for soon answer ThirdPersonController.js // Require a character controller to be attached to the same game object @script RequireComponent(CharacterController) public var idleAnimation : AnimationClip; public var walkAnimation : AnimationClip; public var runAnimation : AnimationClip; public var jumpPoseAnimation : AnimationClip; public var walkMaxAnimationSpeed : float = 0.75; public var trotMaxAnimationSpeed : float = 1.0; public var runMaxAnimationSpeed : float = 1.0; public var jumpAnimationSpeed : float = 1.15; public var landAnimationSpeed : float = 1.0; private var _animation : Animation; enum CharacterState { Idle = 0, Walking = 1, Trotting = 2, Running = 3, Jumping = 4, } private var _characterState : CharacterState; // The speed when walking var walkSpeed = 2.0; // after trotAfterSeconds of walking we trot with trotSpeed var trotSpeed = 4.0; // when pressing "Fire3" button (cmd) we start running var runSpeed = 6.0; var inAirControlAcceleration = 3.0; // How high do we jump when pressing jump and letting go immediately var jumpHeight = 0.5; // The gravity for the character var gravity = 20.0; // The gravity in controlled descent mode var speedSmoothing = 10.0; var rotateSpeed = 500.0; var trotAfterSeconds = 3.0; var canJump = true; private var jumpRepeatTime = 0.05; private var jumpTimeout = 0.15; private var groundedTimeout = 0.25; // The camera doesnt start following the target immediately but waits for a split second to avoid too much waving around. private var lockCameraTimer = 0.0; // The current move direction in x-z private var moveDirection =; // The current vertical speed private var verticalSpeed = 0.0; // The current x-z move speed private var moveSpeed = 0.0; // The last collision flags returned from controller.Move private var collisionFlags : CollisionFlags; // Are we jumping? (Initiated with jump button and not grounded yet) private var jumping = false; private var jumpingReachedApex = false; // Are we moving backwards (This locks the camera to not do a 180 degree spin) private var movingBack = false; // Is the user pressing any keys? private var isMoving = false; // When did the user start walking (Used for going into trot after a while) private var walkTimeStart = 0.0; // Last time the jump button was clicked down private var lastJumpButtonTime = -10.0; // Last time we performed a jump private var lastJumpTime = -1.0; // the height we jumped from (Used to determine for how long to apply extra jump power after jumping.) private var lastJumpStartHeight = 0.0; private var inAirVelocity =; private var lastGroundedTime = 0.0; private var isControllable = true; function Awake () { moveDirection = transform.TransformDirection(Vector3.forward); _animation = GetComponent(Animation); if(!_animation) Debug.Log("The character you would like to control doesn't have animations. Moving her might look weird."); /* public var idleAnimation : AnimationClip; public var walkAnimation : AnimationClip; public var runAnimation : AnimationClip; public var jumpPoseAnimation : AnimationClip; */ if(!idleAnimation) { _animation = null; Debug.Log("No idle animation found. Turning off animations."); } if(!walkAnimation) { _animation = null; Debug.Log("No walk animation found. Turning off animations."); } if(!runAnimation) { _animation = null; Debug.Log("No run animation found. Turning off animations."); } if(!jumpPoseAnimation && canJump) { _animation = null; Debug.Log("No jump animation found and the character has canJump enabled. Turning off animations."); } } function UpdateSmoothedMovementDirection () { var cameraTransform = Camera.main.transform; var grounded = IsGrounded(); // Forward vector relative to the camera along the x-z plane var forward = cameraTransform.TransformDirection(Vector3.forward); forward.y = 0; forward = forward.normalized; // Right vector relative to the camera // Always orthogonal to the forward vector var right = Vector3(forward.z, 0, -forward.x); var v = Input.GetAxisRaw("Vertical"); var h = Input.GetAxisRaw("Horizontal"); // Are we moving backwards or looking backwards if (v < -0.2) movingBack = true; else movingBack = false; var wasMoving = isMoving; isMoving = Mathf.Abs (h) > 0.1 || Mathf.Abs (v) > 0.1; // Target direction relative to the camera var targetDirection = h * right + v * forward; // Grounded controls if (grounded) { // Lock camera for short period when transitioning moving & standing still lockCameraTimer += Time.deltaTime; if (isMoving != wasMoving) lockCameraTimer = 0.0; // We store speed and direction seperately, // so that when the character stands still we still have a valid forward direction // moveDirection is always normalized, and we only update it if there is user input. if (targetDirection != { // If we are really slow, just snap to the target direction if (moveSpeed < walkSpeed * 0.9 && grounded) { moveDirection = targetDirection.normalized; } // Otherwise smoothly turn towards it else { moveDirection = Vector3.RotateTowards(moveDirection, targetDirection, rotateSpeed * Mathf.Deg2Rad * Time.deltaTime, 1000); moveDirection = moveDirection.normalized; } } // Smooth the speed based on the current target direction var curSmooth = speedSmoothing * Time.deltaTime; // Choose target speed //* We want to support analog input but make sure you cant walk faster diagonally than just forward or sideways var targetSpeed = Mathf.Min(targetDirection.magnitude, 1.0); _characterState = CharacterState.Idle; // Pick speed modifier if (Input.GetKey (KeyCode.LeftShift) | Input.GetKey (KeyCode.RightShift)) { targetSpeed *= runSpeed; _characterState = CharacterState.Running; } else if (Time.time - trotAfterSeconds > walkTimeStart) { targetSpeed *= trotSpeed; _characterState = CharacterState.Trotting; } else { targetSpeed *= walkSpeed; _characterState = CharacterState.Walking; } moveSpeed = Mathf.Lerp(moveSpeed, targetSpeed, curSmooth); // Reset walk time start when we slow down if (moveSpeed < walkSpeed * 0.3) walkTimeStart = Time.time; } // In air controls else { // Lock camera while in air if (jumping) lockCameraTimer = 0.0; if (isMoving) inAirVelocity += targetDirection.normalized * Time.deltaTime * inAirControlAcceleration; } } function ApplyJumping () { // Prevent jumping too fast after each other if (lastJumpTime + jumpRepeatTime > Time.time) return; if (IsGrounded()) { // Jump // - Only when pressing the button down // - With a timeout so you can press the button slightly before landing if (canJump && Time.time < lastJumpButtonTime + jumpTimeout) { verticalSpeed = CalculateJumpVerticalSpeed (jumpHeight); SendMessage("DidJump", SendMessageOptions.DontRequireReceiver); } } } function ApplyGravity () { if (isControllable) // don't move player at all if not controllable. { // Apply gravity var jumpButton = Input.GetButton("Jump"); // When we reach the apex of the jump we send out a message if (jumping && !jumpingReachedApex && verticalSpeed <= 0.0) { jumpingReachedApex = true; SendMessage("DidJumpReachApex", SendMessageOptions.DontRequireReceiver); } if (IsGrounded ()) verticalSpeed = 0.0; else verticalSpeed -= gravity * Time.deltaTime; } } function CalculateJumpVerticalSpeed (targetJumpHeight : float) { // From the jump height and gravity we deduce the upwards speed // for the character to reach at the apex. return Mathf.Sqrt(2 * targetJumpHeight * gravity); } function DidJump () { jumping = true; jumpingReachedApex = false; lastJumpTime = Time.time; lastJumpStartHeight = transform.position.y; lastJumpButtonTime = -10; _characterState = CharacterState.Jumping; } function Update() { if (!isControllable) { // kill all inputs if not controllable. Input.ResetInputAxes(); } if (Input.GetButtonDown ("Jump")) { lastJumpButtonTime = Time.time; } UpdateSmoothedMovementDirection(); // Apply gravity // - extra power jump modifies gravity // - controlledDescent mode modifies gravity ApplyGravity (); // Apply jumping logic ApplyJumping (); // Calculate actual motion var movement = moveDirection * moveSpeed + Vector3 (0, verticalSpeed, 0) + inAirVelocity; movement *= Time.deltaTime; // Move the controller var controller : CharacterController = GetComponent(CharacterController); collisionFlags = controller.Move(movement); // ANIMATION sector if(_animation) { if(_characterState == CharacterState.Jumping) { if(!jumpingReachedApex) { _animation[].speed = jumpAnimationSpeed; _animation[].wrapMode = WrapMode.ClampForever; _animation.CrossFade(; } else { _animation[].speed = -landAnimationSpeed; _animation[].wrapMode = WrapMode.ClampForever; _animation.CrossFade(; } } else { if(controller.velocity.sqrMagnitude < 0.1) { _animation.CrossFade(; } else { if(_characterState == CharacterState.Running) { _animation[].speed = Mathf.Clamp(controller.velocity.magnitude, 0.0, runMaxAnimationSpeed); _animation.CrossFade(; } else if(_characterState == CharacterState.Trotting) { _animation[].speed = Mathf.Clamp(controller.velocity.magnitude, 0.0, trotMaxAnimationSpeed); _animation.CrossFade(; } else if(_characterState == CharacterState.Walking) { _animation[].speed = Mathf.Clamp(controller.velocity.magnitude, 0.0, walkMaxAnimationSpeed); _animation.CrossFade(; } } } } // ANIMATION sector // Set rotation to the move direction if (IsGrounded()) { transform.rotation = Quaternion.LookRotation(moveDirection); } else { var xzMove = movement; xzMove.y = 0; if (xzMove.sqrMagnitude > 0.001) { transform.rotation = Quaternion.LookRotation(xzMove); } } // We are in jump mode but just became grounded if (IsGrounded()) { lastGroundedTime = Time.time; inAirVelocity =; if (jumping) { jumping = false; SendMessage("DidLand", SendMessageOptions.DontRequireReceiver); } } } function OnControllerColliderHit (hit : ControllerColliderHit ) { // Debug.DrawRay(hit.point, hit.normal); if (hit.moveDirection.y > 0.01) return; } function GetSpeed () { return moveSpeed; } function IsJumping () { return jumping; } function IsGrounded () { return (collisionFlags & CollisionFlags.CollidedBelow) != 0; } function GetDirection () { return moveDirection; } function IsMovingBackwards () { return movingBack; } function GetLockCameraTimer () { return lockCameraTimer; } function IsMoving () : boolean { return Mathf.Abs(Input.GetAxisRaw("Vertical")) + Mathf.Abs(Input.GetAxisRaw("Horizontal")) > 0.5; } function HasJumpReachedApex () { return jumpingReachedApex; } function IsGroundedWithTimeout () { return lastGroundedTime + groundedTimeout > Time.time; } function Reset () { gameObject.tag = "Player"; } And here the script that is actually supposed to attack using UnityEngine; using System.Collections; public class freeflyprerobeny : MonoBehaviour { //the camera to sync with public Transform imitate; //the physical body of player public Transform playertarget; //animations public AnimationClip run; public AnimationClip idleattack; public AnimationClip death; public AnimationClip attackanim; //states public bool die; private bool deathanim=true; public bool charge; public bool attack; public bool idle; private float timer; public bool enableattackdam=true; public int damage=35; //the 3 target positions to raycast to for attack range public Transform attackrange; public Transform attackrange2; public Transform attackrange3; public bool attackenable=true; private bool dead; private float respawntimer; private int displaytime; //get a refrence of what units are on ur team rather than making a new list public Transform unitlistrefrence; //audio public AudioClip swing; public AudioClip hitt; public AudioClip footsteps; // Use this for initialization void Start () { respawntimer=21; displaytime=20; } // Update is called once per frame void Update () { //get health health die=(health)GetComponent("health"); //dead state if(die){ if(die.dead){ charge=false; idle=false; attack=false; dead=true; //stuff=gameObject.GetComponent("MouseTimeLook"); if(death){ if(deathanim){ animation[].speed = animation[].length / 2f; animation.Play(; deathanim=false; } } } else{ RaycastHit hit = new RaycastHit(); //run animation if(run){ if(charge){ animation[].speed = animation[].length / 0.8f; animation.CrossFade(, 0.12f); } } //idle animation if(idleattack){ if(idle){ animation[].speed = animation[].length / 2f; animation.CrossFade(, 0.25f); } } //attack animation if(attackanim){ if(attack){ animation[].speed = animation[].length / 1f; animation.CrossFade(, 0.15f); } } if(timer>1f){ attack=false; timer=0; } //draw lines to attack range points if(playertarget&attackrange&attackrange2&attackrange3){ Debug.DrawLine(playertarget.transform.position, attackrange.transform.position,; Debug.DrawLine(playertarget.transform.position, attackrange2.transform.position,; Debug.DrawLine(playertarget.transform.position, attackrange3.transform.position,; } //ATTACK if(attack){ if(timer>0.5&timer<0.68){ if(enableattackdam){ if(playertarget&attackrange&attackrange2&attackrange3){ if(Physics.Linecast(playertarget.transform.position, attackrange.transform.position, out hit)|Physics.Linecast(playertarget.transform.position, attackrange2.transform.position, out hit)|Physics.Linecast(playertarget.transform.position, attackrange3.transform.position, out hit)){ if(hit.transform){ audio.clip=hitt; audio.Play(); health dam=(health)hit.transform.GetComponent("health"); if(dam){ team team=(team)hit.transform.GetComponent("team"); team pteam=(team)GetComponent("team"); if(team.teamnumber==pteam.teamnumber){} else dam.currenthealth=dam.currenthealth-damage; } } } } enableattackdam=false; } } timer+=Time.deltaTime; if(timer<0.3f){ //play audio swing audio.clip=swing; audio.Play(); } idle=false; charge=false; } else{ if(charge){ idle=false; } else{ idle=true; } } //charge=true if any of these buttons r being pressed if(Input.GetKey(KeyCode.A)|Input.GetKey(KeyCode.W)|Input.GetKey(KeyCode.S)|Input.GetKey(KeyCode.D)){ if(attack){} else charge=true; } else charge=false; //attack input if(attackenable){ if(Input.GetKeyUp(KeyCode.Mouse0)){ enableattackdam=true; attack=true; } } } if(dead){ respawntimer-=Time.deltaTime; if(displaytime>respawntimer)displaytime=displaytime-1; if(respawntimer<=0){ dead=false; displaytime=20; respawntimer=21; } } } } void OnGUI(){ //message to the player if he is dead if(dead){ GUI.Box(new Rect(200, 300, 190, 50), "You died..Respawn in.. "+displaytime); } //raycast for close units and shopping RaycastHit hit = new RaycastHit(); if(playertarget&attackrange){ if(Physics.Linecast(playertarget.transform.position, attackrange.transform.position, out hit)){ shop shop=(shop)hit.transform.GetComponent("shop"); orderai ai=(orderai)hit.transform.GetComponent("orderai"); if(ai){ if(ai.enableaiorder){} else{ GUI.Box(new Rect(200, 300, 150, 50), "Press E To Give Orders!"); if(Input.GetKey(KeyCode.E)) ai.enableaiorder=true; } } if(shop){ if(shop.menuactive){} else{ GUI.Box(new Rect(200, 300, 150, 50), "Press E To Shop!"); if(Input.GetKey(KeyCode.E)) shop.menuactive=true; } } } } } }
  19. Hunter Missle: These scripts adds to your game Hunter Missle like Call Of Duty MW2 predator missle or MW3 Reaper. Download Screenshot: Web Player. Model downloaded from If you have your own model, please replace old one.
  20. Does anyone have any scripts that replicate Halo? I have a decent project right now, but I'm horrible at scripting. Help the Bean out! Thanks mates! Halo-Test1.tiff
  21. Hello, So im making a multiplayer game and everything is working fine (Main Menu, Spawning) except killing. Can any1 help me? Here are the scripts: using UnityEngine; using System.Collections; public class Gun : MonoBehaviour { public float FireRate; public float MinDamage = 15; public float MaxDamage = 45; private float ActualDamage; private float FireTime; public float Range = 800; public Transform SpawnPoint; public bool Shoot; // Use this for initialization void Start () { Shoot = false; } // Update is called once per frame void Update () { if(Input.GetButton("Fire1")) Fire(); } public void Fire() { if(FireTime <= Time.time) { FireTime = FireRate + Time.time; ActualDamage = Random.Range(MinDamage,MaxDamage); audio.Play(); RaycastHit hit; if(Physics.Raycast(SpawnPoint.position,SpawnPoint.forward,out hit,Range)) { UserPlayer hitter = hit.transform.root.GetComponent<UserPlayer>(); if (hitter != null) { hitter.networkView.RPC("Server_TakeDamage",RPCMode.All, ActualDamage); } } } } } using UnityEngine; using System.Collections; public class UserPlayer : MonoBehaviour { public Transform FirstPerson; public Transform ThirdPerson; public Player MyPlayer; public GameObject RagDoll; public Vector3 CurPos; public Quaternion CurRot; // Use this for initialization void Start () { MyPlayer = NetworkManager.GetPlayer(networkView.owner); MyPlayer.Manager = this; FirstPerson.gameObject.SetActive(false); ThirdPerson.gameObject.SetActive(false); DontDestroyOnLoad(gameObject); } // Update is called once per frame void Update () { } [RPC] void Server_TakeDamage(float Damage) { networkView.RPC("Client_TakeDamag",RPCMode.Server, Damage); } void Client_TakeDamage(float Damage) { MyPlayer.Health -= Damage; Debug.Log (MyPlayer.Health); if(MyPlayer.Health < 0) { networkView.RPC ("Die", RPCMode.All); MyPlayer.IsAlive = false; MyPlayer.Health = 0; } } [RPC] void Spawn() { MyPlayer.Health = 100; MyPlayer.IsAlive = true; if(networkView.isMine) { FirstPerson.gameObject.SetActive(true); ThirdPerson.gameObject.SetActive(false); } else { FirstPerson.gameObject.SetActive(false); ThirdPerson.gameObject.SetActive(true); } } [RPC] void Die() { if(MyPlayer.Health < 0); { MyPlayer.IsAlive = false; FirstPerson.gameObject.SetActive(false); ThirdPerson.gameObject.SetActive(false); } } void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info) { if(stream.isWriting) { CurPos = FirstPerson.position; CurRot = FirstPerson.rotation; stream.Serialize(ref CurPos); stream.Serialize(ref CurRot); } else { stream.Serialize(ref CurPos); stream.Serialize(ref CurRot); ThirdPerson.position = CurPos; ThirdPerson.rotation = CurRot; } } }
  22. Hello everyone, I am Exgen I Need members to Finish this awesome game proyect. My mind is full of Ideas Caps of the map : "Prison" I need bether name _________________________________________________ * = Required _________________________________________________ *Name(first): Age: *What do you specialize in: Why do you want to join?: *Email: *Do you have a Skype?(YES/NO): *Are you a diligent worker?: *Can you use Unity 3D well?: Everyone that is picked for hiring will be posted below here. This is who we need the most: Scripters/Programmers: Important!! *exgen "me Bad programmer :C". * * Modelers: * Graphics Designers: *exgen "me". Music Production: *exgen "me". Animations Designers: * Texture Designers: * Alpha Testers: * Level Designers: *Exgen "me". * Other: * Is Fps online Game I dont Show dont more Captures I working width the sounds, rigid blood system, parkour, Gamemodes and others things Sorry for my bad english. Hi Again, Skype : Exgengames. I am Spanish
  23. Hey guys, just wondering if it was possible to add a line of code to this script the "Zombie" will have its waypoints and once the player comes in contact it will attack and if the player runs away it will go back to its waypoints? this is the script var target : Transform; //the enemy's target var moveSpeed = 3; //move speed var rotationSpeed = 3; //speed of turning var attackRange = 3; // distance within which to attack var chaseRange = 10; // distance within which to start chasing var giveUpRange = 20; // distance beyond which AI gives up var attackRepeatTime : float = 1.5; // delay between attacks when within range var anim : GameObject; var maximumHitPoints = 5.0; var hitPoints = 5.0; var attack : AudioClip; private var chasing = false; private var attackTime : float; var checkRay : boolean = false; var idleAnim : String = "idle"; var walkAnim : String = "walk"; var attackAnim : String = "attack"; var dontComeCloserRange : int = 4; private var myTransform : Transform; //current transform data of this enemy function Awake(){ myTransform = transform; //cache transform data for easy access/preformance anim.animation.wrapMode = WrapMode.Loop; anim.animation[attackAnim].wrapMode = WrapMode.Once; anim.animation[attackAnim].layer = 2; anim.animation.Stop(); } function Start(){ target = GameObject.FindWithTag("Player").transform; } function Update () { // check distance to target every frame: var distance = (target.position - myTransform.position).magnitude; if (distance < dontComeCloserRange){ moveSpeed = 0; anim.animation[idleAnim].speed = .4; anim.animation.CrossFade(idleAnim); }else{ moveSpeed = Random.Range(4, 6); anim.animation.CrossFade(walkAnim); } if (chasing) { //move towards the player myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime; //rotate to look at the player myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime); transform.eulerAngles = Vector3(0, transform.eulerAngles.y, 0); // give up, if too far away from target: if (distance > giveUpRange) { chasing = false; } // attack, if close enough, and if time is OK: if (distance < attackRange && Time.time > attackTime) { anim.animation[attackAnim].speed = 2.0; anim.animation.CrossFade(attackAnim); target.SendMessage( "PlayerDamage", maximumHitPoints); attackTime = Time.time + attackRepeatTime; audio.PlayOneShot(attack, 1.0 / audio.volume); } } else { // not currently chasing. anim.animation[idleAnim].speed = .4; anim.animation.CrossFade(idleAnim); // start chasing if target comes close enough if (distance < chaseRange) { chasing = true; } } } function OnDrawGizmosSelected (){ Gizmos.color = Color.yellow; Gizmos.DrawWireSphere (transform.position, attackRange); Gizmos.color =; Gizmos.DrawWireSphere (transform.position, chaseRange); }
  24. Hello thank you for reading my post to show off my small game it in really small stages as i do not have lot of time due to my health but what will say is that i wanting to turn this in to a real game on ios android mac pc Xbox i wish but why not all down to is cost game is base of cyber space what happens in your pc and networks all round the world as i cant say much on this as it is most in my head due lack of time but i have 2 weeks that by the end i should have done first 3 level and then building this in to a game not just level full game but i cant say much all in my head but i can give you all go try the link below for game Not lot more to add Email me at with any idea or any thing or comment/pm what ever is easy for you Thanks Andrew.M
  25. Hi i want to make a script that will allow you to place a c4 on a wall then it will explode in maybe 5 seconds. Does any one have a script for that? Please I need it in my college project. I have to finish this project before June 14th.