Added: 2 years ago
From: TornadoTwins
Views: 118,525
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (604)

Sign In or Sign Up now to post a comment!
  • I have one problem to make is shoot one by one

    NullReferenceException: Object reference not set to an instance of an object

    TurretControl.Shoot (System.Object seconds) (at Assets/Scripts/TurretControl.j­s:31)

    TurretControl.Update () (at Assets/Scripts/TurretControl.j­s:19)

  • HELPP PLEASEEEE /watch?v=YeAWtVg3BiY

  • What language is he using?

  • @Mardun38 English. LOL

  • @Mardun38 Unity uses JavaScript, C# and Boo. He is using JavaScript in these tutorials.

  • guys if anyone has NullReferenceExeption just try this...i spended 1h trying to solve this puzzle

    write the script exactly as it is above.but int the line :

    var bullit = Instantiate(bullitPrefab,GameO­bject.Find("spawnPoint2").tran­sform.position,Quaternion.iden­tity );

    in tornadotwins script its written as var bullit = Instantiate(bullitPrefab,proje­ct.Find("spawnPoint2").transfo­rm.position,Quaternion.identit­y );

    just write GameObject instead of transform.Find("spawnPoint2").­transform.position

  • OMG it doesnt work for me... the turret wont shoot. ive done all that you did but it says ive got a null reference exception and its wrong on line 28 and 19! PLEASE HELP!!

  • "Assets/TurretScript.js(12,41)­: BCE0023: No appropriate version of 'UnityEngine.Object.Instantiat­e' for the argument list '(System.Type, UnityEngine.Vector3, UnityEngine.Quaternion)' was found."

    var bullet = Instantiate(bulletPrefab, GameObject.Find("TurretFireSpa­wn").transform.position,Quater­nion.identity);

    What to do?

  • can i have the torrent control code so i can copy paste.

  • the link just takes me to gameprefabs [dot] com

    :(

  • @NerdyComputerDood i know lol. i couldnt find any of the stuff for free like the turrets and the temple and stuff. It just takes you to the homepage and when you scroll through it all its not even there

  • Sad that you guys can't even keep these files free you had to sell out so bad.

  • I put my turret under ground and it made a FOUNTAIN!!!! it was so funny me and my team of developers started balling our eyes out of the sockets that hold them!!

  • i cant go to 1

    

  • hey tornado twins would u mind adding me on facebook? to get direct information from u on how to use this

  • can anyone tell me how to make games with this program?

    

  • dude the is programming you need to watch the video from part 1

  • Lol i made a minigun that Heavy uses in TF2 from Maya, im prob going to use that =)

  • I cant get the turret to shoot. It follows me fine but I need the script that they are using. If the scripting works for you, could you copy and paste it in a comment so I could use it?!?!? This SCUKS.

  • i do every thing but when i press play program closes and it pop up error=dont send

    help!

  • unexpected token var line 29 (same as video) please help ive done everything i can also in the same one it says put ; at (29,4) someone please tell me what this means

  • nullreference exeption HELP ME!!!

  • @stijnimanbik Null reference exeptions happen when you don't define a variable in the Inspector, make sure all your variables have a value

  • thumbs up if you think tht flamethrower turret is awesome

  • Assets/TURRET.js(18,27): BCE0023: No appropriate version of 'UnityEngine.Object.Instantiat­e' for the argument list '(UnityEngine.Transform, UnityEngine.Transform, UnityEngine.Vector3, UnityEngine.Quaternion)' was found.

  • @Ceneviva Code:

    var bullit = Instantiate(bullitPrefab, transform.Find("spawnPoint").t­ransform.position, Quaternion.identity);

    You properly left out .transform.position in the second parameter.

  • @mepain1 Oh thanks alot!!! Now it works!

  • 7:53 hilarious voice change:) <3

  • 7:53 ahaha

  • oops i ment 7:53:) haha hilarious voice change! <3

  • 7:54 haha hilarious voice change:)

  • i dont understand any of this XD but if i want to make my own games then it will take some time im 15 so i got still a few years to learn it meybe i understand it when im older to bad im not one of the smart guys but one of the stupid ones and the only reason im writing this is because im bored XD lol

  • I want it to be a machine gun with 2 turrets, so what do i have to chance to make it shoot faster and how do i make an second spawnPoint where he shoots right after the first spawnpoint shot?

  • I got NullReferenceException wat that mean?

  • I keep getting a funny error. up to about 3.5 min into the episode where the turret is supposed to shoot every frame update and instead it fires when i Fire1(left mouse click) and the fireball comes out(of the turret) in the direction of the worm... i remade the spawnPoint etc but unity still is mistaking the worm spawnPoint for the turret spawnPoint. consequently the worm doesnt spawn a fireball with this error only the turret. does anyone know what i am doing wrong? thanks!

  • nice you vids are realy helpfull..havent implemented them yet because im new to unity...and im still stuck on udk and my friend is helping me ajust :D

  • @IRrandom12321 i ment your*

    

  • I typed in everything he did triple checked it, did everything he did, and it still won't shoot!! HELP!

  • It won't shoot at all!

  • Top tip. Don't make the turret fire a turret at this point. My computer almost died.

  • Comment removed

  • Nerd

  • @MrLaMocro You don't even have to be a nerd to know this stuff. It's nice, clean and basic.

  • @Misthema Exactly. He is just jealous.

  • @MrLaMocro Awesome guy

  • learn already that's bullet, not bullit

  • @alexgrinkov Depends on country.

  • @spike117117

    no dictionary lists "bullit"

  • LOL Flametrower COOL

  • OK, what is the problem here, I have everything but, I may be happy that as soon as the scene loads & turret starts shooting the time I expect it to, but 3 errors, error #1 why if no matter what time between shots is set to, it always just rapid fires loads of prefabs, & error #2 why does the prefabs just sit there & not move like a fired bullet & error #3 why does this error missing method rigid body add force occur? D:

  • ok, why in the hell is my turret not going crazy shooting 1000's of fireballs like that? All that happens is when i press "Fire1" the turret shoots off the z axis regardless of where it's looking.....

  • @cwperkins83 Ok, finally figured it out.....I had to parent the spawnPoint to Top Part and not SmallTurret.....only took all day.....

  • Nice sentry gun :P

    Great tutorial!

  • Comment removed

  • keep pressing 8 quickly 

  • Nice I love your tutorials!!

  • my turret wont shoot

  • If you guys are still having trouble with the turret not shooting:

    remove the var seconds, var oddeven and the if(oddeven) statement out of the If(LookAtTarget) statement.

  • can u send me a message on what all those programes are at the bottem startin from left to right plz

  • I got a problem after putting the last script for the turret. When I test play, for some reason, my worm fireball isn't shooting at the front of the worm, its shooting next to the worm. I check on the spawnPoint for the worm and is front of it. What might my worm to shoot on the side.

  • 3:36 coooool

  • i have a problem : unknow identifier : identity

  • Someone please just put the CORRECT script up!

  • Comment removed

  • What happen to the script: //transform.LookAt(LookAtTarge­t);

  • function Shoot(seconds) { if(seconds!=savedTime) { var bullit = Instantiate(bullitPrefab ,transform.Find("spawnPoint").­transform.position , Quaternion.identity); bullit.rigidbody.AddForce(tran­sform.forward * 1000); savedTime=seconds; } }

    this is 2nd half, did anyone fix the problem of turrets facing wrong way and looking the opposite way of the worm?

  • @Dragonhunter1232 spin the Turret around

  • var LookAtTarget:Transform;

    var damp =6.0;

    var bullitPrefab:Transform;

    var savedTime=0;

    function Update () { if(LookAtTarget) { var rotate = Quaternion.LookRotation(LookAt­Target.position - transform.position); transform.rotation = Quaternion.Slerp(transform.rot­ation, rotate, Time.deltaTime * damp); var seconds : int = Time.time; var oddeven = (seconds % 2); if(oddeven) { Shoot(seconds); } }

    this is 1st half

  • Ok... so I know I'm just another random person posting their issue... But does anyone know what a NullRefrenceExeption is? at (System.Object seconds) also says "Object reference is not set to an instance of an object..." I swear I've copied his script perfectly 3 times over and i still have the issue. And the turret keeps spraying everywhere. Anyone help? =/

  • i have not a eror "i can not shoot"

    ik heb geen erors maar ik kan niet shieten

  • can somebody just please paste a working script ive copied it correctly but i still get errors i dont want to waste my time and be stuck on this for hours.

  • you spelt bullet wrong

  • How do I script button inputs? For example, checking if the Z key is down for say, a jetpack input?

  • Comment removed

  • @michaelfadich if(Input.GetkeyDown("z"))

    {

    }

  • @MuLtiFLYGuY24 Could you copy/paste your script so I can see it?

  • hello im stuck on this script too :( cacn someone give me a script that works with u? plz :(

  • Unknown identifier shoot...?

  • Great tutorial guys! I was wondering if someone could help me, i need an object to move torewards another object (me/ maincamra). I tryed gototarget and stuff but it didin't work. How do i do that??

  • NullReferenceException

    cannon controll.Shoot (System.Object seconds) (at Assets/cannon controll.js:28)

    cannon controll.Update () (at Assets/cannon controll.js:19)

    ?

    my error and the turrent is shooting ?

  • Comment removed

  • Assets/TurretControll.js(23,31­): BCE0005: Unknown identifier: 'bullitpreferb'. 

  • @nermiina1 Make sure your spelling is correct "bulletPrefab"

  • @supersushi269 can you help no one else will my problem is that my turret looks away from me instead of following me do you know how to fix it?

  • @SuperGamespawn It happened with me too! Did you download or made the model? If so make sure the "local" axes of your model are same as the "global" axes of unity. In simple terms unity thinks that the rear of your turret is its front.

  • @supersushi269 i made it and thank you so much i have asked this in so many places and finally an answer!

  • @supersushi269 one more thing iv used unity for a year but forgot how to change my model axis can you tell me?

  • @SuperGamespawn Its only a week I am in unity and I dont know how to do it in Unity :P BUT in order to change the axis you need to do in a 3D modelling software (like blender) Make sure Y is 'up', X is 'right' and z is 'front'

  • @supersushi269 i made to model using unity for testing purposes

  • Comment removed

  • tornadoTwinAdd? var LookAtTarget:Transform; var damp = 1.0; var bullitPrefab:Transform; function Update () {if(LookAtTarget) {var rotate = Quaternion.LookRotation(LookAt­Target.position - transform.position); transform.rotation = Quaternion.Slerp(transform.rot­ation, rotate, Time.deltaTime * damp ); Shoot(); } } function Shoot() { var bullit = Instantiate(bullitPrefab ,transform.Find("spawnPoint").­transform.position , Quaternion.identity); bullit.rigidbody.AddForce(tran­sform.forward * 1000); }
  • Awesome tutorials dude! Everything so far works for me :D I got some errors but then I fixed them all ;)

  • I realized that i called my bullitPrefab BullitPrefab and it messed stuff up so it dosnt match the stuff in my script how do i change the name of the bullit prefab (which is currently named BullitPrefab) back to bullitPrefab

  • I realized that i called my bullitPrefab BullitPrefab and it messed stuff up so it dosnt match

  • I have a error that says NullReferenceException

  • @fvgbdhgfe123456789 If I were you I would start back from square 1.

  • When i shot now, my bullit come out from the smallTurent... :S

  • the fireballs don't shoot at my worm unless i press SPACE....and if i do it does not shoot at my worm but the direction my worm is facing... help?

  • Assets/Physic Materials/slowturretdown.js(27­,53): BCE0020: An instance of type 'UnityEngine.Transform' is required to access non static member 'Find'. this is the problem i having pleas help me.

  • Comment removed

  • Comment removed

  • Comment removed

  • my turret doesn't shoot the fireballs just fall from it. I NEED HELP PLEASEEEEEEE!!!!!

  • when i hit the space bar. the turret shoots not me

  • I think you might have misunderstood some functions,

    Quaternion.identity gives you no rotation (like an identity matrix), not the rotation of the object.

    in Quaternion.slerp / lerp the third parameter is not the time, but how much it should rotate (from 0 (no rotation) to 1 (rotate to the target), using the time it will move slower the closer it is to the player.

  • Comment removed

  • @Rokondude5 How do you want us to know what is on line 25 in your script? Post the line code here or if there isn't any it's probably a typo or you forgot some brackets.

  • @fvgbdhgfe123456789 Open up your TurretControl script , line 3, and add a ";" at the end. If you followed the instructions correctly, you're probably missing a semicolon at the end of var bullitPrefab:Transform .

  • i get the erro Assets/TurretScript.js(25,21): BCE0005: Unknown identifier: 'savedTime'.

    in the text if(seconds!=savedTime)

    pls someone help me

  • @rangcardo You seem to have forgot to define the savedTime variable :) Open up your script, and at the beginning add the following line :

    var savedTime = 0;

    Hope this helps.

  • plz plz can u putt the turretcontrol in the discription

  • plz plz can u putt the turretcontrol in the discription

  • how do i fix this?

    Assets/TurretControl.js(38,42)­: BCE0034: Expressions in statements must only be executed for their side-effects.

  • Omg i have a so annoying error it says

    Assets/TurretControl.js(18,30)­: BCE0023: No appropriate version of 'UnityEngine.Object.Instantiat­e' for the argument list '(UnityEngine.Transform, UnityEngine.Transform, UnityEngine.Vector3, UnityEngine.Quaternion)' was found.

    can someone help me??

  • @TheUndeadclaws I agree, everyone put thumbs up like me

  • @sampsonist So with over two million viewers, he is supposed to help all of them?

  • @mepain1 Yes that's supposed to = to that because most videos that are tutorials they're supposed to be helping things not some sort of random entertainment. :|

  • @sampsonist There is no way that he can aid all of them himself, since there are so many. Do you need help your self? If you do, let me know and I will help you out.

  • How do I fix the problem of my turret falling through the ground... At first it didnt do that... someone please tell me which part keeps it on the ground so i can fix it?

  • @DeliciousBuddhaboi

    did u untick ur collider by accident?

  • NullReferenceException

    turretControl.Shoot (System.Object seconds) (at Assets/scripts/turretControl.j­s:31)

    turretControl.Update () (at Assets/scripts/turretControl.j­s:19)

    THIS IS MY NEW ERROR HELP PLS

  • NullReferenceException

    turretControlNew.Shoot () (at Assets/scripts/turretControlNe­w.js:25)

    turretControlNew.Update () (at Assets/scripts/turretControlNe­w.js:16)

    THIS IS MY ERROR PLS HELP

  • ok, i am having such a hard time and nobody else has had this problem looked down to the 19th paige of comments. it says Assets/Physic Materials/slowtureetdown.js(16­,10): UCEOOO1 ';' expected. Insert a semicolon at the end. now i fix that problem and now new problem. Exprressions in statements must only be executed for their side-effects. and there another error sayings. An instance of type 'UnityEngine.Transform' is recuired to acess non static member 'Find'. ps help i have been trying for days

  • never mind, i fixed that error but now i am getting another.

    Assets/TurretControl.js(19,32)­: BCE0044: expecting :, found ';'.

  • I have an error that i researched and can't seem to find a solution to. I'm not sure if it is an error with the script but i checked it many times and couldnt find anything wrong with it. this is the error i get.

    Assets/TurretControl.js(26,85)­: BCE0019: 'transform' is not a member of 'UnityEngine.Transform'.

    That is exactly what it says, and i have no idea what it means or what to do about it...any suggestions?

  • my errors

    Assets/TurretControl.js(22,1): BCE0044: expecting EOF, found '}'.

    Assets/TurretControl.js(19,12)­: UCE0001: ';' expected. Insert a semicolon at the end.

    Assets/TurretControl.js(19,9): BCE0043: Unexpected token: var.

    Assets/TurretControl.js(17,17)­: BCE0043: Unexpected token: ;.

  • @KillerPenguin98 this is the Error I get can u tell me the Fix

  • @KillerPenguin98 all you have to do is erase the semicolon at the line

    function Shoot();

    erase the semicolon so it says

    function Shoot()

  • @KillerPenguin98 It looks like you forgot the semicolon at the end of a line of code so you have 4 errors so go put the semicolons at the end of the line of the code.

  • @KillerPenguin98 You're missing ' ; ' from line 19 or somewhere.

  • i got thees errors:

    Assets/TurretControl.js(20,73)­: BCE0044: expecting ), found 'Quaternion'.

    Assets/TurretControl.js(20,83)­: BCE0043: Unexpected token: ..

    Assets/TurretControl.js(20,92)­: BCE0043: Unexpected token: ).

    Assets/TurretControl.js(20,93)­: BCE0043: Unexpected token: ;.

  • I got this errors:

    Assets/TurretControl.js(19,1): BCE0044: expecting (, found '{'.

    Assets/TurretControl.js(24,1): BCE0044: expecting EOF, found '}'.

  • btw your friends turrets look good but shoot bad you should check it out 0.0

  • Comment removed

  • Comment removed

  • Comment removed

  • dude nice im from Lithuania what a coinsidance

  • I have a problem it says

    NullReferenceException

    turretControl.Shoot (System.Object seconds) (at Assets/turretControl.js:28)

    turretControl.Update () (at Assets/turretControl.js:19)

    what do i do it says line 28 but it is identical

  • @onthebattlefield67 me too and fireballs dont shoot out of it, and when i try to shoot my fireballs it comes out the tuuret in the direction im facing could someone please help!

  • @onthebattlefield67 me too and my fire balls come out the turret, someone please help us!!!

  • The turret doesn't act as it should be! It should rotate at a constant speed but its speed depends on what the difference between current rotation and final rotation. For example when I change my position 180 degrees against turret, in first second turret changes 120degrees and next 30, next 10, next 5, next 1. This is not a machineish behaviour.

  • can you help me i keep getting :

    Assets/TurrentControl.js(20,25­): BCE0043: Unexpected token: }.

    when i look at your scrip , it still haves the }

    but our not getting the error :(

  • mine says: UnassignedReferenceException: The variable bullitPrefab of 'TurretControl' has not been assigned.

    You probably need to assign the bullitPrefab variable of the TurretControl script in the inspector.

    what shoul i do

  • HELP, My turret isnt shooting it is saying that "bulletPrefab" has not been assigned, even tho i assigned it

  • i got 287 errors...

  • thanks i just got it

  • here's the script guys:

    W w W(dot)GOOGLE(dot) C o M

  • What shell I do if it says BC0042: Error reading from 'Assets/Standard Assets/TurretControll.js': 'Index is less than 0 or more than or equal to the list count.Parameter name: index?

    Please help me.

  • plz help when i press space my turret shoots???

  • @MrCODXD name the spawnPoint in the topPart of the turret "spawnPoint1" (without the quotes)

    in the turret controls script where it says

    var bullit = Instantiate(bullitPrefab ,transform.Find("spawnPoint").­transform.position ,Quaternion.identity);

    make the part that says ("spawnPoint") say ("spawnPoint1")

    the line should look like this:

    var bullit = Instantiate(bullitPrefab ,transform.Find("spawnPoint1")­.transform.position ,Quaternion.identity);

    select topPart and drag fireball into its target

  • what game is it called is it out

  • good. still, don't understand exactly...

  • @TornadoTwins I don't get the variable bullet prefab and I get Loads of errors even though i copied the script exactly, can you help please?

  • ok, these are good, but with the script, i did everything precisly to what you've put, could someone paste the script

  • it looked like a flame thrower haha, retitle this " how to make a flame thrower in js "

  • i cant do this it just says Shoot() is not a valid thing

  • @RawrsaidJye same

  • I have a problem with my turrets. I copied this script exactly but my turret heads end up like 10 feet away from the base when I start the game. I don't know what is wrong. Any ideas?

  • 3:40

    Worm:crud,crud, crud. FLAMETHROWER!!

  • help please when i start it doesnt work is says in the console "NullReferenceExeption NewBehaviorScript 2[my turret control script [it wouldnt let me remane it]] (System.Object seconds) (at Assets/NewBehaviorScript 2.js:29)"please help if you want to know the script that i used message me please help

  • how can I import the islanddemo into unity3D?

    

  • Ok my problem is for the part where it says function shoot the this annoying error pops up "expecting (, found shoot and i change shoot to (, and 10 other problems pop up so im freaking out can you help me plz

  • The 1 person who disliked this was a worm.

  • Thanks guys Im loving these tutorials!!

  • nevermind i did it and im eleven :)