I need some scripting help

Actually a lot… I found the Javascript tutorial and that helped a little bit but I need a little bit more help like each of the things in the language and how to apply it to Unity… Tutorials are great, but its followed what someone ELSE is doing… When you wanna do something yourself of your own idea its so hard because sometimes you don’t know how to use some of that code from the tutorial you watched or read without messing up your own, or adding to it to make it your own ya know? Like if I watch a tutorial about scripting a first person shooter and I try to make my own but try to add my own spin, it’ll be tough cause I won’t know how to add my scripts to theirs… Is there a good place to learn what each bit of the language does? This would also help with coming up with my own codes so if, say I wanna make something move around, I know exactly what kind of code I need ya know so I can come up with it on the fly? I know its a long way if I’m just beginning but can someone give me good places to refer to for popular and common scripts to make common genres of games such as FPS’s or RPGs? Those 2 genres are just examples but scripts common for any genres I’d be interested in.

I tried to be as detailed as possible as to what I want because I know quite a bit on everything in the program EXCEPT scripting and thats a major part of the program and making games in general. IF there’s still stuff you don’t understand about my request please tell me and/or give me ideas on how to learn how to script as to make the gamemaking of a novice much less painful and frustrating. Thank you very much and I wish you guys well in the making of YOUR games!

Edit: I just went to the Wiki for this site… are there good scripts there?

The Wiki does have some really great stuff on it, and some of it is useful in lots of situations, but alot of it is really specific.

My best advice to you is to read up how really basic programming works. Things like if statements, loops, variables…all that jazz. Do a few Javascript tutorials that aren’t related to Unity if you need to.

Then, do the Unity tutorials (if you havn’t already done them). Complete something like the FPS tutorial and try to enhance it by adding small new features…most of all, read through the scripts and constantly refer to the Unity script reference for help.

If you want to make games, you unfortunately do have to learn to script fairly well…and most of the skills you learn are exchangable between all genres. For example, if you have a pathfinding script for an RTS unit, this could easily be applied to making enemy AI for an FPS.

I agree with IronWarrior though i dont entirely agree on doing javascript tutorials, but its a matter of choice weather you do and it cant hurt to help you understand the basics around programming.

My personal reason for dissagreement is that Unity’s .JS (UnityScript) isnt really Javascript in its entirety and is more a dialect of Javascript.
This discussion topic will explain more than i can and i’ll let you make your own decisions
http://forum.unity3d.com/viewtopic.php?p=358542

But as far as implementing your own code goes i’d say try it have a dig around try different things and if you find it works then great.
If it doesnt then you have unity wiki/answers/forums/scripting references and a whole host of other sources as reference material to help you understand where your tripping up.
And if your still stuck then just start a new thread on the topic on the scripting forums. these guys/gals are a great bunch and usually more than willing to help.

Hope you all the best in your game/'s

Oh and if you really cant get your head around it, see if theres anybody out there that does and see if you can get them to colaborate though you seem really driven and interested in learning all area’s of development that’s a good thing.

These guys said it all. Find a simple tutorial (sorry I don’t know of any) or take a class. www.W3Schools.com is fantastic for code tips. Ask for help here on the forums.

I’d recommend deciding on a simple project, and learn each piece AS YOU NEED IT. For example, make a ball roll down a slope and bounce off obstacles. Each time it hits one kind of obstacle, it makes a noise. Each time it hits another type of obstacle, it releases a particle explosion. That will involve a few things:

  1. setting up a scene (which you probably already know how to do)
  2. importing sounds
  3. creating a particle system
  4. scripting collisions
  5. scripting sounds
  6. scripting an explosion to go off, by instantiating a prefab

After that project, come up with another small project for yourself – maybe this time guiding a character around with the arrow keys or mouse, firing projectiles (with a particle system “poof”), and destroying targets that get hit with the projectile.

Pretty soon you’ll have enough individual “pieces” in your mind that you’ll be able to code more and more complex Unity experiences. Best of luck to you and have fun with it!