FragMate CommunityLog in

FragMate - Software and Game Developer Community, including Resources, Forums, Marketplace & More.

Share

descriptionCrafting System by Bryce Cain 25

more_horiz
Hey everyone!
a member by the name of FRAGSn111pezz needed some help on a crafting system...to I made one!
the script is commented on, so you should not run into any problems...
but if you do have questions please ask
the script came out with a parsing error but there appeared to be none when compiling the script in unity...
but if the same problems happen with you aswell..please pm me or write on this post...thank you...



PS: I know this code is very discrete in a way with the whole enabling and disabling of gameobjects but this will do

Code:

 #pragma strict
var craftedweaponone : GameObject;
var craftedweapontwo : GameObject;
var craftedweaponthree : GameObject;
//how ever much you wan't, whatever
var suppliesgather : int;
var ammounttogather : int;
function Start () {
craftedweaponone.enabled = false;
craftedweaontwo.enabled = false;
craftedweaponthree.enabled = false;
 //this just makes sure that you are not seeing all the weapons at once, more at one at a time

}

function Update () {
if(suppliesgather == ammounttogather) {
   var craftedweaponone.enabled = true;
   //you will see the weapon appear after enough supplies with the tag "supplies" are gathered
}
}



function OnTriggerEnter () {
   //for preperation add a collider with a trigger...make sure this is not
   //the player's collider, it will fall throught the terrain
   if(GameObject.tag == "supplies") {
      suppliescollect();
      //this just means that we are finding a gameobject with the tag "supplies" attached and making sure we increase the integer..
   }
}

function suppliescollect () {
suppliesgather++;
//this is adding on to the base 0 for the ammount of supplies gathered..

}

_________________
-BryceCain25

descriptionRe: Crafting System by Bryce Cain 25

more_horiz
i get this error

Assets/Crafting system.js(18,24): BCE0043: Unexpected token: ..

descriptionRe: Crafting System by Bryce Cain 25

more_horiz
[You must be registered and logged in to see this link.] wrote:
i get this error      

Assets/Crafting system.js(18,24): BCE0043: Unexpected token: ..

I'm going to look into this...in the mean time just sit back

_________________
-BryceCain25
Permissions in this forum:
You cannot reply to topics in this forum