Hey guys.
So today I was thinking to myself, it would be awesome to add another layer of world interaction and thought of adding a wood cutting script, similar to RuneScape style.
Basically, this is how it would work.
- Tree is loaded with world, with a collider
- When in range, you can press a button to make it chop the tree
- Random number between 3-7 seconds to cut the wood
- Wood is loaded into inventory
- Tree and collider disappears, and spawns a stump with collider
- Stump is not cuttable
- Between 15-20 seconds, stump grows back into the tree ready to be cut again.
Anyone want to help me on this one? 
Stephen
bump… really want some help with this 
hey I can help you but i havn’t time now. maybe tonight or at next weekend.
Perhas if you show us what you have got so far …
I mean have you the collider part setup, can you locate the tree that is. … etc
I have a treee collider set up and stuff. I understand the theory behind scripting i just cant put it into a script.
I have bought a huge rpg kit, the orkashi one, so it will be easy for me to integrate so that the icons get put into inventory.
SO like…
Whenver player hits tree collider with on mouse down,
commence cutting script and begin animation
if the player decides to walk/run away from the tree collider, NOT to be mistaken with the mesh collider (tree collider is a little wider, it uses ON TRIGGER) , return and give nothing. the script resets so that whenever they want to be able to start cutting again, they will have to tart from scratch.
cutting tree takes 5-7 seconds.
at the end of the cutting period, return 1 wood.
tree then transforms into a stump.
stump is not cuttable, it has no scripts.
within 15-20 seconds, respawn the original tree with its cutting script, and delete the stump. or transform whatever…
thanks
im still noob lol
Well I mean I dont want to do the work for you. Two reasons. I am way too lazy. Secondly, you need to learn how to do it.
Start with the collider. Set a script on the tree. Do the collision text by
OnTriggerEnter(Collider other)
{
if(other.tag == “Tree”)
{
// We are now inside the tree. Alert the player. This can be done by for instance sending him a message by using SendMessage, a reference to the player etc
}
}
Start simple and work your way up
thanks man. can i add you on skype or something? this is like my first time scripting something as big as this… haha and its not even big! lol.
i jsut want a little assistance/guidance… you dont have to tell me everything, like you said i have to learn for myself
-
Tree is loaded with world, with a collider – This can be done from the interface
-
When in range, you can press a button to make it chop the tree – Create a raycast from the player to the trees, when the raycast gets small enough, you then are able to chop the wood.
-
Random number between 3-7 seconds to cut the wood – Use Random.Value to create a random number, then use something like this:
if (Random.Value >= 0.5)
{
TreeChopTime == 3;
} else {
TreeChopTime == 7;
}
- Wood is loaded into inventory – I’m not familiar with what Inventory you have set up, so I don’t know what command you should add to add wood to it… But it should be something like this:
var script : InventoryScript;
script = GetComponent("ScriptName");
script.addWood ();
- Tree and collider disappears, and spawns a stump with collider – First Instantiate the stump, then remove the Tree. This script would be attached to the Tree.
- Stump is not cuttable – Dont need to add anything here.
- Between 15-20 seconds, stump grows back into the tree ready to be cut again. – Use the first bit of code that I used to determine the spawning time for the stump to spawn a tree in its place. This would be attached to the Stump.
I hope this helped!
I would recommend reading JavaScript tutorials, so you could be able to make this on your own, and forget the hassle. 
Any chance you can retype this into c#
hehe
thanks for he help though phillip! appreciate it lol