Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

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

MRX

Member
  • Content count

    40
  • Joined

  • Last visited

Community Reputation

5 Neutral

1 Follower

About MRX

  • Rank
    Member

Profile Information

  • Gender
    Male
  • Location:
    Germany

Recent Profile Visitors

354 profile views
  1. Hey my name is Chris and im 18 years old. Im not a really good programmer so im looking 4 a guy that could do some scripts for me so I can recreate an old game that I enjoyed in the past very much. I know many people can´t really explain what the game is about so here is a link to the Trailer: I could do all animation work and texturing for the game. I could also pay you in Paysafecard for the scripts if you are interested. I would really appreciate it if somebody wants to help me
  2. Load Level on Collide

    Hey Guys at the moment I am making a 2D Sidescroller and I want the system to start a new level I want if the player collides with my Winning collider at the end of the level but it doesnt want to load the new level what did I do wrong pls help var levelToLoad : String; function OnCollisionEnter2D(coll: Collision2D) { Application.LoadLevel(levelToLoad); }
  3. Moving Wall

    Danke
  4. Moving Wall

    Hey Guys I am not very good at scripting and I asked me if it is possible if somebody could make a script that makes a Gameobject (Cube) that moves into one direction with a special speed that i the developer can setup and if this wall hits the player a button should be shown on the screen wich says "Respawn". And if you click on it the scene should restart. I know its much but it would be awesome if someone could help me here
  5. Hey guys I am currently making a little jump and run game and i wanted to add a multiplayer mode. I found a script on this forums and added it to my game now players should be able to play the game online but how can I host a server so that for example my friend can play with me?
  6. Building Placement Script

    Hey Guys I have got a Inventory Script for my game. That script allows me to pick up items that have a special script attached to them. I can also drop items that I have picked up but I wanna do something else with my items not just picking them up and drop them. I want to make objects like walls or furniture out of them that I can place on my terrain but I dont know how to do that so I wanted to ask you if somebody of you could help me with my script. Would be awesome!!!! BTW here is the script: Inventory Script: var Contents:Transform[]; //Although in the demo I am going to identify items as its own script *Item* I will still //identify and add them by thier transform to allow more of a versitile of ways to program a game //using this simple type of script . function AddItem(Item:Transform){//Add an item to the inventory. var newContents=new Array(Contents); newContents.Add(Item); Debug.Log(Item.name+" Has been added to inventroy"); Contents=newContents.ToBuiltin(Transform); } function RemoveItem(Item:Transform){//Removed an item from the inventory. print("made it here"); var newContents=new Array(Contents); var index=0; var shouldend=false; for(var i:Transform in newContents){ if(i==Item){ Debug.Log(Item.name+" Has been removed from inventroy"); newContents.RemoveAt(index); shouldend=true; //No need to continue running through the loop since we found our item. } index++;//keep track of what index the item is and remove it. if(shouldend){ Contents=newContents.ToBuiltin(Transform); return; } } } function DebugInfo(){ //A simple debug. Will tell you everything that is in the inventory. Debug.Log("Inventory Debug - Contents"); items=0; for(var i:Transform in Contents){ items++; Debug.Log(i.name); } Debug.Log("Inventory contains "+items+" Item(s)"); } Inventory GUI Script: //This type of inventory display will be a bag. similair to WoW. var backDrop:Texture2D; var windowPosition:Vector2=Vector2(200,200);//where on the screen the window will appear. //this can easily be and should be updated on the fly incase the screen size changes or what not. var windowSize:Vector2=Vector2(96.0,96.0);//the size of the window the bag will be displayed. var itemIconSize:Vector2=Vector2(32.0,32.0);//The size of the item icons var updateListDelay=1.0;//This will be used to updated the inventory on screen, rather then //updating it every time OnGUI is called. if you prefer you can directly get what in the list. but i //dont like having multiple GetComponents >.<. var lastUpdate=0.0;//last time we updated the display. var UpdatedList:Transform[]; var associatedInventory:Inventory; function UpdateInventoryList(){ UpdatedList=associatedInventory.Contents; } function OnGUI(){ //THIS BLOCK OF CODE IS JUST FOR PEOPLE TO MOVE THE BOX AROUND. //If your making a game you dont need anything this this. windowPosition.x = int.Parse(GUI.TextField(Rect (100, 10, 40, 20), ""+windowPosition.x, 3)); windowPosition.y = int.Parse(GUI.TextField(Rect (100, 30, 40, 20), ""+windowPosition.y, 3)); windowSize.x = int.Parse(GUI.TextField(Rect (100, 50, 40, 20), ""+windowSize.x, 3)); windowSize.y = int.Parse(GUI.TextField(Rect (100, 70, 40, 20), ""+windowSize.y, 3)); itemIconSize.x = int.Parse(GUI.TextField(Rect (100, 90, 40, 20), ""+itemIconSize.x, 3)); itemIconSize.y = int.Parse(GUI.TextField(Rect (100, 110, 40, 20), ""+itemIconSize.y, 3)); GUI.Label(Rect (0, 10, 400, 20), "WindowPosition X:"); GUI.Label(Rect (0, 30, 400, 20), "WindowPosition Y"); GUI.Label(Rect (0, 50, 400, 20), "WindowSize X"); GUI.Label(Rect (0, 70, 400, 20), "WindowSize Y"); GUI.Label(Rect (0, 90, 400, 20), "ItemIconSize X"); GUI.Label(Rect (0, 110, 400, 20), "ItemIconSize Y"); //THIS IS WHERE THE EDITING STUFF ENDS> FROM HERE BEFORE YOU would need. var currentX=windowPosition.x;//where to put the first items var currentY=windowPosition.y; //Draw the backdrop in the windowposition and the size of the windowsize. GUI.DrawTexture(Rect(windowPosition.x,windowPosition.y,windowSize.x,windowSize.y),backDrop,ScaleMode.StretchToFill); for(var i:Transform in UpdatedList){//we start a loop for whats in our list. You could var item=i.GetComponent(Item);//we know that all objects in this list are items, cus we //will make sure nothing else can go in here, RIGHT? //directly call accocialtedInventory.Contents but i prefer not to since its more work for you and the pc. //I use a button since its easier to be able to click it and then made a drop down menu to delete or move if(GUI.Button(Rect(currentX,currentY,itemIconSize.x,itemIconSize.y),item.inventoryIcon)){ associatedInventory.RemoveItem(i);//Remove the item from the list, well its transform neways item.BeDropped();//Drops the item. lastUpdate=0.0;//Set the lastupdate to 0 to allow the list to update. } currentX+=itemIconSize.x; if(currentX+itemIconSize.x>windowPosition.x+windowSize.x){ //if the next item icon will be to large for the window..... currentX=windowPosition.x;//we move it back to its startpoint currentY+=itemIconSize.y;//and down a row. if(currentY+itemIconSize.y>windowPosition.y+windowSize.y){//if the row is down to far. we quit the loop return; } } } } function FixedUpdate(){//I will update the display inventory here. if(Time.time>lastUpdate){ lastUpdate=Time.time+updateListDelay; UpdateInventoryList(); } } Item Script that is attached to a gameObject: /* this script is made to show you one way picking up items could possibly be done. you can find others ways to do this but using the same techniques i do to add item . */ var inventoryIcon:Texture2D;//this is what will be displayed in the demos On Screen GUI. var isStackable=false;//If this is true it will be stacked in the inv. if not then it wont! //Stacking will be added in the next update. var maxStack=9;//each stack can be this big. function OnMouseDown(){//When you click an item if(!collider.isTrigger){//im going to check if its collider is active. since i know i deactivate it when //it gets picked up. BUT you could also make a var "canGet" or somthing and change it when its picked up and dropped. //basically we dont want to pick up somthing, we already have. var playersinv=FindObjectOfType(Inventory);//finding the players inv. I suggest when making //a game, you make a function that picks up an item within the player script. and then have the inventory //referneced from its own variable. OR since the playerscript would be attached to the inv i suggest you //do GetComponent(Inventory).AddItem, This way multiple players can have inventorys. playersinv.AddItem(this.transform); MoveMeToThePlayer(playersinv.transform);//moves the object, to the player } } function MoveMeToThePlayer(theplayer:Transform){//This will basically make the item stay where the player is //as long as its in the players inventory. This can also be done multiple ways, but ill stick with an easy one. transform.collider.isTrigger=true;//makes it undence. transform.renderer.enabled=false;//makes it invisible transform.parent=theplayer;//makes the object parented to the player. transform.localPosition=Vector3.zero;//now that the item is parented to the player //i can set the localPosition to 0,0,0 and it will be ontop of the player. and move around with him/her } function BeDropped(){//This will drop the item wherever the player is. //since the player has the item parented to him, and at his position (locally) we are going to just //drop the item where it already is transform.collider.isTrigger=false;//reactive its collider. transform.renderer.enabled=true;//allow it to be seen again. transform.parent=null;//give it no parent. } /* Alternate ways to make objects stay with a player. is just move it to an unused part of the map and deactivate it like i did. Its invisible so it will be unseen and its untouchable . If you are switching scenes. for world areas or somthing. you can keep inventory objects alive by doing "DontDestroyOnLoad(this)". These are just some tips. Design however youd like to . */ Pls help me how I can use Items to make object like walls or 3d Models. Of course the Items I use need to be destroyed
  7. Hey guys I am making a survival game but I dont have a Inventory or a placement script. I am not the best programmer so I just wanted to ask you guys if somebody could make those scripts for me so that I can pick items up like sticks and then craft a barricade and place the barricade on my terrain to save me from enemys or creatures. Please help me that would be awesome!!!
  8. Inventory System C#

    Doesnt work for me. I cant pick Items up. Has it to do something with your GameManager Script because I dont have it.
  9. 3D Pixel Models

    I didnt made them with Cubes every one is a model
  10. 3D Pixel Models

    Hey Guys I have found a new and simple way to make 3d Models. So I decided to make some like a Potion a Pickaxe 3 Swords and a Tree e.t.c Here are the Screenshots tell me what you think about them and if I should give the free for download for you guys Sry for the bad Graphics
  11. Vignette/Chromatic/Blur

    How can I add this shader to my cam?
  12. Hey guys I am working on a Javascript or 2 scripts one for picking up an item and the second for crafting an new item out of it. Its quite simple so no problem so far but now if i picked my log up i want to place it on the ground with "p". Thats also no problem it works and it looks awesome but it does just place the item in the same direction so my player isn´t able to rotate the item in the direction he is looking. Can somebody help me? Btw here are the scripts: PickupLogs: (thats no problem this script is only for picking up and destroying the prefab like log) #pragma strict private var mouseOver = false; var lengthBar : int = 150; var widthBar : int = 25; function OnMouseOver() { mouseOver = true; } function OnMouseExit() { mouseOver = false; } function OnGUI() { if(mouseOver == true) { GUI.Box(new Rect(200, 200, lengthBar, widthBar), "Pickup Logs!"); } } function OnMouseDown() { Destroy(gameObject); var ManageScript : ManageInv = GameObject.Find("First Person Controller").GetComponent(ManageInv); ManageScript.logCollected = true; } ManageInv: (here is my problem i want the barricade to place or rotate in the direction the player looks like and not everytime in the same direction pls help me with this) #pragma strict var logCollected : boolean = false; private var showGui : boolean = false; var plank : Transform; var player : Transform; function Update() { if(logCollected == true) { showGui = true; } if(logCollected == true && Input.GetKey("p")) { MakePlank(); } } function OnGUI() { if(showGui == true) { GUI.Box(new Rect(200, 200, 200, 25), "Press P to craft your plank"); } } function MakePlank() { Instantiate (plank, player.transform.position, Quaternion.identity); logCollected = false; showGui = false; } Btw you can use these scripts if you want
  13. Hey Guys I just wrote a new script for my player for my game but I have a problem I wrote the script in JavaScript and made a GUI.DrawTexture that the player can see his health but it wont work can anybody help me? Script: var currentGun : GameObject; var distToPickUpGun : float = 6; var throwGunUpForce : float = 100; var throwGunForwardForce : float = 300; var waitFrameForSwitchGuns : int = -1; var walkAcceleration : float = 5; var walkAccelAirRacio : float = 0.1; var walkDeacceleration : float = 5; @HideInInspector var walkDeaccelerationVolx : float; @HideInInspector var walkDeaccelerationVolz : float; var cameraObject : GameObject; var maxWalkSpeed : float = 20; @HideInInspector var horizontalMovement : Vector2; var jumpVelocity : float = 20; @HideInInspector var grounded : boolean = false; var maxSlope : float = 60; var crouchRacio : float = 0.3; var transitionToCrouchSec : float = 0.2; var crouchingVelocity : float; var currentCrouchRacio : float = 1; var originalLocalScaleY : float; var crouchLocalScaleY : float; var collisionDetectionSphere : GameObject; @HideInInspector var waitToPickupAmmo : float = 0; var currentCell : GameObject; var health : float = 3000; var deadBodyPrefab : GameObject; var BarLength : int = 100; var Texture2 : Texture2D; function Awake () { currentCrouchRacio = 1; originalLocalScaleY = transform.localScale.y; crouchLocalScaleY = transform.localScale.y * crouchRacio; } function LateUpdate () { if (grounded) rigidbody.useGravity = false; else rigidbody.useGravity = true; waitFrameForSwitchGuns -= 1; waitToPickupAmmo -= Time.deltaTime; transform.localScale.y = Mathf.Lerp(crouchLocalScaleY, originalLocalScaleY, currentCrouchRacio); if (Input.GetButton("Crouch")) currentCrouchRacio = Mathf.SmoothDamp(currentCrouchRacio, 0, crouchingVelocity, transitionToCrouchSec); if (Input.GetButton("Crouch") == false && collisionDetectionSphere.GetComponent(CollsionDetectionSphereScript).collisionDetected == false) currentCrouchRacio = Mathf.SmoothDamp(currentCrouchRacio, 1, crouchingVelocity, transitionToCrouchSec); horizontalMovement = Vector2(rigidbody.velocity.x, rigidbody.velocity.z); if (horizontalMovement.magnitude > maxWalkSpeed) { horizontalMovement = horizontalMovement.normalized; horizontalMovement *= maxWalkSpeed; } rigidbody.velocity.x = horizontalMovement.x; rigidbody.velocity.z = horizontalMovement.y; if (grounded){ rigidbody.velocity.x = Mathf.SmoothDamp(rigidbody.velocity.x, 0, walkDeaccelerationVolx, walkDeacceleration); rigidbody.velocity.z = Mathf.SmoothDamp(rigidbody.velocity.z, 0, walkDeaccelerationVolz, walkDeacceleration);} transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent(MouseLookScript).currentYRotation, 0); /*if (grounded) rigidbody.AddRelativeForce(Input.GetAxis("Horizontal") * walkAcceleration * Time.deltaTime, 0, Input.GetAxis("Vertical") * walkAcceleration * Time.deltaTime); else rigidbody.AddRelativeForce(Input.GetAxis("Horizontal") * walkAcceleration * walkAccelAirRacio * Time.deltaTime, 0, Input.GetAxis("Vertical") * walkAcceleration * walkAccelAirRacio * Time.deltaTime); */ if (Input.GetButtonDown("Jump") && grounded) rigidbody.AddForce(0,jumpVelocity,0); if (health <= 0) { currentGun.GetComponent(GunScript).beingHeld = false; currentGun.rigidbody.AddRelativeForce(Vector3(0, throwGunUpForce, throwGunForwardForce)); Instantiate(deadBodyPrefab, transform.position, transform.rotation); collider.enabled = false; cameraObject.GetComponent(AudioListener).enabled = false; enabled = false; } } function FixedUpdate () { if (grounded) rigidbody.AddRelativeForce(Input.GetAxis("Horizontal") * walkAcceleration, 0, Input.GetAxis("Vertical") * walkAcceleration); else rigidbody.AddRelativeForce(Input.GetAxis("Horizontal") * walkAcceleration * walkAccelAirRacio, 0, Input.GetAxis("Vertical") * walkAcceleration * walkAccelAirRacio); } function OnCollisionStay (collision : Collision) { for (var contact : ContactPoint in collision.contacts) { if (Vector3.Angle(contact.normal, Vector3.up) < maxSlope) grounded = true; } } function OnCollisionExit () { grounded = false; } function OnTriggerExit () { currentCell = null; } function OnTriggerStay (hitTrigger : Collider) { if (hitTrigger.tag == "AIpathCell") currentCell = hitTrigger.gameObject; if (hitTrigger.transform.tag == "StairGoingUp") if (!Input.GetButton("Jump") && Vector3.Angle(rigidbody.velocity, hitTrigger.transform.forward) < 90) if (rigidbody.velocity.y > 0) rigidbody.velocity.y = 0; if (hitTrigger.transform.tag == "StairGoingDown") if (!Input.GetButton("Jump") && Vector3.Angle(rigidbody.velocity, hitTrigger.transform.forward) < 90) rigidbody.AddForce(0,-100,0); var current : GunScript = null; if (currentGun) current = currentGun.GetComponent(GunScript); var ammo : AmmoPickupScript = null; var gun : GunScript = null; if (hitTrigger.tag == "AmmoPickup" && waitToPickupAmmo <= 0) { ammo = hitTrigger.gameObject.GetComponent(AmmoPickupScript); if (current.currentExtraAmmo < current.maxExtraAmmo) { if (ammo.fromGun) { gun = ammo.gun.GetComponent(GunScript); if (gun.currentExtraAmmo > 0 && gun.ammoType == current.ammoType && ammo.gun != currentGun) { if (gun.currentExtraAmmo >= current.maxExtraAmmo - current.currentExtraAmmo) { gun.currentExtraAmmo -= current.maxExtraAmmo - current.currentExtraAmmo; current.currentExtraAmmo = current.maxExtraAmmo; } if (gun.currentExtraAmmo < current.maxExtraAmmo - current.currentExtraAmmo) { current.currentExtraAmmo += gun.currentExtraAmmo; gun.currentExtraAmmo = 0; } if (ammo.pickupSound) ammo.gameObject.GetComponent(AudioSource).Play(); } } if (!ammo.fromGun) { if (current.ammoType == ammo.ammoType || ammo.ammoType == -1) { if (ammo.ammoAmount > 0 && !ammo.unlimitedAmmo) { if (ammo.ammoAmount >= current.maxExtraAmmo - current.currentExtraAmmo) { ammo.ammoAmount -= current.maxExtraAmmo - current.currentExtraAmmo; current.currentExtraAmmo = current.maxExtraAmmo; } if (ammo.ammoAmount < current.maxExtraAmmo - current.currentExtraAmmo) { current.currentExtraAmmo += gun.currentExtraAmmo; ammo.ammoAmount = 0; } if (ammo.pickupSound) ammo.gameObject.GetComponent(AudioSource).Play(); } if (ammo.unlimitedAmmo) { current.currentExtraAmmo = current.maxExtraAmmo; if (ammo.pickupSound) ammo.gameObject.GetComponent(AudioSource).Play(); } } } } } } function OnGUI () { GUI.DrawTexture(Rect(400,430,100*health/BarLength,20),Texture2); }
  14. Hey Guys Im not good at scripting but I have a Minecraft Building Script with that my Character Controller can build and destroy primitive Cubes with no textures. So my question is if somebody could make that the blocks that I am building have textures and make a sound if I place or destroy them. Is that possible please help Thank you for all people who help me! Here is the Building Script: Code: var blockLayer : LayerMask = 1; var range : float = Mathf.Infinity; var hit : RaycastHit; function Update () { if (Input.GetMouseButtonDown(0)) Build(); if (Input.GetMouseButtonDown(1)) Erase(); } function Build() { if (HitBlock()) { var cube = GameObject.CreatePrimitive(PrimitiveType.Cube); cube.transform.position = hit.transform.position + hit.normal; } } function Erase() { if (HitBlock()) Destroy(hit.transform.gameObject); } function HitBlock() : boolean { return Physics.Raycast(transform.position, transform.forward, hit, range, blockLayer); }
×