+ Reply to Thread
Results 1 to 8 of 8

Thread: Vector Thruster Missile Tutorial

  1. #1
    Wire Amateur -Simply-ownage is on a distinguished road -Simply-ownage's Avatar
    Join Date
    Feb 2009
    Posts
    32

    Default Vector Thruster Missile Tutorial

    I realise my last few tutorials have been kinda stupid
    and hard to understand,
    ill try make this as simple as possible,
    without offending anyone.

    Code:
    @name Vector Thruster Missile
    @inputs Numpad
    @outputs Vec:vector Mul Pos:vector
    @persist T:entity Timer
    runOnTick(1)
    
    findByClass("player")
    T = findResult(3)
    
    # Finds T as the person who has been connected the longest, a target.
    Code:
    E = entity():isWeldedTo()
    
    #Gets what you have welded the entity to, usually the rocket.
    Code:
    E:setMass(50)
    
    #Sets the mass of the rocket a bit lower, just so that the mul actually makes a difference.

    # Now you create a vector. A vector containts all 3 xyz co-ords for example
    # Vec(x,y,z)
    Code:
    if (Timer > 300) {
    Pos = (-T:pos() - -E:massCenter())
    Vec = Pos*2 + $Pos*10}
    
    # Adds a "Pos" so that you can use delta.
    # Finds the Vector of the targets position, then removes it from the position of the Rocket.
    # Now if there is a vec input on a vector thruster, how do you think this should be wired. Bare in mind, this is extremely simple and won't work very well.
    Code:
    if (Timer < 300) {
    Pos=(-T:up()*500 - -E:massCenter())
    Vec = Pos*2 + $Pos*8}
    
    #Sends the rocket up into the air when activated.

    Code:
    if (Numpad) {Timer++}
    
    #If you active the same numpad as the missile, then it will start the
    #Timer, sending it up, then to its target.

    Code:
    if (!Numpad) {Timer = 0}
    
    #If you turn the rocket off or it is destroyed, timer resets to 0.

    Code:
    if (Numpad) {
    Mul = 20000}
    
    #Sets the mul for the vector thruster.
    #Experiment with this.

    Code:
    if (!Numpad) {Mul = 0}
    
    Please dont critisize, i just see that some people wanna make some vector thruster missiles.
    Last edited by -Simply-ownage; 07-06-2009 at 07:33 PM.

  2. #2
    Wire Sofaking Officer Tibbles has a spectacular aura about Officer Tibbles has a spectacular aura about Officer Tibbles has a spectacular aura about Officer Tibbles's Avatar
    Join Date
    Aug 2008
    Location
    Barnus Philbert Boulevard
    Posts
    813

    Default Re: Vector Thruster Missile Tutorial

    Okay may I criticize? No? Okay I shall anyway.

    You can't teach people through comments in the code. Do your tutorials, line by line, explaining thoroughly what each element does, and in the end, slap it together into a complete "Example" code.

    For example...

    I am going to be teaching you how to make a toggle switch!

    Let's start off by pulling up your Expression 2 STool, found under "Control".

    Start by adding an Input, let's call it "A", this is how your line should look.

    Code:
    @inputs A
    
    Let's continue by adding an output, which will be our On / Off value. We shall call this, B.

    Code:
    @outputs B
    
    Now for our code.

    We will be using the operator, +=, which means, Increment Value C by D ammount. It looks like this.

    Code:
    C += D
    
    Along with the increment, we will be using an If Then statement that follows the pattern of..

    Code:
    if(Input==E){Output=F}
    
    Back to our project, let's apply these principles!

    Code:
    if(A) {B+=1}
    
    What we just did is, If any input other than 0 is inputted (Remember, A is our input), then Increment B by 1.

    Now for the reset.

    Code:
    if(B > 1) {B = 0}
    
    If Value B is greater than 1, then it reset to 0.

    Your code should look something like this.

    Code:
    @name Toggle
    @inputs A
    @outputs B
    @persist
    
    if(A){B+=1}
    if(B>1){B=0}
    

    This works by incrementing B until it is greater than 1, and resets it back to 0. Wire up a button to A (A non toggle button), and B to a screen.

    As you press the button, the value changes to 1. If you press the button, it resets to 0 because it will have incremented to a value greater than 1.



    ^^ That is my tutorial.

  3. #3
    Wire Amateur Milo is on a distinguished road Milo's Avatar
    Join Date
    May 2008
    Posts
    69

    Default Re: Vector Thruster Missile Tutorial

    Quote Originally Posted by Officer Tibbles View Post
    Okay may I criticize? No? Okay I shall anyway.

    You can't teach people through comments in the code. Do your tutorials, line by line, explaining thoroughly what each element does, and in the end, slap it together into a complete "Example" code.

    For example...

    yes your kinda rigth but, if somone uses this ingame it wuold be unconvinient to do this step by step... therefore commenting is a much greater way to stick it and use it and learn it.
    Hard to do a tutorial changing between browser and gmod. ( little easyer by steams new webclient overlay) but it gets to tricky.
    Thanks for your attension.

  4. #4
    Wire Sofaking eduardo is on a distinguished road eduardo's Avatar
    Join Date
    Jan 2009
    Posts
    401

    Default Re: Vector Thruster Missile Tutorial

    thanks tibbles you're completely and totally correct 110% A+ EXCELLENT

    as for milo......

  5. #5
    Lurker eurocracy is on a distinguished road eurocracy's Avatar
    Join Date
    Sep 2007
    Posts
    117

    Default Re: Vector Thruster Missile Tutorial

    Personally I think tutorials should contain both full code AND explanations :O
    My sig was 201 pixels long so moderators snipped it
    Oh teh noes!

  6. #6
    Wire Sofaking singilli is on a distinguished road singilli's Avatar
    Join Date
    Jun 2007
    Location
    Garðabær, Iceland
    Posts
    505

    Default Re: Vector Thruster Missile Tutorial

    Like I do, I give full code and line by line explanation.

  7. #7
    Lurker Undomian is on a distinguished road Undomian's Avatar
    Join Date
    Nov 2008
    Posts
    87

    Default Re: Vector Thruster Missile Tutorial

    Quote Originally Posted by eurocracy View Post
    Personally I think tutorials should contain both full code AND explanations :O
    I'm against a tutorial giving the full code. If someone just comes in to copy the code at the end, they haven't learned anything, and all the time spend making that tutorial will have gone to waste.

  8. #8
    Wire Amateur -Simply-ownage is on a distinguished road -Simply-ownage's Avatar
    Join Date
    Feb 2009
    Posts
    32

    Default Re: Vector Thruster Missile Tutorial

    Is that better?

+ Reply to Thread

Similar Threads

  1. Replies: 3
    Last Post: 05-01-2009, 01:56 AM
  2. 2 sexy things for Wire Thruster / Vector Thruster
    By andy1976uk in forum Ideas & Suggestions
    Replies: 7
    Last Post: 01-28-2008, 02:25 AM
  3. Vector Missile
    By wabash in forum Wiremod Tutorials
    Replies: 18
    Last Post: 12-15-2007, 10:10 PM
  4. [VIDEO TUTORIAL] Amraam Wired Homing Missile
    By hellrogu3 in forum Wiremod Tutorials
    Replies: 0
    Last Post: 07-28-2007, 10:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots